Arx scripting language: Difference between revisions

From Arx Libertatis Wiki
Jump to navigation Jump to search
Line 48: Line 48:
=== Blocks ===
=== Blocks ===


The {{Command|if}}, {{Command|else}}, {{Command|random}}, {{Command|ifvisible}} and {{Command|ifexistinternal}} commands will skip the next block under certain conditions. A block is either a series of commands on the same line <code>{</code> followed by all commands until the next matching <code>}</code>. If the next command after a skipped block is {{Command|else}} that command will be skipped as well and the following block (which would normally be skipped by {{Command|else}}) will be executed.
The {{Command|if}}, {{Command|else}}, {{Command|random}}, {{Command|ifvisible}} and {{Command|ifexistinternal}} commands will skip the next block under certain conditions. A block is either a series of commands on the same line <code>{</code> followed by all commands until the next matching <code>}</code>. If the next command after a skipped block is {{Command|else}}, that command will be skipped as well and the following block (which would normally be skipped by {{Command|else}}) will be executed.


=== Labels ===
=== Labels ===

Revision as of 02:31, 16 April 2020

This article describes the scripting language used in Arx Fatalis and Arx Libertatis.

Entities

Main article: Entity.

Classes

Events

Main article: Script:Events.

Variables

Main article: Script:Variables.

Arx scripts know three basic data types: int, Template:Real and Template:Text. 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.

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)

While variables in Arx scripts are typed, there are no type restrictions for where variables are used: the types are converted automatically.

Commands

Main article: Script:Commands.

Control flow

Main article: Category:Script control flow.

Execution of the current event is terminated with the accept or refuse commands. For entity instance scripts, refuse ends event execution completely while accept allows execution to continue in the entity class script.

Blocks

The if, else, random, ifvisible and ifexistinternal commands will skip the next block under certain conditions. A block is either a series of commands on the same line { followed by all commands until the next matching }. If the next command after a skipped block is else, that command will be skipped as well and the following block (which would normally be skipped by else) will be executed.

Labels

The two characters >> followed directly by a name define a label. These are skipped when encountered during normal execution but can serve as the target to jump to for a goto or gosub command. Execution of the next command after gosub can be resumed using the return command

Commands as parameters

Main article: Script:Commands#Other commands as parameters.

Some commands take another command as their last parameter. For such commands all following commands on the same line will be skipped during normal execution. Then after some action started by the command is completed these commands will be executed using the special executeline event.

Search script files

mkdir assets
cd assets
arxunpak ~/.local/share/arx/{data,loc,data2,sfx,speech}.pak
grep -rP -ia 's_*p_*e_*c_*i_*a_*l_*f_*x' graph/obj3d/interactive/