Scripting actions with Arabesque
The Arabesque scripting system allows the execution of macros specified by the user. These scripts may carry out any function on the unit that does not require administrative access, as well as play sounds, start and stop pre-recorded animation programs, and command the unit to say or act in a certain way.

Normal Arabesque scripts use the filename prefix “a_”, and can be activated from the perform menu, or via the do command. Each line of the script specifies an action to execute. Be aware that the unit can only run one script at a time, and that additional power is expended in the process of executing these scripts.

In addition to the commands available to the user via remote access (see Remote access), Arabesque scripts may contain the following verbs:

commandaction
start <animation>
This begins the specified animation, which must be included in the writeable memory of the unit alongside the script.
stop <animation>
This stops the specified animation.
sound <sound>
This plays the specified sound, which must either be loaded onto the audio processor or referred to directly by UUID.
sound vox <sound>
This plays one of the messages from the included voice notification pack. See Sound for more information on voice notifications.
remark <message>
This reports a message privately to the unit.
say <message>
This causes the unit to say something. The message may contain speech-processor-level commands such as bang commands, dot commands, or emotes. (See articles on input and commands and speech modification with vox.) This will operate even if the unit’s mind is disabled (i.e., even if the cortex prohibits free speech), since it is not spontaneous speech generated by the unit.
wait <duration>
Pauses execution for <duration> seconds.
disable <subsystem>
Disables subsystem number <subsystem>.
enable <subsystem>
Enables subsystem number <subsystem>. Subsystem numbers are as follows:

subsystemnumber
video0
audio1
move2
teleport3
rapid4
voice5
mind6
preamplifier7
power amplifier8
receiver9
transmitter10
GPS11
identify12
set <variable> <value>
Sets the indicated variable <variable> to the specified value <value>. Variables must be prefixed with $, %, or @ indicating text, integer number, or real number datatype, respectively.
randset <variable> <max>
Sets the indicated variable <variable> to a random integer between 0 and <value> – 1. The variable must be an integer.
unset <variable>
Deletes the specified variable from memory.
report <variable>
Causes the unit to speak the name and value of the specified variable.
ifeq <value_1> <value_2> <expression>
Executes the specified expression (a complete line of code, possibly including more of these keywords) if <value_1> and <value_2> are equal. The first value must be an integer variable with its % prefix removed; the second value may be either an integer literal or an integer variable.
ifexists <filename> <expression>
Executes the specified expression (as above) if a file called <filename> exists in user memory.

To include a comment in an Arabesque script, start the line with a hash sign (#).

As of Companion 8.4.4, the following variables are automatically defined:

variabletypedescription
$userstringThe key of the avatar who activated the Arabesque script.
$usernamestringThe name of the avatar who activated the Arabesque script.
$colorstringThe current system color in space-separated floating point (e.g. "1.0 0.5 0.0" for orange—see chapter on identity options)
$namestringThe unit's current callsign, e.g. "vict0r"
$modelstringThe unit's model, e.g. "NS-304"
%serialintegerThe unit's serial number without punctuation, e.g. 999123456
$serial_displaystringThe unit's serial number with punctuation, e.g. "999-12-3456"
@powerfloatThe current power level (0.0–1.0)
$personastringThe name of the active persona
$versionstringThe system version
$p_absstringPhysical absolute pronoun ("theirs")
$p_posstringPhysical possessive pronoun ("their")
$p_subjstringPhysical subject pronoun ("they")
$p_objstringPhysical object pronoun ("them")
$p_reflstringPhysical reflexive pronoun ("itself")
$p_genderstringPhysical gender ("inanimate")
$m_absstringMental absolute pronoun ("theirs")
$m_posstringMental possessive pronoun ("their")
$m_subjstringMental subject pronoun ("they")
$m_objstringMental object pronoun ("them")
$m_reflstringMental reflexive pronoun ("itself")
$m_genderstringMental gender ("inanimate")

There are two variant types of Arabesque scripts that do not begin with a_. These are e_ and px_ scripts. e_ scripts are executed automatically in response to certain system events, such as connecting to a charger or turning on the system. px_ scripts are executed when a persona is activated; i.e., px_default corresponds to the default persona.

The supported e_ scripts are:
  • e_charge-start: Triggered when charging begins.
  • e_charge-end: Triggered when charging ends.
  • e_boot: Triggered when the system is powered on. (Formerly known as _init.) Not triggered by activation of auxiliary power.
  • e_shutdown: Triggered when the system is shut down using the off or shutdown -h commands, or through the main menu, regardless of auxiliary power settings.

For testing purposes, e_ event scripts can also be activated using the trigger command.

Only one script can be running at a time. Starting a new script (of any type) will interrupt any currently running script.