Difference between revisions of "If switch not pressed"

From Unofficial QEdit Wiki Guide
Jump to: navigation, search
(Continuous registers)
(Use)
 
Line 15: Line 15:
  
 
==Use==
 
==Use==
Used to set a register to check if a switch is not pressed through scripting or map event scripting
+
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,

jmpi_on, jmp, window_msg, winend