help with selecting a subset of options
I've been working on this for a few days, and there has be an easier way of doing this. My code should work, but it doesn't. In my game I present the user with 6 options. They can select and deselect them at will. This part works fine. The problem is, I only want 3 of the options to be selected at any time. So if the user selects options 1, 2, 4. They would have to deselect one of them to choose option 5. On top of that, I need to keep track of the values of each option.
I've tried storing the values in attributes and tables. but for whatever reason my deselect code never seems to function properly. the image will show it deselected, but the back end attribute doesn't update.
I know this is easy, but I have a feeling I'm getting too caught up with my existing code to see the answer staring me in the face.
Anyone done something similar before?
Comments
Have a 'selectable' variable - set it to 0.
When you select an option, add 1 to 'selectable'.
When you deselect an option, subtract one.
When selecting an option, have the rule:
If not selected
And
If 'selectable' is less than 3
And
Touch is pressed
Then select the option.
Hope that helps/points you in the right direction
QS =D
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
for example, this is some of my code. In both examples it compares the value of the first slot with the value of the option selected. If they match, it makes the change, otherwise it moves down the list.
and to clear it
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
hrm, good idea. I'll have to see how it will against keeping track of the values, but it could work!
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Remember to save every time you select/deselect (as in, save which options are selected/deselected and save the 'selectable' value).
You should be fine
QS =D
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
@jonmulcahy -- the demo found here might be useful:
http://forums.gamesalad.com/discussion/comment/496956/#Comment_496956
I thought of something like that, but that acts as a first in first out selection method. I wanted the users to be able to choose 1,2,3, then deselect 2 and select 4.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
this is so frustrating. I changed my code completely, and it still is freaking out.
I now have a table with 6 rows, 1 for each option. when you touch a button, it changes it's row to 1. I have a rule that takes the sum of the table, and only allows you to select an option if it is less than 3. this works fine. however when I try to add the code to remove the option, i get a dual trigger. It adds and removes the last entry instantly.
what a PITA!
I've tried moving them into separate touch rules, switching to on release, putting timers in there, etc. but it keeps double firing.
the idea is that as long as the total value is under 3, they can select a new value. If the value is 3, they can toggle ONLY an option they have previously selected, changing it back to 0. but in the case above, that drops the total value to under 3, and it toggles the same value back to 1.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
well i feel stupid. one simple change and all my problems are solved:
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Glad you got it working
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I was going to say use a mod function I see you did that.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
It has deselection stuff in there as well Give it a try! Do the exact sequence you outlined above and it will deselect 2 and then select 4.