Rescript

From Achron Wiki
Jump to: navigation, search

Rescript is a language use to build achron binaries .abn that can be used as scripts within Resequence. Recript is C like in its syntax. It is described in detail in a file accompaning the game called RescriptReference.txt.

Recript has enhanced support for manipulating things on the bit level. Rescript's way of using outside services is via PERFORM. There is also a query structure for calculating value iterating over units.

RescriptCompiler can be used to make a .abn out of rescript code. Technical details for building custom compilers are provided in RescriptOpCodeMnemonics.txt.

Some PERFORMs that are more language centric and not immediately involved with any gameplay element:

Flow Control

  • Parantheses mark order to evaluate subexpressions
  • If-else block
  • while loop
  • for loop
  • break
  • continue

Rescript has query that speeds up common lookups. There is QUERY VALUE, QUERY UNIT and QUERY BESTMOVE. Their return value is, in order, number, unit identity, and movement option (their types are still either int or float). There are fours modes the QUERYs can operate in. MIN can be used in all, VALUE and UNIT can also use MAX, and VALUE even further has SUM and AVG. All QUERYs base based on a unit. If this unit is a unit like a mech it will search all units in its visibility and gives the reserved variable query the value of that unit in each new iteration. If the unit is a player then all units the player can see are used. If the unit is a scenario monitor then all units on the map are examined. For each examined unit a where clause is checked if it evaluates to true then the actual operation is performed. Thus one can close off certain type of units by making the WHERE clause exclude them. For all units that are deemed fit to operate on MIN evaluates the minimum value for the expression, MAX the maximum, SUM the accumulated value and AVG the average value. QUERY UNIT instead returns the units identity that hits the lowest score (MIN) or highest score (MAX).

Objects

Within the Rescript Engine there exists certain objects. An object is a data type (like the float or the integer).

Objects have two types of properties or attributes. Some of the properties are accessed using the '.' operator, while others are accessed using '->'. There are distinct differences between the two types of properties. '.' properties are (often?) achronal constants and take little time for the game engine to access. '->' properties on the other hand are (often) chronal variables and take anywhere from 1.5x to 10x longer to access in the game engine compared to '.' properties.

In 0.5.0.1 Constraints bit 2 set meant the player has only passive AI. Normal AI players have the bit cleared.