Advertisement
thatparadox

TaskCom

Nov 24th, 2013
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.94 KB | None | 0 0
  1. CB = peripheral.wrap("back")
  2. mon = peripheral.wrap("top")
  3. mon.setTextScale(5)
  4. mon.setTextColour(colours.yellow)
  5. --chat = peripheral.wrap("right")
  6. sort = peripheral.wrap("bottom")
  7. x, y = mon.getSize()
  8. mon.setCursorPos(1,1)
  9. chestSide = 5
  10.  
  11.  
  12.  
  13. while true do
  14. if fs.exists("task") then
  15.     file = io.open("task", "r")
  16.     task = file.read()
  17.     file:close()
  18. else
  19.     mon.setTextColour(colours.yellow)
  20.     mon.setTextScale(5)
  21.     mon.setCursorPos(x/2-3, y/2-1)
  22.     mon.write("Touch me")
  23.     mon.setCursorPos(x/2-6, y/2)
  24.     mon.write("to get a task,")
  25.     mon.setCursorPos(x/2-3, y/2+2)
  26.     mon.write("peasants!")
  27.     event = os.pullEvent()
  28.     file = fs.open("task", "w")
  29.     file.write("1")
  30.     file:close()
  31. end
  32. if task == "1" then
  33.     mon.setTextScale(4)
  34.     mon.clear()
  35.     CB.setCommand("/say Welcome Peasants! Prove to me you're not completely useless. Collect a stack of smooth stone!")
  36.     CB.runCommand()
  37.     mon.setCursorPos(1,3)
  38.     mon.write("Stone: 0 /64")
  39.     id = 1
  40.     count = 0
  41.     while count < 64 and id == 1 do
  42.         inv = sort.list(chestSide)
  43.         for ItemId, ItemCount in pairs(inv) do
  44.             ItemId = tonumber(ItemId)
  45.             ItemCount = tonumber(ItemCount)
  46.             floorCount = string.gsub(ItemCount, ".0", "")
  47.             if ItemId == 1 then
  48.                 mon.setCursorPos(8,3)
  49.                 mon.write("  ")
  50.                 mon.setCursorPos(8,3)
  51.                 mon.write(floorCount)
  52.                 count = ItemCount
  53.                 id = ItemId
  54.             end
  55.             sleep(0.1)
  56.         end
  57.     sleep(0.5)
  58.     end
  59.     sort.extract(chestSide, 1, 0, 64)
  60.     mon.clear()
  61.     mon.setCursorPos(1,3)
  62.     mon.write("Well done, peasant.")
  63.     CB.setCommand("/give @p 257 1")
  64.     CB.runCommand()
  65.     CB.setCommand("/say So, you're not completely useless. Use this to go faster, peasant.")
  66.     CB.runCommand()
  67.     file = fs.open("task", "w")
  68.     file.write("2")
  69.     file:close()
  70.     os.sleep(5)
  71.     mon.clear()
  72. elseif task == "2" then
  73.     mon.setTextScale(4)
  74.     mon.clear()
  75.     CB.setCommand("/say I'm hungry. Feed me some bread, peasants!")
  76.     CB.runCommand()
  77.     mon.setCursorPos(1,3)
  78.     mon.write("Bread: 0 /5")
  79.     id = 297
  80.     count = 0
  81.     while count < 5 and id == 297 do
  82.         inv = sort.list(chestSide)
  83.         for ItemId, ItemCount in pairs(inv) do
  84.             ItemId = tonumber(ItemId)
  85.             ItemCount = tonumber(ItemCount)
  86.             floorCount = string.gsub(ItemCount, ".0", "")
  87.             if ItemId == 297 then
  88.                 mon.setCursorPos(8,3)
  89.                 mon.write("  ")
  90.                 mon.setCursorPos(8,3)
  91.                 mon.write(floorCount)
  92.                 count = ItemCount
  93.                 id = ItemId
  94.             end
  95.             sleep(0.1)
  96.         end
  97.     sleep(0.5)
  98.     end
  99.     sort.extract(chestSide, 297, 0, 5)
  100.     mon.clear()
  101.     mon.setCursorPos(1,3)
  102.     mon.write("Well done, peasant.")
  103.     CB.setCommand("/give @p 392 1")
  104.     CB.runCommand()
  105.     CB.setCommand("/say Delicious. Have some scraps, peasants.")
  106.     CB.runCommand()
  107.     file = fs.open("task", "w")
  108.     file.write("3")
  109.     file:close()
  110.     os.sleep(5)
  111.     mon.clear()
  112.         count = 0
  113. elseif task == "3" then
  114.     mon.setTextScale(4)
  115.     mon.clear()
  116.     CB.setCommand("/say Keep building, peasants! Fetch me some wood.")
  117.     CB.runCommand()
  118.     mon.setCursorPos(1,3)
  119.     mon.write("Oak Wood: 0 /20")
  120.     id = 17
  121.     count = 0
  122.     while count < 20 and id == 17 do
  123.         inv = sort.list(chestSide)
  124.         for ItemId, ItemCount in pairs(inv) do
  125.             ItemId = tonumber(ItemId)
  126.             ItemCount = tonumber(ItemCount)
  127.             floorCount = string.gsub(ItemCount, ".0", "")
  128.             if ItemId == 17 then
  129.                 mon.setCursorPos(11,3)
  130.                 mon.write("  ")
  131.                 mon.setCursorPos(11,3)
  132.                 mon.write(floorCount)
  133.                 count = ItemCount
  134.                 id = ItemId
  135.             end
  136.             sleep(0.1)
  137.         end
  138.     sleep(0.5)
  139.     end
  140.     sort.extract(chestSide, 17, 0, 20)
  141.     mon.clear()
  142.     mon.setCursorPos(1,3)
  143.     mon.write("Well done, peasant.")
  144.     CB.setCommand("/give @p 6 1 2")
  145.     CB.runCommand()
  146.     CB.setCommand("/say That's terrible wood. Use this, peasants.")
  147.     CB.runCommand()
  148.     file = fs.open("task", "w")
  149.     file.write("4")
  150.     file:close()
  151.     os.sleep(5)
  152.     mon.clear()
  153.         count = 0
  154. elseif task == "4" then
  155.     mon.setTextScale(4)
  156.     mon.clear()
  157.     CB.setCommand("/say Quickly! I need the flesh of the undead. Don't ask Questions, peasants!")
  158.     CB.runCommand()
  159.     mon.setCursorPos(1,1)
  160.     mon.write("Rotten flesh:")
  161.     mon.setCursorPos(1,3)
  162.     mon.write("0 /20")
  163.     id = 367
  164.     count = 0
  165.     while count < 20 and id == 367 do
  166.         inv = sort.list(chestSide)
  167.         for ItemId, ItemCount in pairs(inv) do
  168.             ItemId = tonumber(ItemId)
  169.             ItemCount = tonumber(ItemCount)
  170.             floorCount = string.gsub(ItemCount, ".0", "")
  171.             if ItemId == 367 then
  172.                 mon.setCursorPos(1,3)
  173.                 mon.write("  ")
  174.                 mon.setCursorPos(1,3)
  175.                 mon.write(floorCount)
  176.                 count = ItemCount
  177.                 id = ItemId
  178.             end
  179.             sleep(0.1)
  180.         end
  181.     sleep(0.5)
  182.     end
  183.     sort.extract(chestSide, 367, 0, 20)
  184.     mon.clear()
  185.     mon.setCursorPos(1,3)
  186.     mon.write("Well done, peasant.")
  187.     CB.setCommand("/give @p 397 1 2")
  188.     CB.runCommand()
  189.     CB.setCommand("/say Ahhhh, all done. Won't be needing this any more. Why don't you play with this, peasant.")
  190.     CB.runCommand()
  191.     file = fs.open("task", "w")
  192.     file.write("5")
  193.     file:close()
  194.     os.sleep(5)
  195.     mon.clear()
  196.         count = 0
  197. elseif task == "5" then
  198.     mon.setTextScale(4)
  199.     mon.clear()
  200.     CB.setCommand("/say After that I need some melon juice. Don't just stand there, peasants!")
  201.     CB.runCommand()
  202.     mon.setCursorPos(1,1)
  203.     mon.write("Melons:")
  204.     mon.setCursorPos(1,3)
  205.     mon.write("0 /20")
  206.     id = 367
  207.     count = 0
  208.     while count < 20 and id == 367 do
  209.         inv = sort.list(chestSide)
  210.         for ItemId, ItemCount in pairs(inv) do
  211.             ItemId = tonumber(ItemId)
  212.             ItemCount = tonumber(ItemCount)
  213.             floorCount = string.gsub(ItemCount, ".0", "")
  214.             if ItemId == 367 then
  215.                 mon.setCursorPos(1,3)
  216.                 mon.write("  ")
  217.                 mon.setCursorPos(1,3)
  218.                 mon.write(floorCount)
  219.                 count = ItemCount
  220.                 id = ItemId
  221.             end
  222.             sleep(0.1)
  223.         end
  224.     sleep(0.5)
  225.     end
  226.     sort.extract(chestSide, 367, 0, 20)
  227.     mon.clear()
  228.     mon.setCursorPos(1,3)
  229.     mon.write("Well done, peasant.")
  230.     CB.setCommand("/give @p 397 1 2")
  231.     CB.runCommand()
  232.     CB.setCommand("/say Ahhhh, all done. Won't be needing this any more. Why don't you play with this, peasant.")
  233.     CB.runCommand()
  234.     file = fs.open("task", "w")
  235.     file.write("5")
  236.     file:close()
  237.     os.sleep(5)
  238.     mon.clear()
  239.         count = 0
  240. os.sleep(60)
  241. end
  242. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement