removeEquipment Bug

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

removeEquipment Bug

Post by Okti »

Hi,

I was working on a script with mission screens and at one stage I had to remove some pylon based equipment, using the code below.

Code: Select all

	this.misArr = player.ship.missiles;
         player.ship.removeEquipment(this.misArr[this.misArr.length-1].equipmentKey);
But oolite just crushes when the code is run. This code is in a choiceEvaluation function called by a delegate passed to mission.runScreen.

I used the same code in PylonBasedEqRemover.oxp and had no problem with it. But mission screen for this equipment was triggered from playerBoughtEquipment.
My OXP's
And Latest Mission Coyote's Run
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: removeEquipment Bug

Post by JensAyton »

Please e-mail me the crashing OXP.
User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

Re: removeEquipment Bug

Post by Okti »

Mail is on the way,


Thanks
Okti
User avatar
Commander McLane
---- E L I T E ----
---- 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: removeEquipment Bug

Post by Commander McLane »

One possible problem immediately springing to mind is, what happens if the code is executed while the player has no pylon-mounted equipment installed and missArr is therefore empty?

Code: Select all

	this.misArr = player.ship.missiles;
         if(missArr.length > 0) player.ship.removeEquipment(this.misArr[this.misArr.length-1].equipmentKey);
User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

Re: removeEquipment Bug

Post by Okti »

Commander McLane wrote:
One possible problem immediately springing to mind is, what happens if the code is executed while the player has no pylon-mounted equipment installed and missArr is therefore empty?

Code: Select all

 this.misArr = player.ship.missiles;
if(missArr.length > 0) player.ship.removeEquipment(this.misArr[this.misArr.length-1].equipmentKey);
Thanks Commander McLane, but this was not the case. I had 10 max missile bays and all ten of them were used by other equipments.

Any way, I send the OXP to Ahruman and he is probably going to debug it on development environment.
My OXP's
And Latest Mission Coyote's Run
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: removeEquipment Bug

Post by Cholmondely »

If anybody knows how to write a new one of these, or a fixing override... At the moment we can only sell everything in the missile bay ... but with 60-odd missiles, mines & bombs, if one just wishes to exchange one for another, and the local orbital station has a lower TL than needed to buy some of them back...

Or maybe this facility should be included in the Oolite game code...



Oh! And by the way... new wiki page: http://wiki.alioth.net/index.php/Pylon- ... nt_Remover
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: removeEquipment Bug

Post by phkb »

Cholmondely wrote: Thu Jul 22, 2021 9:42 pm
If anybody knows how to write a new one of these, or a fixing override... At the moment we can only sell everything in the missile bay ... but with 60-odd missiles, mines & bombs, if one just wishes to exchange one for another, and the local orbital station has a lower TL than needed to buy some of them back...
Something like this?
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: removeEquipment Bug

Post by Cholmondely »

phkb wrote: Fri Jul 23, 2021 4:43 am
Cholmondely wrote: Thu Jul 22, 2021 9:42 pm
If anybody knows how to write a new one of these, or a fixing override... At the moment we can only sell everything in the missile bay ... but with 60-odd missiles, mines & bombs, if one just wishes to exchange one for another, and the local orbital station has a lower TL than needed to buy some of them back...
Something like this?
Great! Thank you for sorting it out. It just seems to be such a basic thing (just like your Maintenance on Demand, Lave Initial Shipyard & Planet Forests/Oceans). Now that I've finally finished listing the equipment, I hope to retrun to LongWayRound with a summary of what you taught me and my first stab at adding a mission screen with options.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply