New Mission Scripting Commands

Artemis Bridge Tools supports additional commands that can be activated either by writing them to the mission log or by sending them as input via a tracing socket.  Note that writing to the mission log requires that the mission directory be writable.  By default, if you installed Artemis for a single user only, the mission directory will be writable, but if you installed Artemis for "all users" then it will not be writable and missing logging will not work.

The following commands are supported either by writing to the mission log, or by sending input via a tracing socket:

Command Description
play_video filename [monitor #] Play a video with the specified filename
stop_video [monitor #] Stop playing video
dmxset cuename[=value] Set a custom DMX cue to a specified value
set_variable varname=value Set a variable to preserve when generating mission state
update_mission missionname Regenerate a mission with preserved state

How to play a video from a mission script

You can use a log command from within a mission to trigger playing a video file in AVI format (you can convert an mp4 file to an avi file for free at http://video.online-convert.com/convert-to-avi).  The syntax to write to the log file is "play_video filename [monitor #]", where filename is the file name or path relative to the mission directory, and the optional monitor # indicates which monitor to play the file on (defaulting to the monitor the main screen is using).  For example, if you have a mission MISS_MyTestMission, then the following command will trigger playing "<your Artemis directory>\dat\missions\MISS_MyTestMission\MissionBriefing.avi":

<log text="play_video MissionBriefing.avi" />

You can also use a socket from your own program (e.g., a Python script) to trigger the play_video command.  First, enable a tracing socket.  You can then send the same command on the socket that would have been logged.  For example , the following will play missionBriefing.avi on monitor 2:

play_video missionBriefing.avi 2

The video file is looked for under the mission directory, for a scripted mission, or under your Artemis dat directory if the command is issued via a socket when not in a scripted mission.

If you want to forceably stop the video before it is done playing, you can use the "stop_video [monitor #]" syntax.  For example:

<log text="stop_video" />

How to trigger custom DMX events from a mission script

To enable this feature, open Artemis DMX Editor, click FileSettings, click the box labeled "Enable additional mission scripting ommands", and click OK.  Note: this does not currently work with Enttec Open or Enttec Pro controllers, only other controllers.

You can use a log command from within a mission to trigger custom DMX cues.  The syntax to write to the log file is "dmxset cuename[=value]", where cuename is the name of one of the custom cues (CUSTOM_{EVENT,STATE}_{1-4}), and value is 0 or 1. If value is not present, it defaults to 1.  Some examples are:

<log text="dmxset CUSTOM_STATE_1 = 1" />
<log text="dmxset CUSTOM_STATE_1=0" />
<log text="dmxset CUSTOM_EVENT_1" />

Event cues need not be cleared, they will be triggered each time the value is set to 1.

How to preserve state from one mission script to another

To enable this feature, open Artemis DMX Editor, click FileSettings, click the box labeled "Enable additional mission scripting ommands", and click OK.  Note: this does not currently work with Enttec Open or Enttec Pro controllers, only other controllers.

You can use a log command from within a mission to cause variables to be initialized to specified values at the start of another given mission.  The syntax to write to the log is "set_variable varname=value", where varname is the name of the variable to set (no spaces allowed), and value is the value to set.   Some examples are:

<log text="set_variable Base1Survived = 1" />
<log text="set_variable Base2Survived=0" />

Any variables set as above can then be used to apply to a single mission script using another log command to specify the follow-on mission.  The syntax to write to the log is "update_mission missionname", where missionname is the string that appears in the mission directory after "MISS_".  For example, to update "MISS_MyTestMission", the command would be:

<log text="update_mission MyTestMission" />

The file MISS_MyTestMission.xml will be backed up (if not already done) to MISS_MyTestMission-orig.xml, and MISS_MyTestMission.xml will be updated to set those variables in the <start> block.   A well-written MyTestMission script should contain default settings in the <start> block for users who run that mission without having run the pre-requisite first.   If the update_mission command finds a <set_variable> block with the indicated variable name, the value will be updated; if no such block is found then a new <set_variable> block will be added at the end of the <start> block.  Example MISS_MyTestMission.xml script:

<mission_data version="2.4">
  <start>
    <set_variable name="Base1Survived" value="1"/>
    <set_variable name="Base2Survived" value="1"/>
    ...
  </start>
  ...
</mission_data>

Multiple mission scripts can be affected this way, but each update_mission command must be preceded with its own set_variable commands.

You can also use a socket from your own program (e.g., a Python script) to trigger the set_variable and update_mission commands.  First, enable a tracing socket.  You can then send the same commands on the socket that would have been logged.  For example:

set_variable Base1Survived = 1
set_variable Base2Survived=0"
update_mission MyTestMission