Page 50 of 56
Re: Scripting requests
Posted: Sun Feb 03, 2013 5:37 pm
by Walbrigg
The patch above is not intended to be included in trunk (post 1.78 or whenever) as it is -- I posted it as a demonstration that what I was suggesting was in principle quite easy. If there's going to be a change that oxp writers can start to take advantage of, it should be complete, and include a way of doing per-column alignment, and a way of setting the tab stops.
(Both of which I will write if the feedback is that it is worth doing).
Re: Scripting requests
Posted: Sun Feb 03, 2013 6:01 pm
by another_commander
I have a feeling the dev team will be expanding in the not so distant future...
Re: Scripting requests
Posted: Tue Mar 19, 2013 10:20 pm
by Thargoid
Quick question - is a ship's (or entity's) energy recharge rate exposed to script (to read it at least)? If so, as what? I looked in the wiki but couldn't find anything. And if not, could it be?
Re: Scripting requests
Posted: Tue Mar 19, 2013 10:26 pm
by cim
Thargoid wrote:Quick question - is a ship's (or entity's) energy recharge rate exposed to script (to read it at least)? If so, as what? I looked in the wiki but couldn't find anything. And if not, could it be?
No, it's not. Now on the list for when feature addition is open again.
(It's relatively easy to determine with a frame callback, if you need this information before 1.79...)
Re: Scripting requests
Posted: Tue Mar 19, 2013 10:29 pm
by Thargoid
Thanks. I know I can calculate it (with a callback or just a simple timer) but it's a bit of a risky faff. I'm just pondering playing with a script OXP idea which would need the info.
Re: Scripting requests
Posted: Thu Mar 21, 2013 9:16 pm
by Thargoid
One more - it looks like whilst we can identify the data key of an existing entity by entity.dataKey
we can't spawn that specific entity back again by system.addShips(<shipDataKey>, 1)
where <shipDataKey> is a valid data key from a shipdata.plist.
Am I missing something here, or could that functionality be added? It would be most useful to be able to swap a specific entity from a pool with an identical one where the spawning primary role is a generic populator one (pirate, thargoid, thargon etc) rather than the specific datakey one.
Or is there some way of doing this already that I'm missing?
Re: Scripting requests
Posted: Thu Mar 21, 2013 9:52 pm
by cim
Thargoid wrote:One more - it looks like whilst we can identify the data key of an existing entity by entity.dataKey
we can't spawn that specific entity back again by system.addShips(<shipDataKey>, 1)
where <shipDataKey> is a valid data key from a shipdata.plist.
You need to enclose the dataKey in square brackets to distinguish it from a role.
Re: Scripting requests
Posted: Thu Mar 21, 2013 10:22 pm
by Thargoid
Thanks (with an additional " to your quote) - works fine. When you mentioned it I remembered the fact, but needed the prompt. Anyway it's doing what I want now.
Re: Scripting requests
Posted: Fri May 10, 2013 4:02 pm
by Svengali
Can we get a way to set the crew via JS? Name, origin, race, etc...
Re: Scripting requests
Posted: Fri May 10, 2013 6:07 pm
by Commander McLane
Svengali wrote:Can we get a way to set the crew via JS? Name, origin, race, etc...
Maybe this calls for a new Crew object?
Re: Scripting requests
Posted: Fri May 10, 2013 6:44 pm
by JensAyton
Internally, the crew is represented by an array of zero or more Character objects (usually one). As far as I can see, the only use of these is to put them in escape pods so you can sell them/get paid by their insurance later.
Re: Scripting requests
Posted: Sat May 11, 2013 6:39 pm
by Tricky
An example of pilot names for ships.
Ship script code...
Code: Select all
this.shipSpawned = function () {
/* Random name for the pilot. */
this.ship.$pilotName = expandDescription("%N [nom1]");
};
this.shipLaunchedEscapePod = function(escapepod) {
/* Transfer pilot name to the escape pod. */
escapepod.$pilotName = this.ship.$pilotName;
};
World script code...
Code: Select all
this.startUp = function () {
this.$rescued = [];
};
this.shipScoopedOther = function (whom) {
/* Save the pilot's name that was rescued. */
if (whom.$pilotName !== undefined) {
this.$rescued.push(whom.$pilotName);
}
};
Pilot script code... (Referenced in characters.plist)
Code: Select all
this.unloadCharacter = function() {
var mainScript = worldScripts["Name of your world script"],
pilotName;
if (mainScript.$rescued.length) {
/* Get the name of one of the rescued pilots. */
pilotName = mainScript.$rescued.shift();
} else {
/* Random name. Just in case it hasn't been set by the ship script code. */
pilotName = expandDescription("%N [nom1]");
}
/* Do stuff with this name, ie...
* player.addMessageToArrivalReport(expandDescription("You rescued " + pilotName));
*/
};
Re: Scripting requests
Posted: Sat May 11, 2013 7:25 pm
by Svengali
I'm aware of this way (but a good example, Tricky). This will only work for scripted pods though and requires to setup a characters.plist. For standard ships (and resulting escape-capsules) there's no way of specifying the crew dynamically (hence the request to get a way to set the crew before they are bailing out).
Re: Scripting requests
Posted: Mon Dec 16, 2013 12:41 pm
by Zireael
Small things I think could be done to the source code:
1) Making compass_target writable.
2) Have a key for console message log just like there's ~ for comms log.
3) Separate shields_recharge_rate from energy_recharge_rate
Less pressing ideas for some future OXPs:
1) Being able to specify illegal goods on a per-system basis
2) Guuys, there's 4 more function keys after F8, they could be used for something useful in the future.
Re: Scripting requests
Posted: Mon Dec 16, 2013 12:46 pm
by Disembodied
Zireael wrote:Being able to specify illegal goods on a per-system basis
Have you tried the [wiki]New Cargoes[/wiki] OXP? Although it deals with special cargo types, there are some system-specific differences as to what's legal and what's not.