Advertisement
Guest User

ProgramProAssa1

a guest
Jun 29th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. function getVersion()
  2. return 1.2
  3. end
  4. function writeM(side, text)
  5. if peripheral.isPresent(side) then
  6. term.redirect(peripheral.wrap(side))
  7. write(text)
  8. term.restore()
  9. end
  10. end
  11. function printM(side, text)
  12. if peripheral.isPresent(side) then
  13. term.redirect(peripheral.wrap(side))
  14. print(text)
  15. term.restore()
  16. end
  17. end
  18. function writePos(side, text, xpos, ypos)
  19. if peripheral.isPresent(side) then
  20. term.redirect(peripheral.wrap(side))
  21. term.setCursorPos(xpos, ypos)
  22. write(text)
  23. term.restore()
  24. end
  25. end
  26. function slowPrint(side, text)
  27. if peripheral.isPresent(side) then
  28. term.redirect(peripheral.wrap(side))
  29. textutils.slowPrint(text)
  30. term.restore()
  31. end
  32. end
  33. function slowPrintPos(side, text, xpos, ypos)
  34. if peripheral.isPresent(side) then
  35. term.redirect(peripheral.wrap(side))
  36. term.setCursorPos(xpos, ypos)
  37. textutils.slowPrint(text)
  38. term.restore()
  39. end
  40. end
  41. function clear(side)
  42. if peripheral.isPresent(side) then
  43. term.redirect(peripheral.wrap(side))
  44. term.clear()
  45. term.setCursorPos(1, 1)
  46. term.restore()
  47. end
  48. end
  49. function flashyText(side, text, sleep, times)
  50. if peripheral.isPresent(side) then
  51. term.redirect(peripheral.wrap(side))
  52. for i = 1, times do
  53. local cx, cy = term.getCursorPos()
  54. write(text)
  55. term.setCursorPos(cx, cy)
  56. os.sleep(sleep)
  57. term.clearLine()
  58. os.sleep(sleep)
  59. end
  60. term.restore()
  61. end
  62. end
  63. function flashyTextPos(side, text, xpos, ypos, sleep, times)
  64. if peripheral.isPresent(side) then
  65. term.redirect(peripheral.wrap(side))
  66. for i = 1, times do
  67. term.setCursorPos(xpos, ypos)
  68. write(text)
  69. term.setCursorPos(xpos, ypos)
  70. os.sleep(sleep)
  71. term.clearLine()
  72. os.sleep(sleep)
  73. end
  74. term.restore()
  75. end
  76. end
  77. function marqueeLeft(side, text, ypos, sleep)
  78. if peripheral.isPresent(side) then
  79. term.redirect(peripheral.wrap(side))
  80. local sx, sy = term.getSize()
  81. text = string.rep(" ", sx - 1)..text
  82. for i=1,string.len(text) do
  83. term.clearLine()
  84. displayString = string.sub(text, i, math.min(string.len(text), (i + sx - 2)))
  85. term.setCursorPos(1, ypos)
  86. write(displayString)
  87. os.sleep(sleep)
  88. end
  89. term.clearLine()
  90. term.restore()
  91. end
  92. end
  93. function marqueeRight(side, text, ypos, sleep)
  94. if peripheral.isPresent(side) then
  95. term.redirect(peripheral.wrap(side))
  96. local sx, sy = term.getSize()
  97. text = string.rep(" ", sx - 1)..text..string.rep(" ", sx - 1)
  98. for i = 1,string.len(text) - (sx - 1) do
  99. term.clearLine()
  100. displayString = string.sub(text, -math.min(string.len(text), i + sx - 2), -i)
  101. term.setCursorPos(1, ypos)
  102. write(displayString)
  103. os.sleep(sleep)
  104. end
  105. term.clearLine()
  106. term.restore()
  107. end
  108. end
  109. --thanks to Lyqyd from the ComputerCraft fourms for fixing the marquee code. :mellow:/>/>
  110. function goto(side)
  111. if peripheral.isPresent(side) then
  112. term.redirect(peripheral.wrap(side))
  113. end
  114. end
  115. function runprgm(side, prgm, args)
  116. if peripheral.isPresent(side) then
  117. term.redirect(peripheral.wrap(side))
  118. shell.run(prgm, args)
  119. term.restore()
  120. end
  121. end
  122. function run(side, func)
  123. if peripheral.isPresent(side) then
  124. term.redirect(peripheral.wrap(side))
  125. func()
  126. term.restore()
  127. end
  128. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement