Difference between revisions of "Methods"

From Elite Wiki
m (other methods)
m (other methods)
Line 79: Line 79:
   
 
== other methods ==
 
== other methods ==
So far I have summed up the methods used in script.plists, next are the other sources.
+
So far I have summed up the methods used in script.plists, next are the other sources.
'''spawn: <role> #'''
+
'''spawn: <role> #'''
Spawns # entities of the type 'role', randomly clustered around the calling entity.
+
Spawns # entities of the type 'role', randomly clustered around the calling entity.
'''clock_number'''
+
'''clock_number'''
now returns the game-time in seconds as a float rather than an integer.
+
now returns the game-time in seconds as a float rather than an integer.
'''clock_secs_number'''
+
'''clock_secs_number'''
returns the game-time in seconds as an integer.
+
returns the game-time in seconds as an integer.
'''fuel_level_number'''
+
'''fuel_level_number'''
returns the fuel level in LY as a float
+
returns the fuel level in LY as a float
'''dockedStationName_string'''
+
'''dockedStationName_string'''
returns the displayed name of the station, or 'NONE' if the player isn't docked
+
returns the displayed name of the station, or 'NONE' if the player isn't docked
'''systeminfodata_number'''
+
'''systeminfodata_number'''
 
 
   
 
== Internal Links ==
 
== Internal Links ==

Revision as of 17:42, 21 January 2006

Methods

Methods are the actions that are performed when conditions (defined in a script) are met, or when a particular set of actions (like death_actions or script_actions) are called for, or when an AI calls for a script action to be performed.

All methods are stored in plists as strings (in XML this means between a <string> tag and a </string> closing tag). If they take any parameters then these follow a colon and a space (: ) after the 'command' part of the method.

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!

<key>death_actions</key>
<array>
	<string>commsMessage: Oh dear [commander_name]!</string>
	<string>setSunNovaIn: 2.0</string>
</array>

script methods GUI

addMissionText: missiontext.plist<key> 
// adds text to the mission screen from an entry in missiontext.plist
// with the given key

set: mission_variable <value>
// sets the mission_variable to the value given

setGuiToMissionScreen
// opens the mission screen

setMissionDescription: missiontext.plist <key>
// sets the short description given on the player's manifest screen

clearMissionDescription
// clears the short description

showShipModel: <role>
// shows a rotating model of a ship with the role given
// role refers to a value in one of shipdata.plist's entries'
// roles key value pair

setMissionMusic: <filename>
// plays the music file given
// if it exists within any OXP's Music folder

setMissionImage: <filename>
// displays the picture file given
// if it exists within any OXP's Images folder

script methods system

checkForShips: shiptype 
addSystemShips: shiptype # 0.66 (?)
addShips: shiptype #
addShipsAtPrecisely: shiptype 1 pwu 0 0 0.88 (?)
setSunNovaIn: #
setPlanetinfo:  (see planetinfo.plist)

script methods mission state

set: mission_variable <value>
// the value could be a particular string or numeric value
increment: mission_variable
// increases the mission variable's value by 1.0
decrement: mission_variable
// decreases the mission variable's value by 1.0
setMissionChoices: <missiontext.plist key>
// sets the array of choices presented at the bottom of the mission page to those described in the
// entry in missiontext.plist that corresponds to the key given
resetMissionChoice
// makes missionChoice undefined

player state methods

awardShipKills: #
awardEquipment: EQ_SOME_PIECE_OF_KIT
awardCredits: # 
setLegalStatus: #
testForEquipment: EQ_COOL_TOY
setFuelLeak: #
useSpecialCargo: A load full of '['thargoid_curses']' 
launchFromStation
commsMessage: Happy Newyear!
removeAllCargo
awardCargo: # Commodity

other methods

So far I have summed up the methods used in script.plists, next are the other sources. 
spawn: <role> #
Spawns # entities of the type 'role', randomly clustered around the calling entity.
clock_number
now returns the game-time in seconds as a float rather than an integer. 
clock_secs_number
returns the game-time in seconds as an integer. 
fuel_level_number 
returns the fuel level in LY as a float 
dockedStationName_string 
returns the displayed name of the station, or 'NONE' if the player isn't docked 
systeminfodata_number

Internal Links

OXP_howto_AI.


This article is a stub. You can help EliteWiki by expanding it.