Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monitor = peripheral.wrap("back")
- monitor.clear()
- pos = 0
- monitor.setCursorPos(1,1)
- screenSize = 51 -- screen size
- screenSize2 = 25
- function text(a,b,c)
- local pos = b
- monitor.setCursorPos(1,pos) --
- local i2 = 1
- local i = 0
- if c == 1 then
- monitor.setTextScale(1)
- if string.len(a) > screenSize then -- checks wheter it needs an enter
- while true do
- i = i + screenSize -- goes to next section of text ex. "(hej på )(dig hallo)"
- if i > string.len(a) then -- if i has gone over the lentgh of text AKA text is done
- monitor.write(string.sub(a,i2,i))
- break
- end
- while string.sub(a,i,i) ~= " " do -- subtrakts down to latest " " ex "(hej på-> <-)(dig hallo)"
- i = i - 1
- end
- monitor.write(string.sub(a,i2,i))
- pos = pos + 1
- monitor.setCursorPos(1,pos)
- i2 = i + 1
- end
- else
- monitor.write(a)
- end
- end
- if c == 2 then
- monitor.setTextScale(2)
- if string.len(a) > screenSize2 then -- checks wheter it needs an enter
- while true do
- i = i + screenSize2 -- goes to next section of text ex. "(hej på )(dig hallo)"
- if i > string.len(a) then -- if i has gone over the lentgh of text AKA text is done
- monitor.write(string.sub(a,i2,i))
- break
- end
- while string.sub(a,i,i) ~= " " do -- subtrakts down to latest " " ex "(hej på-> <-)(dig hallo)"
- i = i - 1
- end
- monitor.write(string.sub(a,i2,i))
- pos = pos + 1
- monitor.setCursorPos(1,pos)
- i2 = i + 1
- end
- else
- monitor.write(a)
- end
- end
- end
- -- ----
- while true do
- print("test")
- os.pullEvent("redstone")
- if redstone.getInput("front") then
- text("Power: >12 000 000 (80%)",2,2)
- else
- text("Power: <12 000 000 (80%)",2,2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement