Activation Order - Switch/Variable Door Opening Routine

gondracorn

Villager
Member
Joined
Feb 4, 2014
Messages
21
Reaction score
5
First Language
Enlish
I'm perplexed on how a switch would work if you have 4 switches that would have to be activated in a certain order to get the doors/pads/ect  to activate all in the correct way you want them. Otherwise, Only this door will open, and this door will stay closed.

Is there some deep programming for this, or does this require code that I'm not seeing to?

For an instance...

Door #1 can be opened by all for buttons, but depending on which button you press 1st and which buttons you have pressed, door 1 may or may not open. Same rule applys for all other doors. Also, if button A initially opens Door 1, Button B, C, or D CAN re-close that door. Also, if the door was reclosed by button B or C, Button C or D may Reopen that door. In the same case, Button D may close that door once more.

You see, this doesn't seem to be "Button 1 will open Door 1 and Button 2 will close door 1 and open door 2... end of story"

In fact, we're talking about a scenario of 4  buttons, 4 doors, possibly 16 or more scenarios I believe, If my math is correct.

And if order of opening IS relative, perhaps times that by somewhere between 3 and 4?

 
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
you'll need a variable to check and record the sequence.


Let's say you have Buttons A, B, C, D and they have to be pressed in exactly that order


Upon entering the map, Variable X is set to Zero.


Now the event for button A checks the Variable when activated. If the variable X == 0 (first press) then it'll increase X by +1 and does whatever should be done on a successfull activation.


If the variable is NOT 0, then the button was pressed out of sequence, sequence is set back to 0 and all doors close (or whatever you want).


Now the event for button B checks the variable for X == 1. If that is correct, the button was pressed in sequence - X+1 and everything as intended. If X is not 1 (either 0 or 2+) then it was pressed out of sequence - reset to Zero etc.


if you want a more complex sequence you might need to use a bit more in variables and switches, that depends on what exactly you want to do.


You can also sequence conditions to have different reactions depending on the current sequence count.
 

gondracorn

Villager
Member
Joined
Feb 4, 2014
Messages
21
Reaction score
5
First Language
Enlish
you'll need a variable to check and record the sequence.

Let's say you have Buttons A, B, C, D and they have to be pressed in exactly that order

Upon entering the map, Variable X is set to Zero.

Now the event for button A checks the Variable when activated. If the variable X == 0 (first press) then it'll increase X by +1 and does whatever should be done on a successfull activation.

If the variable is NOT 0, then the button was pressed out of sequence, sequence is set back to 0 and all doors close (or whatever you want).

Now the event for button B checks the variable for X == 1. If that is correct, the button was pressed in sequence - X+1 and everything as intended. If X is not 1 (either 0 or 2+) then it was pressed out of sequence - reset to Zero etc.

if you want a more complex sequence you might need to use a bit more in variables and switches, that depends on what exactly you want to do.

You can also sequence conditions to have different reactions depending on the current sequence count.
Yeah,  I was kinda thinking it was a variable addition problem
 

TheRiotInside

Extra Ordinaire
Veteran
Joined
Sep 3, 2012
Messages
270
Reaction score
123
First Language
English
Primarily Uses
Here's maybe a more simple use of variables to get done what you want.

Make the switches do addition and multiplication, then check for a specific amount at the end. For example:

Switch 1: Variable + 2

Switch 2: Variable * 4

Switch 3: Variable + 1

Switch 4: Variable * 2

I haven't tested every combination, but you should be able to check for a specific number which represents a certain switch order. So if you wanted a 1, 2, 3, 4 switch order, your end check would be looking to see if the variable is equal to 18: (((0 + 2) * 4) + 1) * 2 = 18

Something to note is your desired order couldn't do an addition or multiplication twice in a row (as you get 3 by doing 2 + 1 or 1 + 2, you know?). So as long as you alternate your addition and multiplication for the correct order, only one combination should give you that number.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top