Orginalet

scroll

Apr 20th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. strLine1 = " # ### "
  2. strLine2 = " # # ##### # # ###### ##### ##### # #### ###### # # ###### ##### ###### ### "
  3. strLine3 = " # # # # # # # # # # # # # # # # # # # ### "
  4. strLine4 = "# # # # # # ##### # # # # #### ##### ###### ##### # # ##### # "
  5. strLine5 = "####### # # # # # ##### # # # # # # # ##### # "
  6. strLine6 = "# # # # # # # # # # # # # # # # # # # # ### "
  7. strLine7 = "# # ##### ## ###### # # # # #### ###### # # ###### # # ###### ### "
  8.  
  9.  
  10. local marchTextRtoL = function (strMessage,intLine,strHeader,mon,strSep)
  11. local intOffset = 1
  12. local strHeader = strHeader or "" --Optional
  13. local mon = mon or term.native --Optional
  14. local strSep = strSep or " | " --Optional
  15. local intWidth = mon.getSize()
  16. local strBlank = string.rep(" ",intWidth)
  17. local _, y = mon.getCursorPos()
  18. local intLine = intLine or y -- Optional
  19. local strMsgBuilder = tostring(strMessage)
  20. local strMsgText = strBlank..strHeader..strSep..strMsgBuilder..strBlank
  21. return function ()
  22. local intOff = intOffset
  23. if intOff > string.len(strMsgText) then
  24. intOffset = 1
  25. end
  26. intOffset = intOffset + 1
  27. local strMsgDisplay = string.sub(strMsgText, intOff, intOff + intWidth - 1)
  28. mon.setCursorPos(1, intLine)
  29. mon.clearLine()
  30. mon.write(strMsgDisplay)
  31. end
  32. end
  33.  
  34. local scrollLine1 = marchTextRtoL(strLine1,1,"",_,"")
  35. local scrollLine2 = marchTextRtoL(strLine2,2,"",_,"")
  36. local scrollLine3 = marchTextRtoL(strLine3,3,"",_,"")
  37. local scrollLine4 = marchTextRtoL(strLine4,4,"",_,"")
  38. local scrollLine5 = marchTextRtoL(strLine5,5,"",_,"")
  39. local scrollLine6 = marchTextRtoL(strLine6,6,"",_,"")
  40. local scrollLine7 = marchTextRtoL(strLine7,7,"",_,"")
  41.  
  42. while true do
  43. scrollLine1()
  44. scrollLine2()
  45. scrollLine3()
  46. scrollLine4()
  47. scrollLine5()
  48. scrollLine6()
  49. scrollLine7()
  50. sleep(0.2)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment