Enter a code

This is a method for entering a number code and verifying it.

Create a room with a numberpad with objects for the numberbuttons. In the script of the room you have to define some variables.

on (enter) { setnum (counter ; 1) setnum (code1 ; 4) setnum (code2 ; 2) setnum (code3 ; 0) setnum (code4 ; 1) }

The counter variables keeps track on the players inputs. The four code vars are the correct solution. The object scripts of the number buttons should look like this.

on (click) { if_num (counter ; 1) { setnum (input1 ; 1) setnum (counter ; + 1) break () } if_num (counter ; 2) { setnum (input2 ; 1) setnum (counter ; + 1) break () } if_num (counter ; 3) { setnum (input3 ; 1) setnum (counter ; + 1) break () } if_num (counter ; 4) { setnum (input4 ; 1) setnum (counter ; +1) if_num (input1 ; [code1] ) if_num (input2 ; [code2] ) if_num (input3 ; [code3] ) if_num (input4 ; [code4] ) { cutscene (correctcode) break () } cutscene (wrongcode) } }

With every click on a button the counter goes up by one and the entered number will be saved. After the fourth number the script will check if the entered code is correct. Depending on that one of two cutscenes will start.