SHARE
TWEET

MobLimiter [Timer]

scadl Dec 20th, 2016 (edited) 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- MobLimiter
  2. local monitor, kHour, kDay, kMin
  3. kHour = 0
  4. kMin = 10
  5. kDay = 0
  6.  
  7. while true do
  8.  
  9. local sides = {"left", "right", "top", "bottom", "front", "back"}
  10.  
  11. for i, side in pairs(sides) do
  12.     if (peripheral.isPresent(side)) then
  13.         local deviceType = peripheral.getType(side)
  14.         local peripher = peripheral.wrap(side)
  15.         if (deviceType == "monitor") then
  16.             peripher.setTextScale(0.9)
  17.             monitor = peripher
  18.         end
  19.         --print("Debug: side: '"..side.."', device: '"..deviceType.."'")
  20.     end
  21. end
  22.  
  23.  
  24.  
  25. local time = os.time()
  26. local fTime = textutils.formatTime(time, true)
  27.  
  28. monitor.clear()
  29. monitor.setCursorPos(1, 1)
  30. monitor.write("Now is:")
  31. monitor.setCursorPos(1, 2)
  32. monitor.write(fTime..", Day: "..os.day())
  33. monitor.setCursorPos(1, 3)
  34. monitor.write('--------')
  35. monitor.setCursorPos(1, 4)
  36. monitor.write("Next Chiken")
  37. monitor.setCursorPos(1, 5)
  38. monitor.write("kill at: " .. kHour .. ":" .. kMin)
  39.  
  40. term.clear()
  41. term.setCursorPos(1, 1)
  42. term.write("Now is:")
  43. term.setCursorPos(1, 2)
  44. term.write(fTime..", Day: "..os.day())
  45. term.setCursorPos(1, 3)
  46. term.write('--------')
  47. term.setCursorPos(1, 4)
  48. term.write("Next Chiken")
  49. term.setCursorPos(1, 5)
  50. term.write("kill at: " .. kHour .. ":" .. kMin)
  51.  
  52. -- 0:00 AM - Midnight (/time set 18000)
  53. if fTime == kHour .. ":"..kMin then
  54.     local mkill = commands.exec("cofh killall chicken")
  55.     kHour = math.random(0,23)
  56.     kMin = math.random(10,59)
  57.     kDay = os.day()
  58. end
  59.  
  60. sleep(1)
  61. end
RAW Paste Data
Top