For the switch puzzle, unless you definitely need a separate variable for each switch (e.g. an on/off state), I'd just have a variable (e.g. "index") which is the current state in the sequence. Start it out as 0. You'll need to put it somewhere - one place is the room. I'll assume the room is called "Room".
Switch A:
if (Room.index = 0) {
Room.index = 1
} else {
Room.index = 0
}
Switch B:
if (Room.index = 1) {
Room.index = 2
} else {
Room.index = 0
}
Switch C:
if (Room.index = 2) {
Room.index = 3
} else {
Room.index = 0
}
If you have the switches as separate objects, then you could have a common base type for all the switches. The only difference would be an attribute in each switch which tells at what point it's the next switch. Then you'd have a common script in the base type:
if (Room.index = this.index) {
Room.index = Room.index + 1
} else {
Room.index = 0
}
Then set Switch A index to 0, Switch B index to 1, Switch C index to 2, etc. (In some order). You could then even randomly assign the switch index variables if you want the switch order to be different each time.