Hi again,
Quick question, I have a timer which is placed in the main header,
Timer* Actions;
then I have in a dialogue script,
Actions.Start(80,eOnce);
then I have in the global script,
if (lActions.Visible == true && Timer.IsExpired(Actions)) {
lActions.Visible = false;
}
Game starts up fine with no issues, the timer simply doesn't start or maybe it doesn't end.
Thanks
Sorry for the frequent questions, its just a few problems that I didn't get around to handling until now.
Thanks in advance for any help, i really appreciate it. :)
Where in the global script is that last part? Inside which function?
Also, don't declare variables in a header. This will create multiple separate variables. Not sure if it matters if you only use the variable in the global script but it's a good idea to not do that in general.
Quote from: Khris on Mon 25/10/2021 15:53:55
Also, don't declare variables in a header. This will create multiple separate variables. Not sure if it matters if you only use the variable in the global script but it's a good idea to not do that in general.
Yes, this is a common reason for weird errors, where you change the variable in one script, but when using it in another its value does not appear to have changed.
Which may be a cause of your problem here too.
If you need to share a variable among scripts, then declare it inside a script, and declare its
import in the header.
Note: the "Global Variables" panel in the editor basically generates a hidden script that does all that for you. But if you are making variables of custom types you have to do that by hand.
Related articles from the online manual:
https://adventuregamestudio.github.io/ags-manual/TheScriptHeader.html
https://adventuregamestudio.github.io/ags-manual/ImportingFunctionsAndVariables.html
Quote from: Khris on Mon 25/10/2021 15:53:55
Where in the global script is that last part? Inside which function?
Also, don't declare variables in a header. This will create multiple separate variables. Not sure if it matters if you only use the variable in the global script but it's a good idea to not do that in general.
It was placed in the "function repeatedly_execute_always()"
I see the error of my ways now and have looked repeatably over the Manuel again.
Some things just click better when I ask a question which kind of makes sense within my own head. :-[
Ty, Khris & Crimson.