My first script:
Hit R to switch to a "Dark Link" which gives him the master sword, golden ring, and regenerating hp while constantly losing magic.

However, when you switch out of it, you are given back a wooden sword. Does anyone know how to read Link's current sword level without having to check for the presence of each individual item? (if has Sword 1, else if has sword 2, etc.)

EDIT: Changed it around to an item script, with a global script running in the background.
Now you can have several different forms, as well.


Code:
// ===============================================================
// DarkForm Item:
//	Must include the global script ability.
//
// Use item to toggle between normal Link and a Dark Form, 
// which gives him the Master Sword and the Gold Ring, 
// as well as regeneration, all for the price of magic.
//
// If Link tries to activate a different form while one is already
// active, the current form will deactivate, and Link must use the
// item again to activate the new one.
//
// Arguments for ability.toggle_darkform():
// 1:	Number of frames for Link to lose 1/32 point of magic.
//	Set to 0 for no loss.
// 2:	Number of Hearts healed per frame, in sixteenths.
// 3:	Amount of magic in 32nds that one frame of healing costs.
// 4:	Item Id of first item to give/take away.
// 5:	Item Id of second item to give/take away.
// ===============================================================

// Gives golden ring, master sword, and drains magic
item script darkform_item {

	void run() {
		ability.toggle_darkform(12, 0, 0, 61, 36);
	}

}

// Gives golden ring, mirror shield, and heals.
item script darkform_item2 {

	void run() {
		ability.toggle_darkform(0, 1, 1, 61, 37);
	}

}

global script ability {

	bool darkform_activated = false;
	int darkform_delaycount = 0;
	int darkform_magicdelay = 0;
	int darkform_healamount = 0;
	int darkform_healcost = 0;
	int darkform_item1 = 0;
	int darkform_item2 = 0;

	void run() {
		while(true) {
			darkform(darkform_magicdelay, darkform_healamount, darkform_healcost);
			Waitframe();
		}
	}

    	void darkform(int magic_delay, int heal_amount, int heal_cost) {
		if(darkform_activated) {
			if(Link->HP < Link->MaxHP) {
				if(Link->MP >= heal_cost) {
					Link->MP = Link->MP - heal_cost;
					if(Link->MaxHP - Link->HP > heal_amount) {
						Link->HP = Link->HP + heal_amount;
					} else {
						Link->HP = Link->MaxHP;
					}
				}
			}
			if(Link->MP == 0 && magic_delay > 0) {
				set_darkform(false);
			} else {
				darkform_delaycount = darkform_delaycount + 1;
				if(darkform_delaycount == magic_delay) {
					Link->MP = Link->MP - 1;
					darkform_delaycount = 0;
				}
			}
		}
	} // end of void darkform

	void toggle_darkform(int delay, int heal, int cost, int item1, int item2) {
		if(!darkform_activated && (Link->MP > 0 || delay == 0)) {
			darkform_magicdelay = delay;
			darkform_healamount = heal;
			darkform_healcost = cost;
			darkform_item1 = item1;
			darkform_item2 = item2;
			set_darkform(true);
		} else {
			set_darkform(false);
		}
	}

	void set_darkform(bool state) {
		darkform_activated = state;
		Link->Item[darkform_item1] = state;
		Link->Item[darkform_item2] = state;		
		if(!state) {
			darkform_delaycount = 0;
		}
	}

}