//stdArguments.zh v5.0 Example Scripts

// The script that follows is a working example, and requires ffcscript.zh, stdExtra.zh and stdArguments.zh (this header).
// Other headers are optional, but highly recommended. 
//
//import "std.zh"
//import "ffcscript.zh"
//import "string.zh"
//import "stdExtra.zh"
//import "stdArguments.zh"
//import "stdFunctions.zh"
//import "stdConstants.zh"
//import "stdAnimation.zh"
//
//////////////////////
///// Subweapon V /////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///// D0 (#.x)    : Number of Hearts to Use when Activating Subweapon.      ///
///// D0 (x.0###) : MP to Use when Activating Subweapon.                    ///
///// D1 (#.x)    : Colour of Screen Flash.                                 ///
///// D1 (x.0###) : Duration of Screen Flash.                               ///
///// D2 (#.x)    : Amount of Damage that Subweapon Deals to Enemies.       ///
///// D2 (x.0###) : Speed that Subweapon Travels across screen; suggest 60. ///
///// D3 (#.x)    : FFC Slot for FFC Effects.                               ///
///// D3 (x.0###) : Other Item Counter Used by Subweapon (if any).          ///
///// D4 (#.x)    : Type of lweapon to generate (see std_constsnts.zh).     ///
///// D4 (x.0###) : Time before Link can use Subweapon Again.               ///
///// D5 (#.x)    : Sound Effects for using this Subweapon.                 ///
///// D5 (x.0###) : Error Sound Effects for this Subweapon.                 ///
/////                     Select Sounds from Quest->Audio->SFX Data         ///
///// D6 (#.x)    : Item number (in item editor) for this Subweapon.        ///
///// D6 (x.0###) : Sprite used by Subweapon; select from:.                 ///
/////                     Quest->Graphics->Sprites->WeaponsMisc.            ///
///// D7 (#.x)    : SWITCHES                                                ///      
///////////////////////////////////////////////////////////////////////////////
//
//item script SubweaponV{
//	void run (int hearts_magic, int colour_duration, int power_speed, int FFC_Slot_SpecialCounter, int LType_nouse, int SFX_Weapon_SFX_ERROR, int ItemNumber_SWSprite, int switches) {
//		int hearts = GetHighArgument(hearts_magic);
//		int magic = GetLowArgument(hearts_magic);
//		int colour = GetHighArgument(colour_duration);
//		int duration = GetLowArgument(colour_duration);
//		int power = GetHighArgument(power_speed);
//		int speed = GetLowArgument(power_speed);
//		int FFC_Slot = GetHighArgument(FFC_Slot_SpecialCounter);
//		int itemCounter = GetLowArgument(FFC_Slot_SpecialCounter);
//		int LType = GetHighArgument(LType_nouse);
//		int nouse = GetLowArgument(LType_nouse);
//		int SFX_Weapon = GetHighArgument(SFX_Weapon_SFX_ERROR);
//		int ERROR_SFX = GetLowArgument(SFX_Weapon_SFX_ERROR);
//		int ItemNumber = GetHighArgument(ItemNumber_SWSprite);
//		int SWSprite = GetLowArgument(ItemNumber_SWSprite);
//		
//		//code for enabling SWITCHES 0-8
//			
//		int switch0 = GetDigit(switches, 4);
//		int switch1 = GetDigit(switches, 3);
//		int switch2 = GetDigit(switches, 2);
//		int switch3 = GetDigit(switches, 1);
//		int switch4 = GetDigit(switches, 0);
//		int switch5 = GetDigit(switches, -1);
//		int switch6 = GetDigit(switches, -2);
//		int switch7 = GetDigit(switches, -3);
//		int switch8 = GetDigit(switches, -4);
//
//		if (NumLWeaponsOf(LType) < Game->Counter[itemCounter]){
//			if ((Game->Counter[CR_RUPEES] >= hearts) && (Game->Counter[CR_MAGIC] >= magic)){
//				Game->Counter[CR_RUPEES] -= hearts;
//				Game->Counter[CR_MAGIC] -= magic;
//				//Game->Counter[itemCounter] -= itemCounterDecrease;
//				Link->ItemJinx = nouse;
//				lweapon subweapon;
//				Link->Action = LA_ATTACKING;
//				subweapon = NextToLink(LType, 8);                        //Create in front of Link
//				subweapon->UseSprite(SWSprite);                            //Graphics
//				if (switch0 == 0){
//				//Do something.
//				}
//				else if (switch0 == 1){
//				if ( Link->Dir == DIR_DOWN ){                            //Sprite selection/rotation
//					subweapon->Tile++;
//					subweapon->Flip = 0;
//					}
//				else if ( Link->Dir == DIR_LEFT ){
//					subweapon->Flip = 1;
//					}
//				else if ( Link->Dir == DIR_RIGHT ){
//					subweapon->Flip = 0;
//					}
//				else if ( Link->Dir == DIR_UP ){
//					subweapon->Tile++;
//					subweapon->Flip = 2;
//					}
//				}
//				else if (switch0 == 2){
//				//Do something.
//				}
//				subweapon->Damage = power;                                    //Damage
//				subweapon->Step = speed;                                    //Speed
//				int args[8] = {colour, duration};
//				RunFFCScript(FFC_Slot, args);
//				Game->PlaySound(SFX_Weapon);
//		
//				for ( int i = 0; i < 30; i++ ){ //For 30 frames
//					subweapon->DeadState = WDS_ALIVE; //Keep it alive at all times
//					Waitframe();
//				}
//				subweapon->DeadState = WDS_ALIVE;}  			
//				else{
//			//Using Switch 1, place x0xxx.xxxx ; place code here.
//			if (switch1 == 8){
//				return;
//				}
//			else if (switch1 == 1){
//				//do this
//				Game->PlaySound(2);
//				}
//			//Using Switch 2, place xx0xx.xxxx ; place code here.
//			if (switch2 == 0){
//				return;
//				}
//			else if (switch2 == 1){
//				//do this
//				Game->PlaySound(3);
//				}
//			//Using Switch 3, place xxx0x.xxxx ; place code here.
//			if (switch4 == 0){
//				return;
//				}
//			else if (switch3 == 1){
//				//do this
//				Game->PlaySound(4);
//				}
//			//Using Switch 4, place xxxx0.xxxx ; place code here.
//			if (switch4 == 0){
//				return;
//				}
//			else if (switch4 == 1){
//				//do this
//				Game->PlaySound(5);
//				}
//			//Using Switch 5, place xxxxx.0xxx ; place code here.
//			if (switch5 == 0){
//				return;
//				}
//			else if (switch5 == 1){
//				//do this
//				Game->PlaySound(6);
//				}
//			//Using Switch 6, place xxxxx.x0xx ; place code here.
//			if (switch6 == 0){
//				return;
//				Game->PlaySound(7);
//				}
//			else if (switch6 == 1){
//				//do this
//				}
//			//Using Switch 7, place xxxxx.xx0x ; place code here.
//			if (switch7 == 0){
//				return;
//				}
//			else if (switch7 == 1){
//				//do this
//				Game->PlaySound(8);
//				}
//				//Using Switch 8, place xxxxx.xxx0 ; place code here.
//			if (switch0 == 8){
//				return;
//				}
//			else if (switch8 == 1){
//				//do this
//				Game->PlaySound(ERROR_SFX);
//				}
//			}
//			}
//			
//			
//		}
//
//
// As you can see, you can use these 'switches' to set up item (or other) code that you can enable or disable.
// You can also set up switches to depend on other switches, as in this snippet example:
// (You may consider these as 'conditional switches'.) 
//
//Switch 8 sets season.
//Switch 7 sets Weather base.
//
//if (Switch8 == 0){ //Springtime
// if (Switch7 == 0){
//  //Clear Sunshine
//  }
// else if (Switch7 == 1){
//  //Windy
//  }
// else if (Switch7 == 2){
//  //Light Rain
//  }
// else if (Switch7 == 3){
//  //Heavy Rain
// }
// }
//
//else if (Switch8 == 1){ //Summertime
// if (Switch7 == 0){
//  //Bright Sunshine
//  }
// else if (Switch7 == 1){
//  //Heat & Wind
//  // Grasses Dry Up
//  }
// else if (Switch7 == 2){
//  //Overcast
// }
// else if (Switch7 == 3){
//  //Light Rain
//  }
// }
// 
//else if (Switch8 == 2){ //Autumn
// if (Switch7 == 0){
//  //Normal Sunshine
//  //Leaves Turn Orange
//  }
// else if (Switch7 == 1){
//  //Overcast
//  }
// else if (Switch7 == 2){
//  //Light Rain
// }
// else if (Switch7 == 3){
//  //Light Snow
//  }
// }
//
//else if (Switch8 == 3){ //Winter
// if (Switch7 == 0){
//  //Light Sunshine
//  //Trees Lose Leaves
//  }
// else if (Switch7 == 1){
//  //Snow on Ground
//  }
// else if (Switch7 == 2){
//  //Light Snowfall
//  }
// else if (Switch7 == 3){
//  //Heavy Snowfalll
//  }
// }

