CAOS-Programmierung: Befehlsgruppen: Agents
<< Befehlsgruppen | Inhaltsverzeichnis >>
Dies Befehle sind den Agents zuzuordnen:
Agents
ABBA (integer)
Returns the absolute base for the current agent/part. Returns -1 if an invalid part. The absolute base is the value passed into NEW: SIMP and so on, it is different from the BASE.
ALPH (command) alpha_value (integer) yesOrNo (integer)
The agent will be drawn alpha blended against the background by the given value - from 256 for invisible to 0 for completely solid. For compound agents set the PART to affect a particular part or to -1 to affect all parts. The second parameter switches alpha blending on (1) or off (0). Alpha graphics are drawn much slower, so use sparingly and turn it off completely rather than using an intensity value of 0 or 256. At the moment alpha channels only work on compressed, non-mirrored, non-zoomed sprites.
ANIM (command) pose_list (byte-string)
Specify a list of POSEs such as [1 2 3] to animate the current agent/part. Put 255 at the end to continually loop. The first number after the 255 is an index into the animation string where the looping restarts from - this defaults to 0 if not specified. e.g. [0 1 2 10 11 12 255 3] would loop just the 10, 11, 12 section.
ANMS (command) anim_string (string)
This is like ANIM, only it reads the poses from a string such as "3 4 5 255". Use this when you need to dynamically construct animations. Use ANIM in general as it is quicker to execute, although they are the same speed once the animation is underway.
ATTR (command) attributes (integer)
Set attributes of target. Sum the values in the Attribute Flags table to get the attribute value to pass into this command.
ATTR (integer)
Return attributes of target.
BASE (command) index (integer)
Set the base image for this agent or part. The index is relative to the first_image specified in the NEW: command. Future POSE/ANIM commands and any ANIM in progress are relative to this new base.
BASE (integer)
Returns the BASE image for the current agent/part. Returns -1 if an invalid part.
BHVR (command) permissions (integer)
Sets the creature permissions for target. Sum the entries in the Creature Permissions table to get the value to use.
BHVR (integer)
Returns the creature permissions for the target agent.
CALL (command) event_no (integer) param_1 (anything) param_2 (anything)
Calls a subroutine script on the owner with the specified event number. When that script finishes the current script is resumed. No variables are shared between the two scripts so any return values must go through OVs. The called script starts in the same INST state as the calling script, however, it may use SLOW or INST to override this initial state. In addition, when the script returns to the calling script, the INST state is reset to what it was before the CALL command, so CALL preserves INSTness in the calling script. So if the caller script is in an INST then the called script will inherit that, any change in the called script to cancel this (such as OVER, WAIT, SLOW etc) will only affect the called script... when execution returns to the caller script it will still be in whatever state it was in before.
CARR (agent)
Returns the the agent currently holding the target, or NULL if there is none.
CATA (integer)
Returns the target's category. This either depends on its classifier as described in CATI, or is its own individual override set with CATO.
CATI (integer) family (integer) genus (integer) species (integer)
Return the category id for the given classifier. The catalogue tag "Agent Classifiers" specifies these, and you can have more than 40. They are tested in order until the first match is found. -1 is always returned if none match. Agents can override their classifier category with CATO.
CATO (command) category (integer)
Change the target's category to the one specified. The default is -1 which means the category is based on classifier and the catalogue as described in CATI. See also CATX and CATA.
CATX (string) category_id (integer)
Returns the name of the given category. For example, "toy" or "bad bug". The catalogue tag "Agent Categories" stores these. If the id is out of range, CATX returns an empty string.
CLAC (integer)
This returns the CLAC action of the TARG object. If the TARG is in CLIK mode, then the return value is -2. Otherwise it is the CLAC action.
CLIK (integer) which_value (integer)
This returns the CLIK action of the TARG object. If the object is in CLAC mode, then it returns -2, else the return values are as follows: 0 -> Current click action number (1,2,3) 1 -> First CLIK action. 2 -> Second CLIK action. 3 -> Third CLIK action
CORE (command) topY (float) bottomY (float) leftX (float) rightX (float)
Sets the bounding box of the physical core of the object TARG. May be set to smaller (or larger) than the sprite's rectangle.
DCOR (command) core_on (integer)
Debug command to show the physical core of the TARG agent graphically.
DISQ (float) other (agent)
Returns the square of the distance between the centre points of the target agent, and the other agent. It is quicker to compare this square against a squared constant directly, or if you need the actual distance use SQRT.
DROP (command)
Force the TARG to drop what it is carrying. this will try to find a safe place for the agent to fall.
DSEE (command) can_see_on (integer)
Debug command to show all the agents which can be seen by any creature.
ENUM (command) family (integer) genus (integer) species (integer)
Iterate through each agent which conforms to the given classification, setting TARG to point to each valid agent in turn. family, genus and/or species can be zero to act as wildcards. NEXT terminates the block of code which is executed with each TARG. After an ENUM, TARG is set to OWNR. Beispiele: ENUM 2 14 0 KILL TARG NEXT Limit ELAS eines Spielzeugs: ENUM 2 21 0 DOIF ELAS gt 50 ELAS 50 ENDI NEXT Alle Norns sollen erwachsen werden: ENUM 4 0 0 SETV va00 4 SUBV va00 CAGE DOIF va00 gt 0 AGES va00 ENDI NEXT ENUM 0 0 0 DCOR 1 NEXT
ESEE (command) family (integer) genus (integer) species (integer)
As ENUM, except only enumerates through agents which OWNR can see. An agent can see another if it is within RNGE, its PERM allows it to see through all intervening walls, and for creatures ATTR Invisible isn't set. See also STAR and SEEE. In install scripts, when there is no OWNR, TARG is used instead.
ETCH (command) family (integer) genus (integer) species (integer)
As ENUM, except only enumerates through agents which OWNR is touching. Agents are said to be touching if their bounding rectangles overlap. See also TTAR. In install scripts, when there is no OWNR, TARG is used instead.
FLTX (float)
This returns the X position of the TARG object's floating vector.
FLTY (float)
This returns the Y position of the TARG object's floating vector.
FMLY (integer)
Returns family of target. See also GNUS, SPCS.
FRAT (command) FrameRate (integer)
This command sets the frame rate on the TARG agent. If it is a compound agent, then the part affected can be set with the PART command. Valid rates are from 1 to 255. 1 is Normal rate, 2 is half speed etc...
FROM (variable)
If we're processing a message, this is the OWNR who sent the message. NULL if the message was sent from an injected script or an install script. If the message was sent over the network using NET: WRIT, then this contains the user id of the sender, as a string.
GAIT (command) gait_number (integer)
Specifies the current gait for a creature. The gaits are genetically defined. It sets the gait of the creature agent stored in TARG.
GALL (command) sprite_file (string) first_image (integer)
Changes the gallery (sprite file) used by an agent. This works for simple and compound agents (using the current PART). The current POSE is kept the same in both galleries.
GALL (string)
Returns the gallery (sprite file) used by an agent. This works for simple and compound agents (using the current PART).
GNUS (integer)
Returns genus of target. See also FMLY, SPCS.
HAND (command) name_for_the_hand (string)
Sets the name of the hand. Bt default this is 'hand'.
HAND (string)
This returns the name of the hand.
HELD (agent)
Returns the item currently held by the target. For vehicles this returns a random carried agent if carrying more than one. Consider using EPAS instead.
HGHT (integer)
Returns the height of target.
IITT (agent)
Returns the target creature's current agent of attention. Compare _IT_.
IMSK (integer)
Returns the input event mask.
KILL (command) agent (agent)
Destroys an agent. The pointer won't be destroyed. For creatures, you probably want to use DEAD first.
MESG WRIT (command) agent (agent) message_id (integer)
Send a message to another agent. The message_id is from the table of Message Numbers; remember that early Message Numbers differ slightly from Script Numbers. If used from an install script, then FROM for the message to NULL rather than OWNR.
MESG WRT+ (command) agent (agent) message_id (integer) param_1 (anything) param_2 (anything) delay (integer)
Send a message with parameters to another agent. Waits delay ticks before sending the message. The message_id is from the table of Message Numbers.
MIRA (command) on_off (integer)
Tell the agent to draw the current sprite mirrored (send 1 as a parameter) or normally (send 0 as a parameter)
MIRA (integer)
Is the current sprite for this agent mirrored (returns 1) or not (returns 0)
MOWS (integer)
Returns whether the lawn was cut last Sunday or not.
MTHX (float)
This returns the X position of the TARG creature's mouth attachment point in absolute (map) coordinates.
MTHY (float)
This returns the Y position of the TARG creature's mouth attachment point in absolute (map) coordinates.
NCLS (agent) previous (agent) family (integer) genus (integer) species (integer)
Finds the next agent in the agent list which also matches the given classifier. If the previous agent doesn't exist or doesn't match the classifier then the first agent matching it is returned. If none match the classifier, then NULL is returned.
NEW: SIMP (command) family (integer) genus (integer) species (integer) sprite_file (string) image_count (integer) first_image (integer) plane (integer)
Create a new simple agent, using the specified sprite file. The agent will have image_count sprites available, starting at first_image in the file. The plane is the screen depth to show the agent at - the higher the number, the nearer the camera.
NEXT (command)
Closes an enumeration loop. The loop can begin with ENUM, ESEE, ETCH or EPAS.
NOHH (command)
Tell the creature to immediately stop holding hands with the pointer. Useful when you are about to teleport a norn, it prevents the pointer from continuosly changing his position back to where it was.
NULL (agent)
Returns a null agent pointer.
OVER (command)
Wait until the current agent/part's ANIMation is over before continuing. Looping anims stop this command terminating until the animation is changed to a non-looping one.
OWNR (agent)
Returns the agent who's virtual machine the script is running on. Returns NULL for injected or install scripts.
PAUS (command) paused (integer)
Stops the target agent from running - it'll freeze completely, scripts and physics. Set to 1 to pause, 0 to run. You might want to use WPAU with this to implement a pause game option.
PAUS (integer)
Returns 1 if the target agent is paused, or 0 otherwise.
PCLS (agent) next (agent) family (integer) genus (integer) species (integer)
Same as NCLS, only cycles the other way.
PLNE (command) plane (integer)
Sets the target agent's principal drawing plane. The higher the value, the nearer the camera. For compound agents, the principal plane is the one for the automatically made first part. The plane of other parts is relative to this one.
PLNE (integer)
Returns the screen depth plane of the principal part.
PNTR (agent)
Returns the mouse pointer, which is also known as the hand.
POSB (float)
Returns bottom position of target's bounding box.
POSE (command) pose (integer)
Specify a frame in the sprite file for the target agent/part. Relative to any index specified by BASE.
POSE (integer)
Return the current POSE of the target agent/part, or -1 if invalid part.
POSL (float)
Returns left position of target's bounding box.
POSR (float)
Returns right position of target's bounding box.
POST (float)
Returns top position of target's bounding box.
POSX (float)
Returns X position of centre of target.
POSY (float)
Returns Y position of centre of target.
PUHL (command) pose (integer) x (integer) y (integer)
Set the relative x and y coordinate of the handle that target is picked up by, for the given pose. This pose is measured from the absolute base specified in the NEW: command, rather than the relative base specified by the BASE command. Pose -1 sets the same point for all poses.
PUHL (integer) pose (integer) x_or_y (integer)
Returns the x or y coordinate of the handle that target is picked up by for the given pose. x_or_y is 1 for x, 2 for y. The pose is measured from the absolute base specified in the NEW: command, rather than the relative base specified by the BASE command.
PUPT (command) pose (integer) x (integer) y (integer)
Set the relative x and y coordinate of the place where target picks agents up, for the given pose. This pose is measured from the absolute base specified in the NEW: command, rather than the relative base specified by the BASE command. Pose -1 sets the same point for all poses. For vehicles use the CABN command.
PUPT (integer) pose (integer) x_or_y (integer)
Returns the x or y coordinate of the place where target picks agents up for the given pose. x_or_y is 1 for x, 2 for y. The pose is measured from the absolute base specified in the NEW: command, rather than the relative base specified by the BASE command.
RNGE (command) distance (float)
Sets the distance that the target can see and hear, and the distance used to test for potential collisions. See also ESEE, OBST.
RNGE (float)
Returns the target's range. See ESEE, OBST.
RTAR (command) family (integer) genus (integer) species (integer)
Randomly chooses an agent which matches the given classifier, and targets it.
SEEE (integer) first (agent) second (agent)
Returns 1 if the first agent can see the second, or 0 if it can't. See ESEE.
SHOW (command) visibility (integer)
Set the parameter to 0 to hide the agent and to 1 to show the agent on camera. This removes or adds the agent to the main camera and any remote cameras. A non-shown agent can still be visible to creatures, and can still be clicked on or picked up. It just doesn't appear on the cameras.
SPCS (integer)
Returns species of target. See also FMLY, GNUS.
STAR (command) family (integer) genus (integer) species (integer)
Randomly chooses an agent which matches the given classifier and can be seen by the owner of the script. It then sets TARG to that agent. See ESEE for an explanation of seeing.
TARG (agent)
Returns current target, on whom many commands act.
TCOR (integer) topY (float) bottomY (float) leftX (float) rightX (float)
Tests setting the bounding box of the physical core of the object TARG. May be set to smaller (or larger) than the sprite's rectangle. Returns 1 if OK to set (using CORE), 0 if not.
TICK (command) tick_rate (integer)
Start agent timer, calling Timer script every tick_rate ticks. Set to 0 to turn off the timer.
TICK (integer)
Returns the current timer rate set by the command TICK.
TINO (command) red_tint (integer) green_tint (integer) blue_tint (integer) rotation (integer) swap (integer)
Like TINT but only tints the current frame. The other frames are no longer available in the gallery, it becomes a one frame sprite file. Original display engine only.
TINT (command) red_tint (integer) green_tint (integer) blue_tint (integer) rotation (integer) swap (integer)
This tints the TARG agent with the r,g,b tint and applies the colour rotation and swap as per pigment bleed genes. Specify the PART first for compound agents. The tinted agent or part now uses a cloned gallery, which means it takes up more memory, and the save world files are larger. However it also no longer needs the sprite file. Also, tinting resets camera shy and other properties of the gallery. See TINO for a quicker version that tints only one frame.
TINT (integer) attribute (integer)
Returns a tint value for an agent - currently it works only on Skeletal Creatures. Attribute can be: 1 - Red 2 - Green 3 - Blue 4 - Rotation 5 - Swap
TOTL (integer) family (integer) genus (integer) species (integer)
Counts the number of agents in the world matching the classifier.
TOUC (integer) first (agent) second (agent)
Returns 1 if the two specified agents are touching, or 0 if they are not. Agents are said to be touching if their bounding rectangles overlap.
TRAN (integer) xpos (integer) ypos (integer)
Test for a transparent pixel, returns 1 if the given x y position coincides with a transparent pixel on the TARG agent, otherwise it will return 0. This does not work for creatures.
TTAR (command) family (integer) genus (integer) species (integer)
Randomly chooses an agent which matches the given classifier and is touching the owner of the script. It then sets TARG to that agent. See ETCH.
TWIN (agent) original (agent) agent_null (integer)
Clones an agent, and returns the replica. If agent_null is set to 1 the agents that this agent points to (in OVxx, or VAxx in its running script) are set to NULL in the clone. If agent_null is 0, then the clone points to the same agents as the original. When using agent_null 1, you might want to call STPT first so variables being used mid-script aren't cleared under the agent's nose.
UCLN (command)
Make sure that an agent isn't cloned anymore, this releases the memory taken up by TINTing it. Agents are usually cloned for purposes such as tinting. Don't forget to set the relevant PART number for compound agents.
VISI (integer) checkAllCameras (integer)
Checks if the agent, or any of its parts, is on screen and returns 1 if it is or 0 if it is not. Set to 0 to check if the agent is on the main camera. Set to 1 to check if the agent is on the main camera or any remote cameras
WDTH (integer)
Returns the width of target.
WILD (string) family (integer) genus (integer) species (integer) tag_stub (string) offset (integer)
Searches for a catalogue tag based on the given classifier, and returns the string at the given offset. See also READ. As an example, with a tag_stub of "Agent Help" and a classifier 3 7 11 it would first look for the tag "Agent Help 3 7 11". If that wasn't present, it would go through the wildcards, eventually trying "Agent Help 0 0 0", and throwing an error if even that isn't there.
_IT_ (agent)
Returns the agent OWNR's attention was on when the current script was entered. This is only valid if OWNR is a creature. Compare IITT.
<< Befehlsgruppen | Inhaltsverzeichnis >>