Script:Variables
Jump to navigation
Jump to search
This page describes variables in the Arx scripting language.
Variable types
Arx scripts know three basic data types:
int |
32-bit signed integer |
Template:Real | 32-bit IEEE 754 floating-point number |
Template:Text | arbitrary-length string |
Variables can be either global (shared between all entities) or entity-specific. There are also special system variables than can only be read. The variable type is defined by the first character of the variable name. Non-Template:Wp characters are encoded as Template:Wp.
Char | Byte | Scope | Type |
---|---|---|---|
# |
0x23 |
global | int
|
& |
0x26 |
global | Template:Real |
$ |
0x24 |
global | Template:Text |
§ |
0xA7 |
entity | int
|
@ |
0x40 |
entity | Template:Real |
£ |
0xA3 |
entity | Template:Text |
^ |
0x5E |
system | (mixed) |
System variables
System variables don't always have the value type in the name. Some return results specific to the calling object, others are global. Some system variable prefixes (denoted with a *
in the following table) work as functions with the remainder used as the parameters.
Name | Type | Description | Used |
---|---|---|---|
^$param1
|
Template:Text | event parameter 1 | ✓ |
^$param2
|
Template:Text | event parameter 2 | ✓ |
^$param3
|
Template:Text | event parameter 3 | ✓ |
^¶m1
|
Template:Real | event parameter 1 | ✓ |
^¶m2
|
Template:Real | event parameter 2 | ✓ |
^¶m3
|
Template:Real | event parameter 3 | ✓ |
^#param1
|
int
|
event parameter 1 | ✓ |
^#param2
|
int
|
event parameter 2 | ✓ |
^#param3
|
int
|
event parameter 3 | ✓ |
^#timer1
|
int
|
duration the caller's timer #1 has been runing, in milliseconds (or 0 if the timer is stopped) | ✓ |
^#timer2
|
int
|
duration the caller's timer #2 has been runing, in milliseconds (or 0 if the timer is stopped) | ✗ |
^#timer3
|
int
|
duration the caller's timer #3 has been runing, in milliseconds (or 0 if the timer is stopped) | ✗ |
^#timer4
|
int
|
duration the caller's timer #4 has been runing, in milliseconds (or 0 if the timer is stopped) | ✗ |
^$objontop
|
Template:Text | ID of the entity above the caller (or "none") | ✓ |
^&playerdist
|
Template:Real | distance between the caller and the player | ✗ |
^#playerdist
|
int
|
distance between the caller and the player | ✓ |
^gore
|
int
|
0 for low-violence versions, 1 for normal versions (Arx Libertatis always reports 1) | ✓ |
^gamedays
|
int
|
in-game time since the start of the playthough, in 10-days | ✗ |
^gamehours
|
int
|
in-game time since the start of the playthough, in hours | ✗ |
^gameminutes
|
int
|
in-game time since the start of the playthough, in minutes | ✗ |
^gameseconds
|
int
|
in-game time since the start of the playthough, in seconds | ✓ |
^amount
|
int
|
number of items in the stack if the caller is an item (stack), 0 otherwise | ✗ |
^arxdays
|
int
|
in-game time since the start of the playthough, in 2-hours | ✗ |
^arxhours
|
int
|
in-game time since the start of the playthough, in 10-minutes | ✗ |
^arxminutes
|
int
|
in-game time since the start of the playthough, in 10-seconds | ✗ |
^arxseconds
|
int
|
in-game time since the start of the playthough, in 1/6-seconds, rounded down to the next second | ✗ |
^arxtime_hours
|
int
|
time of the day, in 10-minutes (1-12, 0 at the start of the game) | ✗ |
^arxtime_minutes
|
int
|
time of the day, in 10-seconds (1-60, 0 at the start of the game)1 | ✗ |
^arxtime_seconds
|
int
|
time of the day, in 1/6-seconds (1-60, 0 at the start of the game) | ✗ |
^realdist_*
|
Template:Real | portal-based walking distance between the caller and the entity with the given ID | ✗ |
^repairprice_*
|
Template:Real | cost in gold for the caller to repair the item with the given id (-1.f if not an item) | ✓ |
^rnd_*
|
Template:Real | random number between 0 and the given max (to be determined if inclusive/exclusive) | ✓ |
^rune_*
|
int
|
0 if the player *doesn't* have the given rune, and unspecified non-zero value otherwise | ✗ |
^inzone_*
|
int
|
1 if the caller is in the area with the given ID, 0 otherwise | ✗ |
^player_zone
|
Template:Text | ID of the zone the player is in, "none" if in no zone | ✓ |
^ininitpos
|
int
|
1 if the caller is exactly at it's initial position, 0 otherwise | ✓ |
^inplayerinventory
|
int
|
1 if the caller is in the player inventory, 0 otherwise | ✓ |
^possess_*
|
int
|
1 ifthe given item is in the player inventory or equipped by the player, 0 otherwise | ✓ |
^behavior
|
Template:Text | current behavior of the caller NPC1 | ✗ |
^sender
|
Template:Text | ID of the entity that sent the current event | ✓ |
^scale
|
Template:Real | scale of the caller, in percent | ✓ |
^speaking
|
int
|
1 if the caller is currently speaking, 0 otherwise | ✓ |
^me
|
Template:Text | ID of the caller | ✓ |
^life
|
Template:Real | current health value of the caller NPC | ✓ |
^maxlife
|
Template:Real | maximum health value of the caller NPC1 | ✗ |
^player_life
|
Template:Real | the player's current full life (at the start of the frame?) | ✓ |
^player_maxlife
|
Template:Real | the player's maximum life | ✓ |
^player_hunger
|
Template:Real | the player's hunger value | ✗ |
^mana
|
Template:Real | current mana value of the caller NPC | ✓ |
^maxmana
|
Template:Real | maximum mana value of the caller NPC | ✗ |
^myspell_*
|
int
|
1 if the caller is casting a spell with the given name, 0 otherwise | ✓ |
^playerspell_*
|
int
|
1 if the player is casting a spell with the given name (or for "invisibility" if invisibility > 0.3) | ✓ |
^playercasting
|
int
|
1 if the player is casting a life_drain, harm, fire/ice_field, (mass_)lightning_strike spell | ✓ |
^durability
|
Template:Real | current durability value of the caller | ✓ |
^maxdurability
|
Template:Real | maximum durability value of the caller | ✓ |
^last_spawned
|
Template:Text | ID of the last entity spawned by a script | ✗ |
^dist_*
|
Template:Real | distance between the caller and the entity with the given ID, 99999999999.0 on error | ✓ |
^demo
|
int
|
1 if using the demo data (as indicated by the PAK | ✓ |
^price
|
Template:Real | price in gold of the caller Item | ✓ |
^poisoned
|
Template:Real | the poisoned value of the caller NPC | ✓ |
^player_poison
|
Template:Real | the player's poisoned value | ✗ |
^poisonous
|
Template:Real | the poisonous value of the caller Item | ✗ |
^player_gold
|
Template:Real | amount of gold carried by the player | ✓ |
^player_attribute_*
|
Template:Real | player attribute (strength, dexterity, constitution, mind), incl. modifiers | ✓ |
^player_skill_*
|
Template:Real | player skill, incl. modifiers | ✓ |
^npcinsight
|
Template:Text | ID of the first NPC seen by the caller, or "none" | ✓ |
^target
|
Template:Text | ID of the caller's current target, or "none" | ✓ |
^focal
|
Template:Real | the current camera's focal value | ✓ |
^fighting
|
int
|
1 if the player is in combat mode, 0 otherwise | ✓ |
System variables marked as unused may be removed in a future version of Arx Libertatis.