Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Coded by HPWebcamAble
- **********
- Description
- **********
- This program creates scrolling text on an advanced monitor
- It may be glitchy on slow servers because of the way Minecraft works
- *Change options below to configure*
- **********
- Program Version History
- **********
- |1.1| <-- This program
- Date: October 25, 2014
- Changes:
- -Cleaned up the code
- |1.0 (Release)|
- Date: Unknown
- **********
- Options
- **********
- Make sure not to change any characters except text
- ]]
- --Set the side of the monitor
- local monitorSide = "left"
- --Set the text to display
- local text = "This text is scrolling!"
- --The time between text movement
- --Its usually best to leave this alone
- local sleepTime = 0.15
- --The size of the text on the the monitor (1-5, decimals ok)
- local textScale = 2
- --Background Color, must be 'colors.<color>'
- local bColor = colors.black
- --Text Color
- local tColor = colors.white
- --The height of the text (Y position)
- local ypos = 1
- --[[
- *********
- Program
- **********
- ]]
- local textLen = string.len(text)
- local m = peripheral.wrap(monitorSide)
- m.setBackgroundColor(bColor)
- m.setTextColor(tColor)
- m.clear()
- mw,mh = m.getSize()
- local maxPos = mw+textLen/2
- m.setTextScale(textScale)
- pos = maxPos
- posMin = -textLen
- print("Text is scrolling...")
- print("Use ctrl+t to stop the program")
- while true do
- if pos < posMin then
- pos = maxPos
- end
- m.clear()
- m.setCursorPos(pos,ypos)
- m.write(text)
- pos = pos - 1
- sleep(sleepTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement