Difference between revisions of "If switch pressed"
From Unofficial QEdit Wiki Guide
Japanaman2 (Talk | contribs) |
Japanaman2 (Talk | contribs) |
||
Line 20: | Line 20: | ||
<span style='color:blue'>100: </span><span style='color:green'>thread_stg </span>101 <span style='color:orange'>//Threads function 101 for the current floor.</span> | <span style='color:blue'>100: </span><span style='color:green'>thread_stg </span>101 <span style='color:orange'>//Threads function 101 for the current floor.</span> | ||
<span style='color:green'> ret </span> | <span style='color:green'> ret </span> | ||
− | <span style='color:blue'>101: </span><span style='color:green'>sync </span> <span style='color:orange'>//Waits 1 frame. | + | <span style='color:blue'>101: </span><span style='color:green'>sync </span> <span style='color:orange'>//Waits 1 frame.</span> |
<span style='color:green'> leti </span><span style='color:black'>R1, 00000004 </span><span style='color:orange'>//Makes register 1 equal 00000004 for floor id 4.</span> | <span style='color:green'> leti </span><span style='color:black'>R1, 00000004 </span><span style='color:orange'>//Makes register 1 equal 00000004 for floor id 4.</span> | ||
<span style='color:green'> leti </span><span style='color:black'>R2, 00000005 </span><span style='color:orange'>//Makes register 2 equal 00000005 for switch id 5.</span> | <span style='color:green'> leti </span><span style='color:black'>R2, 00000005 </span><span style='color:orange'>//Makes register 2 equal 00000005 for switch id 5.</span> |
Latest revision as of 00:54, 30 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 to equal 00000001 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.
102: 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,