already played around but couldn't get it working
How to display image via Lua?
Moderator: Moderators
- Anakin
- Master of the Force

- Posts: 4817
- Joined: Sat Sep 19, 2009 11:37 am
- Projects :: RC Side Mod - Remastered - SWBF3 Legacy
- Location: Mos Espa (germany)
Re: [LUA] How to display image
Thank you 
already played around but couldn't get it working
already played around but couldn't get it working
-
jedimoose32
- Field Commander

- Posts: 938
- Joined: Thu Jan 24, 2008 12:41 am
- Projects :: Engineering Degree
- Location: The Flatlands of Canada
Re: [LUA] How to display image
Try this:
I haven't tested it but let me know how it works and I can make tweaks.
Hidden/Spoiler:
- Anakin
- Master of the Force

- Posts: 4817
- Joined: Sat Sep 19, 2009 11:37 am
- Projects :: RC Side Mod - Remastered - SWBF3 Legacy
- Location: Mos Espa (germany)
Re: How to display image via Lua?
It still does not work.
I added some print lines and found out. that only the start and exit functions were entered. btw using ScriptDB_PushScreen() will not work. The enter and exit functions are never executed. So i need to use the movie push screen.
Now i modified the Enter function to this:
And the update function is called. But not ifs_bf3_fnAdvance (you remember that the update function should call it. later on i deleted the -- and called the ifs_bf3_fnAdvance directly in the enter function. But nothing is shown. Only result when i push to my custom screen before legal screen is shown, it jumps direct to login.
==EDIT==
Ok maybe it's on the time to show you how i inserted my code. Here is my custom gc script it is comment, so i'm sure you understand what i'm doing:
I jump directly to the login screen. But the exit function from ifs legal and ifs bf3 legal are both executed. But for some reason nothing else.
===UPDATE===
Ok i found a way to display my image. But to be honest i'm still interested in new ifscreens and why this one did not work.
Your first code to insert a list entry worked just fine. I was so stupid. Take a look at my custom gc script. It's implemented the way the custom gc are made. But Zerted used table as variable name. Not a good idea in Lua. In c++ it's not allowed to use key words as variable and i didn't remember that lua will simply redefine the keyword. So you see that table.getn() was always something like ifs_legal.getn() and that was not defined
But nonetheless i want to understand why inserting a new ifscreen will directly go to the login.
I added some print lines and found out. that only the start and exit functions were entered. btw using ScriptDB_PushScreen() will not work. The enter and exit functions are never executed. So i need to use the movie push screen.
Now i modified the Enter function to this:
Code: Select all
Enter = function(this, bFwd)
print("Enter BF3splash")
gIFShellScreenTemplate_fnEnter(this, bFwd)
AnimationMgr_AddAnimation(this.BF3Texture, {fTotalTime = 0.4, fStartAlpha = 0.0, fEndAlpha = 1.0,})
this.Update(this, bFwd)
-- ifs_bf3_fnAdvance(this)
end,
==EDIT==
Ok maybe it's on the time to show you how i inserted my code. Here is my custom gc script it is comment, so i'm sure you understand what i'm doing:
Code: Select all
---------------------------------------------------------------------
-- custom_gc_1 script to add ifscreen before ifs_legal by Anakin
---------------------------------------------------------------------
print("custom_gc_1: BF3 GC Entered")
-- create the custom ifscreen
ScriptCB_DoFile("ifs_bf3Splash")
-- make sure that the function we are going to manipulate exist
if ScriptCB_DoFile then
print("custom_gc_1: Taking control of ScriptCB_DoFile()...")
-- make sure our backup variable is not used by someone else.
if gc1_ScriptCB_DoFile then
print("custom_gc_1: Warning: Someone else is using our gc1_ScriptCB_DoFile variable!")
print("custom_gc_1: Exited")
return
end
-- backup original function
gc1_ScriptCB_DoFile = ScriptCB_DoFile
-- redefine function
ScriptCB_DoFile = function(name,...)
-- execute original function, but do not leave
retValue = gc1_ScriptCB_DoFile(name, unpack(arg))
-- if we just executed ifs_movietrans
-- that means that ifs_movietrans_PushScreen has just been defined,
-- so we needn't check if that function exist
-- (ok maybe someone else will redefine ifs_movietrans and remove ifs_movietrans_PushScreen but that's not my problem now)
if name == "ifs_movietrans" then
-- make sure our backup variable is not used by someone else.
if gc1_ifs_movietrans_PushScreen then
print("custom_gc_1: Warning: Someone else is using our gc1_ifs_movietrans_PushScreen variable!")
print("custom_gc_1: Exited")
return
end
-- backup original function
gc1_ifs_movietrans_PushScreen = ifs_movietrans_PushScreen
-- redefine function
ifs_movietrans_PushScreen = function (table,...)
-- if we push to ifs_legal
if table == ifs_legal then
-- push to ifs_bf3legal first
ifs_movietrans_PushScreen(ifs_bf3legal)
end
-- execute original function
return gc1_ifs_movietrans_PushScreen(table,unpack(arg))
end
end
-- now we can leave
return retValue
end
else
print("custom_gc_1: No ScriptCB_DoFile to take over...")
print("custom_gc_1: Exited")
end
print("custom_gc_1: Exited")
I jump directly to the login screen. But the exit function from ifs legal and ifs bf3 legal are both executed. But for some reason nothing else.
===UPDATE===
Ok i found a way to display my image. But to be honest i'm still interested in new ifscreens and why this one did not work.
Your first code to insert a list entry worked just fine. I was so stupid. Take a look at my custom gc script. It's implemented the way the custom gc are made. But Zerted used table as variable name. Not a good idea in Lua. In c++ it's not allowed to use key words as variable and i didn't remember that lua will simply redefine the keyword. So you see that table.getn() was always something like ifs_legal.getn() and that was not defined
But nonetheless i want to understand why inserting a new ifscreen will directly go to the login.
-
jedimoose32
- Field Commander

- Posts: 938
- Joined: Thu Jan 24, 2008 12:41 am
- Projects :: Engineering Degree
- Location: The Flatlands of Canada
Re: How to display image via Lua?
It goes directly to login afterward because I thought you were putting the BF3 logo *after* the ifs_legal screen, so I made it exit to ifs_start instead of exiting to ifs_legal. Just change that part and it should work for you.
Edit: I got your PM, maybe you can send me all these files and I can try and get it working properly.
Edit: I got your PM, maybe you can send me all these files and I can try and get it working properly.
