Code:
import "std.zh"

////global variables go here

int ButtonShuffle; //You'll have to define this at the global level,
//or this won't work.
//ButtonShuffle is used to tell the code that Link is performing an imput
//that the keyboard did not initiate.  Here are the values for ButtonShuffle:
	//ButtonShuffle == 1 is for the A button.
	//ButtonShuffle == 2 is for the B button.
	//ButtonShuffle == 3 is for the R button.
	//ButtonShuffle == 4 is for the L button.
	//ButtonShuffle == 5 is for the EX1 button.
	//ButtonShuffle == 6 is for the EX2 button.
	//ButtonShuffle == 7 is for the EX3 button.
	//ButtonShuffle == 8 is for the EX4 button.
	//ButtonShuffle == 9 is for the Start Button.
	//ButtonShuffle == 10 is for InputUp.  This is 10 + the Direction constant for facing up.
	//ButtonShuffle == 11 is for InputDown.  This is 10 + the Direction constant for facing down.
	//ButtonShuffle == 12 is for InputLeft.  This is 10 + the Direction constant for facing left.
	//ButtonShuffle == 13 is for InputRight.  This is 10 + the Direction constant for facing right.
	//ButtonShuffle == 20 is for the Map Button.
//If you ever force the engine to use an input, through input = true, you
//will have to precede that line with ButtonShuffle = #, using the number
//for the forced button.  This will make sense shortly.
bool ButtonTruth;


global script onstart {
	void run() {
    
    ////one time things go here
    ButtonShuffle = 0;
		while(true) {
			if(Link->InputB && ButtonTruth){ //Checks if Link actually pressed the button
			//or if this script simulated the press of that button.  Necessary to avoid
			//creating a loop.
				ButtonShuffle = 1; //Sets the button truth to the button who's
				//effect you want the B button to have
				//For Bool ButtonTruth to function properly, you must have this
				//kind of integer assignment above EVERY script-forced input.
				//The number is 1, because the forced input is for A and "A"
				//has an assigned number of 1 in bool ButtonTruth.
				Link->InputA = true; //Same as button truth, makes this button
				//have that effect.  To change the target button, change
				//this line to the target button, and change the ButtonTruth
				//number to that appropriate for the target button.
				Link->InputB = false; //Disables the original function of this
				//button.
		
				//I've set the B button to function as "A", so I could dedicate
				//"B" to the sword without recoding the sword script.
			}
			else if(Link->InputA && ButtonTruth){ //Checks if Link actually pressed the button
			//or if this script simulated the press of that button.
				ButtonShuffle = 3; //For each button who's function you change, you will
				//also need to change the function of the target button.  For example, if
				//you wanted to swap B and A, you would have to use this code for both buttons
				//and not just one.  If you want B to act as A and A to act as something else,
				//(in this case R), then you must also make R act as something else.  Otherwise
				//you will have two buttons with the same function, and one button who's
				//function CANNOT be used, period.
				Link->InputR = true; //I am making A function as "R" so I may
				//attach an activate script to it later.  My other scripts will
				//still say "InputR", but in the player you will hit the "A" button
				//to use that effect.
				Link->InputA = false; //Disables the original function of this
				//button.
			}
			else if(Link->InputR && ButtonTruth){ //Checks if link actually pressed the button
			//or if this script simulated the press of that button.
				ButtonShuffle = 2; //R will be the new B.  Now each button with
				//replaced function has a different button replacing ITS function.
				Link->InputB = true;
				Link->InputR = false;
				
				//Players would press R to select items in the subscreen, and press R to use them
				//with this script in place.
			}
		Waitframe();
		}
	}
		////functions go here
}

	bool ButtonTruth() { //This checks if Link actually pressed the button
	//or if a script simulated the press of that button.
	//ButtonShuffle == 1 is for the A button.
	//ButtonShuffle == 2 is for the B button.
	//ButtonShuffle == 3 is for the R button.
	//ButtonShuffle == 4 is for the L button.
	//ButtonShuffle == 5 is for the EX1 button.
	//ButtonShuffle == 6 is for the EX2 button.
	//ButtonShuffle == 7 is for the EX3 button.
	//ButtonShuffle == 8 is for the EX4 button.
	//ButtonShuffle == 9 is for the Start Button.
	//ButtonShuffle == 10 is for InputUp.  This is 10 + the Direction constant for facing up.
	//ButtonShuffle == 11 is for InputDown.  This is 10 + the Direction constant for facing down.
	//ButtonShuffle == 12 is for InputLeft.  This is 10 + the Direction constant for facing left.
	//ButtonShuffle == 13 is for InputRight.  This is 10 + the Direction constant for facing right.
	//ButtonShuffle == 20 is for the Map Button.
		if((Link->InputA && ButtonShuffle !=1) || (Link->InputB && ButtonShuffle !=2) || (Link->InputR && ButtonShuffle !=3) || (Link->InputL && ButtonShuffle !=4) || (Link->InputEx1 && ButtonShuffle !=5) || (Link->InputEx2 && ButtonShuffle !=6) || (Link->InputEx3 && ButtonShuffle !=7) || (Link->InputEx4 && ButtonShuffle !=8) || (Link->InputStart && ButtonShuffle !=9) || (Link->InputUp && ButtonShuffle !=10) || (Link->InputDown && ButtonShuffle !=11) || (Link->InputLeft && ButtonShuffle !=12) || (Link->InputRight && ButtonShuffle !=13) || (Link->InputMap && ButtonShuffle !=20)){
			return true;
		}
		else{
			return  false;
		}
	} // end of ButtonTruth Bool.
