Room scripts and variables

Started by Wonkyth, Thu 22/05/2008 00:48:48

Previous topic - Next topic

Wonkyth

Just so that I have this all sorted out.
I don't seem to be able to use variables in room scripts, is that because you just cant do that, or am I just doing something wrong?
if you cant, then is the only way I can get variables in a function that is in a roomscript by making another variable in the global script, and then make a function of the same name?

thanks for any help in advance.
"But with a ninja on your face, you live longer!"

Kaktus

The variables have to be declared at the very top of the room script. The functions have to follow after that.

Code: ags

//room script file
int myInt;

function myFunction()
{
    // do something
}


Then they can be used anywhere in that room.

TwinMoon

Could you give some example of how you want to use variables? What doesn't work?

You can declare variables at any time btw, not just at the top of the script.

Wonkyth

What a dunce I am! :P
I had it all figured out, it's just that i forgot to put the semicolon after the "int exampleCounter" bit.
thanks all  the same. 8)
"But with a ninja on your face, you live longer!"

SMF spam blocked by CleanTalk