Scripters cove

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2856
Joined: Sat Jun 11, 2011 6:07 am
Location: Nova Hollandia
Contact:

Re: Scripters cove

Post by Wildeblood »

Lone_Wolf wrote: Thu Aug 14, 2025 2:53 pm
Is there an execution advantage for using a var to call worldscripts or is this cosmetic/style related ?
A slight advantage, yes.

Code: Select all

this.playerBoughtNewShip = this.playerReplacedShip = function _sc_playerReplacedShip(ship) {...}
Are those functions, above, running twice when the player buys a new ship? Would it be sufficient to just have the playerReplacedShip (or, am I thinking of adding and buying equipment)?
"Must keep this response efficient to preserve remaining context."
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5369
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

I believe the replace ship event is separate to the bought ship event. They don’t happen together.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 613
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

Wiki on playerBoughtNewShip
Note: In a future release of Oolite, playerBoughtNewShip will no longer be fired when the ship is replaced using player.replaceShip(). Instead, the playerReplacedShip event should be used. At the moment, both events (playerBoughtNewShip and playerReplacedShip) will fire
That suggests it is currently possible for both playerBoughtNewShip and playerReplacedShip to fire for the same event ?
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page
(needs updating)

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

Re: Scripters cove

Post by phkb »

Oh… oh well, forget what I said, then! That’s what I get when I don’t check my homework before speaking. Every time. Dang it.
Post Reply