Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Timer Error
Author Message
GoranGaming Offline
Member

Posts: 174
Joined: Feb 2012
Reputation: 6
Post: #1
Timer Error
So I am making a Timer Script for a scare, and I got this error:

[Image: xB2b2.png]

Here is my script:

AddEntityCollideCallback("Player", "HoleCeilingEvent", "CollideHoleCeilingEventFunc", true, 1);


void CollideHoleCeilingEventFunc(string &in asParent, string &in asChild, int alState)
{
AddTimer("starteventhole", 0, "CeilingHoleEvent");
AddTimer("voice1", 1, "CeilingHoleEvent");
AddTimer("rock1", 1.5f, "CeilingHoleEvent");
AddTimer("rock2", 2.0f, "CeilingHoleEvent");
AddTimer("voice2", 3.0f, "CeilingHoleEvent");

}
void CeilingHoleEvent(string &in Timer)
{
string x = asTimer; <--- It says that this is the problem!
if (x == "starteventhole")
{
StartScreenShake(0.008f, 2.5f, 2.0f,6.0f);
}
else if (x == "voice1")
{
PlayGuiSound("react_scare4.ogg", 1);
}
else if (x == "rock1")
{
SetEntityActive("RockCeiling1", true);
}
else if (x == "rock2")
{
SetEntityActive("RockCeiling2", true);
}
else if (x == "voice2")
{
PlayGuiSound("react_scare2.ogg", 1);
}
}


Could anybody help? Smile

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
(This post was last modified: 03-31-2012 12:17 PM by GoranGaming.)
03-31-2012 12:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 939
Joined: Jul 2011
Reputation: 39
Post: #2
RE: Timer Error
Do like this instead,

AddEntityCollideCallback("Player", "HoleCeilingEvent", "CollideHoleCeilingEventFunc", true, 1);




void CollideHoleCeilingEventFunc(string &in asParent, string &in asChild, int alState)
{
AddTimer("starteventhole", 0, "CeilingHoleEvent");
AddTimer("voice1", 1, "CeilingHoleEvent");
AddTimer("rock1", 1.5f, "CeilingHoleEvent");
AddTimer("rock2", 2.0f, "CeilingHoleEvent");
AddTimer("voice2", 3.0f, "CeilingHoleEvent");
}

void CeilingHoleEvent(string &in Timer)
{
if (asTimer == "starteventhole")
{
StartScreenShake(0.008f, 2.5f, 2.0f,6.0f);
}

else if (asTimer == "voice1")
{
PlayGuiSound("react_scare4.ogg", 1);
}

else if (asTimer == "rock1")
{
SetEntityActive("RockCeiling1", true);
}

else if (asTimer == "rock2")
{
SetEntityActive("RockCeiling2", true);
}

else if (asTimer == "voice2")
{
PlayGuiSound("react_scare2.ogg", 1);
}
}

(This post was last modified: 03-31-2012 12:58 PM by SilentStriker.)
03-31-2012 12:56 PM
Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,267
Joined: Jul 2011
Reputation: 223
Post: #3
RE: Timer Error
asTimer is not declared because the parameter is named Timer. The tutorial you followed does something weird: it creates a new string instead of using the parameter or simply renaming the parameter to x.

Tutorials: From Noob to Pro
(This post was last modified: 03-31-2012 01:26 PM by Your Computer.)
03-31-2012 01:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 939
Joined: Jul 2011
Reputation: 39
Post: #4
RE: Timer Error
Oh yea... forgot void CeilingHoleEvent(string &in Timer)

should then be void CeilingHoleEvent(string &in asTimer)

03-31-2012 01:26 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)