(04-18-2013, 11:11 AM)BeeKayK Wrote: can a switch script determine if the case has been used before?
Switch statements normally check against integer values, and an integer value isn't enough information to check if something has been used before. If statements check against boolean values, normally through the use of boolean operators or values that can be implicitly converted into a boolean value. Unfortunately, AngelScript scripting (at least the version that comes with Amnesia) doesn't implicitly convert other data types into boolean values for if statement conditions.
If I remember correctly it does convert integers to boolean values when evaluating an if condition, at least in terms of 0 being false and anything else being true, as in C, if that's what you meant.
(04-18-2013, 12:40 PM)Adrianis Wrote: If I remember correctly it does convert integers to boolean values when evaluating an if condition, at least in terms of 0 being false and anything else being true, as in C, if that's what you meant.
(04-18-2013, 11:11 AM)BeeKayK Wrote: can a switch script determine if the case has been used before?
Correct me if I'm wrong, but I think you could add local (or global) variables and an "if" statement to restrict how many times/if the case is used more than once. I'm not entirely certain since I don't fully understand how the original script works.
(04-18-2013, 11:11 AM)BeeKayK Wrote: can a switch script determine if the case has been used before?
Correct me if I'm wrong, but I think you could add local (or global) variables and an "if" statement to restrict how many times/if the case is used more than once. I'm not entirely certain since I don't fully understand how the original script works.
///*insert opening part of switch script here*////
if(GetLocalVarInt("Scare1Played") == 0)
{
*insert the scare script*
SetLocalVarInt("Scare1Played, 1);
}
if (GetLocalVarInt("Scare1Played") == 0)
{
/////whatever else you want here/////
}
/////rest of script below/////
Is that in any way possibly right, or should I just go home and focus on mapping?
You can definately do it like that, but if you looking at having 5+ different events, all of which you need to keep track of, it's going to get very inneficient (but not really a problem*) to keep them all in seperate variables.
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
Trying is the first step to success.
(This post was last modified: 04-23-2013, 06:52 PM by FlawlessHappiness.)
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