List of conditions and commands in DSL
The DSL expander contains two main categories of sentences: the conditions and consequence commands. Conditions are those rules where you test something, e.g. if the player is on particular street, while the consequences order the scenario to perform some action, e.g. show some dialog.
In following text the text that should be substituted is printed in italics, the unnecessary
text is grayed and the variations are separated by vertical|line. The space character can be
explicitly declared as underline (_).
Conditions
There are several categories of conditions:
- Scenario conditions
- test state of the scenario itself, acts and so on.
- Placement conditions
- test player's position.
- User interaction conditions
- allow interaction with the dialogues and keypresses.
- General conditions
- are condidions not included in previous categories.
Scenario conditions
- scenario is ready
- This is the first condition that should apply - it says that everything has been correctly loaded. You should place all the initialization commands into the rule with this condition. You shouldn't use empty condition block because such rule would be run before the scenario is completely loaded.
- scenario started
- The scenario can begin.
- scenario is running
- The scenario is currently running - that means this is not the first time. scenario started
- scenario has finished
- The scenario has been completed or terminated.
- performing act "act name"
- The scenario is currently performing the specified act or some of the acts included in this act.
- not performing act "act name"
- This condition applies when the performing act "act name" does not apply.
Placement conditions
- player is in area "area name"
- This condition applies when the first player is withing the specified area.
- player is not in area "area name"
- The exact opposite of previous condition.
- player is nearby "object name"
- The distance between first player and the object is less than constant dependent on the virtual environment. This constant is 1000 units in UT2004.
- player is nearby "object name"
- The distance between first player and the object is greater than the "nearby distance" constant.
User interaction conditions
- user pressed "key" key
- Applies when such key was pressed. It is recommended to use the set keypress "key" processed command to retract the event. Otherwise the keypress could cause another rule to be fired. For example when you use some key both for showing and hiding of some dialog - if the user has pressed some key and the dialog is hidden, show him, if he has pressed the key and the dialog is shown, hide him - without the retraction would be the dialog displayed but after that the second rule would also fire (the dialog is shown again) and the dialog would hide, causing infinite loop.
- map is shown
- The map dialog is currently displayed on user's screen.
- map is hidden
- The map dialog is not visible.
- selection in|on map is enabled
- When the user clicks on the map an arrow pointing to the point where he clicked will appear.
- selection in|on map is disabled
- When the user clicks on the map there will be no arrow pointing to the point where he clicked.
- position was selected on map
- The map was in the point selection mode and user has confirmed the selected position.
- cardinal directions are shown
- The cardinal directions dialog is displayed on user's screen.
- cardinal directions are hidden
- The cardinal directions dialog is hidden.
- cardinal direction was selected
- User has clicked on the cardinal directions (points) dialog and selected one of it's directions.
- dialog "dialog id" was answered
- The dialog has been submitted or canceled.
- dialog "dialog id" has returned in "name of field" value "value".
- User submitted the dialog and the returned information contains specified value in the given field.
General conditions
- the angle between "first variable" and "second variable" is less than number degrees
- Both these variables should contain rotation objects. This condition tests whether the angle in plane (the difference between their roll coordinates) between them is less than specified number of degrees (180 degrees means these are opposing directions).
- the distance of|from|between "first object" and|to "second object " is less than number
- The distance between the two objects is less than the number.
- the distance of|from|between "first object" and|to "second object " is greater than number
- The distance between the two objects is greater than the number.
- the distance nsignature of|from|between "first object" and|to "second object " is less than number
- This is the same as the two condition above, the only difference is the signature. For internal purposes we cannot have the original rule multiple times in the same rule conditions block. That's why you have to use the signature - simple number which is different in every distance condition.
- the distance nsignature of|from|between "first object" and|to "second object " is greater than number
- The same as above but for the "greater" condition.
- timer "timer name" is over number of seconds|minutes
- A running timer has exceeded the specified time.
- timer "timer name" is on number of seconds|minutes
- A running timer is currently running for the specified amount of time.
Consequence commands
Scenario commands
- start scenario
- Advances the scenario from the READY state to RUNNING state.
- finish scenario
- Switches the scenario to the FINISHED state.
- perform act "act name"
- Switches the plot into this act.
- create report "report name"
- A new report will be created. Reports store pieces of information that should be linked together (e.g. time, place and result of some event).
- add data "variable" to report "report name"
- Appends data from variable to the report.
- store report "report name"
- Closes and stores the report.
- add number penalty points to player
- Every player has a penalties and bonuses score. This increases first player's penalty score by specified number of points.
- add number bonus points to player
- This increases first player's bonus score by specified number of points.
Area commands
- create area "name"
- Creates a new complex area, where you can add other areas and remove them again.
- name the"first area" street|square from crossing with the "second area" street|square to crossing with the "third area" street|square as "name"
- Finds the area on first area between second and third area and keeps this area as variable.
- name the crossing of the "first area" street|square and|with the "second area" street|square as "name"
- Creates a new area that is a crossing of the two areas.
- name current area as "name"
- Stores current area into variables. The player can be in multiple areas at the same moment - this picks the smallest simple area of them.
- add area "first area" to "second area"
- Adds the first area to the second one.
- remove area "first area" from "second area"
- First area which was previously added to the second one will be removed again - this doesn't mean exclusion.
User interaction commands
- play sound "sound game id"
- Plays the sound identified by the game id, e.g. "EduScenarios.sounds.testSound".
- play loop "sound game id"
- Plays the sound in an infinite loop.
- stop sound loop
- Stops playing of the looped sound.
- show message "text"
- Shows the specified message on users screen. There can be multiple messages displayed at one moment.
- show message "text" for number seconds|minutes
- The same as above but the message automatically disappears when the time elapses.
- hide message "text"
- Manually removes first displayed message with this text.
- set keypress "key" processed
- Retracts the keypress to prohibit other rules to fire. See user pressed "key" key for details.
- show map
- Displays the map dialog on user's screen.
- hide map
- Hides the map dialog on user's screen.
- enable current position in|on map
- Shows a little icon of the player in map dialog. The position of the icon is automatically updated
- disable current position in|on map
- Hides the position icon from the map dialog.
- enable selection in|on map
- When the selection is enabled and user clicks on the map an arrow icon will appear on the clicked spot and a confirmation button on the bottom of the map dialog.
- disable selection in|on map
- The selection arrow will disappear and the confirm button as well.
- name position selected on map as "variable"
- Stores the position selected in map dialog into a variable.
- show cardinal directions
- Shows the cardinal directions dialog
- hide cardinal directions
- Hides the cardinal directions dialog
- highlight direction "direction"
- Highlights the direction on the cardinal directions dialog. Possible values are north, northeast, east, southeast, south, southwest, west and northwest.
- highlight direction closest to "rotation in variable"
- Highlights the direction on cardinal directions dialog that is closest to the direction in variable. The variable could have been set for example by the name current orientation as "variable" command.
- clear highlighting of cardinal directions
- Removes the highlighting of all cardinal directions.
- name the selected cardinal direction as "variable"
- Stores the selected cardinal direction into a variable.
- create dialog "dialog"
- Creates a new empty dialog (not displayed yet).
- create panel "panel"
- Creates a new empty panel.
- create optionlist "optionlist"
- Creates a new empty option list.
- create button "button"
- Creates a new button.
- create submit button "button"
- Creates a new button which submits the dialog on click.
- set "panel" to main panel of dialog "dialog" Selects the main panel for the dialog.
- add component "component" to panel "panel"
- Adds a previously created component to the panel
- add new option "text" to "optionlist" as "value"
- Adds a new option to the optionlist. If the option is selected the optionlist will return this value in its data field.
- set position of "component" to x, y
- Sets the position of the component. The coordinates should vary between 0 and 1 relative to component's parent and the sum of x and width should not exceed 1. The same applies to the sum of y and height.
- set size of "component" to width, height
- Sets the size of the component. Width and height should vary between 0 and 1 relative to component's parent's width and height.
- set text on "component" to "text"
- Sets the text on the component if it has a text.
- show dialog "dialog"
- Shows the dialog on user's screen.
- enable point|POI|poi "POI" in|on map
- Set the POI to be visible on the map dialog.
- disable point|POI|poi "POI" in|on map
- Set the POI to be not visible on the map dialog.
- enable path "POI" in|on map
- Set the path to be visible on the map dialog.
- disable path "POI" in|on map
- Set the path to be not visible on the map dialog.
Agents control commands
- take control from player
- The user will be not able to move or rotate its character until the scenario returns control to him. You must take his control before forcing him to move somewhere.
- return control to player
- The user will be able to move as usual.
- move player to "object"
- Moves the player to the specified point or to the centre of area if the object is an area. There is a little inaccuracy in UT2004 - the player is moved only to some point nearby to the point (less than approximately one meter). You should count with that if the exact position is important.
- transport player to "player" to "located object"
- Displaces the player onto coordinates of the object.
- transport and turn player "player" to "located object" towards "direction "
- The same as above but turns the player to some direction at the same moment. Possible values of direction are north, northeast, east, southeast, south, southwest, west and northwest.
- remove bot "bot name"
- Removes the bot from the game.
- transport bot "bot name" to "located object"
- The bot will be immediately displaced onto coordinates of the object.
- add puppet as "bot name"
- Adds a special bot to the scenario who will follow your orders and do nothing else.
- move puppet "bot name" to "located object"
- Commands the puppet bot to walk or run to the position of the object.
- order puppet "bot name" to "action"
- Commands the puppet to either walk, run (these switch his state) or do a single action - jump.
General commands
- start timer "timer name"
- A new timer will be created and starts to count out.
- stop timer "timer name"
- The timer will be stopped and reset to 0.
- restart timer "timer name"
- The timer will start counting from 0 again.
- name current timer as "variable"
- Stores actual time as variable.
- name text "text" as "variable"
- Stores a text as variable.
- name current position as "variable"
- Stores the current position as variable. This command differs from the name current area as "name" command in the detail that this commands stores just location (coordinates in space) but the mentioned one searches for some declared area.
- name current orientation as "variable"
- Stores the current orientation (rotation).
- name position of "located object" as "variable"
- Stores the location of this object ias variable.
- name the distance of|from "first located object" and|to "second located object" as "variable"
- Stores the distance between these two objects as variable
- destroy "variable"
- Destroyes a object stored under this variable (probably created using some "create ..." command) and erases the variable.
- log: "message"
- Writes the message to the console. Use for debugging.