function get_items()
{craftList = 0; readItems(); for (i = 0; i < 4 && craftNeed [i] [1] != 0; i++) 
{if (craftNeed [i] [2] <= craftNeed [i] [4] && craftNeed [i] [0] == false) {craftNeed [i] [0] = 1; craftList += 1;}}
if (craftList >= i) 
{build_over = false; world.triggerBlock(buildBlock [0], buildBlock [1], buildBlock [2]);
world.triggerBlock(buildBlock [0]-1, buildBlock [1], buildBlock [2]);
chat.print(craftSpeech); specialDrop(); for (i = 0; craftNeed [i] != undefined; i++) {
if (craftNeed [i] [3] != -1) {pinv.consumeItemAmount(craftNeed [i] [1],craftNeed [i] [3],craftNeed [i] [2]);}
else {for (ii = 0; ii < craftNeed [i] [2]; ii++) {pinv.consumeItemAmount(craftNeed [i] [1]);}}}} 
else {chat.print("I don't have enough materials to build this");}}

function readItems() {for (ii = 0; ii <= 35; ii++) {item_check = pinv.getItemInSlot(ii);
if (item_check != null) {for (i = 0; craftNeed [i] != undefined; i++) {
if (item_check.itemID == craftNeed [i] [1] && (item_check.damage == craftNeed [i] [3] || craftNeed [i] [3] == -1)) 
{craftNeed [i] [4] += item_check.quantity;}}}} for (i = 0; craftNeed [i] != undefined; i++) 
{buildNeed [i].text = craftNeed [i] [4] + "/" + craftNeed [i] [2]; buildHave [i] = craftNeed [i] [4];
if (craftNeed [i] [4] < craftNeed [i] [2]) {buildNeed [i].red = 1; buildNeed [i].green = 0; buildNeed [i].blue = 0;}
else {buildNeed [i].red = 0; buildNeed [i].green = 1; buildNeed [i].blue = 0;}
if (craftNeed [i] [2] == 0) {buildNeed [i].red = 1; buildNeed [i].green = 1; buildNeed [i].blue = 1;}}}

function specialDrop() {};
if (buildShow == 1) {
if (houseUP == 0) {buildCurrent = "customCrafting/upgradeHouse"+1+".png";
craftNeed = new Array (new Array (false, 5, 15, 0, 0), new Array (false, 4, 2, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -131);
craftSpeech = "You have built - First house upgrade"; 
function specialDrop() {houseUP += 1;}}
if (houseUP == 1) {buildCurrent = "customCrafting/upgradeHouse"+2+".png";
craftNeed = new Array (new Array (false, 5, 20, 0, 0), new Array (false, 4, 4, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -133);
craftSpeech = "You have built - Second house upgrade"; 
function specialDrop() {houseUP += 1;}}
if (houseUP == 2) {buildCurrent = "customCrafting/upgradeHouse"+3+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 17, 8, 0, 0),
new Array (false, 20, 4, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -135);
craftSpeech = "You have built - Final house upgrade"; 
function specialDrop() {houseUP += 1;}}
if (houseUP == 3) {buildCurrent = "customCrafting/upgradeHouse"+4+".png";
craftNeed = new Array (new Array (false, 17, 4, 0, 0), new Array (false, 263, 4, 0, 0),
new Array (false, 20, 8, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -137);
craftSpeech = "You have built - First house interior upgrade"; 
function specialDrop() {houseUP += 1;}}
if (houseUP == 4) {buildCurrent = "customCrafting/upgradeHouse"+5+".png";
craftNeed = new Array (new Array (false, 5, 8, 0, 0), new Array (false, 211, 8, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -139);
craftSpeech = "You have built - Second house interior upgrade"; 
function specialDrop() {houseUP += 1;}}
if (houseUP == 5) {buildCurrent = "customCrafting/upgradeHouse"+6+".png";
craftNeed = new Array (new Array (false, 5, 30, 0, 0), new Array (false, 17, 4, 0, 0),
new Array (false, 20, 5, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -141);
craftSpeech = "You have built - First house 2nd floor upgrade"; 
function specialDrop() {houseUP += 1;}}
if (houseUP == 6) {buildCurrent = "customCrafting/upgradeHouse"+7+".png";
craftNeed = new Array (new Array (false, 5, 20, 0, 0), new Array (false, 17, 15, 0, 0),
new Array (false, 20, 8, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -143);
craftSpeech = "You have built - Second house 2nd floor upgrade"; 
function specialDrop() {houseUP += 1;}}
if (houseUP == 7) {buildCurrent = "customCrafting/upgradeHouse"+8+".png";
craftNeed = new Array (new Array (false, 211, 30, 0, 0), new Array (false, 4, 15, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (82, 66, -145);
craftSpeech = "You have built - Huge house upgrade"; 
function specialDrop() {houseUP += 1;}}}
if (buildShow == 2) {
if (libraryUP == 0) {buildCurrent = "customCrafting/upgradeLibrary"+1+".png";
craftNeed = new Array (new Array (false, 5, 16, 0, 0), new Array (false, 0, 0, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (85, 66, -131);
craftSpeech = "You have built - First Library upgrade"; 
function specialDrop() {libraryUP += 1;}}
if (libraryUP == 1) {buildCurrent = "customCrafting/upgradeLibrary"+2+".png";
craftNeed = new Array (new Array (false, 5, 14, 0, 0), new Array (false, 340, 6, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (85, 66, -133);
craftSpeech = "You have built - Second Library upgrade"; 
function specialDrop() {libraryUP += 1;}}
if (libraryUP == 2) {buildCurrent = "customCrafting/upgradeLibrary"+3+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 17, 6, 0, 0),
new Array (false, 20, 6, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (85, 66, -135);
craftSpeech = "You have built - Final Library upgrade"; 
function specialDrop() {libraryUP += 1;}}
if (libraryUP == 3) {buildCurrent = "customCrafting/upgradeLibrary"+4+".png";
craftNeed = new Array (new Array (false, 5, 5, 0, 0), new Array (false, 20, 12, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (85, 66, -137);
craftSpeech = "You have built - First Library Interior upgrade"; 
function specialDrop() {libraryUP += 1;}}
if (libraryUP == 4) {buildCurrent = "customCrafting/upgradeLibrary"+5+".png";
craftNeed = new Array (new Array (false, 5, 4, 0, 0), new Array (false, 340, 14, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (85, 66, -139);
craftSpeech = "You have built - Second Library Interior upgrade"; 
function specialDrop() {libraryUP += 1;}}
if (libraryUP == 5) {buildCurrent = "customCrafting/upgradeLibrary"+6+".png";
craftNeed = new Array (new Array (false, 4, 20, 0, 0), new Array (false, 340, 8, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (85, 66, -141);
craftSpeech = "You have built - Big Library upgrade"; 
function specialDrop() {libraryUP += 1;}}
if (libraryUP == 6) {buildCurrent = "customCrafting/upgradeLibrary"+7+".png";
craftNeed = new Array (new Array (false, 211, 30, 0, 0), new Array (false, 4, 5, 0, 0),
new Array (false, 20, 10, 0, 0), new Array (false, 340, 8, 0, 0)); buildBlock = new Array (85, 66, -143);
craftSpeech = "You have built - Huge Library upgrade"; 
function specialDrop() {libraryUP += 1;}}}
if (buildShow == 3) {
if (armoryUP == 0) {buildCurrent = "customCrafting/upgradeArmory"+1+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 0, 0, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -131);
craftSpeech = "You have built - First Armory upgrade"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 1) {buildCurrent = "customCrafting/upgradeArmory"+2+".png";
craftNeed = new Array (new Array (false, 5, 12, 0, 0), new Array (false, 17, 2, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -133);
craftSpeech = "You have built - Second Armory upgrade"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 2) {buildCurrent = "customCrafting/upgradeArmory"+3+".png";
craftNeed = new Array (new Array (false, 5, 14, 0, 0), new Array (false, 20, 6, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -135);
craftSpeech = "You have built - Final Armory rebuild"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 3) {buildCurrent = "customCrafting/upgradeArmory"+4+".png";
craftNeed = new Array (new Array (false, 5, 16, 0, 0), new Array (false, 0, 0, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -137);
craftSpeech = "You have built - Basic Mine rebuild"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 4) {buildCurrent = "customCrafting/upgradeArmory"+5+".png";
craftNeed = new Array (new Array (false, 5, 6, 0, 0), new Array (false, 263, 2, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -139);
craftSpeech = "You have built - Final Mine rebuild"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 5) {buildCurrent = "customCrafting/upgradeArmory"+6+".png";
craftNeed = new Array (new Array (false, 211, 8, 0, 0), new Array (false, 4, 6, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -141);
craftSpeech = "You have built - Big Armory Upgrade"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 6) {buildCurrent = "customCrafting/upgradeArmory"+7+".png";
craftNeed = new Array (new Array (false, 211, 4, 0, 0), new Array (false, 4, 12, 0, 0),
new Array (false, 20, 6, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -143);
craftSpeech = "You have built - Big Mine Upgrade"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 7) {buildCurrent = "customCrafting/upgradeArmory"+8+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 4, 4, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -145);
craftSpeech = "You have built - Smooth Mine Upgrade"; 
function specialDrop() {armoryUP += 1;}}
if (armoryUP == 8) {buildCurrent = "customCrafting/upgradeArmory"+9+".png";
craftNeed = new Array (new Array (false, 211, 8, 0, 0), new Array (false, 4, 8, 0, 0),
new Array (false, 20, 2, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (88, 66, -147);
craftSpeech = "You have built - Smooth Mine Upgrade"; 
function specialDrop() {armoryUP += 1;}}}
if (buildShow == 4) {
if (kitchenUP == 0) {buildCurrent = "customCrafting/upgradeKitchen"+1+".png";
craftNeed = new Array (new Array (false, 5, 4, 0, 0), new Array (false, 4, 8, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -131);
craftSpeech = "You have built - First Garden upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 1) {buildCurrent = "customCrafting/upgradeKitchen"+2+".png";
craftNeed = new Array (new Array (false, 5, 6, 0, 0), new Array (false, 4, 6, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -133);
craftSpeech = "You have built - Final Garden upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 2) {buildCurrent = "customCrafting/upgradeKitchen"+3+".png";
craftNeed = new Array (new Array (false, 5, 14, 0, 0), new Array (false, 17, 4, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -135);
craftSpeech = "You have built - First Mill upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 3) {buildCurrent = "customCrafting/upgradeKitchen"+4+".png";
craftNeed = new Array (new Array (false, 5, 16, 0, 0), new Array (false, 17, 4, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -137);
craftSpeech = "You have built - First Kitchen upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 4) {buildCurrent = "customCrafting/upgradeKitchen"+5+".png";
craftNeed = new Array (new Array (false, 5, 15, 0, 0), new Array (false, 17, 8, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -139);
craftSpeech = "You have built - Second Kitchen upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 5) {buildCurrent = "customCrafting/upgradeKitchen"+6+".png";
craftNeed = new Array (new Array (false, 5, 6, 0, 0), new Array (false, 4, 12, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -141);
craftSpeech = "You have built - Big Garden upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 6) {buildCurrent = "customCrafting/upgradeKitchen"+7+".png";
craftNeed = new Array (new Array (false, 5, 8, 0, 0), new Array (false, 211, 10, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -143);
craftSpeech = "You have built - Third Kitchen upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 7) {buildCurrent = "customCrafting/upgradeKitchen"+8+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 211, 14, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -145);
craftSpeech = "You have built - Fourth Kitchen upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 8) {buildCurrent = "customCrafting/upgradeKitchen"+9+".png";
craftNeed = new Array (new Array (false, 4, 12, 0, 0), new Array (false, 211, 12, 0, 0),
new Array (false, 20, 6, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -147);
craftSpeech = "You have built - Fifth Kitchen upgrade"; 
function specialDrop() {kitchenUP += 1;}}
if (kitchenUP == 9) {buildCurrent = "customCrafting/upgradeKitchen"+10+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 211, 10, 0, 0),
new Array (false, 4, 10, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (91, 66, -149);
craftSpeech = "You have built - Fifth Kitchen upgrade"; 
function specialDrop() {kitchenUP += 1;}}}
if (buildShow == 5) {
if (shopUP == 0) {buildCurrent = "customCrafting/upgradeShop"+1+".png";
craftNeed = new Array (new Array (false, 5, 8, 0, 0), new Array (false, 0, 0, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (94, 66, -131);
craftSpeech = "You have built - Final Sign Board upgrade"; 
function specialDrop() {shopUP += 1;}}
if (shopUP == 1) {buildCurrent = "customCrafting/upgradeShop"+2+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 0, 0, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (94, 66, -133);
craftSpeech = "You have built - First Shop upgrade"; 
function specialDrop() {shopUP += 1;}}
if (shopUP == 2) {buildCurrent = "customCrafting/upgradeShop"+3+".png";
craftNeed = new Array (new Array (false, 5, 12, 0, 0), new Array (false, 0, 0, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (94, 66, -135);
craftSpeech = "You have built - Second Shop upgrade"; 
function specialDrop() {shopUP += 1;}}
if (shopUP == 3) {buildCurrent = "customCrafting/upgradeShop"+4+".png";
craftNeed = new Array (new Array (false, 5, 14, 0, 0), new Array (false, 20, 8, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (94, 66, -137);
craftSpeech = "You have built - Third Shop upgrade"; 
function specialDrop() {shopUP += 1;}}
if (shopUP == 4) {buildCurrent = "customCrafting/upgradeShop"+5+".png";
craftNeed = new Array (new Array (false, 5, 10, 0, 0), new Array (false, 20, 8, 0, 0),
new Array (false, 17, 4, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (94, 66, -139);
craftSpeech = "You have built - Fourth Shop upgrade"; 
function specialDrop() {shopUP += 1;}}
if (shopUP == 5) {buildCurrent = "customCrafting/upgradeShop"+6+".png";
craftNeed = new Array (new Array (false, 4, 20, 0, 0), new Array (false, 211, 15, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (94, 66, -141);
craftSpeech = "You have built - Big Shop upgrade"; 
function specialDrop() {shopUP += 1;}}
if (shopUP == 5) {buildCurrent = "customCrafting/upgradeShop"+6+".png";
craftNeed = new Array (new Array (false, 4, 6, 0, 0), new Array (false, 20, 10, 0, 0),
new Array (false, 0, 0, 0, 0), new Array (false, 0, 0, 0, 0)); buildBlock = new Array (94, 66, -143);
craftSpeech = "You have built - Final Shop upgrade"; 
function specialDrop() {shopUP += 1;}}}