Difference between revisions of "If switch not pressed"
From Unofficial QEdit Wiki Guide
(Created page with "==Syntax== ''Syntax:'' <span style='font-size:12px;font-family:courier'><span style='color:blue'>if_switch_not_pressed </span>register</span> * ''register'' = Start of contin...") |
(→Use) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | ==Note== | ||
+ | This opcode is incorrectly named. The purpose of this opcode is to check that a switch is pressed/unlocked on the current floor. It is very similar to opcode 0xf82e <span style='color:blue'>if_switch_pressed</span>. | ||
+ | |||
==Syntax== | ==Syntax== | ||
''Syntax:'' <span style='font-size:12px;font-family:courier'><span style='color:blue'>if_switch_not_pressed </span>register</span> | ''Syntax:'' <span style='font-size:12px;font-family:courier'><span style='color:blue'>if_switch_not_pressed </span>register</span> | ||
Line 9: | Line 12: | ||
Register 1 = Switch id | Register 1 = Switch id | ||
− | Register 2 = | + | Register 2 = Result register. Set to 0 if switch is still locked and 1 if the switch is unlocked. |
− | + | ||
==Use== | ==Use== | ||
− | Used | + | Used to check if a switch on the current floor is pressed/unlocked. |
− | + | ||
==Example== | ==Example== |
Latest revision as of 18:42, 26 April 2025
Note
This opcode is incorrectly named. The purpose of this opcode is to check that a switch is pressed/unlocked on the current floor. It is very similar to opcode 0xf82e if_switch_pressed.
Syntax
Syntax: if_switch_not_pressed register
- register = Start of continuous registers.
Continuous registers
(2 registers.)
Register 1 = Switch id
Register 2 = Result register. Set to 0 if switch is still locked and 1 if the switch is unlocked.
Use
Used to check if a switch on the current floor is pressed/unlocked.
Example
100: thread_stg 101 //Threads function 101 for the current floor.
ret
101: sync //Waits 1 frame.
leti R1, 00000001 //Makes register 1 equal 00000001 for switch id 1.
if_switch_not_pressed R1
leti R3, 00000002 //Makes register 2 equal 00000002 for switch id 2.
if_switch_not_pressed R3
jmp_on 102 2:2:4 //If register 2 and 4 = 1, jump to Function 102
jmp 101 //Jump to function 101.
102: window_msg Switch IDs 1 and 2 are now pressed //Displays a window message.
winend //Closes the window message.
ret
Also see
thread_stg, ret, sync, leti,