Oolite Bulletins

For information and discussion about Oolite.
It is currently Fri Dec 15, 2017 5:55 pm

All times are UTC




Post new topic  Reply to topic  [ 816 posts ]  Go to page Previous 148 49 50 51 5255 Next
Author Message
 Post subject: Re: Scripting requests
PostPosted: Sun Feb 03, 2013 5:37 pm 
Offline
Competent
Competent

Joined: Sun Dec 30, 2012 1:58 pm
Posts: 37
Location: Beds, England
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).


Top
   
 Post subject: Re: Scripting requests
PostPosted: Sun Feb 03, 2013 6:01 pm 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 5028
I have a feeling the dev team will be expanding in the not so distant future... ;-)


Top
   
 Post subject: Re: Scripting requests
PostPosted: Tue Mar 19, 2013 10:20 pm 
Offline
Thargoid
Thargoid
User avatar

Joined: Thu Jun 12, 2008 6:55 pm
Posts: 5510
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 :D.

Thargoid TV
Dropbox Referral Link


Top
   
 Post subject: Re: Scripting requests
PostPosted: Tue Mar 19, 2013 10:26 pm 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
User avatar

Joined: Fri Nov 11, 2011 6:19 pm
Posts: 4015
Quote:
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...)

_________________
OXPs: [EliteWiki] New Cargoes, [EliteWiki] Skilled NPCs, [EliteWiki] Curse of the Black Sunspot, and more


Top
   
 Post subject: Re: Scripting requests
PostPosted: Tue Mar 19, 2013 10:29 pm 
Offline
Thargoid
Thargoid
User avatar

Joined: Thu Jun 12, 2008 6:55 pm
Posts: 5510
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 :D.

Thargoid TV
Dropbox Referral Link


Top
   
 Post subject: Re: Scripting requests
PostPosted: Thu Mar 21, 2013 9:16 pm 
Offline
Thargoid
Thargoid
User avatar

Joined: Thu Jun 12, 2008 6:55 pm
Posts: 5510
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?

_________________
My OXPs via Boxspace or from my Wiki pages :D.

Thargoid TV
Dropbox Referral Link


Top
   
 Post subject: Re: Scripting requests
PostPosted: Thu Mar 21, 2013 9:52 pm 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
User avatar

Joined: Fri Nov 11, 2011 6:19 pm
Posts: 4015
Quote:
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.
Code:
system.addShips("[cobramk1],1);

_________________
OXPs: [EliteWiki] New Cargoes, [EliteWiki] Skilled NPCs, [EliteWiki] Curse of the Black Sunspot, and more


Top
   
 Post subject: Re: Scripting requests
PostPosted: Thu Mar 21, 2013 10:22 pm 
Offline
Thargoid
Thargoid
User avatar

Joined: Thu Jun 12, 2008 6:55 pm
Posts: 5510
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 :D.

Thargoid TV
Dropbox Referral Link


Top
   
 Post subject: Re: Scripting requests
PostPosted: Fri May 10, 2013 4:02 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2267
Can we get a way to set the crew via JS? Name, origin, race, etc...


Top
   
 Post subject: Re: Scripting requests
PostPosted: Fri May 10, 2013 6:07 pm 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Thu Dec 14, 2006 9:08 am
Posts: 9520
Location: a Hacker Outpost in a moderately remote area
Quote:
Can we get a way to set the crew via JS? Name, origin, race, etc...
Maybe this calls for a new Crew object?

_________________
The Story — The Career — The OXPs


Top
   
 Post subject: Re: Scripting requests
PostPosted: Fri May 10, 2013 6:44 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
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: jens@oolite.org


Top
   
 Post subject: Re: Scripting requests
PostPosted: Sat May 11, 2013 6:39 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun May 13, 2012 11:12 pm
Posts: 821
Location: Bradford, UK. (Anarchic)
An example of pilot names for ships.

Ship script code...
Code:
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:
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:
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));
     */
};

_________________
Image
Facebook | Twitter
I3 channel logs | Dedicated servers


Top
   
 Post subject: Re: Scripting requests
PostPosted: Sat May 11, 2013 7:25 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Oct 20, 2007 2:52 pm
Posts: 2267
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).


Top
   
 Post subject: Re: Scripting requests
PostPosted: Mon Dec 16, 2013 12:41 pm 
Offline
---- E L I T E ----
---- E L I T E ----

Joined: Tue Nov 09, 2010 1:44 pm
Posts: 1396
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.


Top
   
 Post subject: Re: Scripting requests
PostPosted: Mon Dec 16, 2013 12:46 pm 
Offline
Jedi Spam Assassin
Jedi Spam Assassin
User avatar

Joined: Thu Jul 12, 2007 10:54 pm
Posts: 5873
Location: Carter's Snort
Quote:
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.

_________________
Oofiction: Calliope: a Captain Hesperus adventure | Stranglehold: a Captain Hesperus adventure | Local Midnight in the Vacuum Bar | A Farewell to Arms, Legs, etc.: the Blaze O'Glory Story


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 816 posts ]  Go to page Previous 148 49 50 51 5255 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited