Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local manager = peripheral.find("inventoryManager") -- Finds the peripheral if one is connected
- if manager == nil then error("inventoryManager not found") end
- term.clear()
- local check = fs.open(manager.getOwner(),"r")
- print("balance:" ..check.readAll())
- check.close()
- function withd()
- local withdraw = fs.open(manager.getOwner(),"r")
- local data = tonumber(withdraw.readAll())
- withdraw.close()
- local withdraw2 = fs.open(manager.getOwner(),"w")
- withdraw2.write(data - withdrawamount)
- withdraw2.close()
- end
- function depo()
- local deposit = fs.open(manager.getOwner(),"r")
- local data = tonumber(deposit.readAll())
- deposit.close()
- local deposit2 = fs.open(manager.getOwner(),"w")
- deposit2.write(data + depositamount)
- deposit2.close()
- end
- function mainmenu()
- print ("1. withdraw")
- print ("2. deposit")
- end
- mainmenu()
- while true do
- local event, key = os.pullEvent("key")
- if key == keys.one then
- term.clear()
- term.setCursorPos(1,1)
- print("1. Copper Block")
- print("2. Zinc Block")
- print("3. Brass Block")
- print("4. Diamond Block")
- print("5. Netherite Block")
- local event2, key2 = os.pullEvent("key")
- if key2 == keys.one then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local copper = tonumber(amount)
- local event3, key3 = os.pullEvent("key")
- print ("What kind?")
- print ("1. Create")
- print ("2. Thermal")
- print ("3. Mystical")
- if key3 == keys.one then manager.addItemToPlayer("DOWN", copper, -1, "create:copper_block") end
- if key3 == keys.two then manager.addtemFromPlayer("DOWN", copper, -1, "thermal:copper_block") end
- if key3 == keys.three then manager.addItemToPlayer("DOWN", copper, -1, "mysticalworld:copper_block") end
- withdrawamount = copper * .5
- withd()
- elseif key2 == keys.two then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local zinc = tonumber(amount)
- manager.addItemToPlayer("DOWN", zinc, -1, "create:zinc_block")
- depositamount = zinc * 1
- withdraw()
- elseif key2 == keys.three then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local brass = tonumber(amount)
- manager.addItemToPlayer("DOWN", brass, -1, "create:brass_block")
- withdrawamount = brass * 2
- withd()
- elseif key2 == keys.four then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local diamond = tonumber(amount)
- manager.addItemToPlayer("DOWN", diamond, -1, "minecraft:diamond_block")
- withdrawamount = diamond * 3
- withd()
- elseif key2 == keys.five then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local netherite = tonumber(amount)
- manager.addItemToPlayer("DOWN", netherite, -1, "minecraft:diamond_block")
- withdrawamount = netherite * 5
- withd()
- end
- end
- if key == keys.two then
- term.clear()
- term.setCursorPos(1,1)
- print("1. Copper Block")
- print("2. Zinc Block")
- print("3. Brass Block")
- print("4. Diamond Block")
- print("5. Netherite Block")
- local event2, key2 = os.pullEvent("key")
- if key2 == keys.one then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local copper = tonumber(amount)
- print ("What kind?")
- print ("1. Create")
- print ("2. Thermal")
- print ("3. Mystical")
- local event3, key3 = os.pullEvent("key")
- if key3 == keys.one then manager.removeItemFromPlayer("DOWN", copper, -1, "create:copper_block") end
- if key3 == keys.two then manager.removeItemFromPlayer("DOWN", copper, -1, "thermal:copper_block") end
- if key3 == keys.three then manager.removeItemFromPlayer("DOWN", copper, -1, "mysticalworld:copper_block") end
- depositamount = copper * .5
- depo()
- elseif key2 == keys.two then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local zinc = tonumber(amount)
- manager.removeItemFromPlayer("DOWN", zinc, -1, "create:zinc_block")
- depositamount = zinc * 1
- depo()
- elseif key2 == keys.three then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local brass = tonumber(amount)
- manager.removeItemFromPlayer("DOWN",brass, -1, "create:brass_block")
- depositamount = brass * 2
- depo()
- elseif key2 == keys.four then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local diamond = tonumber(amount)
- manager.removeItemFromPlayer("DOWN", diamond, -1, "minecraft:diamond_block")
- depositamount = diamond * 3
- depo()
- elseif key2 == keys.five then
- term.clear()
- term.setCursorPos(1,1)
- print("How many?")
- local amount = read()
- local netherite = tonumber(amount)
- manager.removeItemFromPlayer("DOWN", netherite, -1, "minecraft:diamond_block")
- depositamount = netherite * 5
- depo()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement