IntroductionScripts are one of the key concepts in the IE. Scripts are written in a simple scripting language and stored as BAF files. BAF files are compiled into BCS files, which are then processed by the game. Scripts consist of triggers and actions. Triggers are conditional checks, that will return either true or false. A trigger result can be inverted by preprending the trigger with the ! character (e.g. See([Anyone]) will return true if the active creature can see any other creature, while !See([Anyone]) will return true if the active creature can not see any other creature). Scripts are processed from the top of the file downwards, until a block is found where all the triggers return true. Once such a block is found, the associated actions are executed, and the script is processed again, from the top of the file. If no block is found with all its triggers returning true, the script is processed again, from the top of the file.
Script LocationsScripts can run in various places. Some triggers and actions only make sense when run from specific objects (e.g. IsOverMe) while others are only parsed by the engine from certain objects (e.g. LockScroll()). A partial list of script locations is given below:
- Player AI scripts
ParametersBoth triggers and actions may take parameters. Parameters are usually numeric, literal strings (i.e. enclosed in "quotes") or identifier strings. Parameters are a often values from an IDS file, i.e. a symbolic identifier is used which is converted to a numeric value when the script is compiled. An object parameter is a special case - it can be either a literal string (a death variable, such as "Gnoll3"), a object reference (e.g. Player1) or an object identifier. An object identifier can apply to a whole group/category of creatures. The format is [EA.FACTION.TEAM.GENERAL.RACE.CLASS.SPECIFIC.GENDER.ALIGN], though some engines do not accept the faction and team specifiers. Each field within the identifier is from the associated IDS file. An entry of 0 in a field will match any value. For example: [ENEMY.0.0.MAGE] specifies all creatures that are enemies of the party, any general category, any race, mages. An object identifier only evaluates visible creatures.