Effective looping methods for rules

HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
edited February 2012 in Working with GS (Mac)
Just wondering what different methods peeps are using for looping rules. So that an attribute keeps getting changed 'till it no longer meets certain conditions.

What I'm using at the moment feels a bit convoluted.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    @HoneyTribeStudios

    Hi Shaz, funnily enough I helped someone out tonight with a looping mechanism; I just pop between a boolean switch state; here's the thread (finally resolved at the end); I don't know if it's simpler than the method you're using at the moment; hope it helps. :-)

    ----------------------------------------------------------------------------
    iPad app: End of the Earth –•– http://davidgriffinapps.co.uk/
    ----------------------------------------------------------------------------
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @gyroscope - your thread link went walkabout
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Whoops, so it did! I stopped it trying to get on a bus. "Oi!" I said. ;-)

    http://forums.gamesalad.com/discussion/40006/timer-not-updating-with-changing-attribute#Item_15

  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @gyroscope - thanks for the link. Unless I'm not reading it right that 's not quite what I'm talking about though.

    So to be a bit more clear, I have the following rule:

    When game.textAttribute contains game.integer
    Change game.integer to random(1,20)

    So I want to be able to loop that in a simple way until game.integer is changed to a number that is not already listed inside my game.textAttribute

    At the moment I'm just pasting the rule multiple times which is a crappy way of doing it. (And also may not always work)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2012
    I see, sorry, misunderstood (only about the third time this evening)!

    First to ask, do you want the loop over time, or straight away, as it were? Or maybe text.Attribute is "fed" at different times anyway... (just trying to get what the type of gameplay is first...

    THe way you've got it at the moment seems fine to me anyhow:

    When game.textAttribute contains game.integer
    Change game.integer to random(1,20)
    otherwise....

    Or maybe I've got the wrong end of the stick again.

    PS Can I ask: did you get receive email today with your promo code for End of the Earth?
  • CloudsClouds Member Posts: 1,599
    If ping then pong
    If pong then ping

    Result = ping pong.

    I don't charge for advice.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @gyroscope. No worries - I appreciate that you often take the time to stop and help.

    Yeah, it's to trigger straight away.

    The rule is choosing an image from a list of 20. And making sure that the 4 that are on screen at the same time are all different.
    So I'm storing what image is currently on screen in the text attribute.

    Writable tables will make this easier, just thinking of something in the meanwhile.

    I'm now testing if putting the rule from the post above in an 'every 0 sec timer' will work. Although I'm thinking I'll need to wrap another rule around that with a boolean so the timer is not constantly active. And then setting booleans at various other places to reset it. Again though, a bit long winded and messy.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @Tynan. No no, I insist. Please accept my payment with gratitude:

    http://www.fee.org/wp-content/uploads/2011/05/funny-money-modifications-23.jpg

  • CloudsClouds Member Posts: 1,599
    @HoneyTribeStudios

    I normally only accept PNGs as payment, but I will make this exception for King Homer II.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    edited February 2012
    @Tynan - That's a good policy. You never know when microsoft will suddenly start printing jpgs and completely devalue them.

    Edit: P.S - any ideas for simulating a loop behaviour?
  • CloudsClouds Member Posts: 1,599
    "You never know when microsoft will suddenly start printing jpgs and completely devalue them"

    Exactly . . . > pixelative easing . . . > inflated currency . . . > next thing you know you have a wheelbarrow full of old JPEGs just to buy a loaf of bread.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    That's odd, @Tynan, in my part of town it cost two loaves to buy a jpeg...

    Hi again @HTS how about

    When Switcheroo is false
    Change attribute Switcheroo to true

    Change attribute Switcheroo to true
    When game.textAttribute contains game.integer
    Change game.integer to random(1,20)
    Change attribute Switcheroo to false
    otherwise...

  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @Gyroscope - ah, maybe your other post DID have what I was looking for after all then. I shall try this now, cheers :)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    I hope it works out...

    Here's a refinement I've just thought of: make Switcheroo true to start with, then the following:

    When Switcheroo is true
    Change attribute Switcheroo to false
    When game.textAttribute contains game.integer
    Change game.integer to random(1,20)
    Change attribute Switcheroo to true
    otherwise...
  • MotherHooseMotherHoose Member Posts: 2,456
    edited February 2012
    gameAttribute …text type … named: picked#s
    gameAttribute … index type … named: curr#
    gameAttribute … index type … named: loopCount
    randomPicker: selfAttribute … index type … named: maxLoop# … set to max #s

    on randomPicker:
    Rule: when
    Attribute: game.loopCount ≠ self.maxLoop
    --Timer: Every: 0.5 seconds
    ---changeAttribute: game.curr#  To:  random(1,20)
    ---Rule: when
    ----Attribute: picked#s contains game.curr#
    -----changeAttribute: game.curr#  To:  random(1,20)
    ---Otherwise:
    ----changeAttribute: game.picked#s  To:  game.picked#s.."  "..game.curr#
    ----do what has to be done
    ----changedAttribute: game.loopCount  To:  game.loopCount+1

    well that is a loop for a do while … but don't know if that is what you want

    @};- MH
    PS know you don't need this detailed info … but may help someone else
    EDIT: of course … all those gameAttributes can be selfAttributes on the randomPicker
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @MotherHoose - Yeah could be useful for peeps searching through threads. On an unrelated note, what games do you have released? Was just wondring as I don't think I've seen them?

    @Gyroscope - Yep your suggestion seems to work well so far - cheers. I'll email you a vid tomorrow so you can see how it worked out.
Sign In or Register to comment.