Difference between revisions of "If switch pressed"
From Unofficial QEdit Wiki Guide
Japanaman2 (Talk | contribs) |
Japanaman2 (Talk | contribs) |
||
Line 26: | Line 26: | ||
<span style='color:green'> jmpi_= </span>R3, 00000001, 102 <span style='color:orange'>//If register 3 equals 00000001 jump to function 102.</span> | <span style='color:green'> jmpi_= </span>R3, 00000001, 102 <span style='color:orange'>//If register 3 equals 00000001 jump to function 102.</span> | ||
<span style='color:green'> jmp </span>101 <span style='color:orange'>//Jump to function 101.</span> | <span style='color:green'> jmp </span>101 <span style='color:orange'>//Jump to function 101.</span> | ||
− | + | <span style='color:green'> window_msg </span>Switch id 5<cr>on floor 4<cr>is now unlocked. <span style='color:orange'>//Displays a window message.</span> | |
<span style='color:green'> winend </span> <span style='color:orange'>//Closes the window message.</span> | <span style='color:green'> winend </span> <span style='color:orange'>//Closes the window message.</span> | ||
<span style='color:green'> ret </span> | <span style='color:green'> ret </span> |
Revision as of 23:58, 29 July 2013
Syntax
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.
Use
Used to set a register if a switch id is unlocked either though scripting or through the map event scripting.
Example
100: thread_stg 101 //Threads function 101 for the current floor.
ret
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.
window_msg Switch id 5<cr>on floor 4<cr>is now unlocked. //Displays a window message.
winend //Closes the window message.
ret
Also see
thread_stg, ret, sync, leti,