Legacy GM Problem that i can't solve

Hi, im trying to make one thing on my game.

I need that the user click on the button, after the button is pressed it will check if the global variable is higher than another one then will give an error if its true, if its false it will change room.

I don't know what happen because it always go for the next room and always pass the max number.
Can you guys help me? I tried a lot of things but in the end i tried the code that i paste here.

if (global.foodreserve >> global.foodstorageleft)
{
audio_play_sound(snd_errormsg,1,0);
}

if (global.foodreserve <= global.foodstorageleft)
{
global.foodowneddisplay = (global.foodowneddisplay + global.foodreserve);
room_goto(RM_002_MainGame);
}
 

curato

Member
with that fix it should run one if statement or the other. I would say use show_debug_message prior to the first if statement to confirm the values are what you think they are.
 

Joe Ellis

Member
Could it be that you're clamping the food reserve to the max? then it will = the max, maybe change it to:

Code:
if (global.foodreserve >= global.foodstorageleft)
{
audio_play_sound(snd_errormsg,1,0);
}

if (global.foodreserve < global.foodstorageleft)
{
global.foodowneddisplay = (global.foodowneddisplay + global.foodreserve);
room_goto(RM_002_MainGame);
}
 
Top