Difference between revisions of "OXP mission offering"
Eric Walch (talk | contribs) m (added GUI_SCREEN_MAIN) |
Eric Walch (talk | contribs) m (→Conditions for offering) |
||
Line 19: | Line 19: | ||
For Oollite versions up to 1.68 that do not know the "notequal" condition or for compatibillity with those versions use: | For Oollite versions up to 1.68 that do not know the "notequal" condition or for compatibillity with those versions use: | ||
− | conditions = (gui_screen_string oneof GUI_SCREEN_MAIN , GUI_SCREEN_STATUS). | + | conditions = (gui_screen_string oneof GUI_SCREEN_MAIN, GUI_SCREEN_STATUS). |
At the end of the docking procedure the script runs immediately for one time with gui_screen_string = GUI_SCREEN_MAIN but already with status_string = STATUD_DOCKED. All following moments the script runs with as gui_screen_string the screen you are looking at. When you do nothing further this will be the GUI_SCREEN_STATUS . (= F5) You could also explicit check for the mission screen and put your whole action in the else line. | At the end of the docking procedure the script runs immediately for one time with gui_screen_string = GUI_SCREEN_MAIN but already with status_string = STATUD_DOCKED. All following moments the script runs with as gui_screen_string the screen you are looking at. When you do nothing further this will be the GUI_SCREEN_STATUS . (= F5) You could also explicit check for the mission screen and put your whole action in the else line. | ||
Line 28: | Line 28: | ||
conditions = (gui_screen_string notequal GUI_SCREEN_MISSION). | conditions = (gui_screen_string notequal GUI_SCREEN_MISSION). | ||
− | |||
== Setting up the message == | == Setting up the message == |
Revision as of 18:06, 1 February 2008
Contents
How mission offering should be done
Location for offering
Missions should only be offered while being docked. To prevent offering on special stations make sure you are docked at the main station:
conditions = ("dockedAtMainStation_bool equal YES")
Only if you are offering something on a special station you can check for just being docked, but then you should also check the station name.
conditions = ("status_string equal STATUS_DOCKED", "dockedStationName_string equal Your Station Name")
Here is " Your Station Name" the name of the station as defined in shipyard.plist under "name". You could skip the first test for being docked as dockedStationName_string only has the stationname if you are docked.
Conditions for offering
Before placing text also check if the missionscreen is not in use. (See the documents in the downloadeble package below for more info)
For Oollite versions up to 1.68 that do not know the "notequal" condition or for compatibillity with those versions use:
conditions = (gui_screen_string oneof GUI_SCREEN_MAIN, GUI_SCREEN_STATUS).
At the end of the docking procedure the script runs immediately for one time with gui_screen_string = GUI_SCREEN_MAIN but already with status_string = STATUD_DOCKED. All following moments the script runs with as gui_screen_string the screen you are looking at. When you do nothing further this will be the GUI_SCREEN_STATUS . (= F5) You could also explicit check for the mission screen and put your whole action in the else line.
conditions = (gui_screen_string equal GUI_SCREEN_MISSION); do = (); else = (your stuff);
But this involves an extra nested condition, so most people will probably prefer the first method. Versions 1.69 and newer will have a not-equal option.
conditions = (gui_screen_string notequal GUI_SCREEN_MISSION).
Setting up the message
In the do part you must set a mission image. If you have no image set it to "none", otherwise you can get an image from a previous offer. Be aware that some computers are case sensitive so use the same casing as the actual picture. The pictures are placed in a folder called "images", inside the OXP.
setMissionImage: none or setMissionImage: my_pict.png
Then set the output to the MissionScreen with
setGuiToMissionScreen
This command creates an empty missionscreen and any text after this will go to this missionscreen. The text is then placed with:
addMissionText: entryname
"Entryname" is a key value in the file missiontext.plist If you use a second addMissionText commands the text is added below the previous. If you add to much text it runs off the screen and is lost. So make sure you don't use to much text. The system automatic puts a "hit space to continue" message at the bottom. On hitting this space key the MissionScreen will clear and the StatusScreen is put up. There exists also a command to put up the StatusScreen but you don't need that with offering.
Offering with Choices
When you in addition use the command:
setMissionChoices: entryname
the "hit space to continue" message is replaced by your choices. Your choices is in this case a key entry in the missiontext.plist file with as contents an array. On the bottom of your screen you see the contents of the array and if you select one, the variable "missionChoice_string" contains the name of the chosen entry-string. When you are offering choices first make clear that:
conditions = ("missionChoice_string undefined")
And in the following conditions:
conditions = ("missionChoice_string equal Your String")
And make sure that on all possible choices that the player can make, the choice is reseted: "resetMissionChoice"
Some excisting missions reset the choices just before the offering itself, but in that case it is possible that the choices of another active mission that is offered on the same station is reset before it can act on the choices. If you want to play save, just reset the choices on launching so they are clear on the next docking. Also use distinctive text for "Your String" and not just "YES" or "NO" as other badly written OXP could react on those often used responses.
Setting up the mission desciption
If you start a mission it is wise to add a short description and or a location for later reference by the player with:
setMissionDescription: entryname addMissionDestination: planet_number
Entryname is a key value in the missiontext.plist file. This must be a short description as long text won't wrap around but runs off the screen at the right side. For planet_numbet you ca use a plain number between 0 and 255 or a variable between square brackets. The destination is visible as a red cross in the galactic chart. If the mission is over you clear this description and the location with:
clearMissionDescription removeMissionDestination: planet_number
Notice that you do not need to specify the mission name in setting and clearing the missionDescription. The system automatic uses the name of the missionscript that uses this command to store the description. This also means that you can not use these two commands outside the missionscript like inside a death_action of a ship. The best lessons are taken by examining existing scripts. You can download more info and a test OXP here: Mission Offering Protocol