MarcosKoco

API_Logo

Oct 24th, 2021 (edited)
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. local Monitor = {}
  2.  
  3. Monitor[0] = term -- sets Monitor[0] to term
  4.  
  5. local logo = {}
  6. logo.pos = {}
  7. logo.subpos = {}
  8. logo.str = {}
  9. logo.substr = {}
  10. logo.col = {}
  11.  
  12. logo.str[1] = "      "
  13. logo.str[2] = "      "
  14. logo.str[3] = "      "
  15. logo.str[4] = "      "
  16. logo.substr[1] = "   "
  17. logo.substr[2] = "   "
  18. logo.substr[3] = "   "
  19. logo.substr[4] = "   "
  20.  
  21. function drawLogo(WhatScreen, What, X, Y)
  22.    
  23.     if WhatScreen.isColor then
  24.        
  25.         logo.col[1] = colors.lime
  26.         logo.col[2] = colors.red
  27.         logo.col[3] = colors.blue
  28.         logo.col[4] = colors.orange
  29.        
  30.     else
  31.        
  32.         logo.col[1] = colors.white
  33.         logo.col[2] = colors.white
  34.         logo.col[3] = colors.white
  35.         logo.col[4] = colors.white
  36.        
  37.     end
  38.    
  39.     if What == "Head" then
  40.  
  41.         for i = 1, 4 do
  42.            
  43.             local xa, ya
  44.            
  45.             if i == 1 then
  46.                
  47.                 xa, ya = X, Y + 1
  48.                
  49.             elseif i == 2 then
  50.                
  51.                 xa, ya = X + string.len(logo.str[i - 1]), Y
  52.                
  53.             elseif i == 3 then
  54.                
  55.                 xa, ya = X + 1, Y + 5
  56.                
  57.             elseif i == 4 then
  58.                
  59.                 xa, ya = X + 1 + string.len(logo.str[i - 1]), Y + 4
  60.                
  61.             end
  62.            
  63.             for I = 1, 4 do
  64.                
  65.                 WhatScreen.setCursorPos(xa, ya)
  66.                 WhatScreen.setBackgroundColor(logo.col[i])
  67.                 WhatScreen.write(logo.str[i])
  68.                 WhatScreen.setBackgroundColor(colors.black)
  69.                 ya = ya + 1
  70.                
  71.             end
  72.            
  73.         end
  74.  
  75.     elseif What == "Sub" then
  76.  
  77.         for i = 1, 4 do
  78.            
  79.             local xa, ya
  80.            
  81.             if i == 1 then
  82.                
  83.                 xa, ya = X, Y + 1
  84.                
  85.             elseif i == 2 then
  86.                
  87.                 xa, ya = X + string.len(logo.substr[i - 1]), Y
  88.                
  89.             elseif i == 3 then
  90.                
  91.                 xa, ya = X + 1, Y + 3
  92.                
  93.             elseif i == 4 then
  94.                
  95.                 xa, ya = X + 1 + string.len(logo.substr[i - 1]), Y + 2
  96.                
  97.             end
  98.            
  99.             for I = 1, 2 do
  100.                
  101.                 WhatScreen.setCursorPos(xa, ya)
  102.                 WhatScreen.setBackgroundColor(logo.col[i])
  103.                 WhatScreen.write(logo.substr[i])
  104.                 WhatScreen.setBackgroundColor(colors.black)
  105.                 ya = ya + 1
  106.                
  107.             end
  108.            
  109.         end
  110.  
  111.     end
  112.  
  113. end
  114.  
  115. drawLogo(term, "Sub", 1, 1)
  116.  
Advertisement
Add Comment
Please, Sign In to add comment