What "can" be changed without re-compiling?

News and discussion of the PC port of Oolite.

Moderators: winston, another_commander

User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: What "can" be changed without re-compiling?

Post by phkb »

Cholmondely wrote: Wed Aug 17, 2022 9:34 pm
What about all this?
That stuff is really good, but doesn't cover with the limitation I was pointing out. For example, at the moment, we can create a character in the "characters.plist" file, like this:

Code: Select all

{
	myPerson = {
		role = trader;
		name = "Captain Bob";
		script = "myPerson.js";
	};
}
That script file can have some code in it like this:

Code: Select all

// filename "myPerson.js"
this.unloadCharacter = function() {
	// ... Javascript code to do something ...
}
You could then give a ship the "myPerson" character in shipdata.plist

Code: Select all

{
	"myship" = {
		... various shipdata entries ...
		"pilot" = "myPerson";
	};
}
Now, if you were to destroy that ship, and the pilot ejects, and you scoop that escape pod, when you dock at a station and the rescued pilot is unloaded, the "unloadCharacter" function in the "myPerson.js" script file will be executed.

BUT! And this is the point I was making - there is no way to access that script file during play. It's not accessible in the same way other worldscripts are that are declared in the "world-scripts.plist" file. Also, you can't programmatically assign a script to a character during play. So, all characters and their scripts have to be predefined by an OXP before the game starts. This is what I meant when I said "You can't directly reference and/or assign a script to a character".

Hopefully that makes a bit more sense.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5381
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: What "can" be changed without re-compiling?

Post by Cholmondely »

Can we replicate this in Oolite?

(Pioneer's Acropolis - Visiting ancient ruins in Pioneer)
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply