Random Chance Button App, help
Field305
Member Posts: 29
OK well im trying to make a simple app with a little complexity. I have a button that once pushed will "change scene". What I am trying to do is make it a 1/6 chance of getting the right one to make it "change scene".
After you hit the button, I would like it to have a 2/6 chance of getting the right one and so forth. Can anyone help me with this. Thanks all!
After you hit the button, I would like it to have a 2/6 chance of getting the right one and so forth. Can anyone help me with this. Thanks all!
Comments
Create an attribute (I'll call it "chance") (set chance to 1 not 0)
and another one called result
When I push the button
set result to "rand(chance,6)
set chance to chance+1
so when you start it will be random 1-6
Next time you press it will be 2-6
Then create another rule that detects result
If result = 6
Then blah blah blah
set result to 0 (to reset the button essentially)
I'm not sure if this works out as 1/6 2/6 3/6 but you can do something similar to this to get the effect you want.
If result is <= to chance
blah blah blah
set result to 7 (to reset the button)
That way the first time you press it if you get 1 randomly it will be fine
If you get 1 or 2 the second time it will work
If you get 1 2 or 3 the third time etc.
1. What kind of Attributes should they be, REal, integer, boolean???
2. After the second rule I put my "change scene" action. where should i put this?
3. Should the attribute "result" be put to 1 also?
Thanks for the help!!