bobmarley12345

xdddddddshop

Oct 9th, 2020 (edited)
1,378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. MonitorSide = "left"
  2. Monitor = peripheral.wrap(MonitorSide)
  3.  
  4. function DrawText(xPos, yPos, text, textColour, backgroundColour)
  5.     Monitor.setBackgroundColor(backgroundColour)
  6.     Monitor.setTextColor(textColour)
  7.     Monitor.setCursorPos(xPos,yPos)
  8.     Monitor.write(text)
  9. end
  10.  
  11. function ClearMonitor()
  12.     Monitor.setTextColor(colours.black)
  13.     Monitor.setBackgroundColor(colours.black)
  14.     Monitor.clear()
  15.     Monitor.setCursorPos(1,1)
  16. end
  17.  
  18. function GetRandomColour()
  19.     local rand = math.random(1, 10)
  20.  
  21.     if (rand == 1) then return colours.brown   end
  22.     if (rand == 2) then return colours.white   end
  23.     if (rand == 3) then return colours.blue    end
  24.     if (rand == 4) then return colours.brown   end
  25.     if (rand == 5) then return colours.pink    end
  26.     if (rand == 6) then return colours.red     end
  27.     if (rand == 7) then return colours.orange  end
  28.     if (rand == 8) then return colours.cyan    end
  29.     if (rand == 9) then return colours.green   end
  30.     if (rand == 10) then return colours.yellow
  31.     else return colours.white end;
  32. end
  33.  
  34. text = "xdddddddddddddd"
  35. counter = 2
  36. textLength = string.len(text)
  37.  
  38. function Main()
  39.     while true do
  40.         local monX, monY = Monitor.getSize()
  41.         Monitor.setTextScale(3)
  42.         ClearMonitor()
  43.         counter = counter - 1
  44.        
  45.         DrawText(counter, 2, text, GetRandomColour(), colours.black)
  46.  
  47.         if (counter < (1 - textLength)) then
  48.             counter = monX
  49.         end
  50.  
  51.         sleep(0.2)
  52.     end
  53. end
  54.  
  55. Main()
Add Comment
Please, Sign In to add comment