Only In Range

First of all, I’m using javascript so please try posting only javascript. I’m creating a quest script for my rpg game and have a great quest script but I would like it if you could only see it in a certain range or area. I have many variables in this script so just realize that I have no errors at the moment:

function OnGUI () {

	GUI.contentColor = Color.red;

	GUI.Box(Rect(10,10,500,420), questTitle);
	
	GUI.Label(Rect(15,30,500,420), questText);
	
	GUI.Label(Rect(11,410,100,50), npcName);
	
	GUI.Box(Rect(15,100,490,100), "Reward");
	
	GUI.Label(Rect(20,120,490,100), reward);
	
	GUI.contentColor = Color.red;
	
	if (GUI.Button(Rect(400,450,100,30), "Accept")){
		questItem.active = true;
			
	if(autoAccept == false){
		autoAccept = true;
		}
		else{
		autoAccept = false;
	}
}

	if(autoAccept == true){
	GUI.Box(Rect(540,10,150,50), questItems);
	
	GUI.Label(Rect(590,30,100,30), "" + points + "/" + questItemsNeeded);
			
	if (GUI.Button(Rect(300,450,100,30), "Decline")){
	questItem.active = false;
		autoAccept = false;
	}
}	
}

Thanks!

Your question isn’t very clear. Do you want to see the quests you have only within a certain area?
Then I suggest you take a look at triggers:

(scroll down on the page, there is a section about triggers).