Advertisement
Laine_prikol

Untitled

Nov 6th, 2022
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. local text = "alien team house!   "
  2. local checksum = 15764
  3.  
  4. --------------------------------
  5.  
  6. local monitor = peripheral.wrap("back")
  7. monitor.setTextScale(5)
  8. monitor.setBackgroundColor(colors.black)
  9. monitor.setTextColor(colors.orange)
  10.  
  11. --------------------------------
  12.  
  13. local sizeX, sizeY = monitor.getSize()
  14. local pos = 1
  15.  
  16. local function mathChecksum(data)
  17.     local number = 0
  18.     for i = 1, #data do
  19.         number = number + (data:byte(i) * i)
  20.     end
  21.     --print("valid", number)
  22.     return number
  23. end
  24.  
  25. if mathChecksum(text) == checksum then
  26.     while true do
  27.         monitor.clear()
  28.         monitor.setCursorPos(1, 1)
  29.        
  30.         local str = text:sub(pos, pos + (sizeX - 1))
  31.    
  32.         do
  33.             local index = 1
  34.             while #str < sizeX do
  35.                 str = str .. text:sub(index, index)
  36.                 index = index + 1
  37.             end
  38.         end
  39.    
  40.         monitor.write(str)
  41.    
  42.         pos = pos + 1
  43.         if pos > #text then
  44.             pos = 1
  45.         end
  46.    
  47.         sleep(0.5)
  48.     end
  49. else
  50.     monitor.clear()
  51.     monitor.setBackgroundColor(colors.red)
  52.     monitor.setTextColor(colors.orange)
  53.     monitor.setCursorPos(1, 1)
  54.     monitor.write("rootmaster loh   ")
  55.     while true do
  56.         sleep(1)
  57.     end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement