If switch pressed

From Unofficial QEdit Wiki Guide
Jump to: navigation, search


Syntax: if_switch_pressed register

  • register = Start of continuous registers.

Continuous registers

(3 registers.)

Register 1 = Floor id.

Register 2 = Switch id.

Register 3 = Register to set is the switch id in register2 on the floor id in register 1 is unlocked.


Used to set a register to equal 00000001 if a switch id is unlocked either though scripting or through the map event scripting.


100:     thread_stg 101 //Threads function 101 for the current floor.
101:     sync  //Waits 1 frame.
         leti R1, 00000004 //Makes register 1 equal 00000004 for floor id 4.
         leti R2, 00000005 //Makes register 2 equal 00000005 for switch id 5.
         if_switch_pressed R1 //Tells where to start looking for the continuous registers. If switch id 5 on floor 4 is unlocked when this opcode is encountered then register 3 will be set to equal 00000001.
         jmpi_= R3, 00000001, 102 //If register 3 equals 00000001 jump to function 102.
         jmp 101 //Jump to function 101.
102:     window_msg Switch id 5<cr>on floor 4<cr>is now unlocked. //Displays a window message.
         winend  //Closes the window message.

Also see

thread_stg, ret, sync, leti,

jmpi_=, jmp, window_msg, winend