The Dink Network

Global Variables question

April 18th 2007, 05:52 PM
custom_marpro.png
Marpro
Peasant He/Him bloop
 
Heya. I'm trying to do a certain room there the global variable has to be 1 before you can "use" a talking option. The variable get to 2 when I talk to another guy on the same screen (using something like "&pussle += 1;").
This is not working for me... Is it impossible to make?
April 18th 2007, 06:26 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
Maybe a greater than/less than statement?

//if &pussle is 1 or more, then this will work
if (&pussle >= 1)
{
....
}

//if you're using it for a choice statement...
(&pussle >= 1)"Talk Option"

Btw it's spelled puzzle.
April 19th 2007, 10:03 AM
duck.gif
wesley
Peasant He/Him United States
 
I suggest:

//Code for the 'other guy'

...
void talk(void)
{
if (&pussle == 1)
{
&pussle = 2;
}
...
}

This way if you continue talking to the first guy the &pussle var doesn't keep incrementing. In some cases, it won't matter, but it's always nice to know the values of your globals.
April 19th 2007, 05:57 PM
custom_marpro.png
Marpro
Peasant He/Him bloop
 
Thanks, both of you

I have one more question. Is it possible to make like this? (&pussle2 > 1 < 5) "Say something"
April 19th 2007, 06:41 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
No, you need multiple if statements, so break it up like this.

(&pussle2 > 1)(&pussle2 < 5)"Say something"

I think that should work. Remember, one condition per if statement. In a non-choice statement it'd actually look like this.

if (&pussle2 > 1)
{
if (&pussle2 < 5)
{
//do whatever here
}
}