Where is the error in my logic?

FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

So I just want to make it, so that when a button is pressed, it changes the number on an attribute, and displays that on the button. I want it to add 1 each click, up to three, and then when clicked again, go back to 1. I also want it on the first click to go to 2. Default on the attribute is 0

Ok, heres my actor

Rule
{
When touch is released
do
Rule
{
if game.Switch = 0
do
{
set game.Switch to 2
}
}

        Rule
        {
             if game.Switch = 1
             do
             {
                  set game.Switch to 2
             }
        }

        Rule
        {
             if game.Switch = 2
             do
             {
                  set game.Switch to 3
             }
        }

        Rule
        {
             if game.Switch = 3
             do
             {
                  set game.Switch to 1
             }
        }

}

Where is the issue! I dont see how this is complicated at all, but when I get in the game, the button displays zero, I click, it goes to 2, then I click again, nothing. Stays on 2.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Just double-checking that you want the pattern to go like this?

    0
    2
    3
    1
    2
    3
    1
    2
    3
    ...

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Here's a demo of the above pattern.

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    Thanks! Worked great

Sign In or Register to comment.