<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://backup.witchspacewiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SimonRaven</id>
	<title>Elite Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://backup.witchspacewiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SimonRaven"/>
	<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php/Special:Contributions/SimonRaven"/>
	<updated>2026-04-12T06:47:44Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10182</id>
		<title>Escort Instructions</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10182"/>
		<updated>2008-06-15T22:09:22Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Creating a spread group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Oolite contains a lot of commands related to ships with escorts. Not all commands are needed all the times. e.g. when the system adds an escorted ship, all the escorts are already set up.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding of mother ship==&lt;br /&gt;
When a mother ship is added to the universe it is checked if it can have escorts. If yes, the system is examined and a random number of 0, 2, 4 or 6 is subtracted from the maximum escort number. In safer systems it is more likely that escorts are subtracted. When the resulting number is greater than 0 this number of escorts is added as escort with the function '''setUpEscorts''' and the '''escortsAreSetup''' flag is set.&lt;br /&gt;
&lt;br /&gt;
==Adding with setUpEscorts==&lt;br /&gt;
When the function '''setUpEscorts''' is called, it first looks if the '''escortsAreSetup''' flag if false. When they were not previously setup, the escorts are set up. They all get an '''escortAI.plist''' statemachine and the scanclass and the groupID  of the mother.&lt;br /&gt;
&lt;br /&gt;
By default all ships get an escort with role &amp;quot;escort&amp;quot; and only ships with role &amp;quot;police&amp;quot; get an escort with role &amp;quot;wingman&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This default can be overruled by the keys &amp;quot;escort-role&amp;quot; or &amp;quot; escort-ship&amp;quot; in shipData.plist. When a key &amp;quot;escort-role&amp;quot; exist, escorts with this role are chosen and they keep their original role. (this is a bug because the mother will only accept escorts with role &amp;quot;escort&amp;quot;). When a key &amp;quot; escort-ship&amp;quot; exists, a ship with this name is used as escort and they get the role &amp;quot;escort&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When setup is ready they all have a '''escortAI.plist''' statemachine and the state itself is set to &amp;quot;FLYING_ESCORT&amp;quot;. The initial part in this AI were the escorts are setup is skipped as the escorts are already setup by the system. When you want to give you escorts a custom AI you can redefine this by adding the command: &amp;quot;'''switchAITo: yourCustomAI.plist'''&amp;quot; in  the ships &amp;quot;launch_actions&amp;quot; in the shipData.plist.&lt;br /&gt;
&lt;br /&gt;
There are two places were a script can use the function '''setUpEscorts'''. You can place it in the &amp;quot;launch_actions&amp;quot; of the mothership, or you can put it at the beginning of the ships AI.plist. When you  leave it, the system will determine if it will set up the escorts and how many.&lt;br /&gt;
&lt;br /&gt;
==Adding escorts from scratch==&lt;br /&gt;
Also ships that don't belong to the escort group can be assigned as escort. This start with the command '''scanForFormationLeader'''. This commands looks for ships with the same scanclass and that don't already have their maximum escorts. If such a ship exist it returns &amp;quot;TARGET_FOUND&amp;quot;. When a target is found you can initiate the escort process with: &amp;quot;'''setTargetToFoundTarget, suggestEscort'''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''suggestEscort''' first checks if the target will accept the ship as escort.  For getting accepted: &lt;br /&gt;
&lt;br /&gt;
 1: The AI stack size of the escort must be lower than 2 &lt;br /&gt;
 2: It must have a role of escort and the mother must not have the role &amp;quot;escort&amp;quot;. &lt;br /&gt;
    (or it must be wingman and the mother police or interceptor)&lt;br /&gt;
 3: The mother has not yet reached the maximum number of escorts.&lt;br /&gt;
&lt;br /&gt;
When the escort is accepted by the mother it obtains the group ID of the mother, the mother is set as owner, and the escort AI receives an &amp;quot;ESCORTING&amp;quot; message. When the escort was clean, it receives the mothers legal status increased with a small random number.&lt;br /&gt;
&lt;br /&gt;
When the escort is rejected the AI gets: &amp;quot;NOT_ESCORTING&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The requirement of having a role of &amp;quot;escort&amp;quot; makes it difficult for a normal ship getting accepted. (Starting with oolite 1.70 you can use the command: &amp;quot;'''setPrimaryRole:''' &amp;quot; to change a ship role with an AI command). Also escorts introduced by the key &amp;quot;escort-role&amp;quot; will have the wrong role for being added afterwards.&lt;br /&gt;
&lt;br /&gt;
==Maintaining escort function==&lt;br /&gt;
Once an escort is set up the command '''setDesiredRangeTo: ''' sets the follow distance to the leader and the command '''performEscort'''  will start the real escort job. From here on everything is automated and the escort speeds up to fly into a formation position. To check if everything is still OK the AI should issue the command '''escortCheckMother''' in his UPDATE.  '''escortCheckMother''' does exactly the same as '''suggestEscort''' except changing the escorts legal status.&lt;br /&gt;
&lt;br /&gt;
==The escortAI.plist==&lt;br /&gt;
Most escorts fly with this AI and the '''setUpEscorts''' function forces the AI to start with the &amp;quot;FLYING_ESCORT&amp;quot; state. When an escort is hit it receives an &amp;quot;ATTACKED&amp;quot; message but will do nothing with it other than giving this message further to the mother. The mother can react in two ways. &lt;br /&gt;
&lt;br /&gt;
1: Issue a &amp;quot;GROUP_ATTACK_TARGET&amp;quot; with the command '''groupAttackTarget'''. The escortAI.plist will then as reaction set the  AI to interceptAI.plist.&lt;br /&gt;
&lt;br /&gt;
2: Using the command '''fightOrFleeHostiles'''. This command will start the command '''deployEscorts''' by its own. (The script does not need to call '''deployEscorts''' by its own). This '''deployEscorts''' will put all escorts into an &amp;quot;interceptAI.plist&amp;quot; with the current mothers target as target.&lt;br /&gt;
&lt;br /&gt;
==Getting attacked==&lt;br /&gt;
For escorts it is essential to have a role of &amp;quot;escort&amp;quot; (or scanclass &amp;quot;CLASS_POLICE&amp;quot;). Only with this role (or scanclass) the system automatically sets the '''ATTACKED''' message with the mother when an escort is attacked. With the '''ATTACKED''' message the system also sets the &amp;quot;found target&amp;quot; and the &amp;quot;primary aggressor&amp;quot; of the mother to the attacker of the escort.&lt;br /&gt;
&lt;br /&gt;
==messageMother==&lt;br /&gt;
With the command &amp;quot;messageMother: YOUR_MESSAGE&amp;quot;, the mother gets &amp;quot;'''YOUR_MESSAGE'''&amp;quot; as priority message. You can attach commands to this self defined message like any other system message. The mother immediately reacts to it.&lt;br /&gt;
&lt;br /&gt;
==Creating a spread group==&lt;br /&gt;
&lt;br /&gt;
When the desired range is set at 0.0 with using '''performEscort''' the escorts group into a V-shape. With higher values the V-shape is not so clear. You can also create a more spread out group by giving members a different distance. See next escortAI where a die roll is used to give members different distances. A die roll is also used in the FOLLOW_LEADER state to avoid the situation where all ships at once react to a '''groupAttackTarget''' message from the mother.&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
 GLOBAL = {ENTER = (); EXIT = (); UPDATE = (&amp;quot;pauseAI: 2.0&amp;quot;, &amp;quot;setStateTo: ROLL_DICE&amp;quot;); }; &lt;br /&gt;
 &amp;quot;ROLL_DICE&amp;quot; = {&lt;br /&gt;
      ENTER = (&amp;quot;rollD: 5&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (&amp;quot;setDesiredRangeTo: 100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_2&amp;quot; = (&amp;quot;setDesiredRangeTo: 600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_3&amp;quot; = (&amp;quot;setDesiredRangeTo: 1100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_4&amp;quot; = (&amp;quot;setDesiredRangeTo: 1600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_5&amp;quot; = (&amp;quot;setDesiredRangeTo: 2100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      UPDATE = (); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FIND_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;TARGET_FOUND&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: FOLLOW_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;NOTHING_FOUND&amp;quot; = (&amp;quot;setStateTo: HEAD_FOR_PLANET&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      UPDATE = (scanForFormationLeader, &amp;quot;pauseAI: 3.0&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FOLLOW_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (performEscort); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget,  &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;GROUP_ATTACK_TARGET&amp;quot; = (&amp;quot;rollD: 3&amp;quot;);&lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      &amp;quot;NOT_ESCORTING&amp;quot; = (&amp;quot;setStateTo: GLOBAL&amp;quot;); &lt;br /&gt;
      ESCORTING = (performEscort); &lt;br /&gt;
      UPDATE = (escortCheckMother, &amp;quot;pauseAI: 15&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Return to [[OXP howto AI]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10181</id>
		<title>Escort Instructions</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10181"/>
		<updated>2008-06-15T22:07:49Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Creating a spread group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Oolite contains a lot of commands related to ships with escorts. Not all commands are needed all the times. e.g. when the system adds an escorted ship, all the escorts are already set up.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding of mother ship==&lt;br /&gt;
When a mother ship is added to the universe it is checked if it can have escorts. If yes, the system is examined and a random number of 0, 2, 4 or 6 is subtracted from the maximum escort number. In safer systems it is more likely that escorts are subtracted. When the resulting number is greater than 0 this number of escorts is added as escort with the function '''setUpEscorts''' and the '''escortsAreSetup''' flag is set.&lt;br /&gt;
&lt;br /&gt;
==Adding with setUpEscorts==&lt;br /&gt;
When the function '''setUpEscorts''' is called, it first looks if the '''escortsAreSetup''' flag if false. When they were not previously setup, the escorts are set up. They all get an '''escortAI.plist''' statemachine and the scanclass and the groupID  of the mother.&lt;br /&gt;
&lt;br /&gt;
By default all ships get an escort with role &amp;quot;escort&amp;quot; and only ships with role &amp;quot;police&amp;quot; get an escort with role &amp;quot;wingman&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This default can be overruled by the keys &amp;quot;escort-role&amp;quot; or &amp;quot; escort-ship&amp;quot; in shipData.plist. When a key &amp;quot;escort-role&amp;quot; exist, escorts with this role are chosen and they keep their original role. (this is a bug because the mother will only accept escorts with role &amp;quot;escort&amp;quot;). When a key &amp;quot; escort-ship&amp;quot; exists, a ship with this name is used as escort and they get the role &amp;quot;escort&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When setup is ready they all have a '''escortAI.plist''' statemachine and the state itself is set to &amp;quot;FLYING_ESCORT&amp;quot;. The initial part in this AI were the escorts are setup is skipped as the escorts are already setup by the system. When you want to give you escorts a custom AI you can redefine this by adding the command: &amp;quot;'''switchAITo: yourCustomAI.plist'''&amp;quot; in  the ships &amp;quot;launch_actions&amp;quot; in the shipData.plist.&lt;br /&gt;
&lt;br /&gt;
There are two places were a script can use the function '''setUpEscorts'''. You can place it in the &amp;quot;launch_actions&amp;quot; of the mothership, or you can put it at the beginning of the ships AI.plist. When you  leave it, the system will determine if it will set up the escorts and how many.&lt;br /&gt;
&lt;br /&gt;
==Adding escorts from scratch==&lt;br /&gt;
Also ships that don't belong to the escort group can be assigned as escort. This start with the command '''scanForFormationLeader'''. This commands looks for ships with the same scanclass and that don't already have their maximum escorts. If such a ship exist it returns &amp;quot;TARGET_FOUND&amp;quot;. When a target is found you can initiate the escort process with: &amp;quot;'''setTargetToFoundTarget, suggestEscort'''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''suggestEscort''' first checks if the target will accept the ship as escort.  For getting accepted: &lt;br /&gt;
&lt;br /&gt;
 1: The AI stack size of the escort must be lower than 2 &lt;br /&gt;
 2: It must have a role of escort and the mother must not have the role &amp;quot;escort&amp;quot;. &lt;br /&gt;
    (or it must be wingman and the mother police or interceptor)&lt;br /&gt;
 3: The mother has not yet reached the maximum number of escorts.&lt;br /&gt;
&lt;br /&gt;
When the escort is accepted by the mother it obtains the group ID of the mother, the mother is set as owner, and the escort AI receives an &amp;quot;ESCORTING&amp;quot; message. When the escort was clean, it receives the mothers legal status increased with a small random number.&lt;br /&gt;
&lt;br /&gt;
When the escort is rejected the AI gets: &amp;quot;NOT_ESCORTING&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The requirement of having a role of &amp;quot;escort&amp;quot; makes it difficult for a normal ship getting accepted. (Starting with oolite 1.70 you can use the command: &amp;quot;'''setPrimaryRole:''' &amp;quot; to change a ship role with an AI command). Also escorts introduced by the key &amp;quot;escort-role&amp;quot; will have the wrong role for being added afterwards.&lt;br /&gt;
&lt;br /&gt;
==Maintaining escort function==&lt;br /&gt;
Once an escort is set up the command '''setDesiredRangeTo: ''' sets the follow distance to the leader and the command '''performEscort'''  will start the real escort job. From here on everything is automated and the escort speeds up to fly into a formation position. To check if everything is still OK the AI should issue the command '''escortCheckMother''' in his UPDATE.  '''escortCheckMother''' does exactly the same as '''suggestEscort''' except changing the escorts legal status.&lt;br /&gt;
&lt;br /&gt;
==The escortAI.plist==&lt;br /&gt;
Most escorts fly with this AI and the '''setUpEscorts''' function forces the AI to start with the &amp;quot;FLYING_ESCORT&amp;quot; state. When an escort is hit it receives an &amp;quot;ATTACKED&amp;quot; message but will do nothing with it other than giving this message further to the mother. The mother can react in two ways. &lt;br /&gt;
&lt;br /&gt;
1: Issue a &amp;quot;GROUP_ATTACK_TARGET&amp;quot; with the command '''groupAttackTarget'''. The escortAI.plist will then as reaction set the  AI to interceptAI.plist.&lt;br /&gt;
&lt;br /&gt;
2: Using the command '''fightOrFleeHostiles'''. This command will start the command '''deployEscorts''' by its own. (The script does not need to call '''deployEscorts''' by its own). This '''deployEscorts''' will put all escorts into an &amp;quot;interceptAI.plist&amp;quot; with the current mothers target as target.&lt;br /&gt;
&lt;br /&gt;
==Getting attacked==&lt;br /&gt;
For escorts it is essential to have a role of &amp;quot;escort&amp;quot; (or scanclass &amp;quot;CLASS_POLICE&amp;quot;). Only with this role (or scanclass) the system automatically sets the '''ATTACKED''' message with the mother when an escort is attacked. With the '''ATTACKED''' message the system also sets the &amp;quot;found target&amp;quot; and the &amp;quot;primary aggressor&amp;quot; of the mother to the attacker of the escort.&lt;br /&gt;
&lt;br /&gt;
==messageMother==&lt;br /&gt;
With the command &amp;quot;messageMother: YOUR_MESSAGE&amp;quot;, the mother gets &amp;quot;'''YOUR_MESSAGE'''&amp;quot; as priority message. You can attach commands to this self defined message like any other system message. The mother immediately reacts to it.&lt;br /&gt;
&lt;br /&gt;
==Creating a spread group==&lt;br /&gt;
&lt;br /&gt;
When the desired range is set at 0.0 with using '''performEscort''' the escorts group into a V-shape. With higher values the V-shape is not so clear. You can also create a more spreaded group by giving members a different distance. See next escortAI were a dice is used to give members different distances and a dice is also used in the FOLLOW_LEADER state to avoid that all ships at once react to a '''groupAttackTarget''' message from the mother.&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
 GLOBAL = {ENTER = (); EXIT = (); UPDATE = (&amp;quot;pauseAI: 2.0&amp;quot;, &amp;quot;setStateTo: ROLL_DICE&amp;quot;); }; &lt;br /&gt;
 &amp;quot;ROLL_DICE&amp;quot; = {&lt;br /&gt;
      ENTER = (&amp;quot;rollD: 5&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (&amp;quot;setDesiredRangeTo: 100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_2&amp;quot; = (&amp;quot;setDesiredRangeTo: 600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_3&amp;quot; = (&amp;quot;setDesiredRangeTo: 1100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_4&amp;quot; = (&amp;quot;setDesiredRangeTo: 1600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_5&amp;quot; = (&amp;quot;setDesiredRangeTo: 2100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      UPDATE = (); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FIND_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;TARGET_FOUND&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: FOLLOW_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;NOTHING_FOUND&amp;quot; = (&amp;quot;setStateTo: HEAD_FOR_PLANET&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      UPDATE = (scanForFormationLeader, &amp;quot;pauseAI: 3.0&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FOLLOW_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (performEscort); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget,  &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;GROUP_ATTACK_TARGET&amp;quot; = (&amp;quot;rollD: 3&amp;quot;);&lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      &amp;quot;NOT_ESCORTING&amp;quot; = (&amp;quot;setStateTo: GLOBAL&amp;quot;); &lt;br /&gt;
      ESCORTING = (performEscort); &lt;br /&gt;
      UPDATE = (escortCheckMother, &amp;quot;pauseAI: 15&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Return to [[OXP howto AI]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10180</id>
		<title>Escort Instructions</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10180"/>
		<updated>2008-06-15T22:01:15Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Adding escorts from scratch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Oolite contains a lot of commands related to ships with escorts. Not all commands are needed all the times. e.g. when the system adds an escorted ship, all the escorts are already set up.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding of mother ship==&lt;br /&gt;
When a mother ship is added to the universe it is checked if it can have escorts. If yes, the system is examined and a random number of 0, 2, 4 or 6 is subtracted from the maximum escort number. In safer systems it is more likely that escorts are subtracted. When the resulting number is greater than 0 this number of escorts is added as escort with the function '''setUpEscorts''' and the '''escortsAreSetup''' flag is set.&lt;br /&gt;
&lt;br /&gt;
==Adding with setUpEscorts==&lt;br /&gt;
When the function '''setUpEscorts''' is called, it first looks if the '''escortsAreSetup''' flag if false. When they were not previously setup, the escorts are set up. They all get an '''escortAI.plist''' statemachine and the scanclass and the groupID  of the mother.&lt;br /&gt;
&lt;br /&gt;
By default all ships get an escort with role &amp;quot;escort&amp;quot; and only ships with role &amp;quot;police&amp;quot; get an escort with role &amp;quot;wingman&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This default can be overruled by the keys &amp;quot;escort-role&amp;quot; or &amp;quot; escort-ship&amp;quot; in shipData.plist. When a key &amp;quot;escort-role&amp;quot; exist, escorts with this role are chosen and they keep their original role. (this is a bug because the mother will only accept escorts with role &amp;quot;escort&amp;quot;). When a key &amp;quot; escort-ship&amp;quot; exists, a ship with this name is used as escort and they get the role &amp;quot;escort&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When setup is ready they all have a '''escortAI.plist''' statemachine and the state itself is set to &amp;quot;FLYING_ESCORT&amp;quot;. The initial part in this AI were the escorts are setup is skipped as the escorts are already setup by the system. When you want to give you escorts a custom AI you can redefine this by adding the command: &amp;quot;'''switchAITo: yourCustomAI.plist'''&amp;quot; in  the ships &amp;quot;launch_actions&amp;quot; in the shipData.plist.&lt;br /&gt;
&lt;br /&gt;
There are two places were a script can use the function '''setUpEscorts'''. You can place it in the &amp;quot;launch_actions&amp;quot; of the mothership, or you can put it at the beginning of the ships AI.plist. When you  leave it, the system will determine if it will set up the escorts and how many.&lt;br /&gt;
&lt;br /&gt;
==Adding escorts from scratch==&lt;br /&gt;
Also ships that don't belong to the escort group can be assigned as escort. This start with the command '''scanForFormationLeader'''. This commands looks for ships with the same scanclass and that don't already have their maximum escorts. If such a ship exist it returns &amp;quot;TARGET_FOUND&amp;quot;. When a target is found you can initiate the escort process with: &amp;quot;'''setTargetToFoundTarget, suggestEscort'''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''suggestEscort''' first checks if the target will accept the ship as escort.  For getting accepted: &lt;br /&gt;
&lt;br /&gt;
 1: The AI stack size of the escort must be lower than 2 &lt;br /&gt;
 2: It must have a role of escort and the mother must not have the role &amp;quot;escort&amp;quot;. &lt;br /&gt;
    (or it must be wingman and the mother police or interceptor)&lt;br /&gt;
 3: The mother has not yet reached the maximum number of escorts.&lt;br /&gt;
&lt;br /&gt;
When the escort is accepted by the mother it obtains the group ID of the mother, the mother is set as owner, and the escort AI receives an &amp;quot;ESCORTING&amp;quot; message. When the escort was clean, it receives the mothers legal status increased with a small random number.&lt;br /&gt;
&lt;br /&gt;
When the escort is rejected the AI gets: &amp;quot;NOT_ESCORTING&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The requirement of having a role of &amp;quot;escort&amp;quot; makes it difficult for a normal ship getting accepted. (Starting with oolite 1.70 you can use the command: &amp;quot;'''setPrimaryRole:''' &amp;quot; to change a ship role with an AI command). Also escorts introduced by the key &amp;quot;escort-role&amp;quot; will have the wrong role for being added afterwards.&lt;br /&gt;
&lt;br /&gt;
==Maintaining escort function==&lt;br /&gt;
Once an escort is set up the command '''setDesiredRangeTo: ''' sets the follow distance to the leader and the command '''performEscort'''  will start the real escort job. From here on everything is automated and the escort speeds up to fly into a formation position. To check if everything is still OK the AI should issue the command '''escortCheckMother''' in his UPDATE.  '''escortCheckMother''' does exactly the same as '''suggestEscort''' except changing the escorts legal status.&lt;br /&gt;
&lt;br /&gt;
==The escortAI.plist==&lt;br /&gt;
Most escorts fly with this AI and the '''setUpEscorts''' function forces the AI to start with the &amp;quot;FLYING_ESCORT&amp;quot; state. When an escort is hit it receives an &amp;quot;ATTACKED&amp;quot; message but will do nothing with it other than giving this message further to the mother. The mother can react in two ways. &lt;br /&gt;
&lt;br /&gt;
1: Issue a &amp;quot;GROUP_ATTACK_TARGET&amp;quot; with the command '''groupAttackTarget'''. The escortAI.plist will then as reaction set the  AI to interceptAI.plist.&lt;br /&gt;
&lt;br /&gt;
2: Using the command '''fightOrFleeHostiles'''. This command will start the command '''deployEscorts''' by its own. (The script does not need to call '''deployEscorts''' by its own). This '''deployEscorts''' will put all escorts into an &amp;quot;interceptAI.plist&amp;quot; with the current mothers target as target.&lt;br /&gt;
&lt;br /&gt;
==Getting attacked==&lt;br /&gt;
For escorts it is essential to have a role of &amp;quot;escort&amp;quot; (or scanclass &amp;quot;CLASS_POLICE&amp;quot;). Only with this role (or scanclass) the system automatically sets the '''ATTACKED''' message with the mother when an escort is attacked. With the '''ATTACKED''' message the system also sets the &amp;quot;found target&amp;quot; and the &amp;quot;primary aggressor&amp;quot; of the mother to the attacker of the escort.&lt;br /&gt;
&lt;br /&gt;
==messageMother==&lt;br /&gt;
With the command &amp;quot;messageMother: YOUR_MESSAGE&amp;quot;, the mother gets &amp;quot;'''YOUR_MESSAGE'''&amp;quot; as priority message. You can attach commands to this self defined message like any other system message. The mother immediately reacts to it.&lt;br /&gt;
&lt;br /&gt;
==Creating a spreaded group==&lt;br /&gt;
&lt;br /&gt;
When the desired range is set at 0.0 with using '''performEscort''' the escorts group into a V-shape. With higher values the V-shape is not so clear. You can also create a more spreaded group by giving members a different distance. See next escortAI were a dice is used to give members different distances and a dice is also used in the FOLLOW_LEADER state to avoid that all ships at once react to a '''groupAttackTarget''' message from the mother.&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
 GLOBAL = {ENTER = (); EXIT = (); UPDATE = (&amp;quot;pauseAI: 2.0&amp;quot;, &amp;quot;setStateTo: ROLL_DICE&amp;quot;); }; &lt;br /&gt;
 &amp;quot;ROLL_DICE&amp;quot; = {&lt;br /&gt;
      ENTER = (&amp;quot;rollD: 5&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (&amp;quot;setDesiredRangeTo: 100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_2&amp;quot; = (&amp;quot;setDesiredRangeTo: 600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_3&amp;quot; = (&amp;quot;setDesiredRangeTo: 1100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_4&amp;quot; = (&amp;quot;setDesiredRangeTo: 1600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_5&amp;quot; = (&amp;quot;setDesiredRangeTo: 2100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      UPDATE = (); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FIND_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;TARGET_FOUND&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: FOLLOW_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;NOTHING_FOUND&amp;quot; = (&amp;quot;setStateTo: HEAD_FOR_PLANET&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      UPDATE = (scanForFormationLeader, &amp;quot;pauseAI: 3.0&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FOLLOW_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (performEscort); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget,  &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;GROUP_ATTACK_TARGET&amp;quot; = (&amp;quot;rollD: 3&amp;quot;);&lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      &amp;quot;NOT_ESCORTING&amp;quot; = (&amp;quot;setStateTo: GLOBAL&amp;quot;); &lt;br /&gt;
      ESCORTING = (performEscort); &lt;br /&gt;
      UPDATE = (escortCheckMother, &amp;quot;pauseAI: 15&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Return to [[OXP howto AI]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10179</id>
		<title>Escort Instructions</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Escort_Instructions&amp;diff=10179"/>
		<updated>2008-06-15T21:41:52Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Adding of mother ship */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Oolite contains a lot of commands related to ships with escorts. Not all commands are needed all the times. e.g. when the system adds an escorted ship, all the escorts are already set up.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Adding of mother ship==&lt;br /&gt;
When a mother ship is added to the universe it is checked if it can have escorts. If yes, the system is examined and a random number of 0, 2, 4 or 6 is subtracted from the maximum escort number. In safer systems it is more likely that escorts are subtracted. When the resulting number is greater than 0 this number of escorts is added as escort with the function '''setUpEscorts''' and the '''escortsAreSetup''' flag is set.&lt;br /&gt;
&lt;br /&gt;
==Adding with setUpEscorts==&lt;br /&gt;
When the function '''setUpEscorts''' is called, it first looks if the '''escortsAreSetup''' flag if false. When they were not previously setup, the escorts are set up. They all get an '''escortAI.plist''' statemachine and the scanclass and the groupID  of the mother.&lt;br /&gt;
&lt;br /&gt;
By default all ships get an escort with role &amp;quot;escort&amp;quot; and only ships with role &amp;quot;police&amp;quot; get an escort with role &amp;quot;wingman&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This default can be overruled by the keys &amp;quot;escort-role&amp;quot; or &amp;quot; escort-ship&amp;quot; in shipData.plist. When a key &amp;quot;escort-role&amp;quot; exist, escorts with this role are chosen and they keep their original role. (this is a bug because the mother will only accept escorts with role &amp;quot;escort&amp;quot;). When a key &amp;quot; escort-ship&amp;quot; exists, a ship with this name is used as escort and they get the role &amp;quot;escort&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When setup is ready they all have a '''escortAI.plist''' statemachine and the state itself is set to &amp;quot;FLYING_ESCORT&amp;quot;. The initial part in this AI were the escorts are setup is skipped as the escorts are already setup by the system. When you want to give you escorts a custom AI you can redefine this by adding the command: &amp;quot;'''switchAITo: yourCustomAI.plist'''&amp;quot; in  the ships &amp;quot;launch_actions&amp;quot; in the shipData.plist.&lt;br /&gt;
&lt;br /&gt;
There are two places were a script can use the function '''setUpEscorts'''. You can place it in the &amp;quot;launch_actions&amp;quot; of the mothership, or you can put it at the beginning of the ships AI.plist. When you  leave it, the system will determine if it will set up the escorts and how many.&lt;br /&gt;
&lt;br /&gt;
==Adding escorts from scratch==&lt;br /&gt;
Also ships that don't belong to the escort group can be assigned as escort. This start with the command '''scanForFormationLeader'''. This commands looks for ships with the same scanclass and that don't already have their maximum escorts. If such a ship exist it returns &amp;quot;TARGET_FOUND&amp;quot;. When a target is found you can initiate the escort process with: &amp;quot;'''setTargetToFoundTarget, suggestEscort'''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''suggestEscort''' first checks if the target will accept the ship as escort.  For getting accepted: &lt;br /&gt;
&lt;br /&gt;
 1: The AI stack size of the escort must be lower than 2 &lt;br /&gt;
 2: It must have a role of escort and the mother must not have the role &amp;quot;escort&amp;quot;. &lt;br /&gt;
    (or it must be wingman and the mother police or interceptor)&lt;br /&gt;
 3: The mother has not yet the maximum numbers of escorts.&lt;br /&gt;
&lt;br /&gt;
When the escort is accepted by the mother it obtains the group ID of the mother, the mother is set as owner and the escort AI receives an &amp;quot;ESCORTING&amp;quot; message. When the escort was clean, it receives the mothers legal status increased with a small random number.&lt;br /&gt;
&lt;br /&gt;
When the escort is rejected the AI gets: &amp;quot;NOT_ESCORTING&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The requirement of having a role of &amp;quot;escort&amp;quot; makes it difficult for a normal ship getting accepted. (Starting with oolite 1.70 you can use the command: &amp;quot;'''setPrimaryRole:''' &amp;quot; to change a shiprole with an AI command). Also escorts introduced by the key &amp;quot;escort-role&amp;quot; will have the wrong role for being added afterwards.&lt;br /&gt;
&lt;br /&gt;
==Maintaining escort function==&lt;br /&gt;
Once an escort is set up the command '''setDesiredRangeTo: ''' sets the follow distance to the leader and the command '''performEscort'''  will start the real escort job. From here on everything is automated and the escort speeds up to fly into a formation position. To check if everything is still OK the AI should issue the command '''escortCheckMother''' in his UPDATE.  '''escortCheckMother''' does exactly the same as '''suggestEscort''' except changing the escorts legal status.&lt;br /&gt;
&lt;br /&gt;
==The escortAI.plist==&lt;br /&gt;
Most escorts fly with this AI and the '''setUpEscorts''' function forces the AI to start with the &amp;quot;FLYING_ESCORT&amp;quot; state. When an escort is hit it receives an &amp;quot;ATTACKED&amp;quot; message but will do nothing with it other than giving this message further to the mother. The mother can react in two ways. &lt;br /&gt;
&lt;br /&gt;
1: Issue a &amp;quot;GROUP_ATTACK_TARGET&amp;quot; with the command '''groupAttackTarget'''. The escortAI.plist will then as reaction set the  AI to interceptAI.plist.&lt;br /&gt;
&lt;br /&gt;
2: Using the command '''fightOrFleeHostiles'''. This command will start the command '''deployEscorts''' by its own. (The script does not need to call '''deployEscorts''' by its own). This '''deployEscorts''' will put all escorts into an &amp;quot;interceptAI.plist&amp;quot; with the current mothers target as target.&lt;br /&gt;
&lt;br /&gt;
==Getting attacked==&lt;br /&gt;
For escorts it is essential to have a role of &amp;quot;escort&amp;quot; (or scanclass &amp;quot;CLASS_POLICE&amp;quot;). Only with this role (or scanclass) the system automatically sets the '''ATTACKED''' message with the mother when an escort is attacked. With the '''ATTACKED''' message the system also sets the &amp;quot;found target&amp;quot; and the &amp;quot;primary aggressor&amp;quot; of the mother to the attacker of the escort.&lt;br /&gt;
&lt;br /&gt;
==messageMother==&lt;br /&gt;
With the command &amp;quot;messageMother: YOUR_MESSAGE&amp;quot;, the mother gets &amp;quot;'''YOUR_MESSAGE'''&amp;quot; as priority message. You can attach commands to this self defined message like any other system message. The mother immediately reacts to it.&lt;br /&gt;
&lt;br /&gt;
==Creating a spreaded group==&lt;br /&gt;
&lt;br /&gt;
When the desired range is set at 0.0 with using '''performEscort''' the escorts group into a V-shape. With higher values the V-shape is not so clear. You can also create a more spreaded group by giving members a different distance. See next escortAI were a dice is used to give members different distances and a dice is also used in the FOLLOW_LEADER state to avoid that all ships at once react to a '''groupAttackTarget''' message from the mother.&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
 GLOBAL = {ENTER = (); EXIT = (); UPDATE = (&amp;quot;pauseAI: 2.0&amp;quot;, &amp;quot;setStateTo: ROLL_DICE&amp;quot;); }; &lt;br /&gt;
 &amp;quot;ROLL_DICE&amp;quot; = {&lt;br /&gt;
      ENTER = (&amp;quot;rollD: 5&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (&amp;quot;setDesiredRangeTo: 100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_2&amp;quot; = (&amp;quot;setDesiredRangeTo: 600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_3&amp;quot; = (&amp;quot;setDesiredRangeTo: 1100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_4&amp;quot; = (&amp;quot;setDesiredRangeTo: 1600&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;ROLL_5&amp;quot; = (&amp;quot;setDesiredRangeTo: 2100&amp;quot;, &amp;quot;setStateTo: FIND_LEADER&amp;quot;); &lt;br /&gt;
      UPDATE = (); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FIND_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;TARGET_FOUND&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: FOLLOW_LEADER&amp;quot;); &lt;br /&gt;
      &amp;quot;NOTHING_FOUND&amp;quot; = (&amp;quot;setStateTo: HEAD_FOR_PLANET&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      UPDATE = (scanForFormationLeader, &amp;quot;pauseAI: 3.0&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 &amp;quot;FOLLOW_LEADER&amp;quot; = {&lt;br /&gt;
      ENTER = (performEscort); &lt;br /&gt;
      ATTACKED = (setTargetToFoundTarget,  &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;);&lt;br /&gt;
      &amp;quot;GROUP_ATTACK_TARGET&amp;quot; = (&amp;quot;rollD: 3&amp;quot;);&lt;br /&gt;
      &amp;quot;ROLL_1&amp;quot; = (setTargetToFoundTarget, &amp;quot;setStateTo: ATTACK_SHIP&amp;quot;); &lt;br /&gt;
      &amp;quot;INCOMING_MISSILE&amp;quot; = (fightOrFleeMissile, &amp;quot;setStateTo: FLEE&amp;quot;); &lt;br /&gt;
      &amp;quot;NOT_ESCORTING&amp;quot; = (&amp;quot;setStateTo: GLOBAL&amp;quot;); &lt;br /&gt;
      ESCORTING = (performEscort); &lt;br /&gt;
      UPDATE = (escortCheckMother, &amp;quot;pauseAI: 15&amp;quot;); &lt;br /&gt;
      EXIT = ();&lt;br /&gt;
      }; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Return to [[OXP howto AI]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=OXP_howto_AI&amp;diff=10178</id>
		<title>OXP howto AI</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=OXP_howto_AI&amp;diff=10178"/>
		<updated>2008-06-15T21:41:11Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Navigation */ same as other edits today, so far&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''AI Script Format'''&lt;br /&gt;
&lt;br /&gt;
The AI system consists of a [[Stacked AI|stack]] of [[state machine]]s (only the top one of which is active), which respond to game events sent to them as [[Messages|messages]]. They respond by calling a series of [[methods]] which affect the behaviour of the [[entity]] and possibly trigger changes to the '''AI''' by changing the [[state]] or (more drastically) the state machine.&lt;br /&gt;
&lt;br /&gt;
Each state machine (or AI script) is described in a property list in   either [[ASCII]] or [[XML]] format, which can be edited with a text editor or with Property List Editor. The structure is of a dictionary containing each of the machine's possible states referenced by an identifying state name. Each state comprises a dictionary of responses to messages the AI might receive, referenced by the message itself. Each response is an array of methods that will be called when the AI receives that message.&lt;br /&gt;
&lt;br /&gt;
The AI function calls within a message handler are separated from each other by a comma. If a function takes a parameter the value is separated from the function name by a colon and a space, and both the function name and value are enclosed in double quotes.&lt;br /&gt;
&lt;br /&gt;
In [[ASCII]] format a simple (two-state) machine looks like this:&lt;br /&gt;
 {&lt;br /&gt;
      &amp;quot;STATE_1&amp;quot; = {&lt;br /&gt;
          &amp;quot;ENTER&amp;quot; = ();&lt;br /&gt;
          &amp;quot;MESSAGE_A&amp;quot; = (&amp;quot;method1: value&amp;quot;, method2, method3);&lt;br /&gt;
          &amp;quot;MESSAGE_B&amp;quot; = (method4, &amp;quot;setStateTo: STATE_2&amp;quot;);&lt;br /&gt;
          EXIT = ();&lt;br /&gt;
          UPDATE = ();&lt;br /&gt;
      };&lt;br /&gt;
      &amp;quot;STATE_2&amp;quot; = {&lt;br /&gt;
          &amp;quot;ENTER&amp;quot; = ();&lt;br /&gt;
          &amp;quot;MESSAGE_A&amp;quot; = (&amp;quot;method1: another_value&amp;quot;, method5);&lt;br /&gt;
          &amp;quot;MESSAGE_B&amp;quot; = (method6, method7, &amp;quot;setStateTo: STATE_1&amp;quot;);&lt;br /&gt;
          EXIT = ();&lt;br /&gt;
          UPDATE = ();&lt;br /&gt;
      };&lt;br /&gt;
 }&lt;br /&gt;
The same script in [[twostateXML|XML]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== AI ==&lt;br /&gt;
Messages to the statemachine with a [[State machine|priority]] are displayed in boldface.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''exitAI'''&lt;br /&gt;
|Exits current AI and returns to the same state in the old AI that called this AI with a &amp;quot;setAITo:&amp;quot;. It returns: &amp;quot;'''RESTARTED'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''pauseAI:(NSString *)intervalString'''&lt;br /&gt;
|Sets next AI update time in seconds. It does not stop the execution of the remainder of the line. It just sets the next UPDATE time to the current time plus the pause time. The pauseAI commands are non-cumulative.&lt;br /&gt;
|-&lt;br /&gt;
|'''setAITo:(NSString *)aiString'''&lt;br /&gt;
|Pauses current AI and switches to anotherAI.plist, this becomes the top AI on the 'AI-stack'.&lt;br /&gt;
When anotherAI.plist exits (exitAI), the previousAI becomes topAI again and AI-state is messaged &amp;quot;'''RESTARTED'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''setStateTo: SOMESTATE'''&lt;br /&gt;
|Changes the AI state to SOMESTATE.&lt;br /&gt;
|-&lt;br /&gt;
|'''switchAITo:(NSString *)aiString'''&lt;br /&gt;
|Switches entity AI to another *AI.plist, the previous AI will be exited.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== AI choices ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''fightOrFleeHostiles'''&lt;br /&gt;
|Deploys escorts if he has them. If he has enough missiles left he might fire one. Then decides between issue the FIGHTING or FLEEING message. Returns &amp;quot;FIGHTING&amp;quot;, &amp;quot;DEPLOYING_ESCORTS&amp;quot; or &amp;quot;FLEEING&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''fightOrFleeMissile'''&lt;br /&gt;
|Deals with missiles, uses ECM if available, flees if not, marks as offender if police. Returns: &amp;quot;FLEEING&amp;quot; or nothing.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Perform Action ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeEnergyBlast'''&lt;br /&gt;
|Used in the [[Q bomb]].&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeExplosion'''&lt;br /&gt;
|The entity model is replaced by an explosion. If player is docked at exploding station it first launches the player.&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeLargeExplosion'''&lt;br /&gt;
|Used at player entity death, not for use in other instances.&lt;br /&gt;
|-&lt;br /&gt;
|'''dealEnergyDamageWithinDesiredRange'''&lt;br /&gt;
|Needs desiredRange to be set first, then deals [[weaponEnergy]] ([[Shipdata.plist]]) damage within this sphere. &lt;br /&gt;
|-&lt;br /&gt;
|'''decreaseAlertLevel'''&lt;br /&gt;
|Can only be used on stations. Decreases station alertlevel. Returns: &amp;quot;'''CONDITION_YELLOW'''&amp;quot;, &amp;quot;'''CONDITION_GREEN'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''deployEscorts'''&lt;br /&gt;
|Sends the mothers primary target to all escorts and sets the statemachine of all the escorts to: interceptAI.plist.&lt;br /&gt;
|-&lt;br /&gt;
|'''dockEscorts'''&lt;br /&gt;
|Gives all existing escorts a dockingAI.plist and sets the state to ABORT so the escorts go to a waiting position for docking.&lt;br /&gt;
|-&lt;br /&gt;
|'''ejectCargo'''&lt;br /&gt;
|Ejects cargo.&lt;br /&gt;
|-&lt;br /&gt;
|'''enterTargetWormhole'''&lt;br /&gt;
|Will locate nearest wormhole, and enter it.&lt;br /&gt;
|-&lt;br /&gt;
|'''escortCheckMother'''&lt;br /&gt;
|Returns &amp;quot;ESCORTING&amp;quot; or &amp;quot;NOT_ESCORTING&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''fireECM'''&lt;br /&gt;
|Used by stations and hermits to engage ECM.&lt;br /&gt;
|-&lt;br /&gt;
|'''fireMissile'''&lt;br /&gt;
|Fires missiles on selected target. It sends a &amp;quot;'''INCOMING_MISSILE'''&amp;quot; message to the target state machine.&lt;br /&gt;
|-&lt;br /&gt;
|'''groupAttackTarget'''&lt;br /&gt;
|All ships in group will have their targets set to this entity's current target. It will return &amp;quot;'''GROUP_ATTACK_TARGET'''&amp;quot; to the sending ship as well as to all group members.&lt;br /&gt;
|-&lt;br /&gt;
|'''increaseAlertLevel'''&lt;br /&gt;
|Can only be used on stations. Increases station alertlevel. Returns: &amp;quot;'''YELLOW_ALERT'''&amp;quot;, &amp;quot;'''RED_ALERT'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''landOnPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find, increments the landed shuttles counter for that planet and 'removes' the entity. Returns: &amp;quot;'''LANDED_ON_PLANET'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Launch..''Some''Ship'''&lt;br /&gt;
|Launches a ship fron a dockable entity, various types of this method exist. See also [[Station Ships]].&lt;br /&gt;
* LaunchDefenseShip     &lt;br /&gt;
* LaunchEscort&lt;br /&gt;
* LaunchMiner&lt;br /&gt;
* LaunchPatrol&lt;br /&gt;
* LaunchPirateShip&lt;br /&gt;
* LaunchPolice&lt;br /&gt;
* LaunchScavenger&lt;br /&gt;
* LaunchShipWithRole: &amp;lt;Role&amp;gt;&lt;br /&gt;
* LaunchShuttle&lt;br /&gt;
* LaunchTrader&lt;br /&gt;
|-&lt;br /&gt;
|'''markTargetForFines'''&lt;br /&gt;
|Deals out a fine to target. It returns: &amp;quot;TARGET_MARKED&amp;quot;. When the target was no ship it returns: &amp;quot;'''TARGET_LOST'''&amp;quot;.&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;markTargetForFines: 100&amp;quot;&lt;br /&gt;
Will fine the target 10Cr. N.B. for commercial transactions &amp;quot;awardMoney -$&amp;quot; is a more suitable method.&lt;br /&gt;
|-&lt;br /&gt;
|'''markTargetForOffence:(NSString*) valueString'''&lt;br /&gt;
|Has police mark up the criminal record ([[Legal status]]) of target entity.  The value is not added to the criminal record but a bit-wise OR is used between value and criminal record. It returns: &amp;quot;'''TARGET_LOST'''&amp;quot; when the target was no ship.&lt;br /&gt;
|-&lt;br /&gt;
|'''messageMother:(NSString *)msgString'''&lt;br /&gt;
|Sends a AI priority message to the mothership/leader of a group.&lt;br /&gt;
Example:&lt;br /&gt;
 INCOMING_MISSILE = (&amp;quot;messageMother: INCOMING_MISSILE&amp;quot;);&lt;br /&gt;
The mothership will then behave as if it was targeted by the missile. But you don't have to use standard message names, you can also send self defined message names were the mother can react on.&lt;br /&gt;
|-&lt;br /&gt;
|'''performAttack'''&lt;br /&gt;
|Attacks target.&lt;br /&gt;
|-&lt;br /&gt;
|'''performCollect'''&lt;br /&gt;
|Performs 'collection' of target.&lt;br /&gt;
|-&lt;br /&gt;
|'''performDocking'''&lt;br /&gt;
|NOT YET IMPLEMENTED.&lt;br /&gt;
|-&lt;br /&gt;
|'''performEscort'''&lt;br /&gt;
|Performs escorting. Needs a desired range first. The escorts follow at the desired range. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''performFaceDestination'''&lt;br /&gt;
|Has entity face destination. Returns &amp;quot;FACING_DESTINATION&amp;quot; when turn is completed.&lt;br /&gt;
|-&lt;br /&gt;
|'''performFlee'''&lt;br /&gt;
|Sets the caller (AI) to flee from it's primary target at maximum speed. If the caller has a cloaking device, it will be activated. It needs a range to be set first. When the ship outruns the attacker by this distance it returns: &amp;quot;REACHED_SAFETY&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performFlyToRangeFromDestination'''&lt;br /&gt;
|With this command the ship can react in two ways. It first looks at the distance to the target. When it is closer to the target than the previously defined desired range, it will fly away from the target, otherwise it will fly toward the target. It stops the ship at the desired range from the destination and than returns: &amp;quot;DESIRED_RANGE_ACHIEVED&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHold'''&lt;br /&gt;
|Performs idleness while tracking a potential target, speed is set to zero. [[frustration]] level is reset.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHyperSpaceExit'''&lt;br /&gt;
|Gets a list of destinations within fuel range, checks if clear of nearby masses, and select one at random. May return &amp;quot;'''WITCHSPACE UNAVAILABLE'''&amp;quot;, &amp;quot;'''WITCHSPACE BLOCKED'''&amp;quot; or &amp;quot;'''WITCHSPACE_OKAY'''&amp;quot;. It will add a new ship with the same role as the leaving ship at the witchspace entry point.&lt;br /&gt;
&lt;br /&gt;
When the player performs a hyperspace exit or a galactic jump, all NPC ships get the priority message: &amp;quot;'''PLAYER WITCHSPACE'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHyperSpaceExitWithoutReplacing'''&lt;br /&gt;
|Gets a list of destinations within fuel range, checks if clear of nearby masses, and select one at random. May return &amp;quot;'''WITCHSPACE UNAVAILABLE'''&amp;quot;, &amp;quot;'''WITCHSPACE BLOCKED'''&amp;quot; or &amp;quot;'''WITCHSPACE_OKAY'''&amp;quot;. This command will not add a new ship at the witchspace entry point. (available with version 1.70 and higher)&lt;br /&gt;
|-&lt;br /&gt;
|'''performIdle'''&lt;br /&gt;
|Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight, speed is unaffected. [[frustration]] level is reset to zero.&lt;br /&gt;
|-&lt;br /&gt;
|'''performIntercept'''&lt;br /&gt;
|Performs target interception. It needs a range to be set first. When the distance to target becomes less than desired range it returns: &amp;quot;'''DESIRED_RANGE_ACHIEVED'''&amp;quot;. When target lost: &amp;quot;'''TARGET_LOST'''&amp;quot;. When it hasn't come closer to target for 10 seconds it returns: &amp;quot;'''FRUSTRATED'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''performMining'''&lt;br /&gt;
|Performs mining. (Finds, intercepts and shoots asteroids with [[mining]] laser, if fitted.) It returns: &amp;quot;'''TARGET_LOST'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performTumble'''&lt;br /&gt;
|Performs random pitch and roll, 'evasive maneuvers'.&lt;br /&gt;
|-&lt;br /&gt;
|'''setSpeedTo:(NSString *)speedString'''&lt;br /&gt;
|Sets desired speed to an absolute value, entity cannot go faster than maxspeed value determined in the [[shipdata.plist]]. If speed is above maxspeed, entity will use fuel injectors if available. &lt;br /&gt;
|-&lt;br /&gt;
|'''setSpeedFactorTo:(NSString *)speedString'''&lt;br /&gt;
|Sets the desired speed to a percentage of maxspeed (0-&amp;gt;1=0%-&amp;gt;100%). If speedfactor is set above 100%, entity will use fuelinjectors if available.&lt;br /&gt;
|-&lt;br /&gt;
|'''setUpEscorts'''&lt;br /&gt;
|Useful to quickly establish (by name and number the [[Shipdata.plist#escorts|shipdata.plist]] prescribed) escorts, when a ship is introduced to a system. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''suggestEscort'''&lt;br /&gt;
|Has an escort seek employment and either gets accepted or rejected by the &amp;quot;mother&amp;quot;. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''switchLightsOff'''&lt;br /&gt;
|If an entity has lights (or flashers), this command will turn them off. Default state is on. (See [[Shipdata.plist#subentities|shipdata.plist]])&lt;br /&gt;
|-&lt;br /&gt;
|'''switchLightsOn'''&lt;br /&gt;
|Will turn flashers back on.&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeEntireGroup'''&lt;br /&gt;
|Wormholes ships in this group.  Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeEscorts'''&lt;br /&gt;
|Wormholes official escorts. Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeGroup'''&lt;br /&gt;
|Wormholes ships in group of which this is a leader.  Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''****'''&lt;br /&gt;
|The aegis check is part of the system update and messages needs no command to generate them. The following messages are '''only generated''' when the status '''changes'''.&lt;br /&gt;
&amp;quot;AEGIS_CLOSE_TO_PLANET&amp;quot;:   Within 3x planetary radius and not near station.&lt;br /&gt;
&amp;quot;AEGIS_IN_DOCKING_RANGE&amp;quot;:  Within 2x scanner radius of system station.&lt;br /&gt;
&amp;quot;AEGIS_LEAVING_DOCKING_RANGE&amp;quot;: Has been in docking range but now only close to planet.&lt;br /&gt;
&amp;quot;AEGIS_NONE&amp;quot;: None of the above three messages is true.&lt;br /&gt;
|-&lt;br /&gt;
|'''****'''&lt;br /&gt;
|The surface check needs no command. It automatically generates messages when a ship passes a border at approximately 1 meter from the main planet surface.&lt;br /&gt;
&amp;quot;'''APPROACHING_SURFACE'''&amp;quot;: passed the border inward.&lt;br /&gt;
&amp;quot;'''LEAVING_SURFACE'''&amp;quot;:  passed the border outward.&lt;br /&gt;
|-&lt;br /&gt;
|'''abortDocking'''&lt;br /&gt;
|Signal the mother station that the docking is aborted. see [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''getWitchspaceEntryCoordinates'''&lt;br /&gt;
|Calculates coordinates at 10 km from the rotation axis of the nearest station it can find, or just fly 10s forward.&lt;br /&gt;
|-&lt;br /&gt;
|'''recallDockingInstructions'''&lt;br /&gt;
|see [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''requestDockingCoordinates'''&lt;br /&gt;
|Requests coordinates from the nearest station it can find (which may be a Rock hermit). Returns: &amp;quot;NO_STATION_FOUND&amp;quot;, &amp;quot;TRY_AGAIN_LATER&amp;quot;, &amp;quot;HOLD_POSITION&amp;quot;, &amp;quot;BACK_OFF&amp;quot; , &amp;quot;APPROACH&amp;quot; or &amp;quot;APPROACH_COORDINATES&amp;quot;. see also [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''setCoordinates:(NSString *)system_x_y_z'''&lt;br /&gt;
|Sets destination coords, see '''[[Methods#Looking_for.2C_and_adding_ships|addShipsAt]]'''. It needs 4 parameters separated with space. When coordinates are set it returns: &amp;quot;APPROACH_COORDINATES&amp;quot;. You can even [[setCoordinates_randomizer|randomize]] positive coordinates.&lt;br /&gt;
|-&lt;br /&gt;
|'''setCourseToPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find, sets the coordinates to a point on the ship's side of the surface with a large random spread to avoid all ships flying to the same point. Then it sets the desired range to 50 m (+ its own collision diameter). This short desired range will probably crash normal fast flying ships on the surface but a collision between the planet and a ship with role &amp;quot;shuttle&amp;quot; is interpreted as landing.&lt;br /&gt;
|-&lt;br /&gt;
|'''setCourseToWitchpoint'''&lt;br /&gt;
|Sets destination coords to Witchpoint area and sets &amp;quot;DesiredRange&amp;quot; to 10 km.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDesiredRangeTo:(NSString *)rangeString'''&lt;br /&gt;
|Some methods (such as scanForNearestMerchantmen, checkCourseToDestination, checkDistanceTravelled, etc) require a &amp;quot;desired range&amp;quot; parameter to be set before they can be used.&lt;br /&gt;
&lt;br /&gt;
This method is used to set the desired range. There is only one value for desired range within an instance of the AI. The value of desired range is modified internally by AI methods such as fightOrFleeMissile, setCourseToWitchpoint, and setPlanetPatrolCoordinates.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationFromCoordinates'''&lt;br /&gt;
|Enables the plotting of manual waypoints.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToCurrentLocation'''&lt;br /&gt;
|This method sets the destination of the current entity to its current location plus a random offset of up to 0.5 metres in the X, Y, and Z coordinates. This can be used to make a ship idle in a small area of space without being completely still.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToDockingAbort'''&lt;br /&gt;
|DockingAbort coordinates 8000 meter distance from the docking slit.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToStationBeacon'''&lt;br /&gt;
|Gets station beacon position.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToTarget'''&lt;br /&gt;
|Sets destination to target coords.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToWitchpoint'''&lt;br /&gt;
|Sets destination coordinates to WitchspaceExitPosition.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationWithinTarget'''&lt;br /&gt;
|Handy for ramming and racing.&lt;br /&gt;
|-&lt;br /&gt;
|'''setPlanetPatrolCoordinates'''&lt;br /&gt;
|Request coordinates for planet control. Read more in [[setPlanetPatrolCoordinates]].&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimEndCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimExitCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimStartCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToSystemStation'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToStation'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTakeOffFromPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find and calculates a vector perpendicular to the surface and sets a destination range of 10 km. Does nothing if there is no planet to be found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Communication ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''******'''&lt;br /&gt;
|Hitting a clean ship automatical sends a &amp;quot;'''OFFENCE_COMMITTED'''&amp;quot; to all nearby ships with scanClass equal CLASS_NEUTRAL, CLASS_STATION, CLASS_BUOY, CLASS_POLICE, CLASS_MILITARY, CLASS_PLAYER. Besides this all the ships flying in a group like pirates, police or escorts get an &amp;quot;'''ATTACKED'''&amp;quot; message as when they were attacked themself.&lt;br /&gt;
|-&lt;br /&gt;
|'''broadcastDistressMessage'''&lt;br /&gt;
|Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack. This command resets a previous found target to none at the sending side. It returns: &amp;quot;'''ACCEPT_DISTRESS_MESSAGE'''&amp;quot; in the AI of Stations, Hunters and Police ships and gives them as&amp;quot; Found Target&amp;quot;, the &amp;quot;Primary Target&amp;quot; of the sender of the broadcast.&lt;br /&gt;
|-&lt;br /&gt;
|'''commsMessage:(NSString *)valueString'''&lt;br /&gt;
|Broadcasts a general message to player.&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;sendCommsMessage: [thargoid_curses]&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''patrolReportIn'''&lt;br /&gt;
|This command sets the &amp;quot;last patrol report time&amp;quot; to the current time. Only useful for station patrol.&lt;br /&gt;
|-&lt;br /&gt;
|'''sendTargetCommsMessage:(NSString*) message'''&lt;br /&gt;
|Sends any message to the established (found) target. When the target is not a ship it returns: &amp;quot;'''TARGET_LOST'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;sendTargetCommsMessage: Listen to me!!&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Locating entities ==&lt;br /&gt;
&lt;br /&gt;
All these methods require a range to be set by setDesiredRange or by &amp;lt;scanner_range&amp;gt; in [[shipdata.plist]], all will return the message TARGET_FOUND or NOTHING_FOUND. The calling entity remembers the found target, but it does not become the current (universal) target. It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.&lt;br /&gt;
&lt;br /&gt;
When you are continuously scanning as in a update event, make sure you add also a pause command. Scanning takes time and in most cases one scan every few seconds is enough. Look also at Oolites internal AI's were this timing is well thought of.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''checkCourseToDestination'''&lt;br /&gt;
|Will return &amp;quot;COURSE_OK&amp;quot; when no obstacles on the direct route, else it calculates a little deviated save vector and returns &amp;quot;WAYPOINT_SET&amp;quot;. When there is a small ship in his way it also returns: '''HAZARD_CAN_BE_DESTROYED'''&lt;br /&gt;
|-&lt;br /&gt;
|'''checkDistanceTravelled'''&lt;br /&gt;
|First you must define a range with setDesiredRangeTo:. When the total traveled distance since creation is greater than this value it returns: &amp;quot;GONE_BEYOND_RANGE&amp;quot;. Used  for missiles.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkGroupOddsVersusTarget'''&lt;br /&gt;
|Will return &amp;quot;ODDS_GOOD&amp;quot;, &amp;quot;ODDS_LEVEL&amp;quot; or &amp;quot;ODDS_BAD&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForFullHold'''&lt;br /&gt;
|If entity's cargo capacity is reached, will return &amp;quot;HOLD_FULL&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForMotherStation'''&lt;br /&gt;
|Will return &amp;quot;STATION_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForNormalSpace'''&lt;br /&gt;
|Will return &amp;quot;NORMAL_SPACE&amp;quot; or &amp;quot;INTERSTELLAR_SPACE&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkTargetLegalStatus'''&lt;br /&gt;
|Returns &amp;quot;TARGET_CLEAN, &amp;quot;TARGET_MINOR_OFFENDER&amp;quot;, &amp;quot;TARGET_OFFENDER&amp;quot;, &amp;quot;TARGET_FUGITIVE&amp;quot; or &amp;quot;NO_TARGET&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''findNearestPlanet'''&lt;br /&gt;
|Will scan for planetentity. Returns nothing. Nearest planet coordinates are placed in destination memory.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForFormationLeader'''&lt;br /&gt;
|Locates the nearest suitable formation leader in range. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForHostiles'''&lt;br /&gt;
|Locates all the ships in range targeting the receiver and ships with &amp;quot;SCANNCLASS_TARGOID&amp;quot; and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForLoot'''&lt;br /&gt;
|Scans for nearest debris in range.&lt;br /&gt;
Returns: &amp;quot;HOLD_FULL&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
If scanning ship is moving station or has no scoop it always return: &amp;quot;NOTHING_FOUND&amp;quot;. If scanning ship has scanClass: &amp;quot;CLASS_POLICE&amp;quot;, it only finds slaves and lifepods.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestMerchantmen'''&lt;br /&gt;
|Scans for ships with role: Trader or Player and selects the nearest. If scanning ship has role Pirate it prefers the player.&lt;br /&gt;
Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithRole:(NSString*) scanRole'''&lt;br /&gt;
|Locates all the ships in range and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNonThargoid'''&lt;br /&gt;
|Locates all the non thargoid ships in range and chooses the nearest. It finds everything except cargo and ships with a role starting with: &amp;quot;tharg&amp;quot;. If it finds the player it prefers the player. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForOffenders'''&lt;br /&gt;
|Locates all the ships in range, subtracts a random value between 0 and 255 from their legal status or bounty and compares the remaining value. It chooses the worst offender. Because of the random value not all ships are found in every scan and the lower the bounty the longer it takes to detect him as  offender. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRandomLoot'''&lt;br /&gt;
|Scans for debris in range and selects one at random from the first 16 found.&lt;br /&gt;
Returns: &amp;quot;HOLD_FULL&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
If scanning ship is station or has no scoop it always return: &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRandomMerchantmen'''&lt;br /&gt;
|Scans for ships with role: Trader or Player and selects one at random. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRocks'''&lt;br /&gt;
|Scans for nearest boulder in range. When nothing found then scans for nearest asteroid in range. Returns &amp;quot;TARGET_FOUND&amp;quot; or  &amp;quot;NOTING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForThargoid'''&lt;br /&gt;
|Locates all the ships with role &amp;quot;thargoid&amp;quot; in range and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Targeting ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''requestNewTarget'''&lt;br /&gt;
|Locates all the ships in range targeting the mother ship, and chooses the nearest/biggest. Returns: &amp;quot;MOTHER_LOST&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToFoundTarget'''&lt;br /&gt;
|Affirms a TARGET_FOUND by a scanFor- or find-Something-method as the universal target.&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToPrimaryAggressor'''&lt;br /&gt;
|This function sets the primary agressor to the primary target. Then in the &amp;quot;performAttack&amp;quot; state, it only has a 25% change of setting the primary agressor to the primary target. The other 75% it will do nothing. This function is designed for used during attack to prevent it will constantly change targets when attacking a group.&lt;br /&gt;
&lt;br /&gt;
primary agressor is set by the system when a ship fires a laser or missile on the other. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''addFuel:(NSString*) fuel_number'''&lt;br /&gt;
|Changes player's fuel level by fuel_number LY's, max to 7.0 min to 0.0.&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeUncontrolledThargon'''&lt;br /&gt;
|Changes ship into cargo with scannClass &amp;quot;CLASS_CARGO&amp;quot; and sets AI to &amp;quot;dumbAI&amp;quot;. If also the the cargo type is defined in ShipData.plist it can be picked up like any other cargo.&lt;br /&gt;
|-&lt;br /&gt;
|'''initialiseTurret'''&lt;br /&gt;
|Prepares the turret. As turrets have no statemachine of their own, this function can only be used in the setup_actions of the turrets shipData.&lt;br /&gt;
|-&lt;br /&gt;
|'''rollD:(NSString*) dice_number'''&lt;br /&gt;
|Uses &amp;quot;dice&amp;quot; for random situation use. It returns &amp;quot;'''ROLL_1'''&amp;quot;, &amp;quot;'''ROLL_2'''&amp;quot; and so on until dice_number. dice_number is an integer and has no size limit.&lt;br /&gt;
&lt;br /&gt;
Example 1, 3 options in someAI.plist:&lt;br /&gt;
 GLOBAL = {&lt;br /&gt;
   ENTER = (&amp;quot;rollD: 3&amp;quot;); &lt;br /&gt;
   &amp;quot;ROLL_1&amp;quot; = (action1);&lt;br /&gt;
   &amp;quot;ROLL_2&amp;quot; = (action2);&lt;br /&gt;
   &amp;quot;ROLL_3&amp;quot; = (action3);}&lt;br /&gt;
&lt;br /&gt;
Example 2, 50% chance in [[script.plist]];&lt;br /&gt;
 [[Script.plist#conditions|conditions]] = (&amp;quot;d100_number lessthan 50&amp;quot;);&lt;br /&gt;
 [[Script.plist#do|do]] = (action1);&lt;br /&gt;
 [[Script.plist#else|else]] = (action2);&lt;br /&gt;
is similar in function.&lt;br /&gt;
|-&lt;br /&gt;
|'''safeScriptActionOnTarget:(NSString*) action'''&lt;br /&gt;
|This will do a script action on the target. For NPC ships as target you can use all the AI commands available that will act as if its own AI used the command. (command introduced with version 1.71)&lt;br /&gt;
&lt;br /&gt;
It will also execute player script commands, like setting mission variables. For this to work it needs a target being set. It doesn't matter witch one.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;scriptActionOnTarget: set: mission_my_missionvariable TRUE&amp;quot;,&lt;br /&gt;
 &amp;quot;scriptActionOnTarget: awardCredits: 100&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scriptActionOnTarget:(NSString*) action'''&lt;br /&gt;
|This will do the same as safeScriptActionOnTarget, but in addition the legacy script engine is started so all installed player scripts are evaluated immediately. Use of this command is discouraged in favour of safeScriptActionOnTarget as it takes a lot of time to evaluate all scripts and in most situations this is also unnecessary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|'''sendScriptMessage: message'''&lt;br /&gt;
|Calls the javaScript function '''message()''' on the ship’s [[Oolite JavaScript Reference: Script|ship script]]. Added in Oolite 1.70. This function opens the whole js power to the AI scripting.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Role scanning methods ==&lt;br /&gt;
Starting with version 1.70 next commands will become available. This info is still preliminary until the actual release.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithPrimaryRole:(NSString*) role'''&lt;br /&gt;
|new (preferred) name for '''scanForNearestShipWithRole:'''.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipHavingRole:(NSString*) role'''&lt;br /&gt;
|scan based on entire role set rather than primary role.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithAnyPrimaryRole:(NSString*) role-list'''&lt;br /&gt;
|takes a list of roles (space-separated) and returns the nearest ship with any of them as primary. &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipHavingAnyRole:(NSString*) role-list'''&lt;br /&gt;
|takes a list of roles (space-separated) and returns the nearest ship with any of them in its role set.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithScanClass:(NSString*) scanclass'''&lt;br /&gt;
|searches for a ship by scan class.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutPrimaryRole:(NSString*) role'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipNotHavingRole:(NSString*) role'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutAnyPrimaryRole:(NSString*) role-list'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipNotHavingAnyRole:(NSString*) role-list'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutScanClass:(NSString*) scanclass'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''setPrimaryRole:(NSString*) role'''&lt;br /&gt;
|Sets the primary role for a ship.&lt;br /&gt;
|}&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
[[Category:Oolite]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=OXP_howto_AI&amp;diff=10177</id>
		<title>OXP howto AI</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=OXP_howto_AI&amp;diff=10177"/>
		<updated>2008-06-15T21:35:32Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Perform Action */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''AI Script Format'''&lt;br /&gt;
&lt;br /&gt;
The AI system consists of a [[Stacked AI|stack]] of [[state machine]]s (only the top one of which is active), which respond to game events sent to them as [[Messages|messages]]. They respond by calling a series of [[methods]] which affect the behaviour of the [[entity]] and possibly trigger changes to the '''AI''' by changing the [[state]] or (more drastically) the state machine.&lt;br /&gt;
&lt;br /&gt;
Each state machine (or AI script) is described in a property list in   either [[ASCII]] or [[XML]] format, which can be edited with a text editor or with Property List Editor. The structure is of a dictionary containing each of the machine's possible states referenced by an identifying state name. Each state comprises a dictionary of responses to messages the AI might receive, referenced by the message itself. Each response is an array of methods that will be called when the AI receives that message.&lt;br /&gt;
&lt;br /&gt;
The AI function calls within a message handler are separated from each other by a comma. If a function takes a parameter the value is separated from the function name by a colon and a space, and both the function name and value are enclosed in double quotes.&lt;br /&gt;
&lt;br /&gt;
In [[ASCII]] format a simple (two-state) machine looks like this:&lt;br /&gt;
 {&lt;br /&gt;
      &amp;quot;STATE_1&amp;quot; = {&lt;br /&gt;
          &amp;quot;ENTER&amp;quot; = ();&lt;br /&gt;
          &amp;quot;MESSAGE_A&amp;quot; = (&amp;quot;method1: value&amp;quot;, method2, method3);&lt;br /&gt;
          &amp;quot;MESSAGE_B&amp;quot; = (method4, &amp;quot;setStateTo: STATE_2&amp;quot;);&lt;br /&gt;
          EXIT = ();&lt;br /&gt;
          UPDATE = ();&lt;br /&gt;
      };&lt;br /&gt;
      &amp;quot;STATE_2&amp;quot; = {&lt;br /&gt;
          &amp;quot;ENTER&amp;quot; = ();&lt;br /&gt;
          &amp;quot;MESSAGE_A&amp;quot; = (&amp;quot;method1: another_value&amp;quot;, method5);&lt;br /&gt;
          &amp;quot;MESSAGE_B&amp;quot; = (method6, method7, &amp;quot;setStateTo: STATE_1&amp;quot;);&lt;br /&gt;
          EXIT = ();&lt;br /&gt;
          UPDATE = ();&lt;br /&gt;
      };&lt;br /&gt;
 }&lt;br /&gt;
The same script in [[twostateXML|XML]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== AI ==&lt;br /&gt;
Messages to the statemachine with a [[State machine|priority]] are displayed in boldface.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''exitAI'''&lt;br /&gt;
|Exits current AI and returns to the same state in the old AI that called this AI with a &amp;quot;setAITo:&amp;quot;. It returns: &amp;quot;'''RESTARTED'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''pauseAI:(NSString *)intervalString'''&lt;br /&gt;
|Sets next AI update time in seconds. It does not stop the execution of the remainder of the line. It just sets the next UPDATE time to the current time plus the pause time. The pauseAI commands are non-cumulative.&lt;br /&gt;
|-&lt;br /&gt;
|'''setAITo:(NSString *)aiString'''&lt;br /&gt;
|Pauses current AI and switches to anotherAI.plist, this becomes the top AI on the 'AI-stack'.&lt;br /&gt;
When anotherAI.plist exits (exitAI), the previousAI becomes topAI again and AI-state is messaged &amp;quot;'''RESTARTED'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''setStateTo: SOMESTATE'''&lt;br /&gt;
|Changes the AI state to SOMESTATE.&lt;br /&gt;
|-&lt;br /&gt;
|'''switchAITo:(NSString *)aiString'''&lt;br /&gt;
|Switches entity AI to another *AI.plist, the previous AI will be exited.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== AI choices ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''fightOrFleeHostiles'''&lt;br /&gt;
|Deploys escorts if he has them. If he has enough missiles left he might fire one. Then decides between issue the FIGHTING or FLEEING message. Returns &amp;quot;FIGHTING&amp;quot;, &amp;quot;DEPLOYING_ESCORTS&amp;quot; or &amp;quot;FLEEING&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''fightOrFleeMissile'''&lt;br /&gt;
|Deals with missiles, uses ECM if available, flees if not, marks as offender if police. Returns: &amp;quot;FLEEING&amp;quot; or nothing.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Perform Action ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeEnergyBlast'''&lt;br /&gt;
|Used in the [[Q bomb]].&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeExplosion'''&lt;br /&gt;
|The entity model is replaced by an explosion. If player is docked at exploding station it first launches the player.&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeLargeExplosion'''&lt;br /&gt;
|Used at player entity death, not for use in other instances.&lt;br /&gt;
|-&lt;br /&gt;
|'''dealEnergyDamageWithinDesiredRange'''&lt;br /&gt;
|Needs desiredRange to be set first, then deals [[weaponEnergy]] ([[Shipdata.plist]]) damage within this sphere. &lt;br /&gt;
|-&lt;br /&gt;
|'''decreaseAlertLevel'''&lt;br /&gt;
|Can only be used on stations. Decreases station alertlevel. Returns: &amp;quot;'''CONDITION_YELLOW'''&amp;quot;, &amp;quot;'''CONDITION_GREEN'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''deployEscorts'''&lt;br /&gt;
|Sends the mothers primary target to all escorts and sets the statemachine of all the escorts to: interceptAI.plist.&lt;br /&gt;
|-&lt;br /&gt;
|'''dockEscorts'''&lt;br /&gt;
|Gives all existing escorts a dockingAI.plist and sets the state to ABORT so the escorts go to a waiting position for docking.&lt;br /&gt;
|-&lt;br /&gt;
|'''ejectCargo'''&lt;br /&gt;
|Ejects cargo.&lt;br /&gt;
|-&lt;br /&gt;
|'''enterTargetWormhole'''&lt;br /&gt;
|Will locate nearest wormhole, and enter it.&lt;br /&gt;
|-&lt;br /&gt;
|'''escortCheckMother'''&lt;br /&gt;
|Returns &amp;quot;ESCORTING&amp;quot; or &amp;quot;NOT_ESCORTING&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''fireECM'''&lt;br /&gt;
|Used by stations and hermits to engage ECM.&lt;br /&gt;
|-&lt;br /&gt;
|'''fireMissile'''&lt;br /&gt;
|Fires missiles on selected target. It sends a &amp;quot;'''INCOMING_MISSILE'''&amp;quot; message to the target state machine.&lt;br /&gt;
|-&lt;br /&gt;
|'''groupAttackTarget'''&lt;br /&gt;
|All ships in group will have their targets set to this entity's current target. It will return &amp;quot;'''GROUP_ATTACK_TARGET'''&amp;quot; to the sending ship as well as to all group members.&lt;br /&gt;
|-&lt;br /&gt;
|'''increaseAlertLevel'''&lt;br /&gt;
|Can only be used on stations. Increases station alertlevel. Returns: &amp;quot;'''YELLOW_ALERT'''&amp;quot;, &amp;quot;'''RED_ALERT'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''landOnPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find, increments the landed shuttles counter for that planet and 'removes' the entity. Returns: &amp;quot;'''LANDED_ON_PLANET'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Launch..''Some''Ship'''&lt;br /&gt;
|Launches a ship fron a dockable entity, various types of this method exist. See also [[Station Ships]].&lt;br /&gt;
* LaunchDefenseShip     &lt;br /&gt;
* LaunchEscort&lt;br /&gt;
* LaunchMiner&lt;br /&gt;
* LaunchPatrol&lt;br /&gt;
* LaunchPirateShip&lt;br /&gt;
* LaunchPolice&lt;br /&gt;
* LaunchScavenger&lt;br /&gt;
* LaunchShipWithRole: &amp;lt;Role&amp;gt;&lt;br /&gt;
* LaunchShuttle&lt;br /&gt;
* LaunchTrader&lt;br /&gt;
|-&lt;br /&gt;
|'''markTargetForFines'''&lt;br /&gt;
|Deals out a fine to target. It returns: &amp;quot;TARGET_MARKED&amp;quot;. When the target was no ship it returns: &amp;quot;'''TARGET_LOST'''&amp;quot;.&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;markTargetForFines: 100&amp;quot;&lt;br /&gt;
Will fine the target 10Cr. N.B. for commercial transactions &amp;quot;awardMoney -$&amp;quot; is a more suitable method.&lt;br /&gt;
|-&lt;br /&gt;
|'''markTargetForOffence:(NSString*) valueString'''&lt;br /&gt;
|Has police mark up the criminal record ([[Legal status]]) of target entity.  The value is not added to the criminal record but a bit-wise OR is used between value and criminal record. It returns: &amp;quot;'''TARGET_LOST'''&amp;quot; when the target was no ship.&lt;br /&gt;
|-&lt;br /&gt;
|'''messageMother:(NSString *)msgString'''&lt;br /&gt;
|Sends a AI priority message to the mothership/leader of a group.&lt;br /&gt;
Example:&lt;br /&gt;
 INCOMING_MISSILE = (&amp;quot;messageMother: INCOMING_MISSILE&amp;quot;);&lt;br /&gt;
The mothership will then behave as if it was targeted by the missile. But you don't have to use standard message names, you can also send self defined message names were the mother can react on.&lt;br /&gt;
|-&lt;br /&gt;
|'''performAttack'''&lt;br /&gt;
|Attacks target.&lt;br /&gt;
|-&lt;br /&gt;
|'''performCollect'''&lt;br /&gt;
|Performs 'collection' of target.&lt;br /&gt;
|-&lt;br /&gt;
|'''performDocking'''&lt;br /&gt;
|NOT YET IMPLEMENTED.&lt;br /&gt;
|-&lt;br /&gt;
|'''performEscort'''&lt;br /&gt;
|Performs escorting. Needs a desired range first. The escorts follow at the desired range. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''performFaceDestination'''&lt;br /&gt;
|Has entity face destination. Returns &amp;quot;FACING_DESTINATION&amp;quot; when turn is completed.&lt;br /&gt;
|-&lt;br /&gt;
|'''performFlee'''&lt;br /&gt;
|Sets the caller (AI) to flee from it's primary target at maximum speed. If the caller has a cloaking device, it will be activated. It needs a range to be set first. When the ship outruns the attacker by this distance it returns: &amp;quot;REACHED_SAFETY&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performFlyToRangeFromDestination'''&lt;br /&gt;
|With this command the ship can react in two ways. It first looks at the distance to the target. When it is closer to the target than the previously defined desired range, it will fly away from the target, otherwise it will fly toward the target. It stops the ship at the desired range from the destination and than returns: &amp;quot;DESIRED_RANGE_ACHIEVED&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHold'''&lt;br /&gt;
|Performs idleness while tracking a potential target, speed is set to zero. [[frustration]] level is reset.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHyperSpaceExit'''&lt;br /&gt;
|Gets a list of destinations within fuel range, checks if clear of nearby masses, and select one at random. May return &amp;quot;'''WITCHSPACE UNAVAILABLE'''&amp;quot;, &amp;quot;'''WITCHSPACE BLOCKED'''&amp;quot; or &amp;quot;'''WITCHSPACE_OKAY'''&amp;quot;. It will add a new ship with the same role as the leaving ship at the witchspace entry point.&lt;br /&gt;
&lt;br /&gt;
When the player performs a hyperspace exit or a galactic jump, all NPC ships get the priority message: &amp;quot;'''PLAYER WITCHSPACE'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHyperSpaceExitWithoutReplacing'''&lt;br /&gt;
|Gets a list of destinations within fuel range, checks if clear of nearby masses, and select one at random. May return &amp;quot;'''WITCHSPACE UNAVAILABLE'''&amp;quot;, &amp;quot;'''WITCHSPACE BLOCKED'''&amp;quot; or &amp;quot;'''WITCHSPACE_OKAY'''&amp;quot;. This command will not add a new ship at the witchspace entry point. (available with version 1.70 and higher)&lt;br /&gt;
|-&lt;br /&gt;
|'''performIdle'''&lt;br /&gt;
|Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight, speed is unaffected. [[frustration]] level is reset to zero.&lt;br /&gt;
|-&lt;br /&gt;
|'''performIntercept'''&lt;br /&gt;
|Performs target interception. It needs a range to be set first. When the distance to target becomes less than desired range it returns: &amp;quot;'''DESIRED_RANGE_ACHIEVED'''&amp;quot;. When target lost: &amp;quot;'''TARGET_LOST'''&amp;quot;. When it hasn't come closer to target for 10 seconds it returns: &amp;quot;'''FRUSTRATED'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''performMining'''&lt;br /&gt;
|Performs mining. (Finds, intercepts and shoots asteroids with [[mining]] laser, if fitted.) It returns: &amp;quot;'''TARGET_LOST'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performTumble'''&lt;br /&gt;
|Performs random pitch and roll, 'evasive maneuvers'.&lt;br /&gt;
|-&lt;br /&gt;
|'''setSpeedTo:(NSString *)speedString'''&lt;br /&gt;
|Sets desired speed to an absolute value, entity cannot go faster than maxspeed value determined in the [[shipdata.plist]]. If speed is above maxspeed, entity will use fuel injectors if available. &lt;br /&gt;
|-&lt;br /&gt;
|'''setSpeedFactorTo:(NSString *)speedString'''&lt;br /&gt;
|Sets the desired speed to a percentage of maxspeed (0-&amp;gt;1=0%-&amp;gt;100%). If speedfactor is set above 100%, entity will use fuelinjectors if available.&lt;br /&gt;
|-&lt;br /&gt;
|'''setUpEscorts'''&lt;br /&gt;
|Useful to quickly establish (by name and number the [[Shipdata.plist#escorts|shipdata.plist]] prescribed) escorts, when a ship is introduced to a system. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''suggestEscort'''&lt;br /&gt;
|Has an escort seek employment and either gets accepted or rejected by the &amp;quot;mother&amp;quot;. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''switchLightsOff'''&lt;br /&gt;
|If an entity has lights (or flashers), this command will turn them off. Default state is on. (See [[Shipdata.plist#subentities|shipdata.plist]])&lt;br /&gt;
|-&lt;br /&gt;
|'''switchLightsOn'''&lt;br /&gt;
|Will turn flashers back on.&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeEntireGroup'''&lt;br /&gt;
|Wormholes ships in this group.  Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeEscorts'''&lt;br /&gt;
|Wormholes official escorts. Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeGroup'''&lt;br /&gt;
|Wormholes ships in group of which this is a leader.  Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''****'''&lt;br /&gt;
|The aegis check is part of the system update and messages needs no command to generate them. The following messages are '''only generated''' when the status '''changes'''.&lt;br /&gt;
&amp;quot;AEGIS_CLOSE_TO_PLANET&amp;quot;:   Within 3x planetary radius and not near station.&lt;br /&gt;
&amp;quot;AEGIS_IN_DOCKING_RANGE&amp;quot;:  Within 2x scanner radius of system station.&lt;br /&gt;
&amp;quot;AEGIS_LEAVING_DOCKING_RANGE&amp;quot;: Has been in docking range but now only close to planet.&lt;br /&gt;
&amp;quot;AEGIS_NONE&amp;quot;: None of the above tree messages is true.&lt;br /&gt;
|-&lt;br /&gt;
|'''****'''&lt;br /&gt;
|The surface check needs no command. It automatically generates messages when a ship passes a border at approximately 1 meter from the main planet surface.&lt;br /&gt;
&amp;quot;'''APPROACHING_SURFACE'''&amp;quot;: passed the border inward.&lt;br /&gt;
&amp;quot;'''LEAVING_SURFACE'''&amp;quot;:  passed the border outward.&lt;br /&gt;
|-&lt;br /&gt;
|'''abortDocking'''&lt;br /&gt;
|Signal the motherstation that the docking is aborted. see [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''getWitchspaceEntryCoordinates'''&lt;br /&gt;
|Calculates coordinates at 10 km from the rotation axis of the nearest station it can find, or just fly 10s forward.&lt;br /&gt;
|-&lt;br /&gt;
|'''recallDockingInstructions'''&lt;br /&gt;
|see [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''requestDockingCoordinates'''&lt;br /&gt;
|Requests coordinates from the nearest station it can find (which may be a Rock hermit). Returns: &amp;quot;NO_STATION_FOUND&amp;quot;, &amp;quot;TRY_AGAIN_LATER&amp;quot;, &amp;quot;HOLD_POSITION&amp;quot;, &amp;quot;BACK_OFF&amp;quot; , &amp;quot;APPROACH&amp;quot; or &amp;quot;APPROACH_COORDINATES&amp;quot;. see also [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''setCoordinates:(NSString *)system_x_y_z'''&lt;br /&gt;
|Sets destination coords, see '''[[Methods#Looking_for.2C_and_adding_ships|addShipsAt]]'''. It needs 4 parameters separated with space. When coordinates are set it returns: &amp;quot;APPROACH_COORDINATES&amp;quot;. You can even [[setCoordinates_randomizer|randomize]] positive coordinates.&lt;br /&gt;
|-&lt;br /&gt;
|'''setCourseToPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find, sets the coordinates to a point on the ships side of the surface with a large random spread to avoid all ships flying to the same point. Then it sets the desired range to 50 m (+ its own collision diameter). This short desired range will probably crash normal fast flying ships on the surface but a collission between the planet and a ship with role &amp;quot;shuttle&amp;quot; is interpreted as landing.&lt;br /&gt;
|-&lt;br /&gt;
|'''setCourseToWitchpoint'''&lt;br /&gt;
|Sets destination coords to Witchpoint area and sets &amp;quot;DesiredRange&amp;quot; to 10 km.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDesiredRangeTo:(NSString *)rangeString'''&lt;br /&gt;
|Some methods (such as scanForNearestMerchantmen, checkCourseToDestination, checkDistanceTravelled, etc) require a &amp;quot;desired range&amp;quot; parameter to be set before they can be used.&lt;br /&gt;
&lt;br /&gt;
This method is used to set the desired range. There is only one value for desired range within an instance of the AI. The value of desired range is modified internally by AI methods such as fightOrFleeMissile, setCourseToWitchpoint, and setPlanetPatrolCoordinates.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationFromCoordinates'''&lt;br /&gt;
|Enables the plotting of manual waypoints.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToCurrentLocation'''&lt;br /&gt;
|This method sets the destination of the current entity to its current location plus a random offset of up to 0.5 metres in the X, Y, and Z coordinates. This can be used to make a ship idle in a small area of space without being completely still.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToDockingAbort'''&lt;br /&gt;
|DockingAbort coordinates 8000 meter distance from the dockingslit.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToStationBeacon'''&lt;br /&gt;
|Gets station beacon position.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToTarget'''&lt;br /&gt;
|Sets destination to target coords.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToWitchpoint'''&lt;br /&gt;
|Sets destination coordinates to WitchspaceExitPosition.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationWithinTarget'''&lt;br /&gt;
|Handy for ramming and racing.&lt;br /&gt;
|-&lt;br /&gt;
|'''setPlanetPatrolCoordinates'''&lt;br /&gt;
|Request coordinates for planet control. Read more in [[setPlanetPatrolCoordinates]].&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimEndCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimExitCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimStartCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToSystemStation'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToStation'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTakeOffFromPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find and calculates a vector perpendicular to the surface an sets a destinaton range of 10 km. Does nothing if there is no planet to be found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Communication ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''******'''&lt;br /&gt;
|Hitting a clean ship automatical sends a &amp;quot;'''OFFENCE_COMMITTED'''&amp;quot; to all nearby ships with scanClass equal CLASS_NEUTRAL, CLASS_STATION, CLASS_BUOY, CLASS_POLICE, CLASS_MILITARY, CLASS_PLAYER. Besides this all the ships flying in a group like pirates, police or escorts get an &amp;quot;'''ATTACKED'''&amp;quot; message as when they were attacked themself.&lt;br /&gt;
|-&lt;br /&gt;
|'''broadcastDistressMessage'''&lt;br /&gt;
|Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack. This command resets a previous found target to none at the sending side. It returns: &amp;quot;'''ACCEPT_DISTRESS_MESSAGE'''&amp;quot; in the AI of Stations, Hunters and Police ships and gives them as&amp;quot; Found Target&amp;quot;, the &amp;quot;Primary Target&amp;quot; of the sender of the broadcast.&lt;br /&gt;
|-&lt;br /&gt;
|'''commsMessage:(NSString *)valueString'''&lt;br /&gt;
|Broadcasts a general message to player.&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;sendCommsMessage: [thargoid_curses]&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''patrolReportIn'''&lt;br /&gt;
|This command sets the &amp;quot;last patrol report time&amp;quot; to the current time. Only useful for station patrol.&lt;br /&gt;
|-&lt;br /&gt;
|'''sendTargetCommsMessage:(NSString*) message'''&lt;br /&gt;
|Sends any message to the established (found) target. When the target is not a ship it returns: &amp;quot;'''TARGET_LOST'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;sendTargetCommsMessage: Listen to me!!&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Locating entities ==&lt;br /&gt;
&lt;br /&gt;
All these methods require a range to be set by setDesiredRange or by &amp;lt;scanner_range&amp;gt; in [[shipdata.plist]], all will return the message TARGET_FOUND or NOTHING_FOUND. The calling entity remembers the found target, but it does not become the current (universal) target. It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.&lt;br /&gt;
&lt;br /&gt;
When you are continuously scanning as in a update event, make sure you add also a pause command. Scanning takes time and in most cases one scan every few seconds is enough. Look also at Oolites internal AI's were this timing is well thought of.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''checkCourseToDestination'''&lt;br /&gt;
|Will return &amp;quot;COURSE_OK&amp;quot; when no obstacles on the direct route, else it calculates a little deviated save vector and returns &amp;quot;WAYPOINT_SET&amp;quot;. When there is a small ship in his way it also returns: '''HAZARD_CAN_BE_DESTROYED'''&lt;br /&gt;
|-&lt;br /&gt;
|'''checkDistanceTravelled'''&lt;br /&gt;
|First you must define a range with setDesiredRangeTo:. When the total traveled distance since creation is greater than this value it returns: &amp;quot;GONE_BEYOND_RANGE&amp;quot;. Used  for missiles.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkGroupOddsVersusTarget'''&lt;br /&gt;
|Will return &amp;quot;ODDS_GOOD&amp;quot;, &amp;quot;ODDS_LEVEL&amp;quot; or &amp;quot;ODDS_BAD&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForFullHold'''&lt;br /&gt;
|If entity's cargo capacity is reached, will return &amp;quot;HOLD_FULL&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForMotherStation'''&lt;br /&gt;
|Will return &amp;quot;STATION_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForNormalSpace'''&lt;br /&gt;
|Will return &amp;quot;NORMAL_SPACE&amp;quot; or &amp;quot;INTERSTELLAR_SPACE&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkTargetLegalStatus'''&lt;br /&gt;
|Returns &amp;quot;TARGET_CLEAN, &amp;quot;TARGET_MINOR_OFFENDER&amp;quot;, &amp;quot;TARGET_OFFENDER&amp;quot;, &amp;quot;TARGET_FUGITIVE&amp;quot; or &amp;quot;NO_TARGET&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''findNearestPlanet'''&lt;br /&gt;
|Will scan for planetentity. Returns nothing. Nearest planet coordinates are placed in destination memory.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForFormationLeader'''&lt;br /&gt;
|Locates the nearest suitable formation leader in range. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForHostiles'''&lt;br /&gt;
|Locates all the ships in range targeting the receiver and ships with &amp;quot;SCANNCLASS_TARGOID&amp;quot; and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForLoot'''&lt;br /&gt;
|Scans for nearest debris in range.&lt;br /&gt;
Returns: &amp;quot;HOLD_FULL&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
If scanning ship is moving station or has no scoop it always return: &amp;quot;NOTHING_FOUND&amp;quot;. If scanning ship has scanClass: &amp;quot;CLASS_POLICE&amp;quot;, it only finds slaves and lifepods.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestMerchantmen'''&lt;br /&gt;
|Scans for ships with role: Trader or Player and selects the nearest. If scanning ship has role Pirate it prefers the player.&lt;br /&gt;
Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithRole:(NSString*) scanRole'''&lt;br /&gt;
|Locates all the ships in range and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNonThargoid'''&lt;br /&gt;
|Locates all the non thargoid ships in range and chooses the nearest. It finds everything except cargo and ships with a role starting with: &amp;quot;tharg&amp;quot;. If it finds the player it prefers the player. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForOffenders'''&lt;br /&gt;
|Locates all the ships in range, subtracts a random value between 0 and 255 from their legal status or bounty and compares the remaining value. It chooses the worst offender. Because of the random value not all ships are found in every scan and the lower the bounty the longer it takes to detect him as  offender. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRandomLoot'''&lt;br /&gt;
|Scans for debris in range and selects one at random from the first 16 found.&lt;br /&gt;
Returns: &amp;quot;HOLD_FULL&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
If scanning ship is station or has no scoop it always return: &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRandomMerchantmen'''&lt;br /&gt;
|Scans for ships with role: Trader or Player and selects one at random. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRocks'''&lt;br /&gt;
|Scans for nearest boulder in range. When nothing found then scans for nearest asteroid in range. Returns &amp;quot;TARGET_FOUND&amp;quot; or  &amp;quot;NOTING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForThargoid'''&lt;br /&gt;
|Locates all the ships with role &amp;quot;thargoid&amp;quot; in range and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Targeting ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''requestNewTarget'''&lt;br /&gt;
|Locates all the ships in range targeting the mother ship, and chooses the nearest/biggest. Returns: &amp;quot;MOTHER_LOST&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToFoundTarget'''&lt;br /&gt;
|Affirms a TARGET_FOUND by a scanFor- or find-Something-method as the universal target.&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToPrimaryAggressor'''&lt;br /&gt;
|This function sets the primary agressor to the primary target. Then in the &amp;quot;performAttack&amp;quot; state, it only has a 25% change of setting the primary agressor to the primary target. The other 75% it will do nothing. This function is designed for used during attack to prevent it will constantly change targets when attacking a group.&lt;br /&gt;
&lt;br /&gt;
primary agressor is set by the system when a ship fires a laser or missile on the other. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''addFuel:(NSString*) fuel_number'''&lt;br /&gt;
|Changes player's fuel level by fuel_number LY's, max to 7.0 min to 0.0.&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeUncontrolledThargon'''&lt;br /&gt;
|Changes ship into cargo with scannClass &amp;quot;CLASS_CARGO&amp;quot; and sets AI to &amp;quot;dumbAI&amp;quot;. If also the the cargo type is defined in ShipData.plist it can be picked up like any other cargo.&lt;br /&gt;
|-&lt;br /&gt;
|'''initialiseTurret'''&lt;br /&gt;
|Prepares the turret. As turrets have no statemachine of their own, this function can only be used in the setup_actions of the turrets shipData.&lt;br /&gt;
|-&lt;br /&gt;
|'''rollD:(NSString*) dice_number'''&lt;br /&gt;
|Uses &amp;quot;dice&amp;quot; for random situation use. It returns &amp;quot;'''ROLL_1'''&amp;quot;, &amp;quot;'''ROLL_2'''&amp;quot; and so on until dice_number. dice_number is an integer and has no size limit.&lt;br /&gt;
&lt;br /&gt;
Example 1, 3 options in someAI.plist:&lt;br /&gt;
 GLOBAL = {&lt;br /&gt;
   ENTER = (&amp;quot;rollD: 3&amp;quot;); &lt;br /&gt;
   &amp;quot;ROLL_1&amp;quot; = (action1);&lt;br /&gt;
   &amp;quot;ROLL_2&amp;quot; = (action2);&lt;br /&gt;
   &amp;quot;ROLL_3&amp;quot; = (action3);}&lt;br /&gt;
&lt;br /&gt;
Example 2, 50% chance in [[script.plist]];&lt;br /&gt;
 [[Script.plist#conditions|conditions]] = (&amp;quot;d100_number lessthan 50&amp;quot;);&lt;br /&gt;
 [[Script.plist#do|do]] = (action1);&lt;br /&gt;
 [[Script.plist#else|else]] = (action2);&lt;br /&gt;
is similar in function.&lt;br /&gt;
|-&lt;br /&gt;
|'''safeScriptActionOnTarget:(NSString*) action'''&lt;br /&gt;
|This will do a script action on the target. For NPC ships as target you can use all the AI commands available that will act as if its own AI used the command. (command introduced with version 1.71)&lt;br /&gt;
&lt;br /&gt;
It will also execute player script commands, like setting mission variables. For this to work it needs a target being set. It doesn't matter witch one.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;scriptActionOnTarget: set: mission_my_missionvariable TRUE&amp;quot;,&lt;br /&gt;
 &amp;quot;scriptActionOnTarget: awardCredits: 100&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scriptActionOnTarget:(NSString*) action'''&lt;br /&gt;
|This will do the same as safeScriptActionOnTarget, but in addition the legacy script engine is started so all installed player scripts are evaluated immediately. Use of this command is discouraged in favour of safeScriptActionOnTarget as it takes a lot of time to evaluate all scripts and in most situations this is also unnecessary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|'''sendScriptMessage: message'''&lt;br /&gt;
|Calls the javaScript function '''message()''' on the ship’s [[Oolite JavaScript Reference: Script|ship script]]. Added in Oolite 1.70. This function opens the whole js power to the AI scripting.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Role scanning methods ==&lt;br /&gt;
Starting with version 1.70 next commands will become available. This info is still preliminary until the actual release.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithPrimaryRole:(NSString*) role'''&lt;br /&gt;
|new (preferred) name for '''scanForNearestShipWithRole:'''.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipHavingRole:(NSString*) role'''&lt;br /&gt;
|scan based on entire role set rather than primary role.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithAnyPrimaryRole:(NSString*) role-list'''&lt;br /&gt;
|takes a list of roles (space-separated) and returns the nearest ship with any of them as primary. &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipHavingAnyRole:(NSString*) role-list'''&lt;br /&gt;
|takes a list of roles (space-separated) and returns the nearest ship with any of them in its role set.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithScanClass:(NSString*) scanclass'''&lt;br /&gt;
|searches for a ship by scan class.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutPrimaryRole:(NSString*) role'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipNotHavingRole:(NSString*) role'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutAnyPrimaryRole:(NSString*) role-list'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipNotHavingAnyRole:(NSString*) role-list'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutScanClass:(NSString*) scanclass'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''setPrimaryRole:(NSString*) role'''&lt;br /&gt;
|Sets the primary role for a ship.&lt;br /&gt;
|}&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
[[Category:Oolite]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=OXP_howto_AI&amp;diff=10176</id>
		<title>OXP howto AI</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=OXP_howto_AI&amp;diff=10176"/>
		<updated>2008-06-15T21:33:04Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Perform Action */ fix typos/bad spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''AI Script Format'''&lt;br /&gt;
&lt;br /&gt;
The AI system consists of a [[Stacked AI|stack]] of [[state machine]]s (only the top one of which is active), which respond to game events sent to them as [[Messages|messages]]. They respond by calling a series of [[methods]] which affect the behaviour of the [[entity]] and possibly trigger changes to the '''AI''' by changing the [[state]] or (more drastically) the state machine.&lt;br /&gt;
&lt;br /&gt;
Each state machine (or AI script) is described in a property list in   either [[ASCII]] or [[XML]] format, which can be edited with a text editor or with Property List Editor. The structure is of a dictionary containing each of the machine's possible states referenced by an identifying state name. Each state comprises a dictionary of responses to messages the AI might receive, referenced by the message itself. Each response is an array of methods that will be called when the AI receives that message.&lt;br /&gt;
&lt;br /&gt;
The AI function calls within a message handler are separated from each other by a comma. If a function takes a parameter the value is separated from the function name by a colon and a space, and both the function name and value are enclosed in double quotes.&lt;br /&gt;
&lt;br /&gt;
In [[ASCII]] format a simple (two-state) machine looks like this:&lt;br /&gt;
 {&lt;br /&gt;
      &amp;quot;STATE_1&amp;quot; = {&lt;br /&gt;
          &amp;quot;ENTER&amp;quot; = ();&lt;br /&gt;
          &amp;quot;MESSAGE_A&amp;quot; = (&amp;quot;method1: value&amp;quot;, method2, method3);&lt;br /&gt;
          &amp;quot;MESSAGE_B&amp;quot; = (method4, &amp;quot;setStateTo: STATE_2&amp;quot;);&lt;br /&gt;
          EXIT = ();&lt;br /&gt;
          UPDATE = ();&lt;br /&gt;
      };&lt;br /&gt;
      &amp;quot;STATE_2&amp;quot; = {&lt;br /&gt;
          &amp;quot;ENTER&amp;quot; = ();&lt;br /&gt;
          &amp;quot;MESSAGE_A&amp;quot; = (&amp;quot;method1: another_value&amp;quot;, method5);&lt;br /&gt;
          &amp;quot;MESSAGE_B&amp;quot; = (method6, method7, &amp;quot;setStateTo: STATE_1&amp;quot;);&lt;br /&gt;
          EXIT = ();&lt;br /&gt;
          UPDATE = ();&lt;br /&gt;
      };&lt;br /&gt;
 }&lt;br /&gt;
The same script in [[twostateXML|XML]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== AI ==&lt;br /&gt;
Messages to the statemachine with a [[State machine|priority]] are displayed in boldface.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''exitAI'''&lt;br /&gt;
|Exits current AI and returns to the same state in the old AI that called this AI with a &amp;quot;setAITo:&amp;quot;. It returns: &amp;quot;'''RESTARTED'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''pauseAI:(NSString *)intervalString'''&lt;br /&gt;
|Sets next AI update time in seconds. It does not stop the execution of the remainder of the line. It just sets the next UPDATE time to the current time plus the pause time. The pauseAI commands are non-cumulative.&lt;br /&gt;
|-&lt;br /&gt;
|'''setAITo:(NSString *)aiString'''&lt;br /&gt;
|Pauses current AI and switches to anotherAI.plist, this becomes the top AI on the 'AI-stack'.&lt;br /&gt;
When anotherAI.plist exits (exitAI), the previousAI becomes topAI again and AI-state is messaged &amp;quot;'''RESTARTED'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''setStateTo: SOMESTATE'''&lt;br /&gt;
|Changes the AI state to SOMESTATE.&lt;br /&gt;
|-&lt;br /&gt;
|'''switchAITo:(NSString *)aiString'''&lt;br /&gt;
|Switches entity AI to another *AI.plist, the previous AI will be exited.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== AI choices ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''fightOrFleeHostiles'''&lt;br /&gt;
|Deploys escorts if he has them. If he has enough missiles left he might fire one. Then decides between issue the FIGHTING or FLEEING message. Returns &amp;quot;FIGHTING&amp;quot;, &amp;quot;DEPLOYING_ESCORTS&amp;quot; or &amp;quot;FLEEING&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''fightOrFleeMissile'''&lt;br /&gt;
|Deals with missiles, uses ECM if available, flees if not, marks as offender if police. Returns: &amp;quot;FLEEING&amp;quot; or nothing.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Perform Action ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeEnergyBlast'''&lt;br /&gt;
|Used in the [[Q bomb]].&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeExplosion'''&lt;br /&gt;
|The entity model is replaced by an explosion. If player is docked at exploding station it first launches the player.&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeLargeExplosion'''&lt;br /&gt;
|Used at player entity death, not for use in other instances.&lt;br /&gt;
|-&lt;br /&gt;
|'''dealEnergyDamageWithinDesiredRange'''&lt;br /&gt;
|Needs desiredRange to be set first, then deals [[weaponEnergy]] ([[Shipdata.plist]]) damage within this sphere. &lt;br /&gt;
|-&lt;br /&gt;
|'''decreaseAlertLevel'''&lt;br /&gt;
|Can only be used on stations. Decreases station alertlevel. Returns: &amp;quot;'''CONDITION_YELLOW'''&amp;quot;, &amp;quot;'''CONDITION_GREEN'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''deployEscorts'''&lt;br /&gt;
|Sends the mothers primary target to all escorts and sets the statemachine of all the escorts to: interceptAI.plist.&lt;br /&gt;
|-&lt;br /&gt;
|'''dockEscorts'''&lt;br /&gt;
|Gives all existing escorts a dockingAI.plist and sets the state to ABORT so the escorts go to a waiting position for docking.&lt;br /&gt;
|-&lt;br /&gt;
|'''ejectCargo'''&lt;br /&gt;
|Ejects cargo.&lt;br /&gt;
|-&lt;br /&gt;
|'''enterTargetWormhole'''&lt;br /&gt;
|Will locate nearest wormhole, and enter it.&lt;br /&gt;
|-&lt;br /&gt;
|'''escortCheckMother'''&lt;br /&gt;
|Returns &amp;quot;ESCORTING&amp;quot; or &amp;quot;NOT_ESCORTING&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''fireECM'''&lt;br /&gt;
|Used by stations and hermits to engage ECM.&lt;br /&gt;
|-&lt;br /&gt;
|'''fireMissile'''&lt;br /&gt;
|Fires missiles on selected target. It sends a &amp;quot;'''INCOMING_MISSILE'''&amp;quot; message to the target state machine.&lt;br /&gt;
|-&lt;br /&gt;
|'''groupAttackTarget'''&lt;br /&gt;
|All ships in group will have their targets set to this entity's current target. It will return &amp;quot;'''GROUP_ATTACK_TARGET'''&amp;quot; to the sending ship as well as to all group members.&lt;br /&gt;
|-&lt;br /&gt;
|'''increaseAlertLevel'''&lt;br /&gt;
|Can only be used on stations. Increases station alertlevel. Returns: &amp;quot;'''YELLOW_ALERT'''&amp;quot;, &amp;quot;'''RED_ALERT'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''landOnPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find, increments the landed shuttles counter for that planet and 'removes' the entity. Returns: &amp;quot;'''LANDED_ON_PLANET'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''Launch..''Some''Ship'''&lt;br /&gt;
|Launches a ship fron a dockable entity, various types of this method exist. See also [[Station Ships]].&lt;br /&gt;
* LaunchDefenseShip     &lt;br /&gt;
* LaunchEscort&lt;br /&gt;
* LaunchMiner&lt;br /&gt;
* LaunchPatrol&lt;br /&gt;
* LaunchPirateShip&lt;br /&gt;
* LaunchPolice&lt;br /&gt;
* LaunchScavenger&lt;br /&gt;
* LaunchShipWithRole: &amp;lt;Role&amp;gt;&lt;br /&gt;
* LaunchShuttle&lt;br /&gt;
* LaunchTrader&lt;br /&gt;
|-&lt;br /&gt;
|'''markTargetForFines'''&lt;br /&gt;
|Deals out a fine to target. It returns: &amp;quot;TARGET_MARKED&amp;quot;. When the target was no ship it returns: &amp;quot;'''TARGET_LOST'''&amp;quot;.&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;markTargetForFines: 100&amp;quot;&lt;br /&gt;
Will fine the target 10Cr. N.B. for commercial transactions &amp;quot;awardMoney -$&amp;quot; is a more suitable method.&lt;br /&gt;
|-&lt;br /&gt;
|'''markTargetForOffence:(NSString*) valueString'''&lt;br /&gt;
|Has police mark up the criminal record ([[Legal status]]) of target entity.  The value is not added to the criminal record but a bit-wise OR is used between value and criminal record. It returns: &amp;quot;'''TARGET_LOST'''&amp;quot; when the target was no ship.&lt;br /&gt;
|-&lt;br /&gt;
|'''messageMother:(NSString *)msgString'''&lt;br /&gt;
|Sends a AI priority message to the mothership/leader of a group.&lt;br /&gt;
Example:&lt;br /&gt;
 INCOMING_MISSILE = (&amp;quot;messageMother: INCOMING_MISSILE&amp;quot;);&lt;br /&gt;
The mothership will then behave as if it was targeted by the missile. But you don't have to use standard message names, you can also send self defined message names were the mother can react on.&lt;br /&gt;
|-&lt;br /&gt;
|'''performAttack'''&lt;br /&gt;
|Attacks target.&lt;br /&gt;
|-&lt;br /&gt;
|'''performCollect'''&lt;br /&gt;
|Performs 'collection' of target.&lt;br /&gt;
|-&lt;br /&gt;
|'''performDocking'''&lt;br /&gt;
|NOT YET IMPLEMENTED.&lt;br /&gt;
|-&lt;br /&gt;
|'''performEscort'''&lt;br /&gt;
|Performs escorting. Needs a desired range first. The escorts follow at the desired range. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''performFaceDestination'''&lt;br /&gt;
|Has entity face destination. Returns &amp;quot;FACING_DESTINATION&amp;quot; when turn is completed.&lt;br /&gt;
|-&lt;br /&gt;
|'''performFlee'''&lt;br /&gt;
|Sets the caller (AI) to flee from it's primary target at maximum speed. If the caller has a cloaking device, it will be activated. It needs a range to be set first. When the ship outruns the attacker by this distance it returns: &amp;quot;REACHED_SAFETY&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performFlyToRangeFromDestination'''&lt;br /&gt;
|Whit this command the ship can react in two ways. It first looks at the distance to the target. When it is closer to the target than the previously defined desired range, it will fly away from the target, otherwise it will fly toward the target. It stops the ship at the desired range from the destination and than returns: &amp;quot;DESIRED_RANGE_ACHIEVED&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHold'''&lt;br /&gt;
|Performs idleness while tracking a potential target, speed is set to zero. [[frustration]] level is reset.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHyperSpaceExit'''&lt;br /&gt;
|Gets a list of destinations within fuel range, checks if clear of nearby masses, and select one at random. May return &amp;quot;'''WITCHSPACE UNAVAILABLE'''&amp;quot;, &amp;quot;'''WITCHSPACE BLOCKED'''&amp;quot; or &amp;quot;'''WITCHSPACE_OKAY'''&amp;quot;. It will add a new ship with the same role as the leaving ship at the witchspace entry point.&lt;br /&gt;
&lt;br /&gt;
When the player performs a hyperspace exit or a galactic jump, all NPC ships get the priority message: &amp;quot;'''PLAYER WITCHSPACE'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performHyperSpaceExitWithoutReplacing'''&lt;br /&gt;
|Gets a list of destinations within fuel range, checks if clear of nearby masses, and select one at random. May return &amp;quot;'''WITCHSPACE UNAVAILABLE'''&amp;quot;, &amp;quot;'''WITCHSPACE BLOCKED'''&amp;quot; or &amp;quot;'''WITCHSPACE_OKAY'''&amp;quot;. This command will not add a new ship at the witchspace entry point. (available with version 1.70 and higher)&lt;br /&gt;
|-&lt;br /&gt;
|'''performIdle'''&lt;br /&gt;
|Performs idleness. Ship corrects its roll and pitch to 'horizontal' flight, speed is unaffected. [[frustration]] level is reset to zero.&lt;br /&gt;
|-&lt;br /&gt;
|'''performIntercept'''&lt;br /&gt;
|Performs target interception. It needs a range to be set first. When the distance to target becomes less than desired range it returns: &amp;quot;'''DESIRED_RANGE_ACHIEVED'''&amp;quot;. When target lost: &amp;quot;'''TARGET_LOST'''&amp;quot;. When it hasn't come closer to target for 10 seconds it returns: &amp;quot;'''FRUSTRATED'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''performMining'''&lt;br /&gt;
|Performs mining. (Finds, intercepts and shoots asteroids with [[mining]] laser, if fitted.) It returns: &amp;quot;'''TARGET_LOST'''&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''performTumble'''&lt;br /&gt;
|Performs random pitch and roll, 'evasive maneuvers'.&lt;br /&gt;
|-&lt;br /&gt;
|'''setSpeedTo:(NSString *)speedString'''&lt;br /&gt;
|Sets desired speed to an absolute value, entity cannot go faster than maxspeed value determined in the [[shipdata.plist]]. If speed is above maxspeed, entity will use fuel injectors if available. &lt;br /&gt;
|-&lt;br /&gt;
|'''setSpeedFactorTo:(NSString *)speedString'''&lt;br /&gt;
|Sets the desired speed to a percentage of maxspeed (0-&amp;gt;1=0%-&amp;gt;100%). If speedfactor is set above 100%, entity will use fuelinjectors if available.&lt;br /&gt;
|-&lt;br /&gt;
|'''setUpEscorts'''&lt;br /&gt;
|Useful to quickly establish (by name and number the [[Shipdata.plist#escorts|shipdata.plist]] prescribed) escorts, when a ship is introduced to a system. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''suggestEscort'''&lt;br /&gt;
|Has an escort seek employment and either gets accepted or rejected by the &amp;quot;mother&amp;quot;. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''switchLightsOff'''&lt;br /&gt;
|If an entity has lights (or flashers), this command will turn them off. Default state is on. (See [[Shipdata.plist#subentities|shipdata.plist]])&lt;br /&gt;
|-&lt;br /&gt;
|'''switchLightsOn'''&lt;br /&gt;
|Will turn flashers back on.&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeEntireGroup'''&lt;br /&gt;
|Wormholes ships in this group.  Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeEscorts'''&lt;br /&gt;
|Wormholes official escorts. Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''wormholeGroup'''&lt;br /&gt;
|Wormholes ships in group of which this is a leader.  Returns '''&amp;quot;ENTER WORMHOLE'''&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''****'''&lt;br /&gt;
|The aegis check is part of the system update and messages needs no command to generate them. The following messages are '''only generated''' when the status '''changes'''.&lt;br /&gt;
&amp;quot;AEGIS_CLOSE_TO_PLANET&amp;quot;:   Within 3x planetary radius and not near station.&lt;br /&gt;
&amp;quot;AEGIS_IN_DOCKING_RANGE&amp;quot;:  Within 2x scanner radius of system station.&lt;br /&gt;
&amp;quot;AEGIS_LEAVING_DOCKING_RANGE&amp;quot;: Has been in docking range but now only close to planet.&lt;br /&gt;
&amp;quot;AEGIS_NONE&amp;quot;: None of the above tree messages is true.&lt;br /&gt;
|-&lt;br /&gt;
|'''****'''&lt;br /&gt;
|The surface check needs no command. It automatically generates messages when a ship passes a border at approximately 1 meter from the main planet surface.&lt;br /&gt;
&amp;quot;'''APPROACHING_SURFACE'''&amp;quot;: passed the border inward.&lt;br /&gt;
&amp;quot;'''LEAVING_SURFACE'''&amp;quot;:  passed the border outward.&lt;br /&gt;
|-&lt;br /&gt;
|'''abortDocking'''&lt;br /&gt;
|Signal the motherstation that the docking is aborted. see [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''getWitchspaceEntryCoordinates'''&lt;br /&gt;
|Calculates coordinates at 10 km from the rotation axis of the nearest station it can find, or just fly 10s forward.&lt;br /&gt;
|-&lt;br /&gt;
|'''recallDockingInstructions'''&lt;br /&gt;
|see [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''requestDockingCoordinates'''&lt;br /&gt;
|Requests coordinates from the nearest station it can find (which may be a Rock hermit). Returns: &amp;quot;NO_STATION_FOUND&amp;quot;, &amp;quot;TRY_AGAIN_LATER&amp;quot;, &amp;quot;HOLD_POSITION&amp;quot;, &amp;quot;BACK_OFF&amp;quot; , &amp;quot;APPROACH&amp;quot; or &amp;quot;APPROACH_COORDINATES&amp;quot;. see also [[Docking Instructions]]&lt;br /&gt;
|-&lt;br /&gt;
|'''setCoordinates:(NSString *)system_x_y_z'''&lt;br /&gt;
|Sets destination coords, see '''[[Methods#Looking_for.2C_and_adding_ships|addShipsAt]]'''. It needs 4 parameters separated with space. When coordinates are set it returns: &amp;quot;APPROACH_COORDINATES&amp;quot;. You can even [[setCoordinates_randomizer|randomize]] positive coordinates.&lt;br /&gt;
|-&lt;br /&gt;
|'''setCourseToPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find, sets the coordinates to a point on the ships side of the surface with a large random spread to avoid all ships flying to the same point. Then it sets the desired range to 50 m (+ its own collision diameter). This short desired range will probably crash normal fast flying ships on the surface but a collission between the planet and a ship with role &amp;quot;shuttle&amp;quot; is interpreted as landing.&lt;br /&gt;
|-&lt;br /&gt;
|'''setCourseToWitchpoint'''&lt;br /&gt;
|Sets destination coords to Witchpoint area and sets &amp;quot;DesiredRange&amp;quot; to 10 km.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDesiredRangeTo:(NSString *)rangeString'''&lt;br /&gt;
|Some methods (such as scanForNearestMerchantmen, checkCourseToDestination, checkDistanceTravelled, etc) require a &amp;quot;desired range&amp;quot; parameter to be set before they can be used.&lt;br /&gt;
&lt;br /&gt;
This method is used to set the desired range. There is only one value for desired range within an instance of the AI. The value of desired range is modified internally by AI methods such as fightOrFleeMissile, setCourseToWitchpoint, and setPlanetPatrolCoordinates.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationFromCoordinates'''&lt;br /&gt;
|Enables the plotting of manual waypoints.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToCurrentLocation'''&lt;br /&gt;
|This method sets the destination of the current entity to its current location plus a random offset of up to 0.5 metres in the X, Y, and Z coordinates. This can be used to make a ship idle in a small area of space without being completely still.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToDockingAbort'''&lt;br /&gt;
|DockingAbort coordinates 8000 meter distance from the dockingslit.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToStationBeacon'''&lt;br /&gt;
|Gets station beacon position.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToTarget'''&lt;br /&gt;
|Sets destination to target coords.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationToWitchpoint'''&lt;br /&gt;
|Sets destination coordinates to WitchspaceExitPosition.&lt;br /&gt;
|-&lt;br /&gt;
|'''setDestinationWithinTarget'''&lt;br /&gt;
|Handy for ramming and racing.&lt;br /&gt;
|-&lt;br /&gt;
|'''setPlanetPatrolCoordinates'''&lt;br /&gt;
|Request coordinates for planet control. Read more in [[setPlanetPatrolCoordinates]].&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimEndCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimExitCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setSunSkimStartCoordinates'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToSystemStation'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToStation'''&lt;br /&gt;
|...&lt;br /&gt;
|-&lt;br /&gt;
|'''setTakeOffFromPlanet'''&lt;br /&gt;
|Selects the nearest planet it can find and calculates a vector perpendicular to the surface an sets a destinaton range of 10 km. Does nothing if there is no planet to be found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Communication ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''******'''&lt;br /&gt;
|Hitting a clean ship automatical sends a &amp;quot;'''OFFENCE_COMMITTED'''&amp;quot; to all nearby ships with scanClass equal CLASS_NEUTRAL, CLASS_STATION, CLASS_BUOY, CLASS_POLICE, CLASS_MILITARY, CLASS_PLAYER. Besides this all the ships flying in a group like pirates, police or escorts get an &amp;quot;'''ATTACKED'''&amp;quot; message as when they were attacked themself.&lt;br /&gt;
|-&lt;br /&gt;
|'''broadcastDistressMessage'''&lt;br /&gt;
|Locates all the stations, bounty hunters and police ships in range and tells them that you are under attack. This command resets a previous found target to none at the sending side. It returns: &amp;quot;'''ACCEPT_DISTRESS_MESSAGE'''&amp;quot; in the AI of Stations, Hunters and Police ships and gives them as&amp;quot; Found Target&amp;quot;, the &amp;quot;Primary Target&amp;quot; of the sender of the broadcast.&lt;br /&gt;
|-&lt;br /&gt;
|'''commsMessage:(NSString *)valueString'''&lt;br /&gt;
|Broadcasts a general message to player.&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;sendCommsMessage: [thargoid_curses]&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''patrolReportIn'''&lt;br /&gt;
|This command sets the &amp;quot;last patrol report time&amp;quot; to the current time. Only useful for station patrol.&lt;br /&gt;
|-&lt;br /&gt;
|'''sendTargetCommsMessage:(NSString*) message'''&lt;br /&gt;
|Sends any message to the established (found) target. When the target is not a ship it returns: &amp;quot;'''TARGET_LOST'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;quot;sendTargetCommsMessage: Listen to me!!&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Locating entities ==&lt;br /&gt;
&lt;br /&gt;
All these methods require a range to be set by setDesiredRange or by &amp;lt;scanner_range&amp;gt; in [[shipdata.plist]], all will return the message TARGET_FOUND or NOTHING_FOUND. The calling entity remembers the found target, but it does not become the current (universal) target. It can be made the current target by responding to the TARGET_FOUND message with a call to setTargetToFoundTarget.&lt;br /&gt;
&lt;br /&gt;
When you are continuously scanning as in a update event, make sure you add also a pause command. Scanning takes time and in most cases one scan every few seconds is enough. Look also at Oolites internal AI's were this timing is well thought of.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''checkCourseToDestination'''&lt;br /&gt;
|Will return &amp;quot;COURSE_OK&amp;quot; when no obstacles on the direct route, else it calculates a little deviated save vector and returns &amp;quot;WAYPOINT_SET&amp;quot;. When there is a small ship in his way it also returns: '''HAZARD_CAN_BE_DESTROYED'''&lt;br /&gt;
|-&lt;br /&gt;
|'''checkDistanceTravelled'''&lt;br /&gt;
|First you must define a range with setDesiredRangeTo:. When the total traveled distance since creation is greater than this value it returns: &amp;quot;GONE_BEYOND_RANGE&amp;quot;. Used  for missiles.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkGroupOddsVersusTarget'''&lt;br /&gt;
|Will return &amp;quot;ODDS_GOOD&amp;quot;, &amp;quot;ODDS_LEVEL&amp;quot; or &amp;quot;ODDS_BAD&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForFullHold'''&lt;br /&gt;
|If entity's cargo capacity is reached, will return &amp;quot;HOLD_FULL&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForMotherStation'''&lt;br /&gt;
|Will return &amp;quot;STATION_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkForNormalSpace'''&lt;br /&gt;
|Will return &amp;quot;NORMAL_SPACE&amp;quot; or &amp;quot;INTERSTELLAR_SPACE&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''checkTargetLegalStatus'''&lt;br /&gt;
|Returns &amp;quot;TARGET_CLEAN, &amp;quot;TARGET_MINOR_OFFENDER&amp;quot;, &amp;quot;TARGET_OFFENDER&amp;quot;, &amp;quot;TARGET_FUGITIVE&amp;quot; or &amp;quot;NO_TARGET&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''findNearestPlanet'''&lt;br /&gt;
|Will scan for planetentity. Returns nothing. Nearest planet coordinates are placed in destination memory.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForFormationLeader'''&lt;br /&gt;
|Locates the nearest suitable formation leader in range. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;. See also [[Escort Instructions]].&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForHostiles'''&lt;br /&gt;
|Locates all the ships in range targeting the receiver and ships with &amp;quot;SCANNCLASS_TARGOID&amp;quot; and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForLoot'''&lt;br /&gt;
|Scans for nearest debris in range.&lt;br /&gt;
Returns: &amp;quot;HOLD_FULL&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
If scanning ship is moving station or has no scoop it always return: &amp;quot;NOTHING_FOUND&amp;quot;. If scanning ship has scanClass: &amp;quot;CLASS_POLICE&amp;quot;, it only finds slaves and lifepods.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestMerchantmen'''&lt;br /&gt;
|Scans for ships with role: Trader or Player and selects the nearest. If scanning ship has role Pirate it prefers the player.&lt;br /&gt;
Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithRole:(NSString*) scanRole'''&lt;br /&gt;
|Locates all the ships in range and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNonThargoid'''&lt;br /&gt;
|Locates all the non thargoid ships in range and chooses the nearest. It finds everything except cargo and ships with a role starting with: &amp;quot;tharg&amp;quot;. If it finds the player it prefers the player. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForOffenders'''&lt;br /&gt;
|Locates all the ships in range, subtracts a random value between 0 and 255 from their legal status or bounty and compares the remaining value. It chooses the worst offender. Because of the random value not all ships are found in every scan and the lower the bounty the longer it takes to detect him as  offender. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRandomLoot'''&lt;br /&gt;
|Scans for debris in range and selects one at random from the first 16 found.&lt;br /&gt;
Returns: &amp;quot;HOLD_FULL&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
If scanning ship is station or has no scoop it always return: &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRandomMerchantmen'''&lt;br /&gt;
|Scans for ships with role: Trader or Player and selects one at random. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForRocks'''&lt;br /&gt;
|Scans for nearest boulder in range. When nothing found then scans for nearest asteroid in range. Returns &amp;quot;TARGET_FOUND&amp;quot; or  &amp;quot;NOTING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForThargoid'''&lt;br /&gt;
|Locates all the ships with role &amp;quot;thargoid&amp;quot; in range and chooses the nearest. Returns: &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Targeting ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''requestNewTarget'''&lt;br /&gt;
|Locates all the ships in range targeting the mother ship, and chooses the nearest/biggest. Returns: &amp;quot;MOTHER_LOST&amp;quot;, &amp;quot;TARGET_FOUND&amp;quot; or &amp;quot;NOTHING_FOUND&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToFoundTarget'''&lt;br /&gt;
|Affirms a TARGET_FOUND by a scanFor- or find-Something-method as the universal target.&lt;br /&gt;
|-&lt;br /&gt;
|'''setTargetToPrimaryAggressor'''&lt;br /&gt;
|This function sets the primary agressor to the primary target. Then in the &amp;quot;performAttack&amp;quot; state, it only has a 25% change of setting the primary agressor to the primary target. The other 75% it will do nothing. This function is designed for used during attack to prevent it will constantly change targets when attacking a group.&lt;br /&gt;
&lt;br /&gt;
primary agressor is set by the system when a ship fires a laser or missile on the other. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''addFuel:(NSString*) fuel_number'''&lt;br /&gt;
|Changes player's fuel level by fuel_number LY's, max to 7.0 min to 0.0.&lt;br /&gt;
|-&lt;br /&gt;
|'''becomeUncontrolledThargon'''&lt;br /&gt;
|Changes ship into cargo with scannClass &amp;quot;CLASS_CARGO&amp;quot; and sets AI to &amp;quot;dumbAI&amp;quot;. If also the the cargo type is defined in ShipData.plist it can be picked up like any other cargo.&lt;br /&gt;
|-&lt;br /&gt;
|'''initialiseTurret'''&lt;br /&gt;
|Prepares the turret. As turrets have no statemachine of their own, this function can only be used in the setup_actions of the turrets shipData.&lt;br /&gt;
|-&lt;br /&gt;
|'''rollD:(NSString*) dice_number'''&lt;br /&gt;
|Uses &amp;quot;dice&amp;quot; for random situation use. It returns &amp;quot;'''ROLL_1'''&amp;quot;, &amp;quot;'''ROLL_2'''&amp;quot; and so on until dice_number. dice_number is an integer and has no size limit.&lt;br /&gt;
&lt;br /&gt;
Example 1, 3 options in someAI.plist:&lt;br /&gt;
 GLOBAL = {&lt;br /&gt;
   ENTER = (&amp;quot;rollD: 3&amp;quot;); &lt;br /&gt;
   &amp;quot;ROLL_1&amp;quot; = (action1);&lt;br /&gt;
   &amp;quot;ROLL_2&amp;quot; = (action2);&lt;br /&gt;
   &amp;quot;ROLL_3&amp;quot; = (action3);}&lt;br /&gt;
&lt;br /&gt;
Example 2, 50% chance in [[script.plist]];&lt;br /&gt;
 [[Script.plist#conditions|conditions]] = (&amp;quot;d100_number lessthan 50&amp;quot;);&lt;br /&gt;
 [[Script.plist#do|do]] = (action1);&lt;br /&gt;
 [[Script.plist#else|else]] = (action2);&lt;br /&gt;
is similar in function.&lt;br /&gt;
|-&lt;br /&gt;
|'''safeScriptActionOnTarget:(NSString*) action'''&lt;br /&gt;
|This will do a script action on the target. For NPC ships as target you can use all the AI commands available that will act as if its own AI used the command. (command introduced with version 1.71)&lt;br /&gt;
&lt;br /&gt;
It will also execute player script commands, like setting mission variables. For this to work it needs a target being set. It doesn't matter witch one.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;scriptActionOnTarget: set: mission_my_missionvariable TRUE&amp;quot;,&lt;br /&gt;
 &amp;quot;scriptActionOnTarget: awardCredits: 100&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|'''scriptActionOnTarget:(NSString*) action'''&lt;br /&gt;
|This will do the same as safeScriptActionOnTarget, but in addition the legacy script engine is started so all installed player scripts are evaluated immediately. Use of this command is discouraged in favour of safeScriptActionOnTarget as it takes a lot of time to evaluate all scripts and in most situations this is also unnecessary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|'''sendScriptMessage: message'''&lt;br /&gt;
|Calls the javaScript function '''message()''' on the ship’s [[Oolite JavaScript Reference: Script|ship script]]. Added in Oolite 1.70. This function opens the whole js power to the AI scripting.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Role scanning methods ==&lt;br /&gt;
Starting with version 1.70 next commands will become available. This info is still preliminary until the actual release.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; style=&amp;quot;width:100%&lt;br /&gt;
!width=&amp;quot;225&amp;quot;|Method&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithPrimaryRole:(NSString*) role'''&lt;br /&gt;
|new (preferred) name for '''scanForNearestShipWithRole:'''.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipHavingRole:(NSString*) role'''&lt;br /&gt;
|scan based on entire role set rather than primary role.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithAnyPrimaryRole:(NSString*) role-list'''&lt;br /&gt;
|takes a list of roles (space-separated) and returns the nearest ship with any of them as primary. &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipHavingAnyRole:(NSString*) role-list'''&lt;br /&gt;
|takes a list of roles (space-separated) and returns the nearest ship with any of them in its role set.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithScanClass:(NSString*) scanclass'''&lt;br /&gt;
|searches for a ship by scan class.&lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutPrimaryRole:(NSString*) role'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipNotHavingRole:(NSString*) role'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutAnyPrimaryRole:(NSString*) role-list'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipNotHavingAnyRole:(NSString*) role-list'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''scanForNearestShipWithoutScanClass:(NSString*) scanclass'''&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
|'''setPrimaryRole:(NSString*) role'''&lt;br /&gt;
|Sets the primary role for a ship.&lt;br /&gt;
|}&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
[[Category:Oolite]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Methods&amp;diff=10175</id>
		<title>Methods</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Methods&amp;diff=10175"/>
		<updated>2008-06-15T21:13:56Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Communications */ fix i.e. (which means &amp;quot;that is&amp;quot;, not &amp;quot;for example&amp;quot;); fix external link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Methods'''&lt;br /&gt;
&lt;br /&gt;
Methods are the actions that are performed when conditions (defined in a script) are met, or when a particular set of actions (like ''[[Shipdata.plist#death_actions|death_actions]]'' or ''[[Shipdata.plist#script_actions|script_actions]]'') are called for, or when an AI calls for a script action to be performed.&lt;br /&gt;
&lt;br /&gt;
All methods are stored in plists as strings (in XML this means between a &amp;lt;string&amp;gt; tag and a &amp;lt;/string&amp;gt; closing tag). If they take any parameters then these follow a colon and a space (''': ''') after the 'command' part of the method.&lt;br /&gt;
&lt;br /&gt;
For example: if the ship containing this ''death_actions'' entry is destroyed - the player gets a message and the sun goes Nova two seconds later!&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;key&amp;gt;death_actions&amp;lt;/key&amp;gt;&lt;br /&gt;
 &amp;lt;array&amp;gt;&lt;br /&gt;
 	&amp;lt;string&amp;gt;commsMessage: Oh dear [commander_name]!&amp;lt;/string&amp;gt;&lt;br /&gt;
 	&amp;lt;string&amp;gt;setSunNovaIn: 2.0&amp;lt;/string&amp;gt;&lt;br /&gt;
 &amp;lt;/array&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The Mission Screen ==&lt;br /&gt;
&lt;br /&gt;
 '''setGuiToMissionScreen'''&lt;br /&gt;
 // opens the mission screen&lt;br /&gt;
 &lt;br /&gt;
 '''addMissionText: &amp;lt;[[missiontext.plist]] key&amp;gt; '''&lt;br /&gt;
 // adds text to the mission screen from an entry in [[missiontext.plist]]&lt;br /&gt;
 // with the given key&lt;br /&gt;
 &lt;br /&gt;
 '''showShipModel: &amp;lt;role&amp;gt;'''&lt;br /&gt;
 // shows a rotating model of a ship with the role given&lt;br /&gt;
 // role refers to a value in one of [[shipdata.plist]]'s entries'&lt;br /&gt;
 // ''roles'' key value pair&lt;br /&gt;
 &lt;br /&gt;
 '''setMissionMusic: &amp;lt;filename&amp;gt;'''&lt;br /&gt;
 // plays the music file given&lt;br /&gt;
 // if it exists within any OXP's ''Music'' folder&lt;br /&gt;
 &lt;br /&gt;
 '''setMissionImage: &amp;lt;filename&amp;gt;'''&lt;br /&gt;
 // displays the picture file given&lt;br /&gt;
 // if it exists within any OXP's ''Images'' folder&lt;br /&gt;
 &lt;br /&gt;
 '''setMissionChoices: &amp;lt;[[missiontext.plist]] key&amp;gt;'''&lt;br /&gt;
 // sets the array of choices presented at the bottom of the mission page to those described in the&lt;br /&gt;
 // entry in missiontext.plist that corresponds to the key given&lt;br /&gt;
 &lt;br /&gt;
 '''resetMissionChoice'''&lt;br /&gt;
 // makes missionChoice ''UNDEFINED''&lt;br /&gt;
 &lt;br /&gt;
 '''setMissionDescription: &amp;lt;[[missiontext.plist]] key&amp;gt;'''&lt;br /&gt;
 // sets the short description given on the player's manifest screen&lt;br /&gt;
 &lt;br /&gt;
 '''clearMissionDescription'''&lt;br /&gt;
 // clears the short description&lt;br /&gt;
 &lt;br /&gt;
 Starting with version 1.71 you can also use:&lt;br /&gt;
 clearMissionScreen&lt;br /&gt;
 // it clears the image, music and shipmodel in one singlee command.&lt;br /&gt;
 // same as:  setMissionImage: none, showShipModel: none, setMissionMusic: none.&lt;br /&gt;
 (In 1.70 this command also did clear the mission choices.)&lt;br /&gt;
 &lt;br /&gt;
 Note that '''setMissionImage:''' displays an image OVER a ship displayed with '''showShipModel:'''. &lt;br /&gt;
 This means a normal image will cover the ship. To use both, an image must be used with a transparent main page &lt;br /&gt;
 and all the info must be in the alpha channel of the picture.&lt;br /&gt;
 &lt;br /&gt;
 '''resetScriptTimer'''&lt;br /&gt;
 // resets a timer for scripting purposes '''deprecated - do not use''&lt;br /&gt;
&lt;br /&gt;
== Star charts ==&lt;br /&gt;
&lt;br /&gt;
 '''addMissionDestination: &amp;lt;pnum&amp;gt;'''&lt;br /&gt;
 // causes the given planets to be marked on the short and long range star charts&lt;br /&gt;
 // multiple planet numbers may be supplied separated by spaces&lt;br /&gt;
 &lt;br /&gt;
 '''removeMissionDestination: &amp;lt;pnum&amp;gt;'''&lt;br /&gt;
 // causes the given planets to have their marks remove from the short and long range star charts&lt;br /&gt;
 // multiple planet numbers may be supplied separated by spaces&lt;br /&gt;
&lt;br /&gt;
== Looking for, and adding ships ==&lt;br /&gt;
&lt;br /&gt;
 '''checkForShips: &amp;lt;role&amp;gt;'''&lt;br /&gt;
 // returns the number of ships found in the current system that match the role&lt;br /&gt;
 // this number can be queried with [[Methods#Results_from_other_methods|'''shipsFound_number''']]&lt;br /&gt;
 &lt;br /&gt;
 '''addShips: &amp;lt;role&amp;gt; &amp;lt;number&amp;gt;'''&lt;br /&gt;
 // causes a number of ships matching the given role to appear near the withpoint&lt;br /&gt;
 &lt;br /&gt;
 '''addSystemShips: &amp;lt;role&amp;gt; &amp;lt;number&amp;gt; &amp;lt;position&amp;gt;'''&lt;br /&gt;
 // causes a number of ships matching the given role to appear near a point&lt;br /&gt;
 // on a line from the witchpoint to the planet's station. &amp;lt;position&amp;gt; should be a floating point&lt;br /&gt;
 // number where 0.0  represents the witchpoint and 1.0 represents the station&lt;br /&gt;
 &lt;br /&gt;
 '''addShipsAt: &amp;lt;role&amp;gt; &amp;lt;number&amp;gt; &amp;lt;coordinate scheme&amp;gt; &amp;lt;x&amp;gt; &amp;lt;y&amp;gt; &amp;lt;z&amp;gt;'''&lt;br /&gt;
 // causes a number of ships matching the given role to appear ''near'' a point&lt;br /&gt;
 // defined by the &amp;lt;coordinate scheme&amp;gt; and the floating point coordinates x,y and z&lt;br /&gt;
 // &amp;lt;coordinate scheme&amp;gt; consists of a three letter code:&lt;br /&gt;
 // &lt;br /&gt;
 // The first letter indicates the feature that is the origin of the coordinate system.&lt;br /&gt;
 // w =&amp;gt; witchpoint&lt;br /&gt;
 // s =&amp;gt; sun&lt;br /&gt;
 // p =&amp;gt; planet&lt;br /&gt;
 // &lt;br /&gt;
 // The next letter indicates the feature on the 'z' axis of the coordinate system.&lt;br /&gt;
 // w =&amp;gt; witchpoint&lt;br /&gt;
 // s =&amp;gt; sun&lt;br /&gt;
 // p =&amp;gt; planet&lt;br /&gt;
 // &lt;br /&gt;
 // Then the 'y' axis of the system is normal to the plane formed by the planet, sun and witchpoint.&lt;br /&gt;
 // And the 'x' axis of the system is normal to the y and z axes.&lt;br /&gt;
 // So:&lt;br /&gt;
 // ps:  z axis = (planet -&amp;gt; sun)  y axis = normal to (planet - sun - witchpoint)  x axis = normal to y and z axes&lt;br /&gt;
 // pw:  z axis = (planet -&amp;gt; witchpoint)  y axis = normal to (planet - witchpoint - sun)  x axis = normal to y and z axes&lt;br /&gt;
 // sp:  z axis = (sun -&amp;gt; planet)  y axis = normal to (sun - planet - witchpoint)  x axis = normal to y and z axes&lt;br /&gt;
 // sw:  z axis = (sun -&amp;gt; witchpoint)  y axis = normal to (sun - witchpoint - planet)  x axis = normal to y and z axes&lt;br /&gt;
 // wp:  z axis = (witchpoint -&amp;gt; planet)  y axis = normal to (witchpoint - planet - sun)  x axis = normal to y and z axes&lt;br /&gt;
 // ws:  z axis = (witchpoint -&amp;gt; sun)  y axis = normal to (witchpoint - sun - planet)  x axis = normal to y and z axes&lt;br /&gt;
 // &lt;br /&gt;
 // The third letter denotes the units used:&lt;br /&gt;
 // m:  meters&lt;br /&gt;
 // p:  planetary radii&lt;br /&gt;
 // s:  solar radii&lt;br /&gt;
 // u:  distance between first two features indicated (eg. spu means that u = distance from sun to the planet)&lt;br /&gt;
 // &lt;br /&gt;
 // in witchspace (== no sun) coordinates are absolute irrespective of the system used&lt;br /&gt;
 &lt;br /&gt;
 '''addShipsAtPrecisely: &amp;lt;role&amp;gt; &amp;lt;number&amp;gt; &amp;lt;coordinate scheme&amp;gt; &amp;lt;x&amp;gt; &amp;lt;y&amp;gt; &amp;lt;z&amp;gt;'''&lt;br /&gt;
 // This adds the ships as close as possible to the specified point&lt;br /&gt;
 &lt;br /&gt;
 '''addShipsWithinRadius: &amp;lt;role&amp;gt; &amp;lt;number&amp;gt; &amp;lt;coordinate-system&amp;gt; &amp;lt;x&amp;gt; &amp;lt;y&amp;gt; &amp;lt;z&amp;gt; &amp;lt;radius in metres&amp;gt;'''&lt;br /&gt;
 // Example:&lt;br /&gt;
 // &amp;quot;addShipsWithinRadius: asteroid 48 wpm 0 0 15000 5000&amp;quot;&lt;br /&gt;
 // would add a 5km-wide asteroid field with 48 asteroids at a position roughly 15000m towards&lt;br /&gt;
 // the planet from the witchpoint.&lt;br /&gt;
 &lt;br /&gt;
 '''spawn: &amp;lt;role&amp;gt; &amp;lt;number&amp;gt;'''&lt;br /&gt;
 // adds a number of ships matching &amp;lt;role&amp;gt; near the ship&lt;br /&gt;
 // that's the target of this script (as [[Shipdata.plist#script_actions|script_actions]] or [[Shipdata.plist#death_actions|death_actions]])&lt;br /&gt;
 &lt;br /&gt;
 '''spawnShip: &amp;lt;[[shipdata.plist]] key&amp;gt;'''&lt;br /&gt;
 // adds a ship with the unique [[shipdata.plist]] key given&lt;br /&gt;
 // the position and facing of the ship are determined by a ''spawn'' dictionary in the&lt;br /&gt;
 // ship's shipdata.plist entry with ''position'' and ''facing_position'' as strings describing&lt;br /&gt;
 // coordinates according to one of the schemes above&lt;br /&gt;
&lt;br /&gt;
== Changing the universe ==&lt;br /&gt;
&lt;br /&gt;
 '''setSunNovaIn: &amp;lt;seconds&amp;gt;'''&lt;br /&gt;
 // Sets the sun to go nova after the given time in seconds&lt;br /&gt;
 &lt;br /&gt;
 '''sendAllShipsAway'''&lt;br /&gt;
 // Makes all the ships in the system hyperspace away&lt;br /&gt;
 &lt;br /&gt;
 '''setPlanetinfo: &amp;lt;key&amp;gt;=&amp;lt;value&amp;gt;'''&lt;br /&gt;
 // sets an override to the [[planetinfo.plist]] entry for the current system&lt;br /&gt;
 // the value for the given key is set to match the value&lt;br /&gt;
 // (see [[planetinfo.plist]])&lt;br /&gt;
 //&lt;br /&gt;
 // eg '''setPlanetinfo: description=a very dull planet'''&lt;br /&gt;
 // (Note the '=' is required)&lt;br /&gt;
 &lt;br /&gt;
 '''setSpecificPlanetInfo: &amp;lt;gnum&amp;gt;=&amp;lt;pnum&amp;gt;=&amp;lt;key&amp;gt;=&amp;lt;value&amp;gt;&lt;br /&gt;
 // sets an override to the [[planetinfo.plist]] entry for the system&lt;br /&gt;
 // specified by galaxy gnum and planet pnum&lt;br /&gt;
 //&lt;br /&gt;
 // eg '''setSpecificPlanetInfo: 0=7=description=Lave is not a very dull planet'''&lt;br /&gt;
 // (Note the '=' is required between all 4 values)&lt;br /&gt;
 &lt;br /&gt;
 '''addPlanet: &amp;lt;[[planetinfo.plist]] key&amp;gt;'''&lt;br /&gt;
 // adds a planet to the universe from data in [[planetinfo.plist]].&lt;br /&gt;
 &lt;br /&gt;
 '''addMoon: &amp;lt;[[planetinfo.plist]] key&amp;gt;'''&lt;br /&gt;
 // adds a moon to the universe from data in [[planetinfo.plist]].&lt;br /&gt;
 // (Moons do not get an atmosphere or clouds like planets).&lt;br /&gt;
 &lt;br /&gt;
 '''blowUpStation'''&lt;br /&gt;
 // blows up the main station. If there are more stations, the nearest becomes the main station were you can save files.&lt;br /&gt;
 // the removal of the station is stored in the save-file&lt;br /&gt;
&lt;br /&gt;
== Mission Variables ==&lt;br /&gt;
&lt;br /&gt;
As of 1.65? these methods can also be used with script local variables by suppling a&lt;br /&gt;
&amp;quot;local_&amp;quot; variable rather than a &amp;quot;mission_&amp;quot; varaible. The difference is that &amp;quot;mission_&amp;quot; variables are stored within a save file and &amp;quot;local_&amp;quot; variables are not saved with the game and are only valid localy, within a mission script.&lt;br /&gt;
&lt;br /&gt;
 '''set: [[mission_variable]] &amp;lt;value&amp;gt;'''&lt;br /&gt;
 // sets the [[mission_variable]] to the value given&lt;br /&gt;
 // the value can be a particular string or numeric value,&lt;br /&gt;
 // or a queriable state&lt;br /&gt;
 &lt;br /&gt;
 '''reset: [[mission_variable]] &amp;lt;value&amp;gt;'''&lt;br /&gt;
 // sets the [[mission_variable]] to be ''UNDEFINED''&lt;br /&gt;
 &lt;br /&gt;
 '''increment: [[mission_variable]]'''&lt;br /&gt;
 // increases the mission variable's value by 1.0&lt;br /&gt;
 &lt;br /&gt;
 '''decrement: [[mission_variable]]'''&lt;br /&gt;
 // decreases the mission variable's value by 1.0&lt;br /&gt;
 &lt;br /&gt;
 '''add: [[mission_variable]] &amp;lt;value&amp;gt;'''&lt;br /&gt;
 // adds the value given to the [[mission_variable]]&lt;br /&gt;
 // the value can be a number or a queriable state&lt;br /&gt;
 // like ''shipsFound_number''&lt;br /&gt;
 &lt;br /&gt;
 '''subtract: [[mission_variable]] &amp;lt;value&amp;gt;'''&lt;br /&gt;
 // subtracts the value given from the [[mission_variable]]&lt;br /&gt;
 // the value can be a number or a queriable state&lt;br /&gt;
 // like ''shipsFound_number''&lt;br /&gt;
&lt;br /&gt;
Be aware that increment and decrement result in values with integer representation like &amp;quot;1&amp;quot;, &amp;quot;2&amp;quot;  and that &amp;quot;add&amp;quot; and &amp;quot;subtract&amp;quot; result in valus with a real representation like &amp;quot;1.000000&amp;quot; and &amp;quot;2.000000&amp;quot;.&lt;br /&gt;
This is important by comparing values with an equal statement.&lt;br /&gt;
&lt;br /&gt;
== Player rewards and penalties==&lt;br /&gt;
These methods work on the player, not any other ship.&lt;br /&gt;
&lt;br /&gt;
 '''awardCredits: &amp;lt;number&amp;gt;'''&lt;br /&gt;
 // awards number of credits.&lt;br /&gt;
 &lt;br /&gt;
 '''awardShipKills: &amp;lt;number&amp;gt;'''&lt;br /&gt;
 // Adds to the number of kills accredited to the player&lt;br /&gt;
 &lt;br /&gt;
 '''setLegalStatus: &amp;lt;number&amp;gt;'''&lt;br /&gt;
 // Sets the bounty on the player's head.&lt;br /&gt;
 &lt;br /&gt;
 '''setFuelLeak: &amp;lt;amount&amp;gt;'''&lt;br /&gt;
 // removes this amount from the fuel tank every second&lt;br /&gt;
 // until the tanks drain and self-seal&lt;br /&gt;
 &lt;br /&gt;
 '''awardFuel: &amp;lt;amount&amp;gt;'''&lt;br /&gt;
 // The amount can be positive or negative, expressed in LY of range&lt;br /&gt;
 // the fuel level is adjusted to a maximum of 7.0LY and minimum of 0.0.&lt;br /&gt;
&lt;br /&gt;
=== Equipment ===&lt;br /&gt;
&lt;br /&gt;
 '''awardEquipment: &amp;lt;equipment key&amp;gt;'''&lt;br /&gt;
 // if the player doesn't have the equipment already&lt;br /&gt;
 // and their ship can be equipped witth it then this fits the&lt;br /&gt;
 // player's ship with the equipment given&lt;br /&gt;
 // valid keys can be found in [[equipment.plist]] (they all begin '''EQ_'''):-&lt;br /&gt;
 //	EQ_FUEL&lt;br /&gt;
 //	EQ_MISSILE&lt;br /&gt;
 //	EQ_CARGO_BAY&lt;br /&gt;
 //	EQ_ECM&lt;br /&gt;
 //	EQ_FUEL_SCOOPS&lt;br /&gt;
 //	EQ_ESCAPE_POD&lt;br /&gt;
 //	EQ_ENERGY_BOMB&lt;br /&gt;
 //	EQ_ENERGY_UNIT&lt;br /&gt;
 //	EQ_NAVAL_ENERGY_UNIT&lt;br /&gt;
 //	EQ_DOCK_COMP&lt;br /&gt;
 //	EQ_GAL_DRIVE&lt;br /&gt;
 //	EQ_CLOAKING_DEVICE&lt;br /&gt;
 //	EQ_PASSENGER_BERTH&lt;br /&gt;
 //	EQ_HARDENED_MISSILE&lt;br /&gt;
 //	EQ_FUEL_INJECTION&lt;br /&gt;
 //	EQ_SCANNER_SHOW_MISSILE_TARGET&lt;br /&gt;
 //	EQ_MULTI_TARGET&lt;br /&gt;
 //	EQ_ADVANCED_COMPASS&lt;br /&gt;
 //	EQ_QC_MINE&lt;br /&gt;
 //	EQ_SHIELD_BOOSTER&lt;br /&gt;
 //	EQ_NAVAL_SHIELD_BOOSTER&lt;br /&gt;
 //	EQ_WEAPON_TWIN_PLASMA_CANNON&lt;br /&gt;
 //	EQ_MILITARY_JAMMER&lt;br /&gt;
 //	EQ_MILITARY_SCANNER_FILTER&lt;br /&gt;
 &lt;br /&gt;
 '''removeEquipment: &amp;lt;equipment key&amp;gt;'''&lt;br /&gt;
 // removes the indicated equipment from the player's ship&lt;br /&gt;
 &lt;br /&gt;
 '''testForEquipment: &amp;lt;equipment key&amp;gt;'''&lt;br /&gt;
 // tests whether the player ship has a piece of equipment installed&lt;br /&gt;
 // returns the result in [[Methods#Results_from_other_methods|'''foundEquipment_bool''']]&lt;br /&gt;
&lt;br /&gt;
=== Cargo ===&lt;br /&gt;
&lt;br /&gt;
 '''awardCargo: &amp;lt;amount&amp;gt; &amp;lt;[[Commodities|Commodity]] name&amp;gt;'''&lt;br /&gt;
 // awards a quantity of the cargo named&lt;br /&gt;
 // the cargo name must match the name in [[commodities.plist]] exactly&lt;br /&gt;
 // only positive numbers are allowed.&lt;br /&gt;
 &lt;br /&gt;
 '''removeAllCargo'''&lt;br /&gt;
 // removes all cargo from the hold with no compensation to the player&lt;br /&gt;
 // any special cargo is also removed (see below) restoring use of the cargo bay&lt;br /&gt;
 // Gold, Platinum, and Gemstones are unaffected (they're in the cabin safe).&lt;br /&gt;
 &lt;br /&gt;
 '''useSpecialCargo: &amp;lt;description of cargo&amp;gt;'''&lt;br /&gt;
 // fills the cargo bay withthe cargo described, effectively&lt;br /&gt;
 // disabling the use of the cargo bay until the cargo is removed.&lt;br /&gt;
&lt;br /&gt;
=== Special ===&lt;br /&gt;
&lt;br /&gt;
 '''ejectItem: &amp;lt;[[shipdata.plist]] key&amp;gt;'''  &lt;br /&gt;
 // Creates a ship or other entity from [[shipdata.plist]] and ejects from&lt;br /&gt;
 // the ship's aft hatch&lt;br /&gt;
 &lt;br /&gt;
 '''launchFromStation'''&lt;br /&gt;
 // forces the player ship to launch&lt;br /&gt;
 // STATUS_LAUNCHING is skipped, so no script action on that moment.&lt;br /&gt;
&lt;br /&gt;
== Communications ==&lt;br /&gt;
&lt;br /&gt;
 '''commsMessage: ''message'' '''&lt;br /&gt;
 // sends the player a message in the form of a text string.&lt;br /&gt;
 // if the message contains elements enclosed in square brackets ''[like_this]''&lt;br /&gt;
 // that corresponds to a [[mission_variable]] or keys in [[misc plists|descriptions.plist]]&lt;br /&gt;
 // or to special expansions like [commander_name] then these are expanded&lt;br /&gt;
 // and substituted into the original message&lt;br /&gt;
 //&lt;br /&gt;
 '''consoleMessage3s: ''message'' '''&lt;br /&gt;
 '''consoleMessage6s: ''message'' '''&lt;br /&gt;
 // sends the player a message in the form of a text string with 3 or 6 second duration.&lt;br /&gt;
 // if the message contains elements enclosed in square brackets ''[like_this]''&lt;br /&gt;
 // that corresponds to a [[mission_variable]] or keys in [[misc plists|descriptions.plist]]&lt;br /&gt;
 // or to special expansions like [commander_name] then these are expanded&lt;br /&gt;
 // and substituted into the original message&lt;br /&gt;
 // difference with commsMessage is that it is not stored in the comms file and can not be recalled by the player.&lt;br /&gt;
 //&lt;br /&gt;
 '''Special Expansions'''&lt;br /&gt;
 //As well as [commander_name] the following are available;&lt;br /&gt;
 //[commander_shipname] - Displays the name of the players ship, as specified by [[shipdata.plist]].&lt;br /&gt;
 //{commander_rank] - Displays the players Elite rating.&lt;br /&gt;
 //[commander_legal_status] - Displays the players current legal status.&lt;br /&gt;
 //[Thanks-for-assist] - Err, thanks the player for their assistance.&lt;br /&gt;
 //[Thargoid_curses] - Random Thargoid curses.&lt;br /&gt;
 //[police_attack_warning] - Random warning of immediate(?) attack.&lt;br /&gt;
 //%H - Will display the current system name; e.g., Isinor.&lt;br /&gt;
 //%I - Displays the current system name with &amp;quot;ian&amp;quot; attached; e.g., Isinorian.&lt;br /&gt;
 //%R - Random word. &lt;br /&gt;
 // An (incomplete) excell sheet detailing the default [http://home.tiscali.nl/arexack/descriptions%20array.xls descriptions.plist]&lt;br /&gt;
 //&lt;br /&gt;
 //&lt;br /&gt;
 //custom variable texts can be created by creating an array in a custom descriptions.plist,&lt;br /&gt;
 //these can then be referenced like the above examples.&lt;br /&gt;
 //Example of descriptions.plist entry: &lt;br /&gt;
 //&amp;lt;key&amp;gt;beg-for-mercy&amp;lt;/key&amp;gt;&lt;br /&gt;
 //	&amp;lt;array&amp;gt;&lt;br /&gt;
 //		&amp;lt;string&amp;gt;No!&amp;lt;/string&amp;gt;&lt;br /&gt;
 //		&amp;lt;string&amp;gt;Help! Anyone!&amp;lt;/string&amp;gt;&lt;br /&gt;
 //		&amp;lt;string&amp;gt;etc, etc&amp;lt;/string&amp;gt;&lt;br /&gt;
 //	&amp;lt;/array&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Querying states ==&lt;br /&gt;
&lt;br /&gt;
=== Player status ===&lt;br /&gt;
&lt;br /&gt;
 // '''mission_string'''&lt;br /&gt;
 // returns the key for the current mission&lt;br /&gt;
 &lt;br /&gt;
 // '''status_string'''&lt;br /&gt;
 // returns one of:&lt;br /&gt;
 // ''STATUS_AUTOPILOT_ENGAGED''&lt;br /&gt;
 // ''STATUS_DEAD''&lt;br /&gt;
 // ''STATUS_DEMO''&lt;br /&gt;
 // ''STATUS_DOCKING''&lt;br /&gt;
 // ''STATUS_DOCKED''&lt;br /&gt;
 // ''STATUS_EFFECT''&lt;br /&gt;
 // ''STATUS_ENTERING_WITCHSPACE''&lt;br /&gt;
 // ''STATUS_ESCAPE_SEQUENCE''&lt;br /&gt;
 // ''STATUS_EXITING_WITCHSPACE''&lt;br /&gt;
 // ''STATUS_EXPERIMENTAL''&lt;br /&gt;
 // ''STATUS_IN_FLIGHT''&lt;br /&gt;
 // ''STATUS_IN_HOLD''&lt;br /&gt;
 // ''STATUS_INACTIVE''&lt;br /&gt;
 // ''STATUS_LAUNCHING''&lt;br /&gt;
 // ''STATUS_TEST''&lt;br /&gt;
 // ''STATUS_WITCHSPACE_COUNTDOWN''&lt;br /&gt;
 // ''UNDEFINED''&lt;br /&gt;
 &lt;br /&gt;
 // '''gui_screen_string'''&lt;br /&gt;
 // returns one of:&lt;br /&gt;
 // ''GUI_SCREEN_EQUIP_SHIP''&lt;br /&gt;
 // ''GUI_SCREEN_INTRO1''&lt;br /&gt;
 // ''GUI_SCREEN_INTRO2''&lt;br /&gt;
 // ''GUI_SCREEN_INVENTORY''&lt;br /&gt;
 // ''GUI_SCREEN_LONG_RANGE_CHART''&lt;br /&gt;
 // ''GUI_SCREEN_MAIN''&lt;br /&gt;
 // ''GUI_SCREEN_MANIFEST''&lt;br /&gt;
 // ''GUI_SCREEN_MARKET'' //doesnt work (v1.69.1)&lt;br /&gt;
 // ''GUI_SCREEN_CONTRACTS'' &lt;br /&gt;
 // ''GUI_SCREEN_MISSION''&lt;br /&gt;
 // ''GUI_SCREEN_OPTIONS''&lt;br /&gt;
 // ''GUI_SCREEN_SHORT_RANGE_CHART''&lt;br /&gt;
 // ''GUI_SCREEN_STATUS''&lt;br /&gt;
 // ''GUI_SCREEN_SYSTEM_DATA''&lt;br /&gt;
 // ''GUI_SCREEN_SHIPYARD'' &lt;br /&gt;
 // ''UNDEFINED''&lt;br /&gt;
 &lt;br /&gt;
 // '''galaxy_number'''&lt;br /&gt;
 // returns a value between 0 and 7&lt;br /&gt;
 &lt;br /&gt;
 // '''planet_number'''&lt;br /&gt;
 // returns a value between 0 and 255&lt;br /&gt;
 &lt;br /&gt;
 // '''score_number'''&lt;br /&gt;
 // returns the number of the player's current ship kills&lt;br /&gt;
 &lt;br /&gt;
 // '''credits_number'''&lt;br /&gt;
 // returns the player's credits x10&lt;br /&gt;
 &lt;br /&gt;
 // '''legalStatus_number'''&lt;br /&gt;
 // returns the bounty on the players head&lt;br /&gt;
 &lt;br /&gt;
 // '''fuel_level_number'''&lt;br /&gt;
 // returns the fuel level in LY&lt;br /&gt;
 &lt;br /&gt;
 // '''dockedAtMainStation_bool'''&lt;br /&gt;
 // returns ''YES'' if docked at a systems main station, ''NO'' otherwise&lt;br /&gt;
 &lt;br /&gt;
 // '''dockedStationName_string'''&lt;br /&gt;
 // returns ''NONE'' if the player isn't docked, the name of the station (from [[shipdata.plist]]) if it is, ''UNKNOWN'' otherwise&lt;br /&gt;
&lt;br /&gt;
=== Results from other methods ===&lt;br /&gt;
&lt;br /&gt;
 // '''shipsFound_number'''&lt;br /&gt;
 // returns the number of ships found by ''checkForShips:''&lt;br /&gt;
 &lt;br /&gt;
 // '''foundEquipment_bool'''&lt;br /&gt;
 // returns the result of the last ''testForEquipment''&lt;br /&gt;
 // returns ''YES'' if the equipment was found, ''NO'' otherwise&lt;br /&gt;
  &lt;br /&gt;
 // '''missionChoice_string'''&lt;br /&gt;
 // returns the result of the player's selection from a list of missionChoices&lt;br /&gt;
 // returns ''UNDEFINED'' or the key for the chosen option&lt;br /&gt;
&lt;br /&gt;
=== Random numbers ===&lt;br /&gt;
&lt;br /&gt;
 // '''d100_number'''&lt;br /&gt;
 // returns a random value from 0 to 99&lt;br /&gt;
 &lt;br /&gt;
 // '''pseudoFixedD100_number'''&lt;br /&gt;
 // returns a random number from 0 to 99 that will always be the same for a certain system.&lt;br /&gt;
 &lt;br /&gt;
 Starting with version 1.69 you can also use d256 numbers:&lt;br /&gt;
 // '''d256_number'''&lt;br /&gt;
 // returns a random value from 0 to 255&lt;br /&gt;
 &lt;br /&gt;
 // '''pseudoFixedD256_number'''&lt;br /&gt;
 // returns a random number from 0 to 255 that will always be the same for a certain system.&lt;br /&gt;
&lt;br /&gt;
=== Time ===&lt;br /&gt;
&lt;br /&gt;
 // '''clock_number'''&lt;br /&gt;
 // returns the game time in seconds&lt;br /&gt;
 // '''clock_secs_number'''&lt;br /&gt;
 // returns the game time in seconds&lt;br /&gt;
 // '''clock_mins_number'''&lt;br /&gt;
 // returns the game time in minutes&lt;br /&gt;
 // '''clock_hours_number'''&lt;br /&gt;
 // returns the game time in hours&lt;br /&gt;
 // '''clock_days_number'''&lt;br /&gt;
 // returns the game time in days&lt;br /&gt;
&lt;br /&gt;
=== System states ===&lt;br /&gt;
&lt;br /&gt;
 // '''sunWillGoNova_bool'''&lt;br /&gt;
 // returns whether the sun is going to go nova, either ''YES'' or ''NO''&lt;br /&gt;
 &lt;br /&gt;
 // '''sunGoneNova_bool'''&lt;br /&gt;
 // returns whether the sun has gone nova, either ''YES'' or ''NO''&lt;br /&gt;
 &lt;br /&gt;
 // '''systemGovernment_string'''&lt;br /&gt;
 // returns one of:-&lt;br /&gt;
 // ''Anarchy''&lt;br /&gt;
 // ''Feudal''&lt;br /&gt;
 // ''Multi-Government''&lt;br /&gt;
 // ''Dictatorship''&lt;br /&gt;
 // ''Communist''&lt;br /&gt;
 // ''Confederacy''&lt;br /&gt;
 // ''Democracy''&lt;br /&gt;
 // ''Corporate State''&lt;br /&gt;
 &lt;br /&gt;
 // '''systemGovernment_number'''&lt;br /&gt;
 // returns a value from 0 to 7&lt;br /&gt;
 &lt;br /&gt;
 // '''systemEconomy_number'''&lt;br /&gt;
 // returns a value from 0 to 7&lt;br /&gt;
 &lt;br /&gt;
 // '''systemTechLevel_number'''&lt;br /&gt;
 // returns a value from 0 to 14&lt;br /&gt;
 &lt;br /&gt;
 // '''systemPopulation_number'''&lt;br /&gt;
 // returns a value representing the system's population&lt;br /&gt;
 &lt;br /&gt;
 // '''systemProductivity_number'''&lt;br /&gt;
 // returns a value representing the system's productivity&lt;br /&gt;
&lt;br /&gt;
 // '''scriptTimer_number'''&lt;br /&gt;
 // returns the script timer's current value in seconds. It resets on a witchspace jump '''(deprecated - do not use)'''&lt;br /&gt;
&lt;br /&gt;
== Debugging scripts ==&lt;br /&gt;
&lt;br /&gt;
 '''debugOn'''&lt;br /&gt;
 // sends script debugging messages to the console.&lt;br /&gt;
 &lt;br /&gt;
 '''debugOff'''&lt;br /&gt;
 // cancels script debugging messages&lt;br /&gt;
 &lt;br /&gt;
 '''debugMessage: &amp;lt;message&amp;gt;'''&lt;br /&gt;
 // sends the given message to the console. The message is written to the console regardless&lt;br /&gt;
 // of whether debugOn has been performed or not. For GNUstep versions of Oolite, the console&lt;br /&gt;
 // is a file called stderr.txt located in the game's installation directory. Mission variables&lt;br /&gt;
 // and queriable states may be included in the message, eg:&lt;br /&gt;
 //&lt;br /&gt;
 // ''debugMessage: current galaxy is [galaxy_number]''&lt;br /&gt;
&lt;br /&gt;
 '''debug keys'''&lt;br /&gt;
 // pause game to enable debug keys.&lt;br /&gt;
 // press d for full debug-mode.&lt;br /&gt;
 // press b for collision debug-mode.&lt;br /&gt;
 // press c for octree debug-mode.&lt;br /&gt;
 // press o for an object dump.&lt;br /&gt;
 // a full list: [[Debug_Keys]]&lt;br /&gt;
&lt;br /&gt;
== AI ==&lt;br /&gt;
&lt;br /&gt;
Note that although most of these methods affect the player, some can also be utilised by an AI. &lt;br /&gt;
*[[OXP howto AI]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Oolite]]&lt;br /&gt;
[[Category:Oolite scripting]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Talk:Realistic_Shipyards&amp;diff=9800</id>
		<title>Talk:Realistic Shipyards</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Talk:Realistic_Shipyards&amp;diff=9800"/>
		<updated>2008-05-15T16:16:41Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Issues and Requests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Issues and Requests ==&lt;br /&gt;
&lt;br /&gt;
Due to the presence of the &amp;quot;hires&amp;quot; textures, my running oolite process bloats to around&lt;br /&gt;
800 MB virtual memory (ram + swap) in about 45 minutes of play, whereas without them, it stays&lt;br /&gt;
around 400-600 after 2-4 hours' play, including witchspace jumps.&lt;br /&gt;
&lt;br /&gt;
Could there be one that has just the &amp;quot;lowres&amp;quot; or older textures, or at least a place where we can&lt;br /&gt;
drop them into Textures/ and Images/ ? My base is a Debian (Linux-based) box, 512 MB RAM,&lt;br /&gt;
radeon 9000 agp video.&lt;br /&gt;
&lt;br /&gt;
[[User:SimonRaven|SimonRaven]] 07:42, 30 April 2008 (BST)&lt;br /&gt;
&lt;br /&gt;
Update: turns out it was an error on my part, I thought I'd removed the System Redux from AddOns, but I hadn't.&lt;br /&gt;
Still had an issue with the &amp;quot;hires&amp;quot; textures from the ships, bloating the thing a bit too much to my&lt;br /&gt;
taste (but I get nitpicky about such things, so if I complain too much, just ignore the extra complaining hehe).&lt;br /&gt;
&lt;br /&gt;
[[User:SimonRaven|SimonRaven]] 17:16, 15 May 2008 (BST)&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Docking_Computers&amp;diff=9737</id>
		<title>Docking Computers</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Docking_Computers&amp;diff=9737"/>
		<updated>2008-05-04T19:42:48Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Use */ clarify keys a bit, and correct spelling of &amp;quot;queue&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By the time most [[Jameson]]s have acquired enough credits to afford this piece of equipment, they have learnt to dock manually with their optical recievers obscured (or were scraped from a dockingbay by auto-shovels). Nevertheless, this is a useful piece of AI to install in your vessel if you do not have a copilot, who can take over the helm should you feel an urgent need to visit the captains recreational cubicle. (Be advised that voiding the ships sanitation tanks while in dock or in the process of docking is prohibited and will be fined according to GalCop Art.2, sec.4a &amp;quot;unsanitary behaviour&amp;quot; and Art.1,sec.5 &amp;quot;vandalism of GalCop property&amp;quot; - punishments include cleaning the docking area of such noisome jetsam.)&lt;br /&gt;
&lt;br /&gt;
Back to: [[Oolite Equipment]]&lt;br /&gt;
&lt;br /&gt;
== Specification ==&lt;br /&gt;
The SinCorn RemLock D&amp;amp;A System is a sophisticated and expensive piece of gadgetry. It comes with MemmSomn Pilot Interaction to induce hi-cram sleep during the maneuvre.&lt;br /&gt;
&lt;br /&gt;
== Use ==&lt;br /&gt;
Press '''c''' (&amp;quot;c&amp;quot;) on your control console to activate, and to deactivate. &lt;br /&gt;
Autopilot will approach the station, ask for clearance and line up in the queue at the docking beacon and eventually dock.&lt;br /&gt;
&lt;br /&gt;
Docking computers can save on minor collisions and accidents which cost Commanders money.  A tired Commander can easily make a minor mistake that will not destroy the ship but may damage valuable ship systems.&lt;br /&gt;
&lt;br /&gt;
=== Advanced Options ===&lt;br /&gt;
A soothing ancient melody will be replayed while activated as most space veterans get agitated at the slow and deliberate method of docking the AI uses, this can be switched on and off by pressing '''s''' (&amp;quot;s&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Holding '''shift''' and pressing '''d''' (&amp;quot;D&amp;quot;) activates a hypnotic sleep inducer (MemmSomn Pilot Interaction) at the same time as the docking computers - this allows the pilot to sleep while the ship docks and awake refreshed when docking procedures are complete.  This allows Commanders to devote more concentration on important commercial decisions once docked.&lt;br /&gt;
&lt;br /&gt;
Holding '''shift''' and pressing '''c''' (˝C&amp;quot;) contacts the targeted ship or station rather than the main station, permitting auto-docking with large vessels and non-standard space-stations.&lt;br /&gt;
&lt;br /&gt;
== Availability ==&lt;br /&gt;
 Pricetag: 1500.0 Cr.&lt;br /&gt;
 Techlevel: 9&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
Back to: [[Oolite Equipment]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Oolite]]&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Talk:Realistic_Shipyards&amp;diff=9722</id>
		<title>Talk:Realistic Shipyards</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Talk:Realistic_Shipyards&amp;diff=9722"/>
		<updated>2008-04-30T06:42:35Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: New page: == Issues and Requests ==  Due to the presence of the &amp;quot;hires&amp;quot; textures, my running oolite process bloats to around 800 MB virtual memory (ram + swap) in about 45 minutes of play, whereas w...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Issues and Requests ==&lt;br /&gt;
&lt;br /&gt;
Due to the presence of the &amp;quot;hires&amp;quot; textures, my running oolite process bloats to around&lt;br /&gt;
800 MB virtual memory (ram + swap) in about 45 minutes of play, whereas without them, it stays&lt;br /&gt;
around 400-600 after 2-4 hours' play, including witchspace jumps.&lt;br /&gt;
&lt;br /&gt;
Could there be one that has just the &amp;quot;lowres&amp;quot; or older textures, or at least a place where we can&lt;br /&gt;
drop them into Textures/ and Images/ ? My base is a Debian (Linux-based) box, 512 MB RAM,&lt;br /&gt;
radeon 9000 agp video.&lt;br /&gt;
&lt;br /&gt;
[[User:SimonRaven|SimonRaven]] 07:42, 30 April 2008 (BST)&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
	<entry>
		<id>http://backup.witchspacewiki.org/index.php?title=Woma&amp;diff=9517</id>
		<title>Woma</title>
		<link rel="alternate" type="text/html" href="http://backup.witchspacewiki.org/index.php?title=Woma&amp;diff=9517"/>
		<updated>2008-04-12T19:54:08Z</updated>

		<summary type="html">&lt;p&gt;SimonRaven: /* Security */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox ShipStats Oolite| title= Woma Fuel Transport&lt;br /&gt;
|image = [[Image:Oolite-woma.png|250px]]&lt;br /&gt;
|dimensions = 60 x 24 x 142&lt;br /&gt;
|capacity = N/A&lt;br /&gt;
|gunmounts = N/A&lt;br /&gt;
|maxspeed = 0.1 LM&lt;br /&gt;
|maneuverability = Roll: 0.4&amp;lt;br /&amp;gt;Pitch: 0.8&lt;br /&gt;
|energybanks = N/A&lt;br /&gt;
|milshields = N/A&lt;br /&gt;
|shieldboost = N/A&lt;br /&gt;
|hyperspace = Yes&lt;br /&gt;
|isoxp = OXP&lt;br /&gt;
|isplayer = No&lt;br /&gt;
}}&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
An unlikely sighting in poor and hazardous systems, this large mass of metal that is the Woma Fuel Transport Service moves a great deal of [[Quirium]] between systems of commerce, keeping stations in constant supply.  Completing this task is usually done at notoriously slow pace as these are some of the most sluggish movers in populated space, and Woma pilots do not get paid by the hour.&lt;br /&gt;
&lt;br /&gt;
==Security==&lt;br /&gt;
&lt;br /&gt;
As pirates consider them an awkward beast, providing for Woma protection has&lt;br /&gt;
been something of a dilemma for [[FuelCorp]].  Since they will never be found&lt;br /&gt;
transporting anything of value other than the two silos containing fuel, which&lt;br /&gt;
may only be accessed with the apropriate, exclusive machinery, it is practically&lt;br /&gt;
a rule among pirates to ignore them.&lt;br /&gt;
&lt;br /&gt;
[[Image:Womasep.png|thumb|280px|left|A Fuel Silo is dispatched]]&lt;br /&gt;
&lt;br /&gt;
Considering this they are surprisingly often prone to vicious and futile, fatal&lt;br /&gt;
attacks.  This is presumably carried out by vandals who do it just to see a big explosion.&lt;br /&gt;
Any other motive is hard to imagine.  &lt;br /&gt;
&lt;br /&gt;
Having counted the costs of years of indecision, FuelCorp has recently swallowed the&lt;br /&gt;
bitter pill, and has upped the level of protection with a fleet of dedicated&lt;br /&gt;
[[Sidewinder (Oolite)|Sidewinder]] escorts.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
The [http://oosat.alioth.net/node/22 transports.oxp] containing the Woma.&lt;/div&gt;</summary>
		<author><name>SimonRaven</name></author>
		
	</entry>
</feed>