Report this content
We want the Dreams coMmunity to be a safe, diverse and tolerant place for everyone, no matter their age, gender, race, sexual orientation or otherwise. If you believe this content to contradict these principles, you can file a report for our coMmunity teams to investigate.
Note that misuse of the reporting tool will not be tolerated.Item being reported:
I use selectors all the time for anything stateful really--modes of behaviour, etc.
Yeah it can get out of hand pretty quickly. My "cheat code" example does things a different way so the complexity doesn't increase with the number of buttons in the code.
The basic idea is to assign each button an "encoded" value. 1 for X, 2 for square, etc. Then each time a button is pressed, its encoded value is added to the total. That total is compared to what the total *should* be at that stage of the inputs. If it's wrong, everything is reset. If it's right, a selector moves on and the next required total becomes active.