////////////////////
/// Subweapon VII //////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
/// D0 (xxxxx.x###)    : Sound Effects for using this Subweapon.                 ///
///                     Select Sounds from Quest->Audio->SFX Data                ///
/// D0 (xxx##.#xxx)    : MP to Use when Activating Subweapon.                    ///
/// D0 (###xx.xxxx)    : Error Sound Effects for this Subweapon.                 ///
///                     Select Sounds from Quest->Audio->SFX Data                ///
/// D1 (xxxxx.x###)    : Item number (in item editor) for this Subweapon.        ///
/// D1 (xxx##.#xxx)    : Speed that Subweapon Travels across screen; suggest 60. ///
/// D1 (###xx.xxxx)    : FFC Slot for FFC Effects.                               ///
/// D2 (xxxxx.xx##)    : Amount of Damage that Subweapon Deals to Enemies.       ///
/// D2 (xxxxx.##xx)    : Sprite used by Subweapon; select from:                  ///
///                     Quest->Graphics->Sprites->WeaponsMisc.                   ///
/// D2 (xxx##.xxxx)    : Type of lweapon to generate (see std_constsnts.zh).     ///
/// D2 (x##xx.xxxx)    : Colour of Screen Flash.                                 ///
/// D3 (xxxxx.xx##)    : Duration of Screen Flash.                               ///
/// D3 (xxxxx.##xx)    : Other Item Counter Used by Subweapon (if any).          ///
/// D3 (xxx##.xxxx)    : Time before Link can use Subweapon Again.               ///
/// D3 (x##xx.xxxx)    : Rupees/Hearts Used by Subweapon.                        ///
/// D4 (#.x)    : Available for Future Use.                                      ///   
/// D5 (#.x)    : Available for Future Use.                                      ///   
/// D6 (#.x)    : Available for Future Use.                                      ///                                                     
/// D7 (#.x)    : SWITCHES                                                       ///
////////////////////////////////////////////////////////////////////////////////////
/// Switch Values //////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
/// Switch-0 (#xxxx.xxxx) : Sprite Flip On/Off; 0 = Off, 1 = On.                 ///
/// Switch-1 (x#xxx.xxxx) : Available for Future Use.                            ///
/// Switch-2 (xx#xx.xxxx) : Available for Future Use.                            ///
/// Switch-3 (xxx#x.xxxx) : Available for Future Use.                            ///
/// Switch-4 (xxxx#.xxxx) : Available for Future Use.                            ///
/// Switch-5 (xxxxx.#xxx) : Available for Future Use.                            ///
/// Switch-6 (xxxxx.x#xx) : Available for Future Use.                            ///
/// Switch-7 (xxxxx.xx#x) : Available for Future Use.                            ///
/// Switch-8 (xxxxx.xxx#) : Available for Future Use.                            ///
////////////////////////////////////////////////////////////////////////////////////
//
//item script SubweaponVII{
//	void run (int High0_Mid0_Low0, int High1_Mid1_Low1, int First2_Second2_Third2_Fourth2, int First3_Second3_Third3_Fourth3, int d4, int d5, int d6, int switches) {
//	int ERROR_SFX = GetHighTriArgument(High0_Mid0_Low0);
//	int magic = GetMidTriArgument(High0_Mid0_Low0);
//	int SFX_Weapon = GetLowTriArgument(High0_Mid0_Low0);
//		int FFC_Slot = GetHighTriArgument(High1_Mid1_Low1);
//		int speed = GetMidTriArgument(High1_Mid1_Low1);
//		int ItemNumber = GetLowTriArgument(High1_Mid1_Low1);
//			int power = GetFourthDuoArgument(First2_Second2_Third2_Fourth2);	
//			int SWSprite = GetThirdDuoArgument(First2_Second2_Third2_Fourth2);	
//			int LType = GetSecondDuoArgument(First2_Second2_Third2_Fourth2);	
//			int colour = GetFirstDuoArgument(First2_Second2_Third2_Fourth2);	
//				int duration = GetFourthDuoArgument(First3_Second3_Third3_Fourth3);	
//				int itemCounter = GetThirdDuoArgument(First3_Second3_Third3_Fourth3);	
//				int hearts = GetSecondDuoArgument(First3_Second3_Third3_Fourth3);	
//				int nouse = GetFirstDuoArgument(First3_Second3_Third3_Fourth3);	
//		
//			
//		int switch0 = GetDigit(switches, 4);
//		int switch1 = GetDigit(switches, 3);
//		int switch2 = GetDigit(switches, 2);
//		int switch3 = GetDigit(switches, 1);
//		int switch4 = GetDigit(switches, 0);
//		int switch5 = GetDigit(switches, -1);
//		int switch6 = GetDigit(switches, -2);
//		int switch7 = GetDigit(switches, -3);
//		int switch8 = GetDigit(switches, -4);
//
//		if (NumLWeaponsOf(LType) < Game->Counter[itemCounter]){
//			if ((Game->Counter[CR_RUPEES] >= hearts) && (Game->Counter[CR_MAGIC] >= magic)){
//				Game->Counter[CR_RUPEES] -= hearts;
//				Game->Counter[CR_MAGIC] -= magic;
//				//Game->Counter[itemCounter] -= itemCounterDecrease;
//				Link->ItemJinx = nouse;
//				lweapon subweapon;
//				Link->Action = LA_ATTACKING;
//				subweapon = NextToLink(LType, 8);                        //Create in front of Link
//				subweapon->UseSprite(SWSprite);                            //Graphics
//				if (switch0 == 1){
//				if ( Link->Dir == DIR_DOWN ){                            //Sprite selection/rotation
//					subweapon->Tile++;
//					subweapon->Flip = 0;
//					}
//				else if ( Link->Dir == DIR_LEFT ){
//					subweapon->Flip = 1;
//					}
//				else if ( Link->Dir == DIR_RIGHT ){
//					subweapon->Flip = 0;
//					}
//				else if ( Link->Dir == DIR_UP ){
//					subweapon->Tile++;
//					subweapon->Flip = 2;
//					}
//				}
//				subweapon->Damage = power;                                    //Damage
//				subweapon->Step = speed;                                    //Speed
//				int args[8] = {colour, duration};
//				RunFFCScript(FFC_Slot, args);
//				Game->PlaySound(SFX_Weapon);
//		
//				for ( int i = 0; i < 30; i++ ){ //For 30 frames
//					subweapon->DeadState = WDS_ALIVE; //Keep it alive at all times
//					Waitframe();
//				}
//				subweapon->DeadState = WDS_ALIVE;}  			
//				else{
//				Game->PlaySound(ERROR_SFX);
//				}
//			}
//			else{
//			Game->PlaySound(ERROR_SFX);
//			}
//			
//			////Using Switch 0, place 0xxxx.xxxx ; need working example of simple function.
//			//if (switch0 == 0){
//			//	return;
//			//	}
//			//else if (switch0 == 1){
//			//	//do this
//			//	Game->PlaySound(1);
//			//	}
//			////Using Switch 1, place x0xxx.xxxx ; need working example of simple function.
//			//if (switch1 == 0){
//			//	return;
//			//	}
//			//else if (switch1 == 1){
//			//	//do this
//			//	Game->PlaySound(2);
//			//	}
//			////Using Switch 2, place xx0xx.xxxx ; need working example of simple function.
//			//if (switch2 == 0){
//			//	return;
//			//	}
//			//else if (switch2 == 1){
//			//	//do this
//			//	Game->PlaySound(3);
//			//	}
//			////Using Switch 3, place xxx0x.xxxx ; need working example of simple function.
//			//if (switch4 == 0){
//			//	return;
//			//	}
//			//else if (switch3 == 1){
//			//	//do this
//			//	Game->PlaySound(4);
//			//	}
//			////Using Switch 4, place xxxx0.xxxx ; need working example of simple function.
//			//if (switch4 == 0){
//			//	return;
//			//	}
//			//else if (switch4 == 1){
//			//	//do this
//			//	Game->PlaySound(5);
//			//	}
//			////Using Switch 5, place xxxxx.0xxx ; need working example of simple function.
//			//if (switch5 == 0){
//			//	return;
//			//	}
//			//else if (switch5 == 1){
//			//	//do this
//			//	Game->PlaySound(6);
//			//	}
//			////Using Switch 6, place xxxxx.x0xx ; need working example of simple function.
//			//if (switch6 == 0){
//			//	return;
//			//	Game->PlaySound(7);
//			//	}
//			//else if (switch6 == 1){
//			//	//do this
//			//	}
//			////Using Switch 7, place xxxxx.xx0x ; need working example of simple function.
//			//if (switch7 == 0){
//			//	return;
//			//	}
//			//else if (switch7 == 1){
//			//	//do this
//			//	Game->PlaySound(8);
//			//	}
//			////Using Switch 8, place xxxxx.xxx0 ; need working example of simple function.
//			//if (switch8 == 0){
//			//	return;
//			//	}
//			//else if (switch8 == 1){
//			//	//do this
//			//	Game->PlaySound(9);
//			//	}
//		}
//
//	}

	////////////////////    /////////////////
	// Example Values //    // Translation //
	////////////////////    /////////////////////////////////////
	// D0: 06400.0001 //    // D0: (064)(000)(001)             //
	// D1: 00040.0126 //    // D1: (000)(400)(126)             //
	// D2: 00008.9050 //    // D2: 0(00)(08)(90)(50)           //
	// D3: 00100.2200 //   	// D3: 0(01)(00)(22)(00)           //
	// D4:            //   	// D4:                             //
	// D5:            //   	// D5:                             //
	// D6:            //   	// D6:                             //
	// D7: 10000.0000 //    // D7: (1)(0)(0)(0)(0)(0)(0)(0)(0) //
	////////////////////    /////////////////////////////////////