Effective looping methods for rules
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.
What I'm using at the moment feels a bit convoluted.
Comments
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/
----------------------------------------------------------------------------
http://forums.gamesalad.com/discussion/40006/timer-not-updating-with-changing-attribute#Item_15
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)
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?
If pong then ping
Result = ping pong.
I don't charge for advice.
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.
http://www.fee.org/wp-content/uploads/2011/05/funny-money-modifications-23.jpg
I normally only accept PNGs as payment, but I will make this exception for King Homer II.
Edit: P.S - any ideas for simulating a loop behaviour?
Exactly . . . > pixelative easing . . . > inflated currency . . . > next thing you know you have a wheelbarrow full of old JPEGs just to buy a loaf of bread.
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...
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...
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
@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.