Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lines={}
- function printTo(device,text)
- --break into lines on ns
- --we add a n at the end, so it behaves like print and so the match can find the last line
- string.gsub(text.."n","(.-)n",function(v) lines[#lines+1]=v end)
- local _,row=device.getCursorPos()
- local _,height=device.getSize()
- for i=1,#lines do
- --write the line
- device.write(lines[i])
- --move to next row
- row=row+1
- --if this went off the screen, scroll
- if row>height then
- row=height
- device.scroll(1)
- end
- --set to start of next line
- device.setCursorPos(1,row)
- end
- end
- lines={}
- local mon = peripheral.wrap('right')
- local t1 = peripheral.wrap('BigReactors-Turbine_10')
- local t2 = peripheral.wrap('BigReactors-Turbine_9')
- local t3 = peripheral.wrap('BigReactors-Turbine_8')
- local t4 = peripheral.wrap('BigReactors-Turbine_7')
- printTo(mon,"Turbina nr1:"..math.floor(t1.getRotorSpeed()).." RPM")
- printTo(mon,"Turbina nr2:"..math.floor(t2.getRotorSpeed()).." RPM")
- printTo(mon,"Turbina nr3:"..math.floor(t3.getRotorSpeed()).." RPM")
- printTo(mon,"Turbina nr4:"..math.floor(t4.getRotorSpeed()).." RPM")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement