Difference between revisions of "Keyword detect"
From Unofficial QEdit Wiki Guide
Japanaman2 (Talk | contribs) |
m (→Example) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 5: | Line 5: | ||
==Use== | ==Use== | ||
− | Used to allow the searching of | + | Used to allow the searching of Keywords when the player sends a message. |
==Example== | ==Example== | ||
Line 13: | Line 13: | ||
<span style='color:green'> thread </span>101 <span style='color:orange'>//Threads function 101.</span> | <span style='color:green'> thread </span>101 <span style='color:orange'>//Threads function 101.</span> | ||
<span style='color:green'> thread </span>103 <span style='color:orange'>//Threads function 103.</span> | <span style='color:green'> thread </span>103 <span style='color:orange'>//Threads function 103.</span> | ||
+ | <span style='color:green'> thread </span>105 <span style='color:orange'>//Threads function 105.</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> | <span style='color:blue'>101: </span><span style='color:green'>sync </span> <span style='color:orange'>//Waits 1 frame.</span> | ||
Line 18: | Line 19: | ||
<span style='color:green'> jmpi_= </span>R4, 00000001, 102 <span style='color:orange'>//If register 4 equals 00000001 jump to function 102.</span> | <span style='color:green'> jmpi_= </span>R4, 00000001, 102 <span style='color:orange'>//If register 4 equals 00000001 jump to function 102.</span> | ||
<span style='color:red'> keyword_detect </span> <span style='color:orange'>//Allows the searching of keywords when the player sends a message.</span> | <span style='color:red'> keyword_detect </span> <span style='color:orange'>//Allows the searching of keywords when the player sends a message.</span> | ||
− | <span style='color:red'> | + | <span style='color:red'> Keyword </span>R4, R250, pig <span style='color:orange'>//When the word "pig" is said by a player in there message register 4 will equal 00000001.</span> |
<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:blue'>102: </span><span style='color:green'>clear </span>R4 <span style='color:orange'>//Makes register 4 equal 00000000.</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'> | + | <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:green'> | + | |
<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> | ||
Line 32: | Line 32: | ||
<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> | ||
+ | <span style='color:blue'>105: </span><span style='color:green'>sync </span> <span style='color:orange'>//Waits 1 frame.</span> | ||
+ | <span style='color:red'> get_floor_number </span>R250, R2 <span style='color:orange'>//Stores the floor id the player is on in register 2, and stores the room id the player is in in register 3.</span> | ||
+ | <span style='color:green'> jmp </span>105 <span style='color:orange'>//Jumps to function 105.</span> | ||
</span> | </span> | ||
Line 37: | Line 40: | ||
[[ret]], [[get_slotnumber]], [[thread]], | [[ret]], [[get_slotnumber]], [[thread]], | ||
− | [[ | + | [[sync]], [[jmpiue|jmpi_=]], [[keyword_detect]], |
− | [[ | + | [[Keyword]], [[jmp]], [[jmpiuexe|jmpi_!=]], |
[[sync_register]], [[window_msg]], [[winend]], | [[sync_register]], [[window_msg]], [[winend]], | ||
− | [[reservedregisters]] | + | [[get_floor_number]], [[reservedregisters]] |
Latest revision as of 07:59, 13 July 2013
Contents
Syntax
Syntax: keyword_detect
- None
Use
Used to allow the searching of Keywords when the player sends a 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.