Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. local lines={}
  2. function printTo(device,text)
  3. --break into lines on ns
  4. --we add a n at the end, so it behaves like print and so the match can find the last line
  5. string.gsub(text.."n","(.-)n",function(v) lines[#lines+1]=v end)
  6. local _,row=device.getCursorPos()
  7. local _,height=device.getSize()
  8. for i=1,#lines do
  9. --write the line
  10. device.write(lines[i])
  11. --move to next row
  12. row=row+1
  13. --if this went off the screen, scroll
  14. if row>height then
  15. row=height
  16. device.scroll(1)
  17. end
  18. --set to start of next line
  19. device.setCursorPos(1,row)
  20. end
  21. end
  22. lines={}
  23. local mon = peripheral.wrap('right')
  24. local t1 = peripheral.wrap('BigReactors-Turbine_10')
  25. local t2 = peripheral.wrap('BigReactors-Turbine_9')
  26. local t3 = peripheral.wrap('BigReactors-Turbine_8')
  27. local t4 = peripheral.wrap('BigReactors-Turbine_7')
  28. printTo(mon,"Turbina nr1:"..math.floor(t1.getRotorSpeed()).." RPM")
  29. printTo(mon,"Turbina nr2:"..math.floor(t2.getRotorSpeed()).." RPM")
  30. printTo(mon,"Turbina nr3:"..math.floor(t3.getRotorSpeed()).." RPM")
  31. printTo(mon,"Turbina nr4:"..math.floor(t4.getRotorSpeed()).." RPM")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement