Page 4 of 4

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

Posted: Mon Aug 22, 2022 4:51 am
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.

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

Posted: Wed Oct 12, 2022 6:14 pm
by Cholmondely
Can we replicate this in Oolite?

(Pioneer's Acropolis - Visiting ancient ruins in Pioneer)