Posted 09 April 2017 - 06:59 AM
Hello. So right now I am just making a silly thing for my factory. The idea is that I have a monitor above my PC which displays the Current % efficiency of the factory and also the Day Average %. I got it to work fine for having just one line, but I dont know how to get both to work and constantly update, because they just override each other. Here is the code:
If you need more explanation, please feel free to ask. Thankyou!
function newLine()
local _,cY = m.getCursorPos()
m.setCursorPos(1,cY + 1)
end
function currentP()
m.write("Current: " .. math.random(85,98) .. "%")
sleep(1)
m.clearLine()
m.setCursorPos(1,4)
end
function dayP()
m.write("Day Avg: " .. math.random(94,99) .. "%")
sleep(1)
m.clearLine()
m.setCursorPos(1,5)
end
m = peripheral.wrap("top")
m.clear()
m.setCursorPos(1,1)
m.setTextScale(0.5)
m.write("Efficiency Of")
newLine()
m.write("Factory")
newLine()
newLine()
while true do
currentP()
dayP()
end
If you need more explanation, please feel free to ask. Thankyou!
Edited on 09 April 2017 - 11:41 PM