Cleaning up redundant mission variables

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

Moderators: winston, another_commander

Post Reply
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Cleaning up redundant mission variables

Post by Wildeblood »

I'm embarrassed to ask this because it's such a simple question, but how do I delete mission variables set by an equipment OXP, when the equipment is removed? I.e. this will look familiar:

Code: Select all

this.playerBoughtEquipment = function(equipmentKey)
	{
	if(equipmentKey == "EQ_WHATEVER_REMOVAL")
		{
		player.ship.removeEquipment("EQ_WHATEVER");
		player.ship.removeEquipment("EQ_WHATEVER_REMOVAL");
		player.credits += (EquipmentInfo.infoForKey("EQ_WHATEVER").price * 0.1 * 0.6);
		}
	}
While EQ_WHATEVER was in use it stored a parameter in a missionVariable_whatever_param. What do I need to add to the code above to clean that up?
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: Cleaning up redundant mission variables

Post by Okti »

Try,

Code: Select all

missionVariables.whatEver = null;
My OXP's
And Latest Mission Coyote's Run
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Cleaning up redundant mission variables

Post by Wildeblood »

Okti wrote:
Try,

Code: Select all

missionVariables.whatEver = null;
Really? That seems too obvious... it works though.Thanks, Okti.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Cleaning up redundant mission variables

Post by Lone_Wolf »

another possibility :

Code: Select all

delete missionVariables.whatever;
OS : Arch Linux 64-bit - rolling release

OXPs : My user page

Retired, reachable at [email protected]
Post Reply