Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. monitor = peripheral.wrap("back")
  2. monitor.clear()
  3. pos = 0
  4. monitor.setCursorPos(1,1)
  5. screenSize = 51 -- screen size
  6. screenSize2 = 25
  7.  
  8.  
  9.  
  10.  
  11. function text(a,b,c)
  12. local pos = b
  13. monitor.setCursorPos(1,pos) --
  14. local i2 = 1
  15. local i = 0
  16. if c == 1 then
  17. monitor.setTextScale(1)
  18. if string.len(a) > screenSize then -- checks wheter it needs an enter
  19. while true do
  20. i = i + screenSize -- goes to next section of text ex. "(hej på )(dig hallo)"
  21. if i > string.len(a) then -- if i has gone over the lentgh of text AKA text is done
  22. monitor.write(string.sub(a,i2,i))
  23. break
  24. end
  25. while string.sub(a,i,i) ~= " " do -- subtrakts down to latest " " ex "(hej på-> <-)(dig hallo)"
  26. i = i - 1
  27. end
  28. monitor.write(string.sub(a,i2,i))
  29. pos = pos + 1
  30. monitor.setCursorPos(1,pos)
  31. i2 = i + 1
  32.  
  33. end
  34. else
  35. monitor.write(a)
  36. end
  37. end
  38. if c == 2 then
  39. monitor.setTextScale(2)
  40. if string.len(a) > screenSize2 then -- checks wheter it needs an enter
  41. while true do
  42. i = i + screenSize2 -- goes to next section of text ex. "(hej på )(dig hallo)"
  43. if i > string.len(a) then -- if i has gone over the lentgh of text AKA text is done
  44. monitor.write(string.sub(a,i2,i))
  45. break
  46. end
  47. while string.sub(a,i,i) ~= " " do -- subtrakts down to latest " " ex "(hej på-> <-)(dig hallo)"
  48. i = i - 1
  49. end
  50. monitor.write(string.sub(a,i2,i))
  51. pos = pos + 1
  52. monitor.setCursorPos(1,pos)
  53. i2 = i + 1
  54.  
  55. end
  56. else
  57. monitor.write(a)
  58. end
  59. end
  60. end
  61. -- ----
  62.  
  63. while true do
  64. print("test")
  65. os.pullEvent("redstone")
  66. if redstone.getInput("front") then
  67. text("Power: >12 000 000 (80%)",2,2)
  68. else
  69. text("Power: <12 000 000 (80%)",2,2)
  70. end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement