[SCRIPT] Need help with my script - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] Need help with my script (/thread-21618.html) |
Need help with my script - ooadrianoo - 05-25-2013 Hello everyone, this script doesn't work. "icounter" must be declared and expression must be in boolean type. PHP Code: void OnStart() PHP Code: else GiveSanityBoostSmall(); I don't need to declare "icounter". I could be in boolean type but I don't know why it doesn't work this way. Any suggestions? RE: Need help with my script - Bridge - 05-26-2013 icounter is a local variable, which is why the function counter does not recognize it. EDIT: Also, it says your expression is not of type Boolean because icounter isn't declared, so it's meaningless. It's the same as saying: If three is less than banana then this. RE: Need help with my script - TheGreatCthulhu - 05-26-2013 To make it a global variable (visible to every function) move it out of the OnStart() function. For example, like this: PHP Code: int icounter = 1; RE: Need help with my script - ooadrianoo - 05-26-2013 (05-26-2013, 12:58 AM)TheGreatCthulhu Wrote: To make it a global variable (visible to every function) move it out of the OnStart() function. For example, like this: Thanks! Now it works, you deserved a reputation RE: Need help with my script - Bridge - 05-26-2013 http://omnigeek.robmiracle.com/2011/10/14/understanding-scope-for-beginning-programmers/ |