Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getVersion()
- return 1.2
- end
- function writeM(side, text)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- write(text)
- term.restore()
- end
- end
- function printM(side, text)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- print(text)
- term.restore()
- end
- end
- function writePos(side, text, xpos, ypos)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- term.setCursorPos(xpos, ypos)
- write(text)
- term.restore()
- end
- end
- function slowPrint(side, text)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- textutils.slowPrint(text)
- term.restore()
- end
- end
- function slowPrintPos(side, text, xpos, ypos)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- term.setCursorPos(xpos, ypos)
- textutils.slowPrint(text)
- term.restore()
- end
- end
- function clear(side)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- term.clear()
- term.setCursorPos(1, 1)
- term.restore()
- end
- end
- function flashyText(side, text, sleep, times)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- for i = 1, times do
- local cx, cy = term.getCursorPos()
- write(text)
- term.setCursorPos(cx, cy)
- os.sleep(sleep)
- term.clearLine()
- os.sleep(sleep)
- end
- term.restore()
- end
- end
- function flashyTextPos(side, text, xpos, ypos, sleep, times)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- for i = 1, times do
- term.setCursorPos(xpos, ypos)
- write(text)
- term.setCursorPos(xpos, ypos)
- os.sleep(sleep)
- term.clearLine()
- os.sleep(sleep)
- end
- term.restore()
- end
- end
- function marqueeLeft(side, text, ypos, sleep)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- local sx, sy = term.getSize()
- text = string.rep(" ", sx - 1)..text
- for i=1,string.len(text) do
- term.clearLine()
- displayString = string.sub(text, i, math.min(string.len(text), (i + sx - 2)))
- term.setCursorPos(1, ypos)
- write(displayString)
- os.sleep(sleep)
- end
- term.clearLine()
- term.restore()
- end
- end
- function marqueeRight(side, text, ypos, sleep)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- local sx, sy = term.getSize()
- text = string.rep(" ", sx - 1)..text..string.rep(" ", sx - 1)
- for i = 1,string.len(text) - (sx - 1) do
- term.clearLine()
- displayString = string.sub(text, -math.min(string.len(text), i + sx - 2), -i)
- term.setCursorPos(1, ypos)
- write(displayString)
- os.sleep(sleep)
- end
- term.clearLine()
- term.restore()
- end
- end
- --thanks to Lyqyd from the ComputerCraft fourms for fixing the marquee code. :mellow:/>/>
- function goto(side)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- end
- end
- function runprgm(side, prgm, args)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- shell.run(prgm, args)
- term.restore()
- end
- end
- function run(side, func)
- if peripheral.isPresent(side) then
- term.redirect(peripheral.wrap(side))
- func()
- term.restore()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement