Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Scroll, by Symmetryc
- -- Edit the following variables to
- -- change how the program behaves
- -- Change the scrolling text with this
- local str = "Example text"
- -- Change the speed that the text scrolls
- -- With this (higher is faster)
- local speed = 1
- -- Change the side of the monitor with this
- local side = "right"
- -- Change text scale
- local scale = 1
- -- Change the text and back colors
- local textcolor = colors.white
- local backcolor = colors.lime
- --###### Actual program ######
- local mon = peripheral.wrap(side)
- mon.setTextScale(scale)
- mon.setTextColor(textcolor)
- mon.setBackgroundColor(backcolor)
- local max_x, max_y = mon.getSize()
- assert(max_x > #str, "String too large")
- str = str..(" "):rep(max_x - #str)
- local text_pos = 0
- local pos_y = math.ceil(max_y / 2)
- mon.clear()
- while true do
- mon.setCursorPos(1, pos_y)
- mon.write(str:sub(text_pos + 1)..str:sub(1, text_pos))
- text_pos = text_pos == max_x - 1 and 0 or text_pos + 1
- sleep(1 / speed)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement