Page 1 of 1

Cleaning up redundant mission variables

Posted: Thu Jul 21, 2011 7:03 pm
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?

Re: Cleaning up redundant mission variables

Posted: Thu Jul 21, 2011 7:07 pm
by Okti
Try,

Code: Select all

missionVariables.whatEver = null;

Re: Cleaning up redundant mission variables

Posted: Thu Jul 21, 2011 7:24 pm
by Wildeblood
Okti wrote:
Try,

Code: Select all

missionVariables.whatEver = null;
Really? That seems too obvious... it works though.Thanks, Okti.

Re: Cleaning up redundant mission variables

Posted: Thu Jul 21, 2011 10:32 pm
by Lone_Wolf
another possibility :

Code: Select all

delete missionVariables.whatever;