Okay, so I was trying to make Link use the sword with the B button only... without rescripting the entire sword function (As I do not yet understand lweapons). I came up with the idea that I could trick the engine into just using the button I want when I press the button I assign, and the above code was the result. It compiles fine, but when I get into game all it does is disable B and R, and make A perform its normal action.

Is there something wrong with my bool? Should I just dump it into the global script and have all the function contained there? Or is there something else wrong with the code?

EDIT: Sorry, my key controls had reset. The buttons don't do nothing, they do what they were originally programmed to. What am I missing? This is my first bool... maybe I should keep away from that and just stick to integer flagging.


EDIT EDIT: Yep, it was the bool. I should just stick with what I know, and let the script be messy. Messy script with functioning results is still functional, after all.

Here's the working version. I'll go post it in the Script Showcase with a tutorial too.
Code:
import "std.zh"

////global variables go here

int ButtonShuffle; //You'll have to define this at the global level,
//or this won't work.
//ButtonShuffle is used to tell the code that Link is performing an imput
//that the keyboard did not initiate.  Here are the values for ButtonShuffle:
	//ButtonShuffle == 1 is for the A button.
	//ButtonShuffle == 2 is for the B button.
	//ButtonShuffle == 3 is for the R button.
	//ButtonShuffle == 4 is for the L button.
	//ButtonShuffle == 5 is for the EX1 button.
	//ButtonShuffle == 6 is for the EX2 button.
	//ButtonShuffle == 7 is for the EX3 button.
	//ButtonShuffle == 8 is for the EX4 button.
	//ButtonShuffle == 9 is for the Start Button.
	//ButtonShuffle == 10 is for InputUp.  This is 10 + the Direction constant for facing up.
	//ButtonShuffle == 11 is for InputDown.  This is 10 + the Direction constant for facing down.
	//ButtonShuffle == 12 is for InputLeft.  This is 10 + the Direction constant for facing left.
	//ButtonShuffle == 13 is for InputRight.  This is 10 + the Direction constant for facing right.
	//ButtonShuffle == 20 is for the Map Button.
//If you ever force the engine to use an input, through input = true, you
//will have to precede that line with ButtonShuffle = #, using the number
//for the forced button.  This will make sense shortly.



global script onstart {
	void run() {
    
    ////one time things go here
    ButtonShuffle = 0;
		while(true) {
			if(Link->InputB && ButtonShuffle != 2){ //Checks if Link actually pressed the button
			//or if this script simulated the press of that button.  Necessary to avoid
			//creating a loop.
				ButtonShuffle = 1; //Sets the button truth to the button who's
				//effect you want the B button to have
				//For Bool ButtonTruth to function properly, you must have this
				//kind of integer assignment above EVERY script-forced input.
				//The number is 1, because the forced input is for A and "A"
				//has an assigned number of 1 in bool ButtonTruth.
				Link->InputA = true; //Same as button truth, makes this button
				//have that effect.  To change the target button, change
				//this line to the target button, and change the ButtonTruth
				//number to that appropriate for the target button.
				Link->InputB = false; //Disables the original function of this
				//button.
		
				//I've set the B button to function as "A", so I could dedicate
				//"B" to the sword without recoding the sword script.
			}
			else if(Link->InputA && ButtonShuffle != 1){ //Checks if Link actually pressed the button
			//or if this script simulated the press of that button.
				ButtonShuffle = 3; //For each button who's function you change, you will
				//also need to change the function of the target button.  For example, if
				//you wanted to swap B and A, you would have to use this code for both buttons
				//and not just one.  If you want B to act as A and A to act as something else,
				//(in this case R), then you must also make R act as something else.  Otherwise
				//you will have two buttons with the same function, and one button who's
				//function CANNOT be used, period.
				Link->InputR = true; //I am making A function as "R" so I may
				//attach an activate script to it later.  My other scripts will
				//still say "InputR", but in the player you will hit the "A" button
				//to use that effect.
				Link->InputA = false; //Disables the original function of this
				//button.
			}
			else if(Link->InputR && ButtonShuffle != 3){ //Checks if link actually pressed the button
			//or if this script simulated the press of that button.
				ButtonShuffle = 2; //R will be the new B.  Now each button with
				//replaced function has a different button replacing ITS function.
				Link->InputB = true;
				Link->InputR = false;
				
				//Players would press R to select items in the subscreen, and press R to use them
				//with this script in place.
			}
			else{ButtonShuffle = 0;}
		Waitframe();
		}
	}
		////functions go here
}