Compare value is not working

Discussion and feedback on Construct 2

Post » Wed Mar 22, 2017 5:17 pm

Hi, i am trying to make an action that when I click a button, if that button has the same value as the value stored in a global variable it should go to another layout, but this is not working, any ideas why this is happening?

(Sorry if my english is not perfect, it is not my foreign language. )

Posts: 2
Reputation: 209

Post » Wed Mar 22, 2017 6:10 pm


at start of layout you are changing the value of the global variable, but since there are probably multiple buttons, it is getting a value other than what you are looking for.

if you move that action to event 2, it should work. (set the global variable button to button.action in the "On Left button Clicked" event, then the sub event will work - when you click on the button that has "action" set to selectCharacter)

another way to do it without a global variable would be to store the layout to go to in the "action" instance variable, (set button.action to "pjCreation")
then in event 2 add an action that says: system > Go to button.action
(then you dont need the sub event, or other sub events for other layouts).
Posts: 438
Reputation: 17,950

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests