Reply to Re: Globals and the if statement
If you don't have an account, just leave the password field blank.
no, your confused. "int &story = 1" creates a LOCAL variable. that means that this variable is only accessable in the current script (IE start.c, frank.c) open up main.c (if your using the skeleton, if not, get it from the source) open it up, there are all your global variables getting initialized. put make_global_int("&story",1) somewhere in there (it already is in skeleton b) that is how you make your global variable.
now, to change you value, use &story = 1, &story += 1, &story -= 1 et cetra. your IF-THEN is not working probably cause you did not do the global right. but ill tell ya anyway...
if (&story == 3)
{
do this
} else
{
do this
}
you NEED the parenthesis around the if statement and you can take off the else if you want. i think you have the right idea though.
-----------------------------------------
: I am working on the demo of my DMOD for about a week. I have a small problem with the globals and the if statements. No matter what I try it doesnt work! Creating a global is easy but if I want to change it's value in the game it realy doesnt seem to work. That is what I tried:
: int &story = 1;
: &story = 1;
: As for the if statement let's say that I have a default value of &story witch is 0. But if in one of the scripts I set that it'll work ONLY if &story is ex. 3 that script is still launched (although the current value of that Global is still 0) >
>
>
>
>
>
>
!
: I am slowly going mad here>
>
>
>
>
>
>
>
>
>
!!!
: HELP!!!!!!!!!!!!!!!!!!!!
now, to change you value, use &story = 1, &story += 1, &story -= 1 et cetra. your IF-THEN is not working probably cause you did not do the global right. but ill tell ya anyway...
if (&story == 3)
{
do this
} else
{
do this
}
you NEED the parenthesis around the if statement and you can take off the else if you want. i think you have the right idea though.
-----------------------------------------
: I am working on the demo of my DMOD for about a week. I have a small problem with the globals and the if statements. No matter what I try it doesnt work! Creating a global is easy but if I want to change it's value in the game it realy doesnt seem to work. That is what I tried:
: int &story = 1;
: &story = 1;
: As for the if statement let's say that I have a default value of &story witch is 0. But if in one of the scripts I set that it'll work ONLY if &story is ex. 3 that script is still launched (although the current value of that Global is still 0) >







: I am slowly going mad here>










: HELP!!!!!!!!!!!!!!!!!!!!