Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.find("monitor")
- local W, H = mon.getSize() -- W = Largura | H = Altura
- local scale = 1
- -- Pode colocar a cor ou deixar sem para ficar aleatΓ³rio
- local staticTexts = {
- {txt = " BEM VINDO!", y = 1, color = colors.red},
- {txt = "===============================", y = 3},
- {txt = "===============================", y = 5},
- {txt = "===============================", y = 7},
- {txt = " >>>Aproveite<<<", y = 9},
- {txt = " <-- Vanilla | Mods -->", y = 10},
- }
- local roundTexts = {
- {txt = " Teste teste teste teste teste teste", y = 4},
- {txt = " Todos os ingots do modpack", y = 6},
- {txt = " Aproveite", y = 8},
- }
- mon.setTextScale(scale)
- local function moveFirstToLast(str)
- local first = string.sub(str, 1, 1)
- local rest = string.sub(str, 2)
- return rest .. first
- end
- local function staticColoredTexts()
- for _,v in pairs(staticTexts) do
- local x = math.floor((W - string.len(v.txt)) / 2)
- local color = v.color or math.random(1,16)
- mon.setTextColor(color)
- mon.setCursorPos(x, v.y)
- mon.write(v.txt)
- end
- end
- local function roundColoredTexts()
- for _,v in pairs(roundTexts) do
- v.txt = moveFirstToLast(v.txt)
- local x = math.floor((W - string.len(v.txt)) / 2)
- local color = v.color or math.random(1,16)
- mon.setTextColor(color)
- mon.setCursorPos(x, v.y)
- mon.clearLine()
- mon.write(v.txt)
- end
- end
- while true do
- mon.clear()
- roundColoredTexts()
- staticColoredTexts()
- sleep(0.4)
- end
Add Comment
Please, Sign In to add comment