  <refentry id="scr-basepostread">
   <refnamediv><refname>BasePostRead</refname>
    <refpurpose>Common actions to be taken after a book is read.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>PostReadPlaque</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Links</term>
     <listitem><inlinelist>
      <member><flavor>SoundDescription</flavor></member>
      <member><flavor>ControlDevice</flavor></member>
      <member><flavor>SwitchLink</flavor></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Properties</term>
     <listitem><inlinelist>
      <member><property>Book\Text</property></member>
      <member><property>Book\Art</property></member>
      <member><property>Script\Use Message</property></member>
      <member><property>Trap\Quest Var</property></member>
      <member><property>Script\QBName</property></member>
      <member><property>Script\Timing</property></member>
      <member><property>Script\Delay Time</property></member>
      <member><property>Sound\Object Sound</property></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This is an abstract script for when an action should be taken after a book has been read. The advantage over traditional triggering methods is that the actions will always occur after the book-mode screen has been shown. This script can’t be used directly; use either <script moreinfo="refentry">PostReadPlaque</script> or <script moreinfo="refentry">PostReadScroll</script> instead.</para>
    <para>The script can play a voice-over schema and set a quest variable. If both actions are being used, then the quest variable is changed after the schema plays. Specify the schema to play by creating a <flavor>SoundDescription</flavor> link, which can be on an archetype of the object. Unfortunately, the script can’t tell on its own when a voice-over has finished playing. So set the <property>Script\Timing</property> property to the length of the schema.</para>
    <para>After the voice-over has played or, if no schema was specified, after the book is read, a quest variable is modified. The name and operation are specified in the <property>Trap\Quest Var</property> property. The same options as for <script moreinfo="refentry">TrapMissionQVar</script>.</para>
    <para>You can also use <link linkend="triggerlink">trigger links</link> with this script. They will be activated when the book is read.</para>
    <para><application>System Shock 2</application> doesn’t have a book-mode, so this script isn’t as useful as in a <application>Thief</application> game. The text to display is determined by the <property>Script\Use Message</property> property. Set the voice-over schema name with the <property>Sound\Object Sound</property> property, and use the <property>Script\Delay Time</property> property. The quest variable is specified with the <property>Script\QBName</property> property using the same format.</para>
   </refsection>
  </refentry>

  <refentry id="scr-baseqvartext">
   <refnamediv><refname>BaseQVarText</refname>
    <refpurpose>Abstract script for displaying text with quest-variable substitutions.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>BaseQVarText</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Properties</term>
     <listitem><inlinelist>
      <member><property>Book\Text</property></member>
      <member><property>Script\Use Message</property></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This script displays text on-screen that can include the values of quest variables. The text to display, which is specified by the <property>Book\Text</property> or <property>Script\Use Message</property> property, is scanned for replaceable sub-strings. Each sub-string is evaluated and a replacement made. The replacements themselves may contain further replacements, and those will be processed as well. When all of the sub-strings have been found, the text is displayed. This only works for on-screen text, so the <property>Book\Art</property> property is ignored.</para>
    <para>This script can’t be used directly. You can use <script moreinfo="refentry">QVarPlaque</script>, <script moreinfo="refentry">QVarScroll</script>, or <script moreinfo="refentry">TrapQVarText</script> depending on how you want the script to be triggered.</para>
    <para>Each replaceable sub-string begins with the character ‘<literal>%</literal>’ and then the name of the quest variable enclosed in curly braces (‘<literal>{</literal>’ and ‘<literal>}</literal>’). This will insert the value of the quest variable in place of the sub-string. Instead of the value, other text can be inserted by adding a conditional character before the braces. The possible conditions are ‘<literal>=</literal>’, ‘<literal>&lt;</literal>’, ‘<literal>&gt;</literal>’, and ‘<literal>?</literal>’. After the curly braces, write one or two sets of square brackets (‘<literal>[</literal>’ and ‘<literal>]</literal>’) with the new text in each. The first set will be printed if the condition is true, and the optional second set will be printed if it is false.</para>
    <para>The ‘<literal>=</literal>’, ‘<literal>&lt;</literal>’, and ‘<literal>&gt;</literal>’ conditionals test if the quest variable is equal to, less than, or greater than some number. Write the number to compare to immediately after the conditional character. The last conditional, ‘<literal>?</literal>’, just tests if the variable is non-zero.</para>
    <para>The following example prints the value of the quest variable <literal>bottles</literal> if it is not zero, or the text “<literal>No more</literal>” if it is zero. Then the word “<literal>bottle</literal>” is pluralized if necessary.
     <informalexample>
      <simpara><literal>%?{bottles}[%{bottles}][No more] bottle%=1{bottles}[][s] of beer on the wall.</literal></simpara>
     </informalexample>
    </para>
   </refsection>
  </refentry>

  <refentry id="scr-postreadplaque">
   <refnamediv><refname>PostReadPlaque</refname>
    <refpurpose>Perform actions after reading a book in the world.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>PostReadPlaque</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script moreinfo="refentry">BasePostRead</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>FrobWorldEnd</message></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This is for books that are frobbed in the world. The actions that occur are described in <script moreinfo="refentry">BasePostRead</script>.</para>
   </refsection>
  </refentry>

  <refentry id="scr-postreadscroll">
   <refnamediv><refname>PostReadScroll</refname>
    <refpurpose>Perform actions after reading a book in the inventory.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>PostReadScroll</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script moreinfo="refentry">BasePostRead</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>FrobInvEnd</message></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This is for books that are frobbed in the inventory. The actions that occur are described in <script moreinfo="refentry">BasePostRead</script>.</para>
   </refsection>
  </refentry>

  <refentry id="scr-qvarplaque">
   <refnamediv><refname>QVarPlaque</refname>
    <refpurpose>Display text when frobbed in the world.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>QVarPlaque</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script moreinfo="refentry">BaseQVarText</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>FrobWorldEnd</message></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This script activates when the object is frobbed in the world. The text is displayed as described in <script moreinfo="refentry">BaseQVarText</script>.</para>
   </refsection>
  </refentry>

  <refentry id="scr-qvarscroll">
   <refnamediv><refname>QVarScroll</refname>
    <refpurpose>Display text when frobbed in inventory.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>QVarScroll</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script moreinfo="refentry">BaseQVarText</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>FrobInvEnd</message></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This script activates when the object is frobbed in the inventory. The text is displayed as described in <script moreinfo="refentry">BaseQVarText</script>.</para>
   </refsection>
  </refentry>

  <refentry id="scr-transmogrify">
   <refnamediv><refname>Transmogrify</refname>
    <refpurpose>An object that becomes something else when picked up.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>Transmogrify</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseScript</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>Contained</message></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Links</term>
     <listitem><inlinelist>
      <member><flavor>Transmute</flavor></member>
      <member><flavor>Mutate</flavor></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This script lets you make objects that act like the crystals from <application>Thief</application>. There are two types of objects: one that appears in the world, and another for the inventory. This script goes on the object that is created in the world. When the object is picked up by the <object>Player</object>, it will create the other type of object and put that in the inventory instead. The link that associates the two objects can be placed on the archetypes, which makes it easy to implement different types of transmogrifying objects.</para>
    <para><application>Thief</application>: Link the objects using a <flavor>Transmute</flavor> link.</para>
    <para><application>SS2</application>: Link the objects using a <flavor>Mutate</flavor> link.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapcampaignqvar">
   <refnamediv><refname>TrapCampaignQVar</refname>
    <refpurpose>Set a quest variable in the campaign database.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapCampaignQVar</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script moreinfo="refentry">TrapMissionQVar</script></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>The quest variable that this trap sets will be saved in the campaign database, so it can be read in later missions as well. The variable actually gets written to the mission database first, and only gets moved when the game ends. Trust me, this is the best way to make the script work. Just don’t be surprised if DromEd doesn’t always show the variable in the campaign database.</para>
    <para>In <application>System Shock 2</application>, the default for most scripts is to store quest variables in the campaign database. The hack described above does not apply in SS2.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapcinema">
   <refnamediv><refname>TrapCinema</refname>
    <refpurpose>Play a movie.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapCinema</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Parameters</term>
     <listitem><inlinelist>
      <member><parameter>movie</parameter><type>(string)</type></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>When activated, an AVI movie is played. The parameter <parameter>movie</parameter> is the filename of the file to view. It will be looked for in the <filename>movies</filename> directory, or whatever your <command>movie_path</command> is set to.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapdestroydoor">
   <refnamediv><refname>TrapDestroyDoor</refname>
    <refpurpose>Destroy a door the right way.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapDestroyDoor</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>TurnOn</message></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Links</term>
     <listitem><inlinelist>
      <member><flavor>ControlDevice</flavor></member>
      <member><flavor>SwitchLink</flavor></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>Doors are difficult to destroy by ordinary means. Traps that slay an object will only make the door pop open. And teleporting a door away will leave behind the black rectangle when the <symbol>Blocks Vision?</symbol> flag is on. This script will make sure a door is really destroyed, and leaves the portal open. The doors to destroy are linked to using <flavor>ControlDevice</flavor> or <flavor>SwitchLink</flavor> links.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapfader">
   <refnamediv><refname>TrapFader</refname>
    <refpurpose>Fade the screen in and out.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapFader</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Parameters</term>
     <listitem><inlinelist>
      <member><parameter>fade_time</parameter><type>(time)</type></member>
      <member><parameter>fade_color</parameter><type>(color)</type></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>The screen will fade out when this trap is turned on. Turning off the trap will fade the screen back in. You should always use the <link linkend="trapflags">revert timer</link> with this trap so the screen doesn’t get stuck in the fade-out. The <parameter>fade_time</parameter> is the time it will take for the screen to fade completely in or out. When using the revert feature of the trap, the timer will start at the same time as the fade. So you should set it to at least the same length as <parameter>fade_time</parameter>.</para>
    <para><application>Thief 1</application>: The screen will not fade in, but will just instantly reappear.</para>
    <para><application>Thief 2</application>: Fading in will make the player unwield any weapons.</para>
    <para><application>SS2</application>: The color of the fade can be changed with the <parameter>fade_color</parameter> parameter. The default is black.</para>
    <para>The configuration setting <command>no_endgame</command> prevents this script from working.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapflipflop">
   <refnamediv><refname>TrapFlipFlop</refname>
    <refpurpose>Alternate between <message>TurnOn</message> and <message>TurnOff</message>.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapFlipFlop</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseScript</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>TurnOn</message></member>
      <member><message>TurnOff</message></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This trap only responds to <message>TurnOn</message>. Each time it is triggered, it will send either <message>TurnOn</message> or <message>TurnOff</message>, alternating between the two. The <constant>Invert</constant> and <constant>Once</constant> <link linkend="trapflags">trap control flags</link> will be used.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapmissionqvar">
   <refnamediv><refname>TrapMissionQVar</refname>
    <refpurpose>Sets a quest variable, with complete arithmetic operations.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapMissionQVar</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Properties</term>
     <listitem><inlinelist>
      <member><property>Trap\Quest Var</property></member>
      <member><property>Script\QBName</property></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Parameters</term>
     <listitem><inlinelist>
      <member><parameter>initqv</parameter><type>(integer)</type></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>When activated, the script will modify the value of a quest variable. The variable name and operation to perform are specified in the <property>Trap\Quest Var</property> or <property>Script\QBName</property> property. The quest variable is stored in the mission database. <application>Thief</application> games can also write the variable to the campaign database using <script moreinfo="refentry">TrapCampaignQVar</script>.</para>
    <para>The operation format is the same as from <script>TrapSetQVar</script> from <application>Thief</application>. First is a single-character operation, followed by an integer argument to the operation. Then there is a colon (‘<literal>:</literal>’) followed by the name of the quest variable. There should be no spaces up until the variable name. Spaces are allowed in the name, however. The following table explains the possible operations, and includes an example of what happens when the trap is activated with a certain argument. In all cases, the original value of the quest variable is 102.
     <segmentedlist>
      <title>Quest Variable Trap Operations</title>
      <segtitle>Op</segtitle> <segtitle>Turn On</segtitle> <segtitle>Turn Off</segtitle> <segtitle>Example</segtitle>
      <seglistitem>
       <seg><literal>=</literal></seg>
       <seg>Sets the value to the argument.</seg>
       <seg>Sets the value to 0.</seg>
       <seg><literal>=3</literal> &rarr; <literal>3</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>+</literal></seg>
       <seg>Adds the argument to the value.</seg>
       <seg>Subtracts the argument from the value.</seg>
       <seg><literal>+3</literal> &rarr; <literal>105</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>-</literal></seg>
       <seg>Subtracts the argument from the value.</seg>
       <seg>Adds the argument to the value.</seg>
       <seg><literal>-3</literal> &rarr; <literal>99</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>*</literal></seg>
       <seg>Multiplies the value by the argument.</seg>
       <seg>Divides the value by the argument.</seg>
       <seg><literal>*3</literal> &rarr; <literal>306</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>/</literal></seg>
       <seg>Divides the value by the argument.</seg>
       <seg>Multiplies the value by the argument.</seg>
       <seg><literal>/3</literal> &rarr; <literal>34</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>%</literal></seg>
       <seg>Takes the remainder of the value divided by the argument.</seg>
       <seg>Multiplies the value by the argument.</seg>
       <seg><literal>%4</literal> &rarr; <literal>2</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>|</literal></seg>
       <seg>Performs bitwise-or with the value and the argument.</seg>
       <seg>Clears the bits in the value that are set in the argument.</seg>
       <seg><literal>|3</literal> &rarr; <literal>103</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>{</literal></seg>
       <seg>Shifts the bits in the value to the left.</seg>
       <seg>Shifts the bits in the value to the right.</seg>
       <seg><literal>{3</literal> &rarr; <literal>816</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>}</literal></seg>
       <seg>Shifts the bits in the value to the right.</seg>
       <seg>Shifts the bits in the value to the left.</seg>
       <seg><literal>}3</literal> &rarr; <literal>12</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>"</literal></seg>
       <seg>Multiplies the value by 10, then adds the least-significant decimal digit of the argument to the variable.</seg>
       <seg>Divides the value by 10.</seg>
       <seg><literal>"3</literal> &rarr; <literal>1023</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>#</literal></seg>
       <seg>Multiplies the value by 10, then adds the least-significant decimal digit of the argument to the variable. The value will always be less than 10000.</seg>
       <seg>Divides the value by 10.</seg>
       <seg><literal>#31</literal> &rarr; <literal>1021</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>?</literal></seg>
       <seg>Adds to the value a random number &ge; 0 and &le; the argument.</seg>
       <seg>Subtracts from the value a random number &ge; 0 and &le; the argument.</seg>
       <seg><literal>?3</literal> &rarr; <literal>102&mdash;105</literal></seg>
      </seglistitem>
      <seglistitem>
       <seg><literal>d</literal></seg>
       <seg>Adds to the value a random number &gt; 0 and &le; the argument.</seg>
       <seg>Subtracts from the value a random number &gt; 0 and &le; the argument.</seg>
       <seg><literal>d3</literal> &rarr; <literal>103&mdash;105</literal></seg>
      </seglistitem>
     </segmentedlist>
    </para>
    <para>You don’t have to create the quest variable ahead of time with this script. If the parameter <parameter>initqv</parameter> is set, then the variable will be set to that value when the game starts.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapqvarfilter">
   <refnamediv><refname>TrapQVarFilter</refname>
    <refpurpose>Relay if a quest-variable meets the requirement.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapQVarFilter</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Properties</term>
     <listitem><inlinelist>
      <member><property>Trap\Quest Var</property></member>
      <member><property>Script\QBName</property></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This script will relay messages if a quest variable condition is met. Set the <property>Trap\Quest Var</property> or <property>Script\QBName</property> property like <script moreinfo="refentry">TrigQuestVar</script>. Then, when the test is true, the relay will pass messages.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trapqvartext">
   <refnamediv><refname>TrapQVarText</refname>
    <refpurpose>Display text when turned on.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapQVarText</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script moreinfo="refentry">BaseQVarText</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>TurnOn</message></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>When this trap is activated it displays text as described in <script moreinfo="refentry">BaseQVarText</script>.</para>
   </refsection>
  </refentry>

  <refentry id="scr-traprequireone">
   <refnamediv><refname>TrapRequireOne</refname>
    <refpurpose>Trigger when an odd number of switches is turned on.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapRequireOne</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Links</term>
     <listitem><inlinelist>
      <member><flavor>ScriptParams</flavor>(<userinput>Require</userinput>)</member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This script combines the outputs of multiple triggers so that when any one of the triggers changes state, the state of the trap changes. With only two sources, this is called a three-way switch; but this trap can have any number of sources. In particular, the trap is turned on when an odd number of triggers has been turned on. The triggers that are turned on are tracked using <flavor>ScriptParams</flavor> links that have the data set to “<userinput>Require</userinput>”.</para>
   </refsection>
  </refentry>

  <refentry id="scr-traprequireoneonly">
   <refnamediv><refname>TrapRequireOneOnly</refname>
    <refpurpose>Trigger when just one switch is turned on.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapRequireOneOnly</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Links</term>
     <listitem><inlinelist>
      <member><flavor>ScriptParams</flavor>(<userinput>Require</userinput>)</member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This trap will be turned on when exactly one of its triggers is turned on. The triggers that are turned on are tracked using <flavor>ScriptParams</flavor> links that have the data set to “<userinput>Require</userinput>”.</para>
   </refsection>
  </refentry>

  <refentry id="scr-traptimer">
   <refnamediv><refname>TrapTimer</refname>
    <refpurpose>A simple timer.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrapTimer</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Properties</term>
     <listitem><inlinelist>
      <member><property>Script\Timing</property></member>
      <member><property>Script\Delay Time</property></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>A timer is the most useful type of trap that isn’t present in most of the standard games. What were they thinking? Set the time to delay the message in <property>Script\Timing</property> (as milliseconds) or in <property>Script\Delay Time</property> (as seconds). The extra data of the message will not be preserved.</para>
    <para>This trap works like the standard <script>TrapRelay</script> in that it will pass not just <message>TurnOn</message> and <message>TurnOff</message>, but other (though not all) types of messages as well.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trigobbcreature">
   <refnamediv><refname>TrigOBBCreature</refname>
    <refpurpose>Trigger when an AI enter a bounding-box.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrigOBBCreature</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script moreinfo="refentry">TrigOBBSpec</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>PhysEnter</message></member>
      <member><message>PhysExit</message></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Links</term>
     <listitem><inlinelist>
      <member><flavor>Population</flavor></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>This is an OBB trigger, also known as a tripwire, that triggers when an AI enters the bounding-box of the object. Actually, it reacts to objects of type <object>Creature</object> (<application>Thief</application>) or <object>Monsters</object> (<application>SS2</application>). The creature is tracked the same way as for <script moreinfo="refentry">TrigOBBSpec</script>.</para>
   </refsection>
  </refentry>

  <refentry id="scr-trigquestvar">
   <refnamediv><refname>TrigQuestVar</refname>
    <refpurpose>Trigger when a quest variable changes.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrigQuestVar</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseTrap</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>QuestChange</message></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Properties</term>
     <listitem><inlinelist>
      <member><property>Trap\Quest Var</property></member>
      <member><property>Script\QBName</property></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>When the value of a quest variable changes, this script tests it against a condition and sends <message>TurnOn</message> when the condition becomes true, or <message>TurnOff</message> if it is now false. (Or it sends nothing if the condition hasn’t changed.) The possible tests are the same as in <application>Thief 2</application>, so there’s no difference between this script and <script>TrigQVar</script> in that game.</para>
    <para>The condition in the <property>Trap\Quest Var</property> or <property>Script\QBName</property> property is similar to that used by <script moreinfo="refentry">TrapMissionQVar</script>. The first character is the type of the test, ‘<literal>=</literal>’, ‘<literal>&lt;</literal>’, ‘<literal>&gt;</literal>’, ‘<literal>&amp;</literal>’, or ‘<literal>"</literal>’. Following this is the number to test against, then a colon (‘<literal>:</literal>’) and finally the name of the quest variable. There should not be any spaces from the start of the string up to the name of the variable. (Variables names can have spaces in them.)</para>
    <para>The tests ‘<literal>=</literal>’, ‘<literal>&lt;</literal>’, and ‘<literal>&gt;</literal>’ test if the quest variable is equal-to, less-than, or greater-than the given number. The ‘<literal>&amp;</literal>’ test compares the numbers as a set of binary bits. If any of the bits set in the test number are also set in the quest variable, the condition is true. The ‘<literal>"</literal>’ test compares the decimal digits of the numbers. The quest variable must have the same digits in the same places as the test number. Digits greater than those in the test number are ignored. You can test against 0, even in the leading digits. (So testing against “<literal>01</literal>” is actually different than testing against just “<literal>1</literal>”.)</para>
   </refsection>
  </refentry>

  <refentry id="scr-trigwaypoint">
   <refnamediv><refname>TrigWaypoint</refname>
    <refpurpose>Trigger when a moving terrain object reaches the waypoint.</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
    <variablelist>
    <varlistentry>
     <term>Script</term>
     <listitem><inlinelist>
      <member><script>TrigWaypoint</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Inherits</term>
     <listitem><inlinelist>
      <member><script>BaseScript</script></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Messages</term>
     <listitem><inlinelist>
      <member><message>WaypointReached</message></member>
     </inlinelist></listitem>
    </varlistentry>
    <varlistentry>
     <term>Links</term>
     <listitem><inlinelist>
      <member><flavor>ControlDevice</flavor></member>
     </inlinelist></listitem>
    </varlistentry>
    </variablelist>
   </refsynopsisdiv>
   <refsection>
    <para>Put this script on a <object>TerrPt</object> and it will activate its <link linkend="triggerlink">trigger links</link> when the moving terrain object reaches it.</para>
   </refsection>
  </refentry>
