Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CB = peripheral.wrap("back")
- mon = peripheral.wrap("top")
- mon.setTextScale(5)
- mon.setTextColour(colours.yellow)
- --chat = peripheral.wrap("right")
- sort = peripheral.wrap("bottom")
- x, y = mon.getSize()
- mon.setCursorPos(1,1)
- chestSide = 5
- while true do
- if fs.exists("task") then
- file = io.open("task", "r")
- task = file.read()
- file:close()
- else
- mon.setTextColour(colours.yellow)
- mon.setTextScale(5)
- mon.setCursorPos(x/2-3, y/2-1)
- mon.write("Touch me")
- mon.setCursorPos(x/2-6, y/2)
- mon.write("to get a task,")
- mon.setCursorPos(x/2-3, y/2+2)
- mon.write("peasants!")
- event = os.pullEvent()
- file = fs.open("task", "w")
- file.write("1")
- file:close()
- end
- if task == "1" then
- mon.setTextScale(4)
- mon.clear()
- CB.setCommand("/say Welcome Peasants! Prove to me you're not completely useless. Collect a stack of smooth stone!")
- CB.runCommand()
- mon.setCursorPos(1,3)
- mon.write("Stone: 0 /64")
- id = 1
- count = 0
- while count < 64 and id == 1 do
- inv = sort.list(chestSide)
- for ItemId, ItemCount in pairs(inv) do
- ItemId = tonumber(ItemId)
- ItemCount = tonumber(ItemCount)
- floorCount = string.gsub(ItemCount, ".0", "")
- if ItemId == 1 then
- mon.setCursorPos(8,3)
- mon.write(" ")
- mon.setCursorPos(8,3)
- mon.write(floorCount)
- count = ItemCount
- id = ItemId
- end
- sleep(0.1)
- end
- sleep(0.5)
- end
- sort.extract(chestSide, 1, 0, 64)
- mon.clear()
- mon.setCursorPos(1,3)
- mon.write("Well done, peasant.")
- CB.setCommand("/give @p 257 1")
- CB.runCommand()
- CB.setCommand("/say So, you're not completely useless. Use this to go faster, peasant.")
- CB.runCommand()
- file = fs.open("task", "w")
- file.write("2")
- file:close()
- os.sleep(5)
- mon.clear()
- elseif task == "2" then
- mon.setTextScale(4)
- mon.clear()
- CB.setCommand("/say I'm hungry. Feed me some bread, peasants!")
- CB.runCommand()
- mon.setCursorPos(1,3)
- mon.write("Bread: 0 /5")
- id = 297
- count = 0
- while count < 5 and id == 297 do
- inv = sort.list(chestSide)
- for ItemId, ItemCount in pairs(inv) do
- ItemId = tonumber(ItemId)
- ItemCount = tonumber(ItemCount)
- floorCount = string.gsub(ItemCount, ".0", "")
- if ItemId == 297 then
- mon.setCursorPos(8,3)
- mon.write(" ")
- mon.setCursorPos(8,3)
- mon.write(floorCount)
- count = ItemCount
- id = ItemId
- end
- sleep(0.1)
- end
- sleep(0.5)
- end
- sort.extract(chestSide, 297, 0, 5)
- mon.clear()
- mon.setCursorPos(1,3)
- mon.write("Well done, peasant.")
- CB.setCommand("/give @p 392 1")
- CB.runCommand()
- CB.setCommand("/say Delicious. Have some scraps, peasants.")
- CB.runCommand()
- file = fs.open("task", "w")
- file.write("3")
- file:close()
- os.sleep(5)
- mon.clear()
- count = 0
- elseif task == "3" then
- mon.setTextScale(4)
- mon.clear()
- CB.setCommand("/say Keep building, peasants! Fetch me some wood.")
- CB.runCommand()
- mon.setCursorPos(1,3)
- mon.write("Oak Wood: 0 /20")
- id = 17
- count = 0
- while count < 20 and id == 17 do
- inv = sort.list(chestSide)
- for ItemId, ItemCount in pairs(inv) do
- ItemId = tonumber(ItemId)
- ItemCount = tonumber(ItemCount)
- floorCount = string.gsub(ItemCount, ".0", "")
- if ItemId == 17 then
- mon.setCursorPos(11,3)
- mon.write(" ")
- mon.setCursorPos(11,3)
- mon.write(floorCount)
- count = ItemCount
- id = ItemId
- end
- sleep(0.1)
- end
- sleep(0.5)
- end
- sort.extract(chestSide, 17, 0, 20)
- mon.clear()
- mon.setCursorPos(1,3)
- mon.write("Well done, peasant.")
- CB.setCommand("/give @p 6 1 2")
- CB.runCommand()
- CB.setCommand("/say That's terrible wood. Use this, peasants.")
- CB.runCommand()
- file = fs.open("task", "w")
- file.write("4")
- file:close()
- os.sleep(5)
- mon.clear()
- count = 0
- elseif task == "4" then
- mon.setTextScale(4)
- mon.clear()
- CB.setCommand("/say Quickly! I need the flesh of the undead. Don't ask Questions, peasants!")
- CB.runCommand()
- mon.setCursorPos(1,1)
- mon.write("Rotten flesh:")
- mon.setCursorPos(1,3)
- mon.write("0 /20")
- id = 367
- count = 0
- while count < 20 and id == 367 do
- inv = sort.list(chestSide)
- for ItemId, ItemCount in pairs(inv) do
- ItemId = tonumber(ItemId)
- ItemCount = tonumber(ItemCount)
- floorCount = string.gsub(ItemCount, ".0", "")
- if ItemId == 367 then
- mon.setCursorPos(1,3)
- mon.write(" ")
- mon.setCursorPos(1,3)
- mon.write(floorCount)
- count = ItemCount
- id = ItemId
- end
- sleep(0.1)
- end
- sleep(0.5)
- end
- sort.extract(chestSide, 367, 0, 20)
- mon.clear()
- mon.setCursorPos(1,3)
- mon.write("Well done, peasant.")
- CB.setCommand("/give @p 397 1 2")
- CB.runCommand()
- CB.setCommand("/say Ahhhh, all done. Won't be needing this any more. Why don't you play with this, peasant.")
- CB.runCommand()
- file = fs.open("task", "w")
- file.write("5")
- file:close()
- os.sleep(5)
- mon.clear()
- count = 0
- elseif task == "5" then
- mon.setTextScale(4)
- mon.clear()
- CB.setCommand("/say After that I need some melon juice. Don't just stand there, peasants!")
- CB.runCommand()
- mon.setCursorPos(1,1)
- mon.write("Melons:")
- mon.setCursorPos(1,3)
- mon.write("0 /20")
- id = 367
- count = 0
- while count < 20 and id == 367 do
- inv = sort.list(chestSide)
- for ItemId, ItemCount in pairs(inv) do
- ItemId = tonumber(ItemId)
- ItemCount = tonumber(ItemCount)
- floorCount = string.gsub(ItemCount, ".0", "")
- if ItemId == 367 then
- mon.setCursorPos(1,3)
- mon.write(" ")
- mon.setCursorPos(1,3)
- mon.write(floorCount)
- count = ItemCount
- id = ItemId
- end
- sleep(0.1)
- end
- sleep(0.5)
- end
- sort.extract(chestSide, 367, 0, 20)
- mon.clear()
- mon.setCursorPos(1,3)
- mon.write("Well done, peasant.")
- CB.setCommand("/give @p 397 1 2")
- CB.runCommand()
- CB.setCommand("/say Ahhhh, all done. Won't be needing this any more. Why don't you play with this, peasant.")
- CB.runCommand()
- file = fs.open("task", "w")
- file.write("5")
- file:close()
- os.sleep(5)
- mon.clear()
- count = 0
- os.sleep(60)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement