Members | Sign In
All Forums > Mission Scripting
avatar

Mission SCript ref V1.40

posted Apr 15, 2011 22:10:22 by ThomRobertson
-----------------------------------------------------------------------------
MISSION SCRIPT DOCS FOR ARTEMIS SBS V1.36
4/13/2011
rev 2

-----------------------------------------------------------------------------
GENERAL NOTES
The mission script system is designed to let anyone create, share, and play
game missions for Artemis. In the Artemis install folder, there's a subfolder
called 'Dat'. Inside that is another folder called 'Missions'.

Inside the Missions folder, each mission needs to have its own unique folder.
Each mission folder name must start with 'MISS_'.
Inside a mission folder must be 1 XML file. It must share the same exact name
as the folder it's inside, except for the .xml suffix. This file will contain
all the commands that make the mission happen. There may be other files in the
same folder. As a general rule, any sound, video, or image files that the
mission uses must be in the same folder as the XML file that references it.

When the Artemis game starts up, choose "Start Server". At that point, the
game will look inside the Missions subfolder and make a list of every folder
that starts with 'MISS_'. On the Server control screen you can select one of
those missions. If you do, you can still set the game difficulty. The diff
setting won't control the amount and type of enemies (the mission will do that),
but it will still control the enemy beam damage and the efficiency of the
Artemis' systems.

When you've chosen your mission (and other settings), click the 'Start Game'
button. As the game is initialized, the Artemis app will attempt to
open the chosen folder and read the XML file inside. It will read the entire
XML script into memory, and keep it in memory for the entire game.

The XML script should contain a single <start> block. At the start of
the mission, the commands in the start block will be immediately followed.

The XML script should also contain <event> blocks. These blocks should
contain both COMMAND and CONDITION blocks. For each event block, all
of its CONDITION blocks are checked. If they are all TRUE, then
all of the event's COMMAND blocks are immediately followed.

So, when you make a mission XML file, use one start block to create all
the initial conditions of the mission. Then use event blocks to trigger
parts of the story when they are supposed to occur.



-----------------------------------------------------------------------------
COMMAND: create (the command that creates everything you can think of in the game)
ATTRIBUTE: type
VALID: station, player, enemy, neutral, nebulas, asteroids, mines, anomaly
ATTRIBUTE: x
VALID: 0 to 100000
ATTRIBUTE: y
VALID: -100000 to 100000
ATTRIBUTE: z
VALID: 0 to 100000
ATTRIBUTE: name
VALID: text
ATTRIBUTE: hulltype
VALID: 0-? (corresponds to the unique hull ID in vesselData.xml)
ATTRIBUTE: angle
VALID: 0-360
ATTRIBUTE: fleetnumber
VALID: 1-99

ATTRIBUTE: count
VALID: 0 to 500
ATTRIBUTE: radius
VALID: 0 to 100000
ATTRIBUTE: randomRange
VALID: 0 to 100000
ATTRIBUTE: startX
VALID: 0 to 100000
ATTRIBUTE: startY
VALID: -100000 to 100000
ATTRIBUTE: startZ
VALID: 0 to 100000
ATTRIBUTE: endX
VALID: 0 to 100000
ATTRIBUTE: endY
VALID: -100000 to 100000
ATTRIBUTE: endZ
VALID: 0 to 100000
ATTRIBUTE: randomSeed
VALID: 0 to big number
ATTRIBUTE: startAngle
VALID: 0 to 360
ATTRIBUTE: endAngle
VALID: 0 to 360


-----------------------------------------------------------------------------
COMMAND: destroy (the command that removes something from the game)
ATTRIBUTE: name
VALID: text


-----------------------------------------------------------------------------
COMMAND: destroy_near (the command that removes unnamed objects from the game, if near a point)
ATTRIBUTE: type
VALID: nebulas, asteroids, mines
ATTRIBUTE: centerX
VALID: 0 to 100000
ATTRIBUTE: centerY
VALID: -100000 to 100000
ATTRIBUTE: centerZ
VALID: 0 to 100000
ATTRIBUTE: radius
VALID: 0 to 100000


-----------------------------------------------------------------------------
COMMAND: direct (the command that tells a neutral or enemy to go somewhere or fight something)
ATTRIBUTE: name
VALID: text

ATTRIBUTE: targetName
VALID: text

ATTRIBUTE: pointX
VALID: 0 to 100000
ATTRIBUTE: pointY
VALID: -100000 to 100000
ATTRIBUTE: pointZ
VALID: 0 to 100000

ATTRIBUTE: scriptThrottle
VALID: 0.0 to 1.0


-----------------------------------------------------------------------------
COMMAND: set_variable (makes or sets a named value)
ATTRIBUTE: name
VALID: text
ATTRIBUTE: value
VALID: 0 to big number

-----------------------------------------------------------------------------
COMMAND: set_timer (makes or sets a named timer)
ATTRIBUTE: name
VALID: text
ATTRIBUTE: seconds
VALID: 0 to big number


-----------------------------------------------------------------------------
COMMAND: incoming_message (creates a Comms button to play a media file on the main screen)
ATTRIBUTE: from
VALID: text
ATTRIBUTE: fileName (all media files belong in the mission subdirectory, alongside the mission script XML file)
VALID: text
ATTRIBUTE: mediaType
VALID: 0 (for OGG audio files)


-----------------------------------------------------------------------------
COMMAND: big_message (creates a chapter title on the main screen)
ATTRIBUTE: title
VALID: text
ATTRIBUTE: subtitle1
VALID: text
ATTRIBUTE: subtitle2
VALID: text

-----------------------------------------------------------------------------
COMMAND: end_mission (stops the mission)



-----------------------------------------------------------------------------
COMMAND: incoming_comms_text (sends a block of text to the Comms station)
ATTRIBUTE: from
VALID: text
BODY:
VALID: multiple lines of text

-----------------------------------------------------------------------------
COMMAND: log (sends text to the mission's log file)
ATTRIBUTE: text
VALID: text


-----------------------------------------------------------------------------
COMMAND: set_object_property (sets a named space object's named property to a value)
ATTRIBUTE: name
VALID: text
ATTRIBUTE: property
VALID: text
ATTRIBUTE: value
VALID: signed floating point value

NOTE: Properties you can set:
// values for everything
positionX
positionY
positionZ

// values for Stations
shieldState
canBuild
missileStoresHoming
missileStoresNuke
missileStoresMine

// values for ShieldedShips
throttle
steering
topSpeed
turnRate
shieldStateFront
shieldMaxStateFront
shieldStateBack
shieldMaxStateBack
shieldsOn
hullDamageFront
hullDamageBack
systemDamageBeam
systemDamageTorpedo
systemDamageTactical
systemDamageTurning
systemDamageImpulse
systemDamageWarp
systemDamageFrontShield
systemDamageBackShield
shieldBandStrength0
shieldBandStrength1
shieldBandStrength2
shieldBandStrength3
shieldBandStrength4

// values for Enemys
targetPointX
targetPointY
targetPointZ
hasSurrendered
eliteAIType
eliteAbilityBits
eliteAbilityState

// values for Neutrals
willAcceptCommsOrders







-----------------------------------------------------------------------------
CONDITION: if_inside_box (tests if named object is inside a rectangle in space)
ATTRIBUTE: name
VALID: text

ATTRIBUTE: leastX
VALID: 0 to 100000
ATTRIBUTE: leastZ
VALID: 0 to 100000
ATTRIBUTE: mostX
VALID: 0 to 100000
ATTRIBUTE: mostZ
VALID: 0 to 100000

-----------------------------------------------------------------------------
CONDITION: if_outside_box (tests if named object is outside a rectangle in space)
ATTRIBUTE: name
VALID: text

ATTRIBUTE: leastX
VALID: 0 to 100000
ATTRIBUTE: leastZ
VALID: 0 to 100000
ATTRIBUTE: mostX
VALID: 0 to 100000
ATTRIBUTE: mostZ
VALID: 0 to 100000


-----------------------------------------------------------------------------
CONDITION: if_inside_sphere (tests if named object is inside a sphere in space)
ATTRIBUTE: name
VALID: text

ATTRIBUTE: centerX
VALID: 0 to 100000
ATTRIBUTE: centerY
VALID: -100000 to 100000
ATTRIBUTE: centerZ
VALID: 0 to 100000
ATTRIBUTE: radius
VALID: 0 to 100000

-----------------------------------------------------------------------------
CONDITION: if_outside_sphere (tests if named object is outside a sphere in space)
ATTRIBUTE: name
VALID: text

ATTRIBUTE: centerX
VALID: 0 to 100000
ATTRIBUTE: centerY
VALID: -100000 to 100000
ATTRIBUTE: centerZ
VALID: 0 to 100000
ATTRIBUTE: radius
VALID: 0 to 100000


-----------------------------------------------------------------------------
CONDITION: if_distance (tests the distance between two named objects against a condition)
ATTRIBUTE: name1
VALID: text

ATTRIBUTE: name2
VALID: text

ATTRIBUTE: pointX
VALID: 0 to 100000
ATTRIBUTE: pointY
VALID: -100000 to 100000
ATTRIBUTE: pointZ
VALID: 0 to 100000

ATTRIBUTE: comparator
VALID: =, !=, <, >, <=, >=, EQUALS, NOT, GREATER, LESS, GREATER_EQUAL, LESS_EQUAL
ATTRIBUTE: value
VALID: signed floating point value


-----------------------------------------------------------------------------
CONDITION: if_variable (tests a named variable against a condition)
ATTRIBUTE: name
VALID: text
ATTRIBUTE: comparator
VALID: =, !=, <, >, <=, >=, EQUALS, NOT, GREATER, LESS, GREATER_EQUAL, LESS_EQUAL
ATTRIBUTE: value
VALID: signed floating point value



-----------------------------------------------------------------------------
CONDITION: if_fleet_count (tests an indexed fleet's membership count against a condition)
ATTRIBUTE: name
VALID: text
ATTRIBUTE: comparator
VALID: =, !=, <, >, <=, >=, EQUALS, NOT, GREATER, LESS, GREATER_EQUAL, LESS_EQUAL
ATTRIBUTE: value
VALID: signed floating point value
ATTRIBUTE: fleetnumber
VALID: 0-99


-----------------------------------------------------------------------------
CONDITION: if_docked (tests if a player is docked with a named station)
ATTRIBUTE: name
VALID: text


-----------------------------------------------------------------------------
CONDITION: if_timer_finished (tests if a timer has counted down to zero yet)
ATTRIBUTE: name
VALID: text


-----------------------------------------------------------------------------
CONDITION: if_exists (tests if named object exists right now)
ATTRIBUTE: name
VALID: text


-----------------------------------------------------------------------------
CONDITION: if_object_property (tests a named space object's named property against a condition)
ATTRIBUTE: name
VALID: text
ATTRIBUTE: name
VALID: property
ATTRIBUTE: comparator
VALID: =, !=, <, >, <=, >=, EQUALS, NOT, GREATER, LESS, GREATER_EQUAL, LESS_EQUAL
ATTRIBUTE: value
VALID: signed floating point value

NOTE: Properties you can test against:
// values for everything
positionX
positionY
positionZ

// values for Stations
shieldState
canBuild
missileStoresHoming
missileStoresNuke
missileStoresMine

// values for ShieldedShips
throttle
steering
topSpeed
turnRate
shieldStateFront
shieldMaxStateFront
shieldStateBack
shieldMaxStateBack
shieldsOn
hullDamageFront
hullDamageBack
systemDamageBeam
systemDamageTorpedo
systemDamageTactical
systemDamageTurning
systemDamageImpulse
systemDamageWarp
systemDamageFrontShield
systemDamageBackShield
shieldBandStrength0
shieldBandStrength1
shieldBandStrength2
shieldBandStrength3
shieldBandStrength4

// values for Enemys
targetPointX
targetPointY
targetPointZ
hasSurrendered
eliteAIType
eliteAbilityBits
eliteAbilityState

// values for Neutrals
willAcceptCommsOrders
Creator of Artemis
page   first prev 1 2 3 4 next last
58 replies
avatar
MrSquid said Apr 27, 2011 22:06:04
The former is indeed correct. Your line of code would execute if the system in question was greater than 90% damaged.
avatar
Mike_Substelny said Apr 28, 2011 02:42:31
My "Shakedown" mission has a problem similar to Apollo's. The following code is supposed to execute the first time Artemis docks with station DS02. Unfortunately it executes the first time Artemis docks at ANY station.

<event>
<if_docked station="DS02"/>
<if_variable name="lesson" comparator="=" value="1"/>
<if_variable name="dock2" comparator="!=" value="1"/>
<incoming_comms_text from="CAL 9000">
The distance between DS01 and DS02 is 28,284^
meters, about a quarter of the sector. Note^
the power used in your journey.^
-^
Order your Engineer to increase power to warp drive^
then make the return trip.^
-
</incoming_comms_text>
<set_variable name="dock2" value="1"/>
</event>

I believe this is a bug in version 1.41. If you play Thom's Mission "The End of Peace" in Artemis 1.41 you can get the Kralians to appear by docking at either station.

The if_docked turns true if the player ship is docked anywhere. For now the workaround is to check to see if Artemis is within 100 meters of the base in question.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
TobiHill-Meyer said Apr 28, 2011 22:35:02
I could really use some help with someone looking over my scripting. I can't get the if_inside_sphere, if_outside_sphere or if_distance conditions to activate. I'm copying and pasting it from TheWaningDark and changing my coordinates, but they don't work. Also, if I use them in a new mission, they do. So as best I can tell, it's not the condition that isn't working, but something else in the script that's preventing it from happening.

I'm still testing it, but if anyone wants to take a look, I have it online at http://handbasketproductions.com/MISS_Dream.txt

If someone can point me to what I'm doing wrong I would GREATLY appreciate it.
avatar
TobiHill-Meyer said Apr 29, 2011 00:32:57
Aha! I found the problem. I was missing a close quotation mark in an above section and that was preventing anything below it from running. I did not realize that could be the case, and assuming each event ran or failed on it's own I was just looking at the most significant event rather than the one with the typo.

Anyway, another odd problem. I'm trying to load an ogg file, and it plays really really slowly to the point that it's not really audible. It plays fine in a regular media player. Any idea what's up?
avatar
Mike_Substelny said Apr 29, 2011 13:03:01
I know this one because it happened to me. Artemis is set up to play incoming Communications ogg files in mono. If you give it a stereo ogg then the sound will play at half speed. It's just a matter of re-saving the file as mono and your problem is solved.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
TobiHill-Meyer said Apr 29, 2011 18:26:33
Yay! Thanks Mike!
avatar
ThomRobertson said Apr 30, 2011 21:23:07
It checks to see if the total damage to system (whatever) is greater than 90%.
Creator of Artemis
avatar
MrSquid said May 06, 2011 22:00:26
Hey Thom, is there an appropriate way to write mission scripts for multiple player ships?
avatar
Mike_Substelny said May 07, 2011 01:18:03
Mr. Squid, I'm pretty sure that the scripting system only works for single ship, single crew missions at this time. When the day comes that it works with multiple ships I have a few ideas for good missions, but I'll always concentrate on single ship missions because it's pretty easy to get a single crew together.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
ApolloELanding said May 07, 2011 02:39:02
Hi,

Has anyone created a minefield? During testing of I am able to pilot the Artemis through the minefield?

Also: What is the new line command as \n does not create a new line in the log file.

I tried ^M , /n but no luck.

I am using notepad to view the log file.

Ideally I wanted to use the log file as an audit trail to be sure all the event are firing at the proper times per the story script.

Dave
avatar
MrSquid said May 08, 2011 22:49:06
I have a couple of new questions concerning the set_object_property command:

1. What do 'throttle' and 'topSpeed' refer to? Can one of them be used to evaluate how fast Artemis is going? (e.g., Warp 1-4 and/or impulse speed?)

2. What is the difference between 'steering', 'turnRate', and 'systemDamageTurning'?

Thanks!
avatar
MrSquid said May 08, 2011 23:11:55
Oh! Also, is there a way to evaluate if a particular enemy ship has been destroyed? (I tried if_outside_box of the entire map, but that didn't work :) )
avatar
TobiHill-Meyer said May 09, 2011 07:56:21
@MrSquid, I found an awkward mechanism to evaluate if a particular enemy ship has been destroyed. Using the if_exists condition, I would set a timer if that enemy ship exists. Without any other condition, the timer would constantly be reset and never make it to zero. When the ship is destroyed, the timer would finish, and you can use that to trigger an event.
avatar
Mike_Substelny said May 09, 2011 12:48:23
Over the weekend I experimented with 'throttle' and 'topSpeed' and was able to get enemy and neutral ships to go at warp speed. I was not able to get any values for Artemis.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
ThomRobertson said May 10, 2011 01:17:47
with 'throttle' and 'topSpeed'


I added many class member variables at once to the scripting system. Some of them are set by the code, and some are set constantly. So it's easy to believe that I let you set the value but nothing happens ('cause the ode is setting it right back). If you see such a behavior, please post about it and I'll try to fix it.
Creator of Artemis
Login below to reply: