Welcome to the Creatures Wiki! Log in and join the community.

Difference between revisions of "NAME"

From Creatures Wiki
Jump to navigation Jump to search
(Added more examples and bugs)
Line 17: Line 17:
 
</pre>
 
</pre>
 
and so on.
 
and so on.
 +
 +
The names and results of the named variables can be anything, even the value of another variable.
 +
<pre>
 +
SETS NAME "Creature" "A norn"
 +
SETS va00 "variable1"
 +
SETV NAME va00 9
 +
SETS NAME 800 "Eight hundred"
 +
SETA ov00 NORN
 +
SETA NAME "myCreature" ov00
 +
</pre>
 +
 +
==Bugs==
 +
 +
If you alter/check the unnamed NAME variable (NAME ""), the [[NAMN]] function stops working for this agent. Any set named variables will not disappear, but NAMN won't be able to find any named variables for this agent.
 +
Getting the [[TYPE]] of the NAME "" variable will return 0. This also breaks the NAMN function.
 +
<pre>
 +
OUTV TYPE NAME ""
 +
    0
 +
</pre>
 +
  
 
==See also==
 
==See also==

Revision as of 19:13, 30 March 2018

NAME is a CAOS command which allows access to named local variables.

Usage

Syntax: NAME varname (anything)

This returns the target agent variable referred to by varname. varname may be anything at all - integer, string, agent, etc.

NAME variables are effectively named OVxx variables.

Examples

Assuming a Creature is selected:

SETV NAME NORN 42
DIVV NAME NORN 6
OUTV NAME NORN
    7

and so on.

The names and results of the named variables can be anything, even the value of another variable.

SETS NAME "Creature" "A norn"
SETS va00 "variable1"
SETV NAME va00 9
SETS NAME 800 "Eight hundred"
SETA ov00 NORN
SETA NAME "myCreature" ov00

Bugs

If you alter/check the unnamed NAME variable (NAME ""), the NAMN function stops working for this agent. Any set named variables will not disappear, but NAMN won't be able to find any named variables for this agent. Getting the TYPE of the NAME "" variable will return 0. This also breaks the NAMN function.

OUTV TYPE NAME ""
    0


See also

  • OVxx, the numbered target agent variables
  • NAMN, which loops over NAME variables
  • MAME and GAME, the other named variables

External links