### Character Script Commands

When the player enters the room, NPCs start performing the behavior you designate. There are four general classes of script commands, as follows:

1. Placement - Change the NPCs location.

1. Appear - If not visible, the NPC will appear at the current square (i.e. it enters the room). This command does nothing if the NPC is already visible. If a monster or the player occupies the square it is appearing in, then the NPC will wait until the square is vacant to appear.
2. Appear at - Use this to have an invisible NPC enter the room at a designated square different from the one where the NPC is current located. After selecting this command, the room will temporarily appear. Click on a square to select where the NPC will enter the room. This command does nothing if the NPC is already visible. If a monster or the player occupies the square the NPC is to appear in, it will wait until the square becomes vacant to appear.
3. Move to - Tell the NPC to move to the indicated square (selected by clicking on a room square). Each turn, the NPC will attempt to move one square closer to its destination. It moves roughly along a straight line and won't move on a given turn if something is in its way. Enable "Forbid turning" if you don't want the monster turning to face the direction it is moving. Hint: If you want the NPC to move in a more complex fashion, such as following a twisting corridor, this can be accomplished with a sequence of "Move to" commands, one to navigate each twist in the corridor. This command finishes when the NPC arrives at the destination square.
4. Face direction - Initially, the NPC faces the direction it is oriented when placed in the room. Use this command to turn the NPC in a different direction without moving (takes 1 turn).
5. Strike orb at - Activates the orb at the room square you select. Nothing will happen this turn if no orb is at the indicated square. Hint: Move the character next to the orb before striking it for more intuitive behavior. If no one is next to the orb when struck, it will appear that Beethro is using his portable orb.
6. Disappear - Removes the NPC from the room. Use this to show an NPC leaving the room. Script commands continue to play while the character is invisible but the NPC will not otherwise interact with any room elements.

2. Interaction - How the NPC interacts with its environment.

1. Invincibility - Make the NPC invincible or vulnerable (default). When vulnerable, the NPC can be killed like other monsters.
2. Speech - Causes someone in the room to say something.
   Dialog text: Type the words that are said. This may be left blank in order to only play a sound effect.
   Speaker: who says the words. The text appears next to the person's figure in the room and their face appears on screen while they are speaking. Use Custom to have the NPC "throw its voice" to a different square in the room. If a monster or character is located at the indicated square when this command is executed, it will appear as if this monster or character is speaking. If speaker is set to None, or the person indicated is not present in the room, then the words will appear next to the NPC.
   Mood: the face displays the indicated mood. Not all moods are available for all speaker types.
   Speech delay: How long, in milliseconds, the speech lasts for. If placing multiple lines of speech in sequence, this determines how much time passes until the next line of speech (and corresponding speaker) is displayed. Set this value to zero to have the game engine calculate how long to wait based on the length of the speech text.
   Add sound: A sound file (Wave or Ogg Vorbis format) on disk can be optionally attached to the speech. If a sound is specified, it will play along with the text and the next speech command will be played when the sound completes. Use a non-zero speech delay to force when the next line of speech will play regardless of how long the attached sound file plays. Hint: Can use this to provide a room with ambient sound effects.
   Exporting speech text: A hold's entire speech script can be exported to an HTML file on disk when exporting the hold by adding the line "ExportSpeech=1" to the "[Startup]" section of Data/drod.ini.
3. Flush Speech - Tells the game to immediately process any previously queued speech that hasn't had time to play yet. If "On" is selected, these texts will appear immediately onscreen. If "Off" is selected, then text that hasn't played yet won't show at all. Hint: This command is used for dramatic effect, to ensure speech queued after this command will be immediately spoken, as intended. This command is not needed if it doesn't matter at what point in play speech texts are delivered.
4. Set music - Set any of the selected music themes to play. Custom music can be set to continue playing across rooms by executing this command on room entrance.
5. Turn into monster - Turns the NPC into a regular monster of the type indicated by its graphic. This ends the script immediately, but the script will start again from the beginning if the player enters the room again.

3. Queries - Use queries to examine the state of the room and wait indefinitely until certain events occur.

1. Wait - This tells the NPC to do nothing until a certain number of game turns have passed.
2. Wait for turn - The NPC does nothing until at least the specified number of game turns has passed since the player entered the room.
3. Wait for event - The NPC waits until the specified action has taken place.
4. Wait for player - The NPC waits for the player to enter the room region you specify. After selecting this command, the room will temporarily appear. Hold down the mouse button and drag the mouse to choose the area the player must enter before the NPC does anything else.
5. Wait while player is - Wait while the player remains in the room region that you select.
6. Wait for Halph - Wait for Halph to be located in the selected room region.
7. Wait while Halph is - Wait while Halph remains in the selected room region.
8. Wait for monster - Wait for a monster to be located in the selected room region.
9. Wait while monster is - Wait while any monster remains in the selected room region.
10. Wait for NPC - Wait for a visible NPC to be located in the selected room region.
11. Wait while NPC is - Wait while a visible NPC remains in the selected room region.
12. Wait for door to (open/close) - Waits for the door at the selected room square to either open or close.
13. Wait for turn - Waits until the player has made the specified number of moves in the room.
14. Wait for clean room - Waits until the room is in a conquer-ready state (i.e. all killable monsters have been removed).
15. Wait for player to face - Waits until the player turns in the specified direction.
16. Question - Asks a "Yes" or "No" question with the dialogue you specify. If executed as the condition for an "If ..." command, the script will jump to the specified label if the user answers "Yes".

4. Decision making - Use the following commands to continue acting out the script commands from a different position in the script.

1. Label - marks a location in the script to continue executing commands from (used in conjunction with Goto commands). You may optionally name each label to describe what the following commands do.
2. Go to - Select a label to continue executing commands from. Hint: Use Goto to repeat a sequence of commands over and over.
3. If ... Go to - Similar to "Go to", except the script will continue running from the designated label only if the following query is satisfied in the affirmative. Hint: a query command must be placed next in the script for a decision to be made. If the following query is not true, the "If ... Go to" and query will be skipped and the script will continue with the command following.
4. End on room exit - Removes the NPC for the rest of the current game once the player exits the room. If the room is restarted before exit, then the NPC script will begin executing again from the beginning.
5. End - Ends the character script and will remove the NPC for the rest of the current game once the player exits the room. If the room is restarted before exit, then the NPC script will begin executing again from the beginning.

Notes about using NPC scripts.

1. Each character script begins execution when the room is entered. Once a script runs to completion, the character stops functioning. If still in the room when the script ends, it will remain where it is until the player exits the room. Upon reentry, the script will start again from the beginning.
2. A script can be made to not start again when the player reenters the room by placing an "End" command at the end of the script or by executing an "End on room exit" command anywhere within the script. A character can be made to run only while the room is unconquered by placing an "If <Wait for Clean Room> Go to" check at the beginning of the script that jumps to an "End" command.
3. Character monsters are not used to determine room completion. That is, character monsters with un-Ended scripts will continue to appear in a conquered room each time the player reenters it.
4. A character can be turned into a regular monster with the "Turn into monster" command. In this case, it may need to be killed in order to conquer the room.

Contents