OXP mission offering

From Elite Wiki
Revision as of 13:41, 14 September 2007 by Eric Walch (talk | contribs) (Offering with Choices)

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 till 1.69/1.70 that do not know the "notequal" condition or for compatibillity with those versions use:

conditions = (gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_MARKET, GUI_SCREEN_SHORT_RANGE_CHART).

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.7 and newer will have a not-equal option when programming in the new introduced javascript)

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.

setMissionImage: none

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 choices that the player makes the the choice is reseted: "resetMissionChoice"

Some missions reset the choices just before the offering to make it clear, but in that case it is possible that the choices of another 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 for later reference by the player with:

setMissionDescription: entryname

This must be a short description as long text won't wrap around but runs off the screen at the right side. If the mission is over you clear this description with:

clearMissionDescription.

The best lessons are done by examining existing scripts. You can download more info and a test OXP here: Mission Offering Protocol