Page 121 of 121

Re: Scripters cove

Posted: Thu Aug 14, 2025 3:12 pm
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)?

Re: Scripters cove

Posted: Thu Aug 14, 2025 10:07 pm
by phkb
I believe the replace ship event is separate to the bought ship event. They don’t happen together.

Re: Scripters cove

Posted: Fri Aug 15, 2025 10:10 am
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 ?

Re: Scripters cove

Posted: Fri Aug 15, 2025 11:47 am
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.