Difference between revisions of "Get coord player detect"

From Unofficial QEdit Wiki Guide
Jump to: navigation, search
(Also see)
Line 14: Line 14:
 
<span style='color:orange'>//Detecting the player within the given parameters.</span>
 
<span style='color:orange'>//Detecting the player within the given parameters.</span>
 
  <span style='color:blue'>0:  </span><span style='color:green'>get_slotnumber </span>R250 <span style='color:orange'>//Gets the player's slot # and puts it in R250.</span>
 
  <span style='color:blue'>0:  </span><span style='color:green'>get_slotnumber </span>R250 <span style='color:orange'>//Gets the player's slot # and puts it in R250.</span>
  <span style='color:blue'>100:     </span><span style='color:green'>leti </span>R1, 0000000A <span style='color:orange'>//Set the X value to 10.</span>
+
<span style='color:green'>    ret </span>
  <span style='color:green'>         leti </span>R2, 00000000 <span style='color:orange'>//Set Z value to 0</span>
+
  <span style='color:blue'>100: </span><span style='color:green'>leti </span>R1, 0000000A <span style='color:orange'>//Set the X value to 10.</span>
  <span style='color:green'>         leti </span>R3, 00000064 <span style='color:orange'>//Set the radius to 100</span>
+
  <span style='color:green'>     leti </span>R2, 00000014 <span style='color:orange'>//Set Z value to 20.</span>
  <span style='color:green'>         let </span> R4, R250 <span style='color:orange'>//Set the player slot to R250</span>
+
  <span style='color:green'>     leti </span>R3, 00000064 <span style='color:orange'>//Set the radius to 100.</span>
  <span style='color:green'>         leti </span>R5, 00000000 <span style='color:orange'>//Output if the player is standing within the radius set in R3</span>
+
  <span style='color:green'>     let </span> R4, R250 <span style='color:orange'>//Set the player slot to R250.</span>
  <span style='color:green'>         particle_v3 R1 </span><span style='color:orange'>//Tells where to start the continuation of registry strings to be used for the coordinates</span>
+
  <span style='color:green'>     get_coord_player_detect R1, R5 </span><span style='color:orange'>//Tells where to start the continuation of registry strings to be used for the coordinates.</span>
  <span style='color:green'>         ret </span>
+
<span style='color:green'>    jmpi_= R5, 00000000, 101 </span><span style='color:orange'>//If R5 is set to 0, player is not in radius (call function 101).</span>
 +
  <span style='color:green'>     jmpi_= R5, 00000001, 102 </span><span style='color:orange'>//If R5 is set to 1, player is in radius (call function 102).</span>
 +
<span style='color:green'>    ret </span>
 +
<span style='color:blue'>101: </span><span style='color:green'>window_msg 'You are not in the radius.' </span>
 +
<span style='color:green'>    ret </span>
 +
<span style='color:blue'>102: </span><span style='color:green'>window_msg 'You are in the radius!' </span>
 +
  <span style='color:green'>     ret </span>
  
 
==Also see==
 
==Also see==
[[leti]] [[let]] [[get_slotnumber]] [[ret]]
+
[[leti]] [[let]] [[jmpiue]] [[get_slotnumber]] [[ret]]

Revision as of 03:29, 19 April 2021

Syntax

Syntax: particle_v3 register1, register5

  • register1 = X value.
  • register2 = Z value.
  • register3 = Radius.
  • register4 = Player slot.
  • register5 = Output.

Use

Script version of a touch plate object; used to detect a player's location within specific set parameters.

Example

//Detecting the player within the given parameters.

0:   get_slotnumber R250 //Gets the player's slot # and puts it in R250.
     ret 
100: leti R1, 0000000A //Set the X value to 10.
     leti R2, 00000014 //Set Z value to 20.
     leti R3, 00000064 //Set the radius to 100.
     let  R4, R250 //Set the player slot to R250.
     get_coord_player_detect R1, R5 //Tells where to start the continuation of registry strings to be used for the coordinates.
     jmpi_= R5, 00000000, 101 //If R5 is set to 0, player is not in radius (call function 101).
     jmpi_= R5, 00000001, 102 //If R5 is set to 1, player is in radius (call function 102).
     ret 
101: window_msg 'You are not in the radius.' 
     ret 
102: window_msg 'You are in the radius!' 
     ret 

Also see

leti let jmpiue get_slotnumber ret