User Tools

Site Tools


xrpl:vectors

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

xrpl:vectors [2020/02/02 16:32] (current)
Karsten75 created
Line 1: Line 1:
 +Vectors is a new data type that simplifies passing values between commands.
 +
 +Many commands require a "​set"​ of data. For example, to pass the location of an object on a map, the x, y, and z-coordinates are required. ​
 +
 +Consider the `GetObjPosition` command. ​ assume you want to obtain the position of a specific unit and pass it to a different unit for targeting purposes. Without vectors, the command pair would be
 +
 +<code PRPL>
 +   ​GetObjPosition("​Enemy1"​ true) ->ePosZ ->ePosy ->ePosZ
 +   # intermediate operations that may adjust or necessitate the values of x, y, or x
 +   ​SetUnitSpecifiedTarget(self <-ePosZ <-ePosy <-ePosZ)
 +   
 +</​code> ​  
 +
 +With vectors, the command is somewhat simplified. ​
 +
 +<code PRPL>
 +   ​GetObjPosition("​Enemy1"​ true) ->ePos
 +   # intermediate operations that may adjust or necessitate the values of x, y, or x
 +   ​SetUnitSpecifiedTarget(self <-ePos)
 +   
 +</​code> ​
 +
 +This becomes more meaningful for complex commands that may necessitate multiple sets of paired elements, such as:
 +
 +<code PRPL>
 + BallisticArcLateral(<​-armPos <​-projSpeed <-target <​-projMaxHeight) ->​travelTime ->​gravity ->​fireVel
 +</​code>  ​
 +
  
xrpl/vectors.txt ยท Last modified: 2020/02/02 16:32 by Karsten75