I6: Touching things in the correct sequence?

Hi all,

After some time, I’m back (in case you still remember me from two years ago…:wink:), and of course I have questions.

First of all, in I6, how can I elegantly (!) code a puzzle which requires the player to touch objects in a certain sequence?

Say, there are a red, a green, and a blue button, and the player must touch them in the order red – green – blue to succeed. I have ideas how to code this in a “pedestrian” manner, but are there more clever ways to do it?

(In case it matters, the buttons in questions need not be “true objects”. Since they have no other function, they can simply be part of a console, “You see a console with a red, a green and a blue button each”, and the console object does all the processing with no button objects coded in the game.)

Any hints?

Thanks a lot in advance,


If I were you I’d make them objects. That will save a certain amount of parser hacking. I would set a global variable (value 0) for the button-pushing. In each of the button objects’ code, I would test the value of this variable.

Call it okPush.

When the red button is pushed, set okPush to 1. When the green button is pushed, check the value of okPush. If it’s 1, advance it to 2 – but if it’s not 1, reduce it to 0.

When the blue button is pushed, check whether okPush is 2. If so, advance it to 3 and do whatever you’re going to do in response to the correct sequence. If it’s not 2, reset it to 0.

I think that ought to do it.

Thanks, that sounds like a good solution, as long as there is no built-in mechanism!