//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(16) != null) {
	if(pinv.getItemInSlot(16).getItemID() != 337) {
		for(i = 0;i <= 35;i++) {
			if(i != 16) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(16).copy()
						pinv.emptySlot(16)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(337) != -1) {
	try {
		var item = pinv.getItemInSlot(16).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(337)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 16) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 337) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(16,item)
			}
		}
	}
}

//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(34) != null) {
	if(pinv.getItemInSlot(34).getItemID() != 331) {
		for(i = 0;i <= 35;i++) {
			if(i != 34) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(34).copy()
						pinv.emptySlot(34)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(331) != -1) {
	try {
		var item = pinv.getItemInSlot(34).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(331)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 34) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 331) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(34,item)
			}
		}
	}
}

//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(17) != null) {
	if(pinv.getItemInSlot(17).getItemID() != 348) {
		for(i = 0;i <= 35;i++) {
			if(i != 17) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(17).copy()
						pinv.emptySlot(17)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(348) != -1) {
	try {
		var item = pinv.getItemInSlot(17).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(348)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 17) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 348) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(17,item)
			}
		}
	}
}

//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(26) != null) {
	if(pinv.getItemInSlot(26).getItemID() != 334) {
		for(i = 0;i <= 35;i++) {
			if(i != 26) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(26).copy()
						pinv.emptySlot(26)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(334) != -1) {
	try {
		var item = pinv.getItemInSlot(26).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(334)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 26) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 334) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(26,item)
			}
		}
	}
}

//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(35) != null) {
	if(pinv.getItemInSlot(35).getItemID() != 329) {
		for(i = 0;i <= 35;i++) {
			if(i != 35) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(35).copy()
						pinv.emptySlot(35)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(329) != -1) {
	try {
		var item = pinv.getItemInSlot(35).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(329)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 35) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 329) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(35,item)
			}
		}
	}
}

//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(25) != null) {
	if(pinv.getItemInSlot(25).getItemID() != 336) {
		for(i = 0;i <= 35;i++) {
			if(i != 25) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(25).copy()
						pinv.emptySlot(25)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(336) != -1) {
	try {
		var item = pinv.getItemInSlot(25).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(336)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 25) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 336) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(25,item)
			}
		}
	}
}

var arrowTargetId = 19

for each(var entity in player.getEntitiesWithinRange(40))
{
	if(entity.classType == "Arrow")
	{
		if(entity.isPlayersArrow && entity.inBlockID == arrowTargetId)
		{
			thisBlock3 = entity.inBlockCoords
			world.triggerBlock(thisBlock3.x, thisBlock3.y, thisBlock3.z+1) // North
			world.triggerBlock(thisBlock3.x, thisBlock3.y, thisBlock3.z-1) // South
			world.triggerBlock(thisBlock3.x+1, thisBlock3.y, thisBlock3.z) // East
			world.triggerBlock(thisBlock3.x-1, thisBlock3.y, thisBlock3.z) // West
			world.triggerBlock(thisBlock3.x, thisBlock3.y+1, thisBlock3.z) // Up
			world.triggerBlock(thisBlock3.x, thisBlock3.y-1, thisBlock3.z) // Down
		}
	}
}

//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(9) != null) {
	if(pinv.getItemInSlot(9).getItemID() != 266) {
		for(i = 0;i <= 35;i++) {
			if(i !=9) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(9).copy()
						pinv.emptySlot(9)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(266) != -1) {
	try {
		var item = pinv.getItemInSlot(9).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(266)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 9) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 266) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(9,item)
			}
		}
	}
}

