bobmarley12345

xdddddddshop

Oct 9th, 2020 (edited)
1,162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. function Main()
  35.     while true do
  36.         local text = "xdddddddddddddd"
  37.         local textLength = string.len(text)
  38.         local counter = 0 - textLength
  39.         local monX, monY = Monitor.getSize()
  40.         Monitor.setTextScale(3)
  41.         ClearMonitor()
  42.         counter = counter + 1
  43.        
  44.         DrawText(counter, 1, text, GetRandomColour(), colours.black)
  45.  
  46.         if (counter > monX) then
  47.             counter = 0 - textLength
  48.         end
  49.  
  50.         sleep(0.2)
  51.     end
  52. end
  53.  
  54. Main()
RAW Paste Data