Scripting requests
Moderators: winston, another_commander
Re: Scripting requests
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).
(Both of which I will write if the feedback is that it is worth doing).
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
Re: Scripting requests
I have a feeling the dev team will be expanding in the not so distant future...
Re: Scripting requests
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?
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
Re: Scripting requests
No, it's not. Now on the list for when feature addition is open again.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?
(It's relatively easy to determine with a frame callback, if you need this information before 1.79...)
Re: Scripting requests
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.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
Re: Scripting requests
One more - it looks like whilst we can identify the data key of an existing entity by
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?
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?
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
Re: Scripting requests
You need to enclose the dataKey in square brackets to distinguish it from a role.Thargoid wrote:One more - it looks like whilst we can identify the data key of an existing entity byentity.dataKey
we can't spawn that specific entity back again bysystem.addShips(<shipDataKey>, 1)
where <shipDataKey> is a valid data key from a shipdata.plist.
Code: Select all
system.addShips("[cobramk1],1);
Re: Scripting requests
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.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
Re: Scripting requests
Can we get a way to set the crew via JS? Name, origin, race, etc...
- 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:
Re: Scripting requests
Maybe this calls for a new Crew object?Svengali wrote:Can we get a way to set the crew via JS? Name, origin, race, etc...
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Scripting requests
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.
E-mail: [email protected]
- Tricky
- ---- E L I T E ----
- Posts: 821
- Joined: Sun May 13, 2012 11:12 pm
- Location: Bradford, UK. (Anarchic)
Re: Scripting requests
An example of pilot names for ships.
Ship script code...
World script code...
Pilot script code... (Referenced in characters.plist)
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;
};
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);
}
};
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
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
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.
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.
- Disembodied
- Jedi Spam Assassin
- Posts: 6885
- Joined: Thu Jul 12, 2007 10:54 pm
- Location: Carter's Snort
Re: Scripting requests
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.Zireael wrote:Being able to specify illegal goods on a per-system basis