Difference between revisions of "Keyword"

From Unofficial QEdit Wiki Guide
Jump to: navigation, search
m (Example)
 
Line 26: Line 26:
 
  <span style='color:green'>        jmp </span>101 <span style='color:orange'>//Jumps to function 101.</span>
 
  <span style='color:green'>        jmp </span>101 <span style='color:orange'>//Jumps to function 101.</span>
 
  <span style='color:blue'>102:    </span><span style='color:green'>clear </span>R4 <span style='color:orange'>//Makes register 4 equal 00000000.</span>
 
  <span style='color:blue'>102:    </span><span style='color:green'>clear </span>R4 <span style='color:orange'>//Makes register 4 equal 00000000.</span>
  <span style='color:green'>        jumpi_!= </span>R2, 00000003, 101 <span style='color:orange'>//If register 2 does NOT equal 00000003 (floor id 3) jump to function 101.</span>
+
  <span style='color:green'>        jmpi_!= </span>R2, 00000003, 101 <span style='color:orange'>//If register 2 does NOT equal 00000003 (floor id 3) jump to function 101.</span>
  <span style='color:green'>        jumpi_!= </span>R3, 00000020, 101 <span style='color:orange'>//If register 3 does NOT equal 00000020 (room id 32) jump to function 101.</span>
+
  <span style='color:green'>        jmpi_!= </span>R3, 00000020, 101 <span style='color:orange'>//If register 3 does NOT equal 00000020 (room id 32) jump to function 101.</span>
 
  <span style='color:red'>        sync_register </span>R1, 00000001 <span style='color:orange'>//Makes register 1 equal 00000001 for all clients.</span>
 
  <span style='color:red'>        sync_register </span>R1, 00000001 <span style='color:orange'>//Makes register 1 equal 00000001 for all clients.</span>
 
  <span style='color:green'>        ret </span>
 
  <span style='color:green'>        ret </span>

Latest revision as of 07:52, 13 July 2013

Syntax

Syntax: Keyword register1, register 2, textsting

  • register1 = Register to set when Keyword is said.
  • register2 = Reserved register 250 for player slot number.
  • textstring = Keyword to say.

Use

Used to set a register when a Keyword is said in the players sent message.

Example


1:       ret 
100:     get_slotnumber R250 //Gets the slot number of the players and stores it in register 250.
         thread 101 //Threads function 101.
         thread 103 //Threads function 103.
         thread 105 //Threads function 105.
         ret 
101:     sync  //Waits 1 frame.
         jmpi_= R1, 00000001, 1 //If register 1 equals 00000001 jump to function 1.
         jmpi_= R4, 00000001, 102 //If register 4 equals 00000001 jump to function 102.
         keyword_detect  //Allows the searching of keywords when the player sends a message.
         Keyword R4, R250, pig //When the word "pig" is said by a player in there message register 4 will equal 00000001.
         jmp 101 //Jumps to function 101.
102:     clear R4 //Makes register 4 equal 00000000.
         jmpi_!= R2, 00000003, 101 //If register 2 does NOT equal 00000003 (floor id 3) jump to function 101.
         jmpi_!= R3, 00000020, 101 //If register 3 does NOT equal 00000020 (room id 32) jump to function 101.
         sync_register R1, 00000001 //Makes register 1 equal 00000001 for all clients.
         ret 
103:     sync  //Waits 1 frame.
         jmpi_= R1, 00000001, 104 //If register 1 equals 00000001 jump to function 104.
         jmp 103 //Jumps to function 103.
104:     window_msg Someone said "pig" on floor 3 in room 32. //Displays a window message.
         winend  //Closes the window message.
         ret 
105:     sync  //Waits 1 frame.
         get_floor_number R250, R2 //Stores the floor id the player is on in register 2, and stores the room id the player is in in register 3.
         jmp 105 //Jumps to function 105.

Also see

ret, get_slotnumber, thread,

sync, jmpi_=, keyword_detect,

Keyword, jmp, jmpi_!=,

sync_register, window_msg, winend,

get_floor_number, reservedregisters