Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SIDE = "top"
- local monitor = peripheral.wrap(SIDE)
- local tasks = {}
- local function centerText(text)
- x,y = monitor.getSize()
- x1,y1 = monitor.getCursorPos()
- monitor.setCursorPos((math.floor(x/2) - (math.floor(#text/2))) + 1, y1) -- this is why we cant have nice things
- monitor.write(text)
- end
- local function UpdateMonitor()
- monitor.setCursorPos(0, 3)
- monitor.clear()
- monitor.setTextColor(colors.orange)
- centerText("Task Manager")
- if #tasks > 0 then
- cursorY = 5
- for i=1, #tasks, 1 do
- if tasks[i].priority == 1 then
- monitor.setTextColor(colors.red)
- elseif tasks[i].priority == 2 then
- monitor.setTextColor(colors.yellow)
- elseif tasks[i].priority == 3 then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.white)
- end
- monitor.setCursorPos(0, cursorY)
- centerText(tasks[i].task)
- cursorY = cursorY + 1
- end
- end
- end
- local function AddTask(task, priority)
- table.insert(tasks, {task=task, priority=priority})
- UpdateMonitor()
- end
- UpdateMonitor()
- sleep(2)
- AddTask("Aerotheum Automation", 1)
- sleep(2)
- AddTask("Petrotheum Automation", 1)
- sleep(2)
- AddTask("Task Manager Add/Remove", 3)
Advertisement
Add Comment
Please, Sign In to add comment