AVAR

From Creatures Wikia

Jump to: navigation, search
AVAR
This article is about a CAOS command or function.
Category Variables
Version CV/C3/DS
Command
Parameters agent (agent) index (integer)
Function
Parameters
Return type ]]
Related
CAOS TARG
Concepts Object_Variables

AVAR returns an object variable from the agent, without having to set TARG.

Command

Syntax: AVAR AGENT(agent) nn(integer)

Returns the OVnn variable of AGENT. It is equivalent to TARG AGENT, OVnn, but you don't need to target it first. You can also use AVAR to create simple arrays.

Arrays

While you cannot do

TARG VA00
OVVA01

to get an object variable depending on what another variable is, you can do

AVAR VA00 VA01

This is how a simple array can be implemented.

Archengule: This is confusing. Can anybody else explain it better?

Example

This code gets an object variable the typical way, TARGing the agent first: (VA00 is an agent)

TARG VA00
OV00

This code gets the object variable using AVAR: (Again, VA00 is an agent)

AVAR VA00 00
Personal tools