Difference between revisions of "0509"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with '{{OpCode | ini = 0509=5,%5d% %1d% %2d% %3d% %4d% | description = Gets the distance between X,Y coordinates | p1 = X1-coordinate | p2 = Y1-coordinate | p…')
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{OpCode
 
{{OpCode
| ini        = 0509=5,%5d% %1d% %2d% %3d% %4d%
+
| games      = {{Icon|VC}} {{Icon|SA}}
| description = Gets the distance between X,Y coordinates
+
| command    = GET_DISTANCE_BETWEEN_COORDS_2D
| p1          = X1-coordinate
+
| description = Gets the distance between two X and Y coordinate points
| p2          = Y1-coordinate
+
| syntax1    = 0509: [''var''] = distance_between_point [''flt1''] [''flt2''] and_point [''flt3''] [''flt4'']
| p3          = X2-coordinate
+
| p1t        = [''flt1'']
| p4          = Y2-coordinate
+
| p1d        = X1-coordinate
| p5          = Variable to store distance
+
| p2t        = [''flt2'']
| game        = [[Vice City]], [[San Andreas]]
+
| p2d        = Y1-coordinate
 +
| p3t        = [''flt3'']
 +
| p3d        = X2-coordinate
 +
| p4t        = [''flt4'']
 +
| p4d        = Y2-coordinate
 +
| p5t        = [''var'']
 +
| p5d        = Variable to store the distance, a floating-point value
 
| native      = [[GET_DISTANCE_BETWEEN_COORDS_2D]]
 
| native      = [[GET_DISTANCE_BETWEEN_COORDS_2D]]
 
}}
 
}}
This opcode calculates the distance between two X,Y coordinate points. It uses the [[wiki:Distance#Geometry|distance formula]] in rectangular coordinate system to calculate the distance between the points. The value is stored in the variable as a floating-point value. Use opcode [[050A]] to calculate between two X,Y,Z coordinate points.
 
Note that the parameters of this opcode are rearranged.
 
[[Sanny Builder]] example:<source lang="scm">0509: 0@ = distance_between_point 0.0 0.0 and_point 100.0 100.0</source>
 
  
==Note==
+
This opcode gets the distance between two X and Y coordinate points. It uses the [[wikipedia:Distance#Geometry|distance formula]] in rectangular coordinate system to calculate the distance between the points.
The above format is more commonly used. The actual format of this opcode is in order:<br>
+
 
<code>0509=5,%1d% %2d% %3d% %4d% %5d%</code><br>
+
== Keywords ==
The format to use depends on which INI file you use.
+
get, store, distance, between, coords, coordinates, 2d
 +
 
 +
== See also ==
 +
* {{Icon|VC}} {{Icon|SA}} [[050A]], gets the distance between two X, Y, and Z coordinate points

Latest revision as of 00:46, 20 November 2016

Vice City San Andreas GET_DISTANCE_BETWEEN_COORDS_2D


Description
Gets the distance between two X and Y coordinate points
Syntax
0509: [var] = distance_between_point [flt1] [flt2] and_point [flt3] [flt4]
Parameter
[flt1]
X1-coordinate
[flt2]
Y1-coordinate
[flt3]
X2-coordinate
[flt4]
Y2-coordinate
[var]
Variable to store the distance, a floating-point value
Native analog
GET_DISTANCE_BETWEEN_COORDS_2D

This opcode gets the distance between two X and Y coordinate points. It uses the distance formula in rectangular coordinate system to calculate the distance between the points.

Keywords

get, store, distance, between, coords, coordinates, 2d

See also

  • Vice City San Andreas 050A, gets the distance between two X, Y, and Z coordinate points