Lua CMDs
Options
CMD.OPT_ALT
CMD.OPT_CTRL
CMD.OPT_SHIFT
CMD.OPT_RIGHT
CMD.OPT_INTERNAL
Waitcodes
CMD.WAITCODE_TIME
CMD.WAITCODE_DEATH
CMD.WAITCODE_SQUAD
CMD.WAITCODE_GATHER
Insert/Remove Commands
First, said "tags" are unique command identifiers, so each command that gets inserted into a unit's command
queue gets its unique "tag" number. (It is used to sync command queue operations, also it makes things much easier.)
To receive those "tags" you can do the following:
local cmdQueue = Spring.GetUnitCommands(unitID);
if (#cmdQueue>0) then
local cmdTag = cmdQueue[1].tag
..
end
CMD.INSERT
options.ALT -> treat param0 as a position instead of a tag options.CONTROL -> use the build queue for factories params[0] = command tag or position (negative numbers to reference the back of the queue) params[1] = insertCmd id params[2] = insertCmd options params[3 ... N+2] = insertCmd params[0 ... N-1]
example:
Spring.GiveOrderToUnit(unitID,
CMD.INSERT,
{-1,CMD.ATTACK,CMD.OPT_SHIFT,unitID2},
{"alt"}
);
Note: If you don't already noticed it, the command params and
the command options are twisted in the array (compared to GiverOrder)!
CMD.REMOVE
options.ALT -> use the parameters as commandIDs options.CONTROL -> use the build queue for factories params[0 ... N-1] = tags or commandIDs to remove
Commands
CMD.STOP
type CMDTYPE.ICON
CMD.WAIT
type CMDTYPE.ICON
CMD.TIMEWAIT
type CMDTYPE.NUMBER
CMD.DEATHWAIT
type CMDTYPE.ICON_UNIT_OR_RECTANGLE
CMD.SQUADWAIT
type CMDTYPE.NUMBER
CMD.GATHERWAIT
type CMDTYPE.ICON
CMD.MOVE
type CMDTYPE.ICON_MAP
CMD.PATROL
type CMDTYPE.ICON_MAP
CMD.FIGHT
type CMDTYPE.ICON_MAP
CMD.ATTACK
type CMDTYPE.ICON_UNIT_OR_MAP
CMD.AREA_ATTACK
type CMDTYPE.ICON_AREA
CMD.GUARD
type CMDTYPE.ICON_UNIT
CMD.AISELECT
type CMDTYPE.COMBO_BOX
CMD.GROUPSELECT
type CMDTYPE.ICON
CMD.GROUPADD
type CMDTYPE.ICON
CMD.GROUPCLEAR
type CMDTYPE.ICON
CMD.REPAIR
type CMDTYPE.ICON_UNIT_OR_AREA
CMD.FIRE_STATE
type CMDTYPE.ICON_MODE
CMD.MOVE_STATE
type CMDTYPE.ICON_MODE
CMD.SELFD
type CMDTYPE.ICON
CMD.LOAD_UNITS
type CMDTYPE.ICON_UNIT_OR_AREA
CMD.LOAD_ONTO
type CMDTYPE.ICON_UNIT
CMD.UNLOAD_UNITS
type CMDTYPE.ICON_UNIT_OR_AREA
CMD.UNLOAD_UNIT
type CMDTYPE.ICON_MAP
CMD.ONOFF
type CMDTYPE.ICON_MODE
CMD.RECLAIM
type CMDTYPE.ICON_UNIT_OR_AREA
CMD.CLOAK
type CMDTYPE.ICON_MODE
CMD.STOCKPILE
type CMDTYPE.ICON
CMD.DGUN
type CMDTYPE.ICON_MAP
CMD.RESTORE
type CMDTYPE.ICON_AREA
CMD.REPEAT
type CMDTYPE.ICON_MODE
CMD.TRAJECTORY
type CMDTYPE.ICON_MODE
CMD.RESURRECT
type CMDTYPE.ICON_UNIT_FEATURE_OR_AREA
CMD.CAPTURE
type CMDTYPE.ICON_UNIT_OR_AREA
CMD.AUTOREPAIRLEVEL
type CMDTYPE.ICON_MODE
CMD.LOOPBACKATTACK
type CMDTYPE.ICON_MODE
CMD.IDLEMODE
type CMDTYPE.ICON_MODE
CMD.SET_WANTED_MAX_SPEED
type CMDTYPE.NUMBER
CMD.SETBASE
CMD.INTERNAL
used in different ways
CommandTypes
CMDTYPE.ICON
CMDTYPE.ICON_MODE
CMDTYPE.ICON_MAP
CMDTYPE.ICON_AREA
CMDTYPE.ICON_UNIT
CMDTYPE.ICON_UNIT_OR_MAP
CMDTYPE.ICON_FRONT
CMDTYPE.COMBO_BOX
CMDTYPE.ICON_UNIT_OR_AREA
CMDTYPE.ICON_UNIT_FEATURE_OR_AREA
CMDTYPE.ICON_BUILDING
CMDTYPE.CUSTOM
CMDTYPE.ICON_UNIT_OR_RECTANGLE
CMDTYPE.NUMBER
CMDTYPE.NEXT
CMDTYPE.PREV