Is there a way to create your own loops

IcedBIcedB Member, PRO Posts: 384
edited June 2012 in Working with GS (Mac)
I set up a rule that changes and updates a value, saves that value and then compares it against its new value in order to try and create a looping update, this didn't work. I kind of want a repeating on off latching type of switch. Previously I have done this with a timer, does anyone know a way to do with without using constrain or timers?

Answers

  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    edited June 2012
    Rule when touch is pressed
    --Change game.attribute to (game.attribute+1)%2

    This will change the game.attribute from 0 to 1 every time you press the switch.

  • IcedBIcedB Member, PRO Posts: 384
    @MarkOnTheIron

    Im not the best communicator, but that is just a latching switch, its not a continually looping re-latching switch :S
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    edited June 2012
    Then do this:

    Timer every X seconds
    --Change game.attribute to (game.attribute+1)%2

    This will continually switch the attribute between 0 an 1 every X seconds. If you change the number after the % it will increase the values it will loop.

    If you don't want to use timers there is a recent thread that explain how to use the Time attributes of the device.


Sign In or Register to comment.