Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help No matching signature to AddTimer
Theforgot3n1 Offline
Member

Posts: 192
Threads: 20
Joined: Apr 2012
Reputation: 6
#4
RE: No matching signature to AddTimer

(08-08-2012, 01:52 PM)Solipsist Wrote: 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.
Cool script mate, kind of inspired me a little.

Anyway, could be just me, but if you're uploading scripts, if you could make it bigger, more light, it'd be easier to read. Like:

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");
             }
    }
}

GL ! (^ might be a little odd, but you get the point)

Confusion: a Custom Story - Ch1 for play!
http://www.frictionalgames.com/forum/thread-15477.html
About 50% built.
Delayed for now though!
(This post was last modified: 08-08-2012, 04:02 PM by Theforgot3n1.)
08-08-2012, 03:57 PM
Website Find


Messages In This Thread
No matching signature to AddTimer - by Solipsist - 08-08-2012, 12:19 PM
RE: No matching signature to AddTimer - by Adny - 08-08-2012, 12:32 PM
RE: No matching signature to AddTimer - by Theforgot3n1 - 08-08-2012, 03:57 PM



Users browsing this thread: 1 Guest(s)