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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Scares
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#21
RE: Random Scares

(04-23-2013, 06:48 PM)BeeKayK Wrote:
Spoiler below!

if(asTimer == "PlayerAh")
{
int AhVariable = RandInt(1, 2)
switch(AhVariable)
{
case 1:
PlaySoundAtEntity("Aaaah1", "player_react_guardian1.snt", "Player", 0, false);
AddTimer("PlayerAh", RandInt(10, 20), "Ambience");
break;

case 2:
PlaySoundAtEntity("Aaaah2", "player_react_guardian2.snt", "Player", 0, false);
AddTimer("PlayerAh", RandInt(10, 20), "Ambience");
break;
}
}

This is my script.
Why am i getting an error, that it expected a ; at the highlighted text?

Don't worry, this is not my whole script file. I know this single passage wouldn't work in any way. It's a part of a timer, as you see in the top of the script

JAP already solved the issue, but to explain the error a little....

It was saying there was an issue at the line directly below where the actual problem was.

int AhVariable = RandInt(1, 2)

The compiler reads this line, but because there is no ; at the end, it does not know where the line ends. As far as the compiler knows, the next line down is part of the same statement.
To the compiler it looks like this
int AhVariable = RandInt(1, 2) switch(AhVariable) {

The error is generated because it was expecting to the have the statement terminated by the ;
switch(int) { is not a valid part of a statement, so it throws the error on this line.


tl;dr - the line number given in the error message is approximate, with this particular error, it tends to be the line above

(04-24-2013, 04:50 PM)BeeKayK Wrote: I tried. Now just nothing happens

Can you post the whole function?

(This post was last modified: 04-24-2013, 04:58 PM by Adrianis.)
04-24-2013, 04:56 PM
Find


Messages In This Thread
Random Scares - by PutraenusAlivius - 04-16-2013, 03:10 PM
RE: Random Scares - by Yare - 04-16-2013, 03:39 PM
RE: Random Scares - by PutraenusAlivius - 04-17-2013, 06:10 AM
RE: Random Scares - by Yare - 04-17-2013, 12:44 PM
RE: Random Scares - by PutraenusAlivius - 04-17-2013, 12:51 PM
RE: Random Scares - by Yare - 04-17-2013, 01:55 PM
RE: Random Scares - by VeNoMzTeamHysterical - 04-17-2013, 02:04 PM
RE: Random Scares - by FlawlessHappiness - 04-18-2013, 11:11 AM
RE: Random Scares - by PutraenusAlivius - 04-18-2013, 11:58 AM
RE: Random Scares - by Your Computer - 04-18-2013, 12:10 PM
RE: Random Scares - by Adrianis - 04-18-2013, 12:40 PM
RE: Random Scares - by Your Computer - 04-18-2013, 01:00 PM
RE: Random Scares - by CarnivorousJelly - 04-19-2013, 05:57 AM
RE: Random Scares - by Adrianis - 04-19-2013, 09:45 AM
RE: Random Scares - by Adrianis - 04-18-2013, 01:11 PM
RE: Random Scares - by FlawlessHappiness - 04-20-2013, 09:42 AM
RE: Random Scares - by Adrianis - 04-20-2013, 08:23 PM
RE: Random Scares - by FlawlessHappiness - 04-23-2013, 06:48 PM
RE: Random Scares - by PutraenusAlivius - 04-24-2013, 08:24 AM
RE: Random Scares - by Adrianis - 04-24-2013, 04:56 PM
RE: Random Scares - by RurouniMori - 05-07-2013, 04:22 AM
RE: Random Scares - by PutraenusAlivius - 05-17-2013, 12:19 PM
RE: Random Scares - by FlawlessHappiness - 04-24-2013, 04:50 PM
RE: Random Scares - by PutraenusAlivius - 05-07-2013, 04:30 AM
RE: Random Scares - by RurouniMori - 05-07-2013, 04:47 AM
RE: Random Scares - by Adrianis - 05-20-2013, 06:49 PM
RE: Random Scares - by PutraenusAlivius - 05-21-2013, 02:19 AM
RE: Random Scares - by GoreGrinder99 - 07-21-2013, 11:22 AM
RE: Random Scares - by PutraenusAlivius - 07-21-2013, 11:30 AM
RE: Random Scares - by GoreGrinder99 - 07-21-2013, 11:50 AM
RE: Random Scares - by PutraenusAlivius - 07-21-2013, 12:27 PM



Users browsing this thread: 1 Guest(s)