User Tools

Site Tools


cw4:vectors

common_scripting_language

Vectors

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

   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)
 

With vectors, the command is somewhat simplified.

   GetObjPosition("Enemy1" true) ->ePos
   # intermediate operations that may adjust or necessitate the values of x, y, or x
   SetUnitSpecifiedTarget(self <-ePos)
 

This becomes more meaningful for complex commands that may necessitate multiple sets of paired elements, such as:

	BallisticArcLateral(<-armPos <-projSpeed <-target <-projMaxHeight) ->travelTime ->gravity ->fireVel
cw4/vectors.txt · Last modified: 2021/01/09 11:59 by Karsten75