SetCommand Objects Commands 5.1 OC bool string command Command name (as string). See the table below. object target target object for the command int x X target coordinate int y Y target coordinate object target2 secondary target object any Data additional data for the command int retries Number of retries if the command fails, until the command fails completely. Gives a command to an object. The object will try to complete the command using the internal artificial intelligence (including pathfinding). The following commands are defined: commandtargetx, ytarget2DataDescription Acquire Null0,0Ignore containerObject type (id)Type of object to be acquired. May be bought at the home base if necessary. Material contained in the specified container (Target2) is to be ignored in the search. Activate Target objectActivate the target object (exit from its container). Activate Null0,0Target objectOpen the Get menu for the contents of the target object. Activate NullNumber,0Target objectObject type (id)Activate n objects of the specified type in the target object. Attack Target objectAttack the target object. Buy Null0,0NullObject type (id)Buy an object of the specified type at the closest friendly home base. Buy BasisNumber,0NullObject type (id)Buy n objects of the specified type at the home base. Buy BasisOpen the Buy menu for the specified home base. Call ObjectPar(1),Par(2)Par(3)Function (string)Call Function in the object script. Par(0) will be the calling object. If the command fails because underlaying commands have failed, the function FunctionFailed is called instead. Chop Target objectFell the target object object (tree). Dig NullTarget positionDig towards the target position. Drop Immediately drop the first object in the inventory. Drop NullTarget positionDrop the first object in the inventory at the target position. Drop Target objectTarget positionCollect the target object and drop it at the target position. Enter Target objectEnter the target object. Exit Exit the current container. Follow Target objectFollow the target object (permanently). Get Target objectCollect the target object, dig it out if necessary. Get NullNumber,0Target objectObject type (id)Get the specified number of objects from the target object. Grab Target objectOffsetGrab the target object at the specified offset to the object center. Home Return to the closest friendly home base. Jump Jump into the current direction. Jump NullTarget positionJump into the direction of the target position. MoveTo Target object0,0NullNo automatic adjustment? (bool)Move to the position of the target object. Set iData to true to avoid automatic adjustment of the target coordinates to landscape surface. MoveTo NullTarget positionNullNo automatic adjustment? (bool)Move to the target position. Set iData to true to avoid automatic adjustment of the target coordinates to landscape surface. None Clear all current commands. PushTo Target objectTarget positionPush the target object to the target position. PushTo Object0,0Target objectPush the target object into the secondary target object. Put Target objectPut the first inventory object into the target object. Put Target objectNumber,0Put the specified number of inventory objects into the target object. Put Target object0,0ObjectCollect the target object and put it into the secondary target object. Put Target object0,0NullObject type (id)Put the inventory object of the specified type into the target object. Put Target objectNumber,0NullObject type (id)Put the specified number of inventory objects of the specified type into the target object. Sell Null0,0Object2Object type (id)Sell an object of the specified type at the closest home base. If Object2 is specified, this one will be sold first. Sell BasisNumber,0Object2Object type (id)Sell a number of objects of the specified type at the home base. If Object2 is specified, this one will be sold first. Sell BasisOpen Sell menu for the specified base object. Throw Throw the first inventory item immediately. Throw NullTarget positionThrow the first inventory item towards the target position. Throw Target objectTarget positionCollect the target object and throw it towards the target position. UnGrab Let go of the object currently grabbed. Wait Null0,0NullFramesWait specified number of frames/ticks.
SetCommand("Attack", FindObject(Find_ID(Clonk),Sort_Distance(0,0)), 0, 0, 0, 0, 10); This script gives the clonk the order to attack the closest clonk of player 1. If the command fails (e.g. due to unsuccessful pathfinding), retry 10 times. GetCommand AddCommand AppendCommand FinishCommand
PeterW2001-11