Advertisement
CodeCrafter

startup

Feb 20th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. -- config
  2. local sSide = "left" -- put here the side of your disk reader.
  3.  
  4.  
  5.  
  6. textutils.sloPrint(" WINDOWS 9 ", 5 )
  7.  
  8. while disk.isPresent(sSide) do
  9. print(" Back-upping files... ")
  10. end
  11.  
  12. while not disk.getLabel(sSide," OS ") do
  13. disk.setLabel(sSide,"OS")
  14. end
  15.  
  16. -- here is the code for booting...
  17.  
  18. print(" ___________________________________________________________ ")
  19. print(" / @@@ @@@@@@ @@@ @@@ @@@ @@@ \ ")
  20. print(" | @@@ @@@ @@@ @@@ @@@@@ @@@ | ")
  21. print(" | @@@@@ @@@@@@@ @@@ @@@ @@ @@@ | ")
  22. print(" | @@@ @@@@@ @@@ @@@ @@ @@@ | ")
  23. print(" | @ @@@ @@@ @@@ @@ @@@ | ")
  24. print(" | @ @@@ @@@ @@@@@@@ | ")
  25. print(" | | ")
  26. print(" | Version: 2.0! | ")
  27. print(" | | ")
  28. print(" \___________________________________________________________/ ")
  29.  
  30.  
  31. mon = peripheral.wrap("left")
  32. function lineBreak()
  33. x, y = mon.getCursorPos()
  34. if y ~= 1 then
  35. y = y + 1
  36. end
  37. mon.setCursorPos(1, y)
  38. width, height = mon.getSize()
  39. mon.write("+" .. string.rep("-", width - 2) .. "+")
  40. end
  41. function printString(sString)
  42. x, y = mon.getCursorPos()
  43. y = y + 1
  44. mon.setCursorPos(1, y)
  45. mon.write(sString)
  46. end
  47. function printStringCentre(sString)
  48. x, y = mon.getCursorPos()
  49. y = y + 1
  50. mon.setCursorPos(1, y)
  51. width, height = mon.getSize()
  52. nStringCentre = math.floor(string.len(sString) / 2)
  53. nMonitorCentre = math.floor(width / 2)
  54. x = math.floor(nMonitorCentre - nStringCentre)
  55. mon.setCursorPos(x, y)
  56. mon.write(sString)
  57. end
  58. function printStringRight(sString)
  59. width, height = mon.getSize()
  60. x, y = mon.getCursorPos()
  61. y = y + 1
  62. x = math.ceil(width - string.len(sString))
  63. mon.setCursorPos(x, y)
  64. mon.write(sString)
  65. end
  66. function scrollText(tStrings, nRate)
  67. nRate = nRate or 5
  68. if nRate < 0 then
  69. error("rate must be positive")
  70. end
  71. local nSleep = 1 / nRate
  72.  
  73. width, height = mon.getSize()
  74. x, y = mon.getCursorPos()
  75. sText = ""
  76. for n = 1, #tStrings do
  77. sText = sText .. tostring(tStrings[n])
  78. sText = sText .. " | "
  79. end
  80. sString = "| "
  81. if width / string.len(sText) < 1 then
  82. nStringRepeat = 3
  83. else
  84. nStringRepeat = math.ceil(width / string.len(sText) * 3)
  85. end
  86. for n = 1, nStringRepeat do
  87. sString = sString .. sText
  88. end
  89. while true do
  90. for n = 1, string.len(sText) do
  91. sDisplay = string.sub(sString, n, n + width - 1)
  92. mon.clearLine()
  93. mon.setCursorPos(1, y)
  94. mon.write(sDisplay)
  95. sleep(nSleep)
  96. end
  97. end
  98. end
  99. mon.clear()
  100. mon.setCursorPos(1, 1)
  101. lineBreak()
  102. printStringCentre("|News Board|")
  103. lineBreak()
  104. printString("")
  105. lineBreak()
  106. tScrollText = {}
  107. tScrollText[1] = "BREAKING NEWS"
  108. tScrollText[2] = "Giant cookies falling from sky"
  109. x, y = mon.getCursorPos()
  110. y = y - 1
  111. mon.setCursorPos(1, y)
  112. scrollText(tScrollText)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement