Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- allSlates = {"Blank", "Reinforced", "Imbued", "Demonic", "Ethereal"}
- -- init
- rednet.open("left")
- function clearTerm()
- term.clear()
- term.setCursorPos(1,1)
- end
- function startCraftingProcess(amount, slate)
- msg = {}
- msg[0] = amount
- for i = 1, 5 do
- if string.lower(allSlates[i]) == string.lower(slate) then
- msg[1] = i
- end
- end
- clearTerm()
- write("Crafting " .. tostring(amount) .." " .. slate .. " slate(s).")
- rednet.broadcast(msg, "bloodaltar")
- id, msg = rednet.receive("bloodaltar")
- if msg == "success" then
- clearTerm()
- write("Succesfully crafted slates.\n")
- write("Press any key to continue...")
- evt, key = os.pullEvent("key")
- evt, key = os.pullEvent("key_up")
- elseif msg == "failure" then
- clearTerm()
- write("Something went wrong... rebooting.")
- os.sleep(2.5)
- os.reboot()
- end
- end
- while true do
- clearTerm()
- write("Input slates (For a list type 'list'):\n")
- slate = read()
- if input == "list" then
- clearTerm()
- write("List of available slates:\n")
- x = 5
- y = 2
- for i = 1, 5 do
- term.setCursorPos(x,y+i-1)
- write(tostring(allSlates[i]))
- end
- term.setCursorPos(1, 7)
- write("\nPress a key to continue..")
- evt, key = os.pullEvent("key")
- evt, key = os.pullEvent("key_up")
- else
- write("Amount: ")
- amount = read()
- startCraftingProcess(amount, slate)
- end
- end
- rednet.close("left")
Add Comment
Please, Sign In to add comment