grapSearch = player.getEntitiesWithinRange(40);
for(i=0 ; i < grapSearch.length ; i++) {
	egrap = grapSearch[i];
	
	if(egrap.getClassType() == "Hookshot") {
		gpos = egrap.getPosition();
		for(j=-1 ; j <=1 ; j++) {
			for(k=-1 ; k<=1 ; k++) {
				if(world.getBlockID(gpos.x+j, gpos.y, gpos.z+k) == 17 || world.getBlockID(gpos.x+j, gpos.y, gpos.z+k) == 5 || (world.getBlockID(gpos.x+j, gpos.y, gpos.z+k) == 214
				&& (world.getMetadata(gpos.x+j, gpos.y, gpos.z+k) == 5 || world.getMetadata(gpos.x+j, gpos.y, gpos.z+k) == 7 || world.getMetadata(gpos.x+j, gpos.y, gpos.z+k) == 6))) {
					gslot = pinv.getSlotContainingItem(458);
					pinv.emptySlot(gslot);
					pinv.setSlot(gslot, Item(458));
		
				}			
			}	
		}	
		npcSearch = egrap.getEntitiesWithinRange(3);
		for(j=0 ; j < npcSearch.length ; j++) {
			enpc = npcSearch[j];
			if(enpc.getClassType() == "NPC") {
				gslot = pinv.getSlotContainingItem(458);
				pinv.emptySlot(gslot);
				pinv.setSlot(gslot, Item(458));
			}
			else if(enpc.getClassType() == "Script") {
				gslot = pinv.getSlotContainingItem(458);
				pinv.emptySlot(gslot);
				pinv.setSlot(gslot, Item(458));
}	}	}	}

//---------Slot Forcing by Renounce4--------//
//Create a different copy of this for each item you want to force and put them all inside of your OnUpdate script
var A = 2//the id of the item you want to force
var B = 1//the id of the slot you want to force the item into
var pinv = player.getInventory()
if(pinv.getItemInSlot(18) != null) {
	if(pinv.getItemInSlot(18).getItemID() != 262) {
		for(i = 0;i <= 35;i++) {
			if(i !=18) {
				if(pinv.getItemInSlot(i) == null) {
					try {
						var Iitem = pinv.getItemInSlot(18).copy()
						pinv.emptySlot(18)
						pinv.setSlot(i,Iitem)
					}
					catch(e) {}
				}
			}
		}
	}
}
if(pinv.getSlotContainingItem(262) != -1) {
	try {
		var item = pinv.getItemInSlot(18).copy()
	}
	catch(e) {
		var item = pinv.getItemInSlot(pinv.getSlotContainingItem(262)).copy()
		item.setQuantity(0)
	}
	for(i = 0;i <= 35;i++) {
		if(i != 18) {
			if(pinv.getItemInSlot(i) != null && pinv.getItemInSlot(i).getItemID() == 262) {
				try {
					var count = pinv.getItemInSlot(i).getQuantity()
				}
				catch(e) {
					var count = 0
				}
				pinv.emptySlot(i)
				item.setQuantity(item.getQuantity() + count)
				pinv.setSlot(18,item)
			}
		}
	}
}

//Magic Meter v1.1 - Renounce4

var pinv = player.getInventory()
var ppos = player.getPosition()

screen.clear()

if(!maglock) {
	if(magcnt < 0) {
		magcnt = 0
	}
	if(magdly < 0) {
		magdly = 0
	}
	if(magupg == false) {
		if(magcnt > MAGIC_CAP1) {
			magcnt = MAGIC_CAP1
		}
		if(magdly > MAGIC_CAP1) {
			magdly = MAGIC_CAP1
		}
	}
	if(magupg == true) {
		if(magcnt > MAGIC_CAP2) {
			magcnt = MAGIC_CAP2
		}
		if(magdly > MAGIC_CAP2) {
			magdly = MAGIC_CAP2
		}
	}
	if(!magupg) {
		UIRect(MAGIC_METER_XPOS+3,MAGIC_METER_YPOS+2,MAGIC_CAP1,MAGIC_METER_HEIGHT,MAGIC_METER_COLOR_BACKGROUND_RED,MAGIC_METER_COLOR_BACKGROUND_GREEN,MAGIC_METER_COLOR_BACKGROUND_BLUE,MAGIC_METER_COLOR_BACKGROUND_ALPHA)
	}
	else {
		UIRect(MAGIC_METER_XPOS+3,MAGIC_METER_YPOS+2,MAGIC_CAP2,MAGIC_METER_HEIGHT,MAGIC_METER_COLOR_BACKGROUND_RED,MAGIC_METER_COLOR_BACKGROUND_GREEN,MAGIC_METER_COLOR_BACKGROUND_BLUE,MAGIC_METER_COLOR_BACKGROUND_ALPHA)
	}
	if(!maginf) {
		UIRect(MAGIC_METER_XPOS+3,MAGIC_METER_YPOS+2,magcnt,MAGIC_METER_HEIGHT,MAGIC_METER_COLOR_RED,MAGIC_METER_COLOR_GREEN,MAGIC_METER_COLOR_BLUE,MAGIC_METER_COLOR_ALPHA)
	}
	else {
		UIRect(MAGIC_METER_XPOS+3,MAGIC_METER_YPOS+2,magcnt,MAGIC_METER_HEIGHT,MAGIC_METER_COLOR_INFINITE_RED,MAGIC_METER_COLOR_INFINITE_GREEN,MAGIC_METER_COLOR_INFINITE_BLUE,MAGIC_METER_COLOR_INFINITE_ALPHA)
		magupg = true
		magcnt = MAGIC_CAP2
		magdly = MAGIC_CAP2
	}
	UISprite("gui/Magicbar.png",MAGIC_METER_XPOS,MAGIC_METER_YPOS,7,14,0,0)
	if(magupg == false) {
		for(var rend = 0; rend <= MAGIC_CAP1-9; rend++) {  
			UISprite("gui/Magicbar.png",rend+7+MAGIC_METER_XPOS,MAGIC_METER_YPOS,1,14,7,0)
		}
		UISprite("gui/Magicbar.png",MAGIC_CAP1-1+MAGIC_METER_XPOS,MAGIC_METER_YPOS,7,14,8,0)
	}

	if(magupg == true) {
		for(var rend = 0; rend <= MAGIC_CAP2-9; rend++) {
			UISprite("gui/Magicbar.png",rend+7+MAGIC_METER_XPOS,MAGIC_METER_YPOS,1,14,7,0)
		}
		UISprite("gui/Magicbar.png",MAGIC_CAP2-1+MAGIC_METER_XPOS,MAGIC_METER_YPOS,7,14,8,0)
	}
	if(magcnt < magdly) {
		magcnt = magcnt+1
		sound.playSound3D("sound.Magic",ppos.x,ppos.y,ppos.z,.3,(magcnt/MAGIC_CAP2)+.6)
	}
	if(magcnt > magdly) {
		magcnt = magcnt-1
	}
}
else {
	magcnt = 0
	magdly = 0
}

if(pinv.getSlotContainingItem(MAGIC_ITEM_SMALL) != -1) {
	pinv.consumeItem(MAGIC_ITEM_SMALL)
	magdly = magdly+MAGIC_ITEM_SMALL_AMOUNT
	sound.playSound3D("sound.Magic",ppos.x,ppos.y,ppos.z,.5,1.7)
}
if(pinv.getSlotContainingItem(MAGIC_ITEM_LARGE) != -1) {
	pinv.consumeItem(MAGIC_ITEM_LARGE)
	magdly = magdly+MAGIC_ITEM_LARGE_AMOUNT
	sound.playSound3D("sound.Magic",ppos.x,ppos.y,ppos.z,.5,1.8)
}
if(pinv.getSlotContainingItem(MAGIC_ITEM_MAX) != -1) {
	pinv.consumeItem(MAGIC_ITEM_MAX)
	magdly = MAGIC_CAP2
	sound.playSound3D("sound.Magic",ppos.x,ppos.y,ppos.z,.5,1.9)
}

//----Fire, Ice, Light Arrows v1.1 - Renounce4----//

Arrowsupdate();
FrozenEntitiesupdate();

