Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
---
title: "Script Actions"
---
<div class="title_main"> Script Actions </div>
<br />
<div class="actionHeader">Introduction</div>
Scripts 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.<br />
<br />
<div class="actionHeader">Script Locations</div>
Scripts 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:<br />
<ul>
<li>Creatures</li>
<li>Regions</li>
<li>Containers</li>
<li>Areas</li>
<li>Player AI scripts</li>
<li>baldur.bcs</li>
</ul>
<div class="actionHeader">Parameters</div>
Both triggers and actions may take parameters. Parameters are usually numeric, literal strings (i.e. enclosed in &quot;quotes&quot;) or identifier strings. Parameters are a often values from an <code><a href="../../files/ids/index.htm">IDS</a></code> 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 &mdash; it can be either a literal string (a <code><a href="../../file_formats/ie_formats/cre_v1.htm#CREV1_0_Header_0x280">death variable</a></code>, such as <code>"Gnoll3"</code>), a object reference (e.g. <code><a href="../../files/ids/bgee/object.htm#Player1">Player1</a></code>) or an object identifier. An object identifier can apply to a whole group/category of creatures. The format is <code>[<a href="../../files/ids/bgee/ea.htm">EA</a>.<a href="../../files/ids/pst/faction.htm">FACTION</a>.<a href="../../files/ids/pst/team.htm">TEAM</a>.<a href="../../files/ids/bgee/general.htm">GENERAL</a>.<a href="../../files/ids/bgee/race.htm">RACE</a>.<a href="../../files/ids/bgee/class.htm">CLASS</a>.<a href="../../files/ids/bgee/specific.htm">SPECIFIC</a>.<a href="../../files/ids/bgee/gender.htm">GENDER</a>.<a href="../../files/ids/bgee/align.htm">ALIGN</a>]</code>, though some engines do not accept the faction and team specifiers. Each field within the identifier is from the associated <code><a href="../../files/ids/index.htm">IDS</a></code> file. An entry of <code>0</code> in a field will match any value. For example: <code>[<a href="../../files/ids/bgee/ea.htm#255">ENEMY</a>.0.0.<a href="../../files/ids/bgee/class.htm#1">MAGE</a>]</code> specifies all creatures that are enemies of the party, any general category, any race, mages. An object identifier only evaluates visible creatures.<br />
<br />
<div class="actionHeader">Actions</div>
<a href="bg1actions.htm"> BG1 Actions</a><br />
<a href="bg2actions.htm"> BG2 Actions</a><br />
<a href="bgeeactions.htm"> BG(2)EE Actions</a><br />
<a href="totlactions.htm"> IWD1 Actions</a><br />
<a href="iwd2actions.htm"> IWD2 Actions</a><br />
<a href="pstactions.htm"> PST Actions</a><br />
<a href="psteeactions.htm"> PSTEE Actions</a><br />
<br />
</div>
</div>