You've got to be %*(#% kidding me, I jacked up the spelling? I swear the errors in this scripting language are way too misleading.. (Had odd issues with deciding if the script accepts 0-1 or true-false as boolean, apparently..It accepts both, but as "1" / "0" or true / false. Goddamnit.)
Btw, The "Brackets" tip is irrelevant to me, as you can see; I did just that.
if(ScriptDebugOn() == true)
Also, the "== true" sign Is redundant. You can write
"
if(ScriptDebugOn())" and it would mean the same thing..Same goes to my AddTimer line, which should be better without the '==true' sign anyway.
Anyhoo; Cheers for correcting my idiotic error. The script works now.
Edit:
QUESTION!
I rewrote the script to make it simpler, I got it down to this ;
Quote:C_LanternOut(string &in asParent...Etc)
{
if (GetLanternActive() )
AddTimer("", 0.45f, "C_LanternOut"); //Recurse until False.
else
PlaySoundAtEntity("", "enabled.snt", "Player", 0, false);
}
The problem is that Timer is not able to trigger C_LanternOut. Do I need an argument "String &in asTimer" in order to allow it to callback to a function? The script worked with what I started with...
EDIT : The answer would be ;
yes.
Quote:OnStart()
{
SetLocalVarInt("Flag_LanternOut", 0);
}
void C_LanternOut(string &in asParent, string &in asChild, int alState) //Player has walked into the area.
{
if (GetLanternActive()){
AddTimer("", 0.2f, "CT_LanternOut");
SetLocalVarInt("Flag_LanternOut", 0);
}
else PlaySoundAtEntity("", "enabled.snt", "Player", 0, false);
}
void CT_LanternOut(string &in asTimer)
{
if (GetLanternActive()){
AddTimer("", 0.2f, "CT_LanternOut");
SetLocalVarInt("Flag_LanternOut", 0);
}
else
{
if (GetLocalVarInt("Flag_LanternOut")!=0)
PlaySoundAtEntity("", "enabled.snt", "Player", 0, false);
else{
SetLocalVarInt("Flag_LanternOut", 1);
AddTimer("", 0.85, "CT_LanternOut");
}}}
If anyone ever, for any reason, resonates with this idea. That's an example.