I'm still having a hard time learning the basics of the scripting system
So . . . can anybody recommend some OXPs (preferably using the JavaScript method), that would be good to look at purely for learning purposes?
(I've got far too many to just randomly start looking at them, so I'm just asking for pointers)
I'd ideally like a few that do just one or two things, and are well documented.
I get how models, textures, and sounds are created, and put into their respective folders, but it's just the actual scripting I'm having trouble with.
Maybe someone could write a few simple mission-style ones just for this purpose
Suggestions of OXPs to learn from
Moderators: winston, another_commander
IIRC The Long Way Round is a simple OXP written by Giles, which some peeps have used to learn scripting eg Black Baron, but Oxp's have now moved on to Java scripting, so not sure which would be a simple one to use for guidance.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
It really depends on which scripting language you want to learn. There is the old-style (or legacy) plist-scripting. It is what we all have grown up with, and it still works, and probably will continue to work for a long time in order to ensure backwards-compatibility. But it is deprecated, and our coders discourage its use, because it is slowly replaced by Javascript-scripting.
So that's the second alternative. The whole Javascript-scripting model is still very much in the making. So it gives you the advantage of being on the bleeding edge of OXPing. You can even make suggestions for the functionality you would like to be included.
As a starting point I would suggest of course all the documentation available in the wiki, especially on scripting.
As far as practical examples are concerned, why not start with those included in Oolite itself? All native missions are scripts in your Oolite distribution. As far as legacy plist-scripting is concerned, you find them in Oolite/Contents/Resources/Config/script.plist (in 1.65 only). Javascript-scripts are referenced in Oolite/Contents/Resources/Config/world-scripts.plist and can be found in Oolite/Contents/Resources/Scripts (in 1.70 only). In this folder you find a couple of JS-scripts and one old-style plist-script, named oolite-legacy-script.plist, which contains the rest of the built-in missions.
If you open both 1.65 and 1.70 you will be able to compare the cloaking device and the trumbles mission in plist-scripting (1.65) and JS-scripting (1.70), which may be particularly helpful in understanding the different approaches of the two scripting models.
*****
And finally a (very!) brief and general introduction into scripting: Oolite scripting makes heavy use of property lists (see wiki). For any given OXP you need a couple of different property lists which have to be in the correctly named folder within the OXP. Generally everything has to live within a folder "Config", except JS-scripts, which live in a folder "Scripts" and AIs, which have to live in a folder "AIs". "Models", "Textures", "Images" and "Music" have to go each in their respective folder, as you certainly already have found out. The action takes place in a property list named "script.plist" (legacy scripting) or "whatever.js" (JS-scripting). In most cases you need a couple of other supporting plists as well. All text displayed on a mission screen has to be defined in "missiontext.plist". Any other text, like unique ship-hails, has to be defined in "descriptions.plist". Special prices for commodities, that will be used in your special station only, are defined in "commodities.plist". Individual characters you may meet in their ship are defined in "characters.plist". If you have modelled a new ship, you have to define its specifications in "shipdata.plist". If you want it to be a player-ship and buyable in the shipyard, you have to define the necessary properties in "shipyard.plist". Any new equipment has to be defined in "equipment.plist". Alterations to the Ooniverse, like new planets, are scripted in "planetinfo.plist" I think these are the most important ones for any OXP. Not every OXP will have to use all of them.
And again, consult the wiki. Most of the plists have a (conveniently) equally-named wiki-page attached to them, which will explain pretty much everything you need to know, like every possible command and method in that plist, and what it does, e.g. the documentation of shipdata.plist.
I think with these you should be able to start writing your first OXP.
Right On, Commander!
So that's the second alternative. The whole Javascript-scripting model is still very much in the making. So it gives you the advantage of being on the bleeding edge of OXPing. You can even make suggestions for the functionality you would like to be included.
As a starting point I would suggest of course all the documentation available in the wiki, especially on scripting.
As far as practical examples are concerned, why not start with those included in Oolite itself? All native missions are scripts in your Oolite distribution. As far as legacy plist-scripting is concerned, you find them in Oolite/Contents/Resources/Config/script.plist (in 1.65 only). Javascript-scripts are referenced in Oolite/Contents/Resources/Config/world-scripts.plist and can be found in Oolite/Contents/Resources/Scripts (in 1.70 only). In this folder you find a couple of JS-scripts and one old-style plist-script, named oolite-legacy-script.plist, which contains the rest of the built-in missions.
If you open both 1.65 and 1.70 you will be able to compare the cloaking device and the trumbles mission in plist-scripting (1.65) and JS-scripting (1.70), which may be particularly helpful in understanding the different approaches of the two scripting models.
*****
And finally a (very!) brief and general introduction into scripting: Oolite scripting makes heavy use of property lists (see wiki). For any given OXP you need a couple of different property lists which have to be in the correctly named folder within the OXP. Generally everything has to live within a folder "Config", except JS-scripts, which live in a folder "Scripts" and AIs, which have to live in a folder "AIs". "Models", "Textures", "Images" and "Music" have to go each in their respective folder, as you certainly already have found out. The action takes place in a property list named "script.plist" (legacy scripting) or "whatever.js" (JS-scripting). In most cases you need a couple of other supporting plists as well. All text displayed on a mission screen has to be defined in "missiontext.plist". Any other text, like unique ship-hails, has to be defined in "descriptions.plist". Special prices for commodities, that will be used in your special station only, are defined in "commodities.plist". Individual characters you may meet in their ship are defined in "characters.plist". If you have modelled a new ship, you have to define its specifications in "shipdata.plist". If you want it to be a player-ship and buyable in the shipyard, you have to define the necessary properties in "shipyard.plist". Any new equipment has to be defined in "equipment.plist". Alterations to the Ooniverse, like new planets, are scripted in "planetinfo.plist" I think these are the most important ones for any OXP. Not every OXP will have to use all of them.
And again, consult the wiki. Most of the plists have a (conveniently) equally-named wiki-page attached to them, which will explain pretty much everything you need to know, like every possible command and method in that plist, and what it does, e.g. the documentation of shipdata.plist.
I think with these you should be able to start writing your first OXP.
Right On, Commander!
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Cmd McLane was already very complete. I only can add a list of OXP's that use JS scripting that I currently have installed:
AsteroidStorm
Hotrods
Kestrel&Falcon
Local_Hero
Military Fiasco
Transports
UPS-courier
Of most of above files also an old style oxp exist. The latest versions however are written in JS and can be found by downloading the latest version from the Wiki when your version does not jet contain a JS part.
I switched to JS scripting in december last year so I have just little experience with it, but I like it already. When you do everything during a tickle event you get a script that writes down almost exactly as an old style plist. Therefor is is not more difficult to write. But in JS you can create much more complex structures and make powerful scripts. For a starter I would recommend starting in JS. e.g. in plist scripting you cannot multiply or compare variables. This makes JS scripting often easier than old style scripting.
Only problem with most examples given above is that they are complex. Maybe Military Fiasco is the easiest to start with. It contains both an old and new style script. And the JS script inside is quite straight forward.
Eric
AsteroidStorm
Hotrods
Kestrel&Falcon
Local_Hero
Military Fiasco
Transports
UPS-courier
Of most of above files also an old style oxp exist. The latest versions however are written in JS and can be found by downloading the latest version from the Wiki when your version does not jet contain a JS part.
I switched to JS scripting in december last year so I have just little experience with it, but I like it already. When you do everything during a tickle event you get a script that writes down almost exactly as an old style plist. Therefor is is not more difficult to write. But in JS you can create much more complex structures and make powerful scripts. For a starter I would recommend starting in JS. e.g. in plist scripting you cannot multiply or compare variables. This makes JS scripting often easier than old style scripting.
Only problem with most examples given above is that they are complex. Maybe Military Fiasco is the easiest to start with. It contains both an old and new style script. And the JS script inside is quite straight forward.
Eric
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Thanks a lot for all the advice.
Seems a little overwhelming right now, but I've got to start somewhere.
My last coding experience (other than HTML) was a Pong clone on the Amiga using Blitz Basic, about 10-15 years ago.
I'm working on a simple sound/music replacement one at the moment, but I'll keep reading as much as I can until I feel ready to tackle a more adventurous OXP.
Thanks again to all.
I love this game, and the forums are so damned helpful.
Can't believe it's all free and open source!
Seems a little overwhelming right now, but I've got to start somewhere.
My last coding experience (other than HTML) was a Pong clone on the Amiga using Blitz Basic, about 10-15 years ago.
I'm working on a simple sound/music replacement one at the moment, but I'll keep reading as much as I can until I feel ready to tackle a more adventurous OXP.
Thanks again to all.
I love this game, and the forums are so damned helpful.
Can't believe it's all free and open source!