ID:143272
 
Code:
obj
var
B1 = 0
obj
Button
Button_1
icon = 'Button1.PNG'
density = 1
Click()
B1 = 1
Activate
icon = 'Activate.PNG'
density = 1
Click()
if(B1==1)
alert("Activated")
else
alert("Command Incorrect")


Problem description:
I am trying to create a hub where you click a button then another, however you need to click a button first to activate the other, I had written the code above and I get no errors, however it won't activate the second button, can you tell me what I have done wrong, thanks.


Changing an object's variables doesn't change every object in the game. You could make a mob variable.

mob
var
B1
obj
Button
Button_1
icon = 'Button1.PNG'
density = 1
Click()
usr.B1 = 1
Activate
icon = 'Activate.PNG'
density = 1
Click()
if(usr.B1)
alert("Activated")
else
alert("Command Incorrect")
In response to Kaiochao2536
Worked like a charm, thank you very much.