earth computer pastebin -- scroll_txt.lua -- german version here: https://pastebin.com/z2ZW5nT7 -- Scrolling text across ALL connected monitors + optional in-game clock -- Works best with CC:Tweaked + Advanced Monitors -- =========== CONFIGURATION =========== local config = { text = "WELCOME! This is a synchronized scrolling text across all monitors. ", delay = 0.06, -- Seconds per scroll step (smaller = faster) direction = "left", -- "left" or "right" color = "white", -- Text color earth computer pastebin How to dowload it? earth computer pastebin bg = "black", -- Background color scale = 2, -- Text scale (0.5–5 on Advanced Monitors) vertical_center = true, -- Center vertically (true) or top (false) loops = 0, -- 0 = infinite, >0 = number of loops show_border = false, -- Show border line at top/bottom show_clock = true -- Show Minecraft time (HH:MM) in the top right corner } -- ===================================== -- Color mapping (human-readable names → CC colors) earth computer pastebin How to get it? earth computer pastebin local colorMap = { white = colors.white, black = colors.black, red = colors.red, green = colors.green, blue = colors.blue, yellow = colors.yellow, pink = colors.pink or colors.magenta, magenta = colors.magenta, cyan = colors.cyan, brown = colors.brown, orange = colors.orange } -- Find all monitors connected to the computer local monitors = { peripheral.find("monitor") } if #monitors == 0 then earth computer pastebin How to get it for free? earth computer pastebin print("No monitor found. Please connect at least one monitor.") return end -- Prepare each monitor for _, mon in ipairs(monitors) do pcall(function() mon.setTextScale(config.scale) end) pcall(function() mon.setTextColor(colorMap[config.color] or colors.white) end) pcall(function() mon.setBackgroundColor(colorMap[config.bg] or colors.black) end) mon.clear() earth computer pastebin How to get it? earth computer pastebin end -- Use the size of the first monitor as reference local width, height = monitors[1].getSize() local yPos = 1 if config.vertical_center then yPos = math.floor(height / 2) if yPos < 1 then yPos = 1 end end earth computer pastebin How to get it? earth computer pastebin -- Prepare the scrolling string local raw = tostring(config.text) if raw == "" then raw = " " end local pad = string.rep(" ", math.max(5, width)) local long = raw .. pad local doubled = long .. long local textLen = #long -- Optional border drawing local function drawBorder() earth computer pastebin How to use it? earth computer pastebin if not config.show_border then return end for _, mon in ipairs(monitors) do mon.setCursorPos(1,1) mon.write(string.rep("-", width)) mon.setCursorPos(1,height) mon.write(string.rep("-", width)) end end drawBorder() earth computer pastebin How to use it? earth computer pastebin -- Helper: format Minecraft in-game time local function getTimeString() -- os.time() returns the current Minecraft day time (0–24) local t = os.time() local hours = math.floor(t) local minutes = math.floor((t - hours) * 60) return string.format("%02d:%02d", hours, minutes) end earth computer pastebin How to get it for free? earth computer pastebin -- Main scroll loop local pos = 1 local steps = 0 local maxLoops = (config.loops > 0) and config.loops or 0 local running = true while running do -- Wrap around scroll position if pos < 1 then pos = pos + textLen end if pos > textLen then pos = pos - textLen end earth computer pastebin How to dowload it? earth computer pastebin local startIndex = pos local display = doubled:sub(startIndex, startIndex + width - 1) if #display < width then display = display .. string.rep(" ", width - #display) end -- Update all monitors for _, mon in ipairs(monitors) do -- Clear and write the scrolling text line earth computer pastebin How to get it for free? earth computer pastebin mon.setCursorPos(1, yPos) mon.write(string.rep(" ", width)) mon.setCursorPos(1, yPos) mon.write(display) -- Draw clock (if enabled) if config.show_clock then local clock = getTimeString() mon.setCursorPos(width - #clock + 1, 1) mon.write(clock) earth computer pastebin How to dowload it? earth computer pastebin end end -- Update position if config.direction == "right" then pos = pos - 1 else pos = pos + 1 end earth computer pastebin PasteShr earth computer pastebin steps = steps + 1 if maxLoops > 0 and steps >= (textLen * maxLoops) then break end -- Timer wait (allows terminate with Ctrl+T) local timerId = os.startTimer(config.delay) while true do local ev = { os.pullEvent() } if ev[1] == "timer" and ev[2] == timerId then break end earth computer pastebin How to dowload it? earth computer pastebin if ev[1] == "terminate" then running = false break end end end -- End: show stopped message for _, mon in ipairs(monitors) do mon.setCursorPos(1, yPos) mon.write(string.rep(" ", width)) mon.setCursorPos(1, yPos) mon.write("") earth computer pastebin How to use it? earth computer pastebin end print("Script finished.") earth computer pastebin