GS equiv. of "repeat until x=3"

gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
edited November -1 in Working with GS (Mac)
Hi, I've been scratching my head again (good job I don't have dandruff!). I'm trying to work out the GS equivalent of the Basic command "repeat until x=3".

Say I have a fair chunk of stuff in the Rules of an actor, that I want repeated, 3 times only for instance. Rather than copying all of it twice again, I'm wondering if there's an easier way that I've missed...

I've tried using a Game Attribute, then Change Attribute to Game Attribute + 1, and in Rules, include When this Game Attribute is less than 4, but it still won't loop, of course. I don't know if I'm missing something obvious...

Any thoughts on this appreciated, thanks.

;-)

---------------------------------------------------------------
Spiral Gyro Games

""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Comments

  • jstrahanjstrahan Member Posts: 498
    Wouldn't work for either so I use one timer inside of another
    Timer 1 for 3 sec
    Timer 2 every 1sec
    Rules

    May not be best way but worked
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Thanks for that jstrahan; seems good; my only concern is that in the Rules are already timers; I see how this would work, not sure about "balancing" those other timers as well, if you know what I mean. Still, I'll have a bash; thanks again.

    :-)

    ---------------------------------------------------------------
    Spiral Gyro Games

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Rule when game.loop < 3

    Blah blah blah blah
    Blah blah blah blah
    Blah blah blah blah
    change attribute game.loop to game.loop + 1
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Thanks scitunes, but it still only does the blah blah blah blah's (x3 ;-) once. There doesn't seem to be any way of saying in the Rules to go back to the beginning twice more, that I can find...

    :-(

    ---------------------------------------------------------------
    Spiral Gyro Games

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jstrahanjstrahan Member Posts: 498
    Yea hadn't wrk for me either u could try setting an attribute at the beginning to game time then have a rule to compare difference in att. And game time for 3 cycles that way done without timer
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    I'll give that a whirl, jstrahan, thanks.

    :-)

    ---------------------------------------------------------------
    Spiral Gyro Games

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    can you wrap the blahs in a timer?

    Or I may look for some end point in the rules. Example: to make something blink I have a rule that says when color alpha = 0 interpolate color alpha to 1. when alpha = 1 interpolate alpha to 0. This causes it to blink. If you also added the loop +1 rule from above in with the when alpha = 1 it should only blink 3 times. And no timers
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    i'll look at that tomorrow, thank you. It's early in the morning now for me, can't really concentrate; I'll make a test after I've had some shuteye!

    goodnight all...zzzzzzzzzzzzzzzzzzzzz

    ---------------------------------------------------------------
    Spiral Gyro Games

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi scitunes, still haven't tried your suggestion, but it sounds a good technique for another actor behaviour I have in mind. Thank you!

    For interest, I tried a game attribute again, adding 1 to it every time the Rules were gone though, running only when this particular attribute was less than 4. Anyhow, it's working fine now, I'm pleased to say. I think I put the Change Attribute in the wrong place...

    Thanks again to you and jstrahan.

    :-)

    ---------------------------------------------------------------
    Spiral Gyro Games

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jstrahanjstrahan Member Posts: 498
    glad its wrkn for u
Sign In or Register to comment.