Page 12 of 16

Posted: Fri Oct 09, 2009 10:15 am
by Screet
Commander McLane wrote:
So why should the Buoy Repair Services replace a blown-up station with a buoy?
Concerning galNavy, "S" is from the buoy before the station.

Screet

Posted: Fri Oct 09, 2009 11:36 am
by pmw57
Ahruman wrote:
pmw57 wrote:
How do you feel about back-breaking labour-intensive hand-coded conversions instead?
I’m in favour of someone else doing them. ;-)

I may finish the converter, but for use as an offline tool. In most cases, though, the resulting code would still require a complete rewrite from the “tickle”-based approach to an event-driven one. Most types of events can’t be reliably extracted automatically. (The exceptions would be launch and entered-system checks, since these are guaranteed to only be evaluated once per relevant event.)
I invite then, people to examine a new wiki page, that is intended to provide information to help people create JavaScript scripts for shipdata.plist

http://wiki.alioth.net/index.php/Oolite ... ip_scripts

Feedback is extremely welcome.

Posted: Fri Oct 09, 2009 12:32 pm
by Thargoid
A good beginning there. But there is a little room for expansion:

  • this.shipSpawnedAsEscort might also be worth mentioning.
  • this.shipDied also triggers when a ship is removed by script.
  • This is an ideal place to include a brief tutorial about linking such a ship script to the ships AI plist too (AI - sendScriptMessage: , js - this.ship.AIState, this.ship.reactToAIMessage). Advanced player stuff but a fair few examples around (some of mine and some of Erics for example, plus several others).
  • script_action is more than shipDockedWithStation and shipWasScooped, it can be any of the worldScript events. Certainly valid examples thereof, but people might take it as indicative of all that can be done.
  • The script is unique for that given ship (if you spawn two ships of that particular type, they will both run the same script but independent examples thereof).
  • It is possible to pass parameters from the shipdata.plist to the script (via the script_info key). Again advanced-player stuff but not so difficult.
[/color]

Posted: Fri Oct 09, 2009 12:40 pm
by pmw57
Thargoid wrote:
A good beginning there. But there is a little room for expansion:


May I suggest that you expand the contents of the page with more useful information.

I'm afraid that I don't know half of what you're talking about there, but if you'd be willing to put together some content about it, I would be capable of working it into a wiki-suitable notation for the page.

Posted: Fri Oct 09, 2009 12:45 pm
by Thargoid
Certainly, you just asked for feedback here :)

I'll have a look at it when I get a bit of free time.

Posted: Fri Oct 09, 2009 12:47 pm
by pmw57
Thargoid wrote:
Certainly, you just asked for feedback here :)

I'll have a look at it when I get a bit of free time.
Thanks, I'll add your comments though to the discussion page http://wiki.alioth.net/index.php/Talk:O ... ip_scripts so that they don't get lost.

Posted: Fri Oct 09, 2009 1:05 pm
by Commander McLane
More comments:

I think the page title is wrong/misleading. What the page is obviously about is ship scripts. So that should be the title. Shipdata scripts don't exist; or they do exist, but are covered in the page http://wiki.alioth.net/index.php/Script ... n_shipdata and are different from ship scripts.

One of the differences gets visible in the very first sentence:
The shipdata.plist file can reference a JavaScipt script to perform behaviours that are executed on the creation or the disappearance of the ship.
That was true for the legacy scripts within shipdata, but covers not even a fraction of what ship scripts are good for. Next to creation (shipSpawned) and disappearance (shipDied), all event handlers marked as usable in ship scripts are, errmmm..., usable in ship scripts. :?

Which also means that the page you are setting up actually already exists. Its http://wiki.alioth.net/index.php/Oolite ... t_handlers and it contains hints on which of the event handlers work with ship scripts as well.

I notice you even have put this very information up on the page:
Any other world script events can be applied to the ship as well.
But again that's not entirely correct. Not any other world script events can be used in a ship script, but exactly those marked as usable in ship scripts. That's why they are marked as usable in ship scripts on the event handler page, i.e. it is explicitely written there that a certain handler can be used in ship scripts as well.

Posted: Fri Oct 09, 2009 1:27 pm
by pmw57
Commander McLane wrote:
I think the page title is wrong/misleading. What the page is obviously about is ship scripts. So that should be the title.
Good idea, it has been made so. http://wiki.alioth.net/index.php/Oolite ... ip_scripts
Commander McLane wrote:
Not any other world script events can be used in a ship script, but exactly those marked as usable in ship scripts. That's why they are marked as usable in ship scripts on the event handler page, i.e. it is explicitely written there that a certain handler can be used in ship scripts as well.
Thanks. With that "Any world scripts, " I'll added the letter M to change Any into MAnyMany :wink:

Posted: Fri Oct 09, 2009 1:32 pm
by pmw57
Commander McLane wrote:
The shipdata.plist file can reference a JavaScipt script to perform behaviours that are executed on the creation or the disappearance of the ship.
That was true for the legacy scripts within shipdata, but covers not even a fraction of what ship scripts are good for.
This sounds like a good opportunity to expand on the page. My intention is for the page to be some kind of guide for people who want to move away from plists, to using JavaScript instead.

If we can let them know about other things they can also make good use of the scripts for, then all the better.

Posted: Fri Oct 09, 2009 1:41 pm
by Commander McLane
pmw57 wrote:
My intention is for the page to be some kind of guide for people who want to move away from plists, to using JavaScript instead.
If you allow me the remark, the subject you chose (ship scripts) sounds a bit odd for this purpose. Ship scripts never existed in legacy (plist scripting), so there is no "instead" in this case. They are a completely new opportunity opened by changing the scripting engine to JS.

If you, however, want something with a before—after effect, you should make a guide for world scripts instead.

Posted: Fri Oct 09, 2009 3:44 pm
by Eric Walch
pmw57 wrote:
Commander McLane wrote:
That was true for the legacy scripts within shipdata, but covers not even a fraction of what ship scripts are good for.
This sounds like a good opportunity to expand on the page. My intention is for the page to be some kind of guide for people who want to move away from plists, to using JavaScript instead.

If we can let them know about other things they can also make good use of the scripts for, then all the better.
A lot of the old stuff on the wiki has to be rewritten. It was written with the only focus on legacy (there was no JS at that time). A large part is still better explained in the Legacy version. This encourages people to use the old method. It should be the other way round. Main examples in JS and legacy examples how it used to be so scripters still can understand the old scripts. And that page I once wrote and your new page are a good example of before and after. It now should really start with focus on JS.

One thing that also should be clear is that both script types within a ship definition are never used simultaneously. If a ship contains a JS script, the old scripts are ignored. When converting ships to JS I often leave the old stuff in, so it stays possible to use that ship with Oolite 1.65. That Oolite version than keeps using the old scripts. When not knowing this, the presence of both scripts can confuse people.

Posted: Mon Jun 28, 2010 4:16 pm
by Svengali
v1.02.6 is online.

Changes:
- Fixes for ATI cards (big thanks to Zieman!)
- Cleanup
- v1.74'ish shipdata

Posted: Mon Jun 28, 2010 9:23 pm
by JazHaz
Svengali wrote:
v1.02.6 is online.

Changes:
- Fixes for ATI cards (big thanks to Zieman!)
- Cleanup
- v1.74'ish shipdata
Thanks! Does the last feature still need work doing though?

Posted: Tue Jun 29, 2010 11:22 am
by Svengali
JazHaz wrote:
Thanks! Does the last feature still need work doing though?
There's always work left. Things are changing, time passes by and Oolite itself offers new features/ways. Here it is the subentity declaration in shipdata.plist (introduced in v1.73) plus a major cleanup resulting in a lot smaller filesize (496KB -> 450KB).

But I've forgotten one thing - we wanted to change the Armadillo a bit. Argh. Not this time then.

Re: GRS buoyRepair.oxp

Posted: Sat Feb 19, 2011 10:31 pm
by Svengali
v1.02.7 is online.

Changes:
- Script/AI tweaks for Oolite v1.75, but still works in v1.74.2
- Armadillo a bit more scaled
- Cleanup, etc...