16
Technical forum / Re: self defined global function
« on: June 17, 2007, 12:57:14 PM »
Hi Mnemonic,
I did exactly what you said above and I put the line
in my game.script file (but I also tried the game_daemon.script file)
the dialogs.script file contains the following:
now when I try to run the code "Dlg.Dialogue1();" from scenes\german\scr\window.script I get: Error@line 12: Method is called for 'Dlg' which is not defined in the log file. I should mention that it works if I run "Dlg.Dialogue1();" from inside the game.script file.
Have I missed something? Why is my global variable not global?
I did exactly what you said above and I put the line
Code: [Select]
global Dlg = new Object("scripts\dialogs.script");
in my game.script file (but I also tried the game_daemon.script file)
the dialogs.script file contains the following:
Code: [Select]
method Dialogue1()
{
Game.Msg("booya");
}
now when I try to run the code "Dlg.Dialogue1();" from scenes\german\scr\window.script I get: Error@line 12: Method is called for 'Dlg' which is not defined in the log file. I should mention that it works if I run "Dlg.Dialogue1();" from inside the game.script file.
Have I missed something? Why is my global variable not global?