Advertisement
Reavik

Untitled

Jan 8th, 2023 (edited)
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. local mon = peripheral.find("monitor")
  2. local W, H = mon.getSize() -- W = Largura | H = Altura
  3.  
  4.  
  5. local scale = 1
  6.  
  7. -- Pode colocar a cor ou deixar sem para ficar aleatΓ³rio
  8. local staticTexts = {
  9. {txt = " BEM VINDO!", y = 2, color = colors.red},
  10. {txt = " Todos os ingots do modpack", y = 10},
  11. {txt = " <-- Vanilla | Mods -->", y = 18},
  12. {txt = " >>> Aproveite <<<", y = 26},
  13. {txt = " Reavik", y = 30},
  14. }
  15.  
  16. local roundTexts = {
  17. {txt = "==========<<======================", y = 6},
  18. {txt = "====================<<============", y = 14},
  19. {txt = "================================<<", y = 22},
  20. }
  21.  
  22.  
  23.  
  24. mon.setTextScale(scale)
  25.  
  26. local function moveFirstToLast(str)
  27. local first = string.sub(str, 1, 1)
  28. local rest = string.sub(str, 2)
  29. return rest .. first
  30. end
  31.  
  32. local function staticColoredTexts()
  33. for _,v in pairs(staticTexts) do
  34. local x = math.floor((W - string.len(v.txt)) / 2)
  35. local color = v.color or math.random(1,16)
  36. mon.setTextColor(color)
  37. mon.setCursorPos(x, v.y)
  38. mon.write(v.txt)
  39. end
  40. end
  41.  
  42. local function roundColoredTexts()
  43. for _,v in pairs(roundTexts) do
  44. v.txt = moveFirstToLast(v.txt)
  45. local x = math.floor((W - string.len(v.txt)) / 2)
  46. local color = v.color or math.random(1,16)
  47.  
  48. mon.setTextColor(color)
  49. mon.setCursorPos(x, v.y)
  50. mon.clearLine()
  51. mon.write(v.txt)
  52. end
  53. end
  54.  
  55. while true do
  56. mon.clear()
  57.  
  58. roundColoredTexts()
  59.  
  60. staticColoredTexts()
  61.  
  62. sleep(0.4)
  63. end
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement