Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------
- -- "Ultimate" (could be better) Screen Maker
- -------------------------------------
- -- Load settings early
- settings.load()
- -----------------------------------------------------
- -- Default Global Variables
- -----------------------------------------------------
- textSize = 1
- textStartX, textStartY = 1, 1
- currentText = {}
- scrollSpeed = 0.1
- pauseTime = 1
- currentTextColorNum = colors.white
- currentTextColor = "f"
- currentBackgroundNum = colors.black
- currentBackgroundColor = "0"
- marqueeBackgroundNum = colors.black
- marqueeBackgroundColor = "0"
- startupMarquee = false
- startupClock = false
- startupStarryNight = false
- starryNightColor = colors.yellow
- starryNightBGColor = colors.black
- -----------------------------------------------------
- -- Color Maps
- -----------------------------------------------------
- local colorHexMap = {
- black = "f",
- darkblue = "6",
- darkgreen = "4",
- darkaqua = "3",
- darkred = "1",
- darkpurple = "2",
- gold = "e",
- gray = "8",
- lightgray = "7",
- blue = "b",
- green = "d",
- aqua = "9",
- red = "5",
- magenta = "a",
- yellow = "c",
- white = "0"
- }
- local hexToColor = {
- ["f"] = colors.white,
- ["6"] = colors.gold,
- ["4"] = colors.darkPurple,
- ["3"] = colors.cyan,
- ["1"] = colors.yellow,
- ["2"] = colors.darkGreen,
- ["e"] = colors.pink,
- ["8"] = colors.lightGray,
- ["7"] = colors.gray,
- ["b"] = colors.cyan,
- ["d"] = colors.magenta,
- ["9"] = colors.blue,
- ["5"] = colors.brown,
- ["a"] = colors.green,
- ["c"] = colors.red,
- ["0"] = colors.black
- }
- -----------------------------------------------------
- -- Reset the Monitor's Palette (with safe fallbacks)
- -----------------------------------------------------
- local mon = peripheral.wrap("back")
- if mon then
- local palette = {
- {colors.black, 0x000000},
- {colors.darkBlue, 0x0000AA},
- {colors.darkGreen, 0x00AA00},
- {colors.cyan, 0x00AAAA},
- {colors.darkRed, 0xAA0000},
- {colors.darkPurple, 0xAA00AA},
- {colors.orange, 0xFFAA00},
- {colors.gray, 0xAAAAAA},
- {colors.lightGray, 0x555555},
- {colors.blue, 0x5555FF},
- {colors.green, 0x55FF55},
- {colors.cyan, 0x55FFFF},
- {colors.red, 0xFF5555},
- {colors.magenta, 0xFF55FF},
- {colors.yellow, 0xFFFF55},
- {colors.white, 0xFFFFFF},
- }
- for _, col in ipairs(palette) do
- if col[1] then
- mon.setPaletteColor(col[1], col[2])
- end
- end
- end
- -----------------------------------------------------
- -- Helper Functions
- -----------------------------------------------------
- local function wrapSub(str, start, len)
- if not str or str == "" then return "" end
- local total = #str
- local res = ""
- for i = 0, len - 1 do
- local idx = ((start + i - 1) % total) + 1
- res = res .. str:sub(idx, idx)
- end
- return res
- end
- local function redrawText(mon)
- local w, h = mon.getSize()
- mon.clear()
- for i = 1, h do
- local line = currentText[i] or ""
- local textColors, bgColors
- if line == "" then
- line = string.rep(" ", w)
- textColors = string.rep(currentBackgroundColor, w)
- bgColors = string.rep(currentBackgroundColor, w)
- else
- if #line < w then
- line = line .. string.rep(" ", w - #line)
- else
- line = string.sub(line, 1, w)
- end
- textColors = string.rep(currentTextColor, w)
- bgColors = string.rep(currentBackgroundColor, w)
- end
- mon.setCursorPos(textStartX, textStartY + i - 1)
- mon.blit(line, textColors, bgColors)
- end
- end
- -----------------------------------------------------
- -- Settings Persistence
- -----------------------------------------------------
- function loadSettingsCustom()
- local ts = settings.get("textSize")
- if ts then textSize = ts end
- local tx = settings.get("textStartX")
- local ty = settings.get("textStartY")
- if tx and ty then
- textStartX, textStartY = tx, ty
- end
- local ss = settings.get("scrollSpeed")
- if ss then scrollSpeed = ss end
- local pt = settings.get("pauseTime")
- if pt then pauseTime = pt end
- local txtColNum = settings.get("currentTextColorNum")
- if txtColNum then currentTextColorNum = txtColNum end
- local txtCol = settings.get("currentTextColor")
- if txtCol then currentTextColor = txtCol end
- local bgNum = settings.get("currentBackgroundNum")
- if bgNum then currentBackgroundNum = bgNum end
- local bgCol = settings.get("currentBackgroundColor")
- if bgCol then currentBackgroundColor = bgCol end
- local mbgNum = settings.get("marqueeBackgroundNum")
- if mbgNum then marqueeBackgroundNum = mbgNum end
- local mbgCol = settings.get("marqueeBackgroundColor")
- if mbgCol then marqueeBackgroundColor = mbgCol end
- local sm = settings.get("startupMarquee")
- if sm ~= nil then startupMarquee = sm end
- local sc = settings.get("startupClock")
- if sc ~= nil then startupClock = sc end
- local ssn = settings.get("startupStarryNight")
- if ssn ~= nil then startupStarryNight = ssn end
- local savedText = settings.get("currentText")
- if savedText then
- if type(savedText) == "string" then
- currentText = textutils.unserialize(savedText)
- elseif type(savedText) == "table" then
- currentText = savedText
- end
- end
- end
- function saveSettingsCustom()
- settings.set("textSize", textSize)
- settings.set("textStartX", textStartX)
- settings.set("textStartY", textStartY)
- settings.set("scrollSpeed", scrollSpeed)
- settings.set("pauseTime", pauseTime)
- settings.set("currentTextColorNum", currentTextColorNum)
- settings.set("currentTextColor", currentTextColor)
- settings.set("currentBackgroundNum", currentBackgroundNum)
- settings.set("currentBackgroundColor", currentBackgroundColor)
- settings.set("marqueeBackgroundNum", marqueeBackgroundNum)
- settings.set("marqueeBackgroundColor", marqueeBackgroundColor)
- settings.set("startupMarquee", startupMarquee)
- settings.set("startupClock", startupClock)
- settings.set("startupStarryNight", startupStarryNight)
- settings.set("currentText", textutils.serialize(currentText))
- settings.save()
- end
- -----------------------------------------------------
- -- Apply Settings on Startup
- -----------------------------------------------------
- function applySettings()
- local mon = peripheral.wrap("back")
- if mon then
- mon.setTextScale(textSize)
- mon.setBackgroundColor(currentBackgroundNum)
- mon.clear()
- mon.setCursorPos(textStartX, textStartY)
- redrawText(mon)
- end
- end
- -----------------------------------------------------
- -- Marquee Mode
- -----------------------------------------------------
- function marqueeText()
- local mon = peripheral.wrap("back")
- if not mon then
- print("No monitor found at the back.")
- return
- end
- mon.setTextScale(textSize)
- mon.setBackgroundColor(marqueeBackgroundNum)
- mon.clear()
- local w, h = mon.getSize()
- if #currentText == 0 then
- currentText = {"Marquee Text"}
- end
- local static = {}
- local pattern = {}
- local textColorPattern = {}
- local bgPattern = {}
- local scrollOffsets = {}
- local refIndex = nil
- for i, line in ipairs(currentText) do
- scrollOffsets[i] = 0
- if line == "" then
- static[i] = nil
- pattern[i] = nil
- textColorPattern[i] = nil
- bgPattern[i] = nil
- else
- local truncated = (#line <= w) and (line .. string.rep(" ", w - #line)) or string.sub(line, 1, w)
- static[i] = truncated
- pattern[i] = truncated .. " "
- textColorPattern[i] = string.rep(currentTextColor, w + 1)
- bgPattern[i] = string.rep(marqueeBackgroundColor, w + 1)
- if not refIndex then
- refIndex = i
- end
- end
- end
- local original = refIndex and static[refIndex] or nil
- local pausedThisCycle = false
- print("Entering marquee mode on monitor. (Press any key in the terminal to exit.)")
- local running = true
- while running do
- mon.setBackgroundColor(marqueeBackgroundNum)
- mon.clear()
- for i, line in ipairs(currentText) do
- mon.setCursorPos(textStartX, textStartY + i - 1)
- if line == "" then
- local blank = string.rep(" ", w)
- mon.blit(blank, string.rep(marqueeBackgroundColor, w), string.rep(marqueeBackgroundColor, w))
- else
- local cyc = #pattern[i]
- local off = scrollOffsets[i] % cyc
- local visible = wrapSub(pattern[i], off + 1, w)
- local visTC = wrapSub(textColorPattern[i], off + 1, w)
- local visBG = wrapSub(bgPattern[i], off + 1, w)
- mon.blit(visible, visTC, visBG)
- scrollOffsets[i] = scrollOffsets[i] + 1
- end
- end
- -- Pause if we've returned to the original alignment
- if original and refIndex then
- local cyc = #pattern[refIndex]
- local off = (scrollOffsets[refIndex] - 1) % cyc
- local firstVisible = wrapSub(pattern[refIndex], off + 1, w)
- if firstVisible == original then
- if not pausedThisCycle then
- sleep(pauseTime)
- pausedThisCycle = true
- end
- else
- pausedThisCycle = false
- end
- end
- local timerID = os.startTimer(scrollSpeed)
- local event, param = os.pullEvent()
- if event == "key" then
- running = false
- elseif event == "timer" and param == timerID then
- -- continue
- end
- end
- -- Restore static text
- redrawText(mon)
- print("Exited marquee mode on monitor.")
- end
- -----------------------------------------------------
- -- Terminal Starry Night (runs in parallel)
- -----------------------------------------------------
- function terminalStarryNight()
- term.clear()
- local w, h = term.getSize()
- for y = 1, h - 1 do
- term.setCursorPos(1, y)
- local line = ""
- for x = 1, w do
- if math.random() < 0.1 then
- line = line .. "*"
- else
- line = line .. " "
- end
- end
- term.write(line)
- end
- local exitMsg = "Press any key to exit"
- term.setCursorPos(math.floor((w - #exitMsg) / 2), h)
- term.setTextColor(colors.yellow)
- term.write(exitMsg)
- term.setTextColor(colors.white)
- os.pullEvent("key")
- term.clear()
- end
- -----------------------------------------------------
- -- Monitor Starry Night
- -----------------------------------------------------
- function extrasStarryNight()
- local mon = peripheral.wrap("back")
- if not mon then
- print("No monitor found.")
- return
- end
- mon.setTextScale(textSize)
- local w, h = mon.getSize()
- print("Entering monitor Starry Night. (Press any key to exit.)")
- local running = true
- while running do
- mon.setBackgroundColor(starryNightBGColor)
- mon.clear()
- for y = 1, h do
- mon.setCursorPos(1, y)
- local line = ""
- for x = 1, w do
- if math.random() < 0.1 then
- mon.setTextColor(starryNightColor)
- line = line .. "*"
- else
- line = line .. " "
- end
- end
- mon.write(line)
- end
- local timerID = os.startTimer(0.5)
- local event, param = os.pullEvent()
- if event == "key" then
- running = false
- elseif event == "timer" and param == timerID then
- -- Continue
- end
- end
- mon.clear()
- print("Exited monitor Starry Night.")
- end
- -----------------------------------------------------
- -- Monitor Clock
- -----------------------------------------------------
- function clockMonitor()
- local mon = peripheral.wrap("back")
- if not mon then
- print("No monitor found.")
- return
- end
- mon.setTextScale(textSize)
- local w, h = mon.getSize()
- local running = true
- while running do
- mon.clear()
- local currentTime = os.date("%H:%M:%S")
- local dateStr = os.date("%A, %B %d, %Y")
- local timeX = math.floor((w - #currentTime) / 2) + 1
- local dateX = math.floor((w - #dateStr) / 2) + 1
- local timeY = math.floor(h / 2) - 1
- local dateY = timeY + 2
- mon.setBackgroundColor(currentBackgroundNum)
- mon.clear()
- mon.setCursorPos(timeX, timeY)
- mon.setTextColor(colors.white)
- mon.write(currentTime)
- mon.setCursorPos(dateX, dateY)
- mon.setTextColor(colors.lightGray)
- mon.write(dateStr)
- local timerID = os.startTimer(1)
- local event, param = os.pullEvent()
- if event == "key" then
- running = false
- elseif event == "timer" and param == timerID then
- -- Update clock
- end
- end
- mon.clear()
- print("Exited Clock mode.")
- end
- -----------------------------------------------------
- -- Cute Screen
- -----------------------------------------------------
- function showCuteScreen()
- term.clear()
- term.setCursorPos(1,1)
- local termWidth, termHeight = term.getSize()
- local art = {
- "(\\_/)",
- "( •_•)",
- '(")_(")'
- }
- local startY = math.floor((termHeight - #art) / 2)
- for i, line in ipairs(art) do
- local startX = math.floor((termWidth - #line) / 2)
- term.setCursorPos(startX, startY + i)
- term.setTextColor(colors.magenta)
- print(line)
- end
- term.setTextColor(colors.yellow)
- local msg = "Welcome to Ultimate Screen Maker!"
- term.setCursorPos(math.floor((termWidth - #msg) / 2), startY + #art + 2)
- print(msg)
- term.setTextColor(colors.white)
- sleep(2)
- term.clear()
- end
- -----------------------------------------------------
- -- Single Helper to Render a Centered Menu
- -----------------------------------------------------
- local function drawCenteredMenu(title, options, selectedIndex)
- -- Clear the whole terminal first.
- term.clear()
- term.setCursorPos(1, 1)
- local termWidth, termHeight = term.getSize()
- -----------------------------------
- -- 1) Top border + Title (Line 1)
- -----------------------------------
- -- Build a line that has "==== title ====" with padding on each side
- -- so it is centered. We can just do something simpler: border + space + title + space + border (don't ask) Prob a better way to do this had issues?????
- local fullTitle = string.rep("=", math.floor((termWidth - #title - 2) / 2))
- .. " " .. title .. " "
- .. string.rep("=", math.ceil((termWidth - #title - 2) / 2))
- -- Print that line (clamped to termWidth just in case)
- term.setCursorPos(1, 1)
- term.setTextColor(colors.lightBlue)
- if #fullTitle > termWidth then
- fullTitle = fullTitle:sub(1, termWidth)
- end
- print(fullTitle)
- -----------------------------------
- -- 2) Second border (Line 2)
- -----------------------------------
- term.setCursorPos(1, 2)
- term.setTextColor(colors.lightBlue)
- print(string.rep("=", termWidth))
- -----------------------------------
- -- 3) Menu Items, starting at line 3
- -----------------------------------
- local startLine = 3
- for i, opt in ipairs(options) do
- -- If we’re about to exceed terminal height - 1, we’ll stop printing items
- -- so we can leave at least one line for instructions at the bottom.
- if startLine > termHeight - 1 then
- break
- end
- term.setCursorPos(1, startLine)
- -- Center the text: we add " > " and " < " around selected item
- local text = (i == selectedIndex) and (" > " .. opt .. " < ") or (" " .. opt .. " ")
- local lineX = math.floor((termWidth - #text) / 2)
- if lineX < 1 then lineX = 1 end
- term.setCursorPos(lineX, startLine)
- -- Color it red if it's “Back” or “Exit,” otherwise use yellow if selected, white if not
- if i == selectedIndex then
- term.setTextColor(colors.yellow)
- else
- if string.find(string.lower(opt), "back") or string.find(string.lower(opt), "exit") then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.white)
- end
- end
- print(text)
- startLine = startLine + 1
- end
- -----------------------------------
- -- 4) Footer / Instructions (Last line or near-last line)
- -----------------------------------
- if startLine <= termHeight then
- -- Print a thin separator
- term.setCursorPos(1, startLine)
- term.setTextColor(colors.white)
- print(string.rep("-", termWidth))
- startLine = startLine + 1
- end
- if startLine <= termHeight then
- term.setCursorPos(1, startLine)
- term.setTextColor(colors.white)
- print("Use arrow keys to navigate, Enter to select.")
- end
- end
- -----------------------------------------------------
- -- Setting Changer Functions
- -----------------------------------------------------
- function changeText()
- print("Enter the new text you want to display (type 'END' on a new line to finish):")
- local lines = {}
- while true do
- local line = read()
- if line == "END" then break end
- table.insert(lines, line)
- end
- currentText = lines
- local mon = peripheral.wrap("back")
- if mon then
- redrawText(mon)
- end
- saveSettingsCustom()
- end
- -- I had some probmlems with colors here so I had to remap them to be the right color idk why it does this kinda lost?????? HMMMMMMM
- function changeColor()
- local availableColors = {
- {name = "Black", value = "black"},
- {name = "Pink", value = "darkblue"},
- {name = "Yellow", value = "darkgreen"},
- {name = "Dark Aqua", value = "darkaqua"},
- {name = "Orange", value = "darkred"},
- {name = "Purple", value = "darkpurple"},
- {name = "Red", value = "gold"},
- {name = "Gray", value = "gray"},
- {name = "Light Gray",value = "lightgray"},
- {name = "Blue", value = "blue"},
- {name = "Green", value = "green"},
- {name = "Aqua", value = "aqua"},
- {name = "Lime", value = "red"},
- {name = "Magenta", value = "magenta"},
- {name = "Brown", value = "yellow"},
- {name = "White", value = "white"},
- {name = "Back", value = "Back"}
- }
- local selected = 1
- local function buildOptions()
- local list = {}
- for _, col in ipairs(availableColors) do
- table.insert(list, col.name)
- end
- return list
- end
- while true do
- local options = buildOptions()
- drawCenteredMenu("Choose a Cute Text Color", options, selected)
- local e, key = os.pullEvent("key")
- if key == keys.up then
- selected = (selected <= 1) and #availableColors or (selected - 1)
- elseif key == keys.down then
- selected = (selected >= #availableColors) and 1 or (selected + 1)
- elseif key == keys.enter then
- local chosen = availableColors[selected]
- if chosen.value == "Back" then
- break
- else
- local mon = peripheral.wrap("back")
- if not mon then
- print("No monitor found at the back.")
- return
- end
- local newColor = colors[chosen.value] or colors.white
- mon.setTextColor(newColor)
- currentTextColorNum = newColor
- currentTextColor = colorHexMap[chosen.value] or currentTextColor
- redrawText(mon)
- print("Text color updated to " .. chosen.name)
- sleep(1)
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- saveSettingsCustom()
- end
- -- Don't ask :(
- function changeBackgroundColor()
- local availableColors = {
- {name = "Black", value = "black"},
- {name = "Pink", value = "darkblue"},
- {name = "Yellow", value = "darkgreen"},
- {name = "Dark Aqua", value = "darkaqua"},
- {name = "Orange", value = "darkred"},
- {name = "Purple", value = "darkpurple"},
- {name = "Red", value = "gold"},
- {name = "Gray", value = "gray"},
- {name = "Light Gray",value = "lightgray"},
- {name = "Blue", value = "blue"},
- {name = "Green", value = "green"},
- {name = "Aqua", value = "aqua"},
- {name = "Lime", value = "red"},
- {name = "Magenta", value = "magenta"},
- {name = "Brown", value = "yellow"},
- {name = "White", value = "white"},
- {name = "Back", value = "Back"}
- }
- local selected = 1
- local function buildOptions()
- local list = {}
- for _, col in ipairs(availableColors) do
- table.insert(list, col.name)
- end
- return list
- end
- while true do
- local options = buildOptions()
- drawCenteredMenu("Pick a Cute Background Color", options, selected)
- local e, key = os.pullEvent("key")
- if key == keys.up then
- selected = (selected <= 1) and #availableColors or (selected - 1)
- elseif key == keys.down then
- selected = (selected >= #availableColors) and 1 or (selected + 1)
- elseif key == keys.enter then
- local chosen = availableColors[selected]
- if chosen.value == "Back" then
- break
- else
- local mon = peripheral.wrap("back")
- if not mon then
- print("No monitor found at the back.")
- return
- end
- local newBg = colors[chosen.value] or colors.black
- mon.setBackgroundColor(newBg)
- currentBackgroundNum = newBg
- currentBackgroundColor = colorHexMap[chosen.value] or currentBackgroundColor
- -- Also update marquee background to match
- marqueeBackgroundNum = newBg
- marqueeBackgroundColor = colorHexMap[chosen.value] or marqueeBackgroundColor
- redrawText(mon)
- print("Static & Marquee background color updated to " .. chosen.name)
- sleep(1)
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- saveSettingsCustom()
- end
- function changePosition()
- print("Enter the new position (X, Y) on the monitor (e.g., 2,3):")
- local input = read()
- local x, y = input:match("(%d+),%s*(%d+)")
- x, y = tonumber(x), tonumber(y)
- if not x or not y then
- print("Invalid input.")
- return
- end
- local sw, sh = term.getSize()
- if x < 1 or x > sw or y < 1 or y > sh then
- print("Position out of bounds.")
- return
- end
- textStartX, textStartY = x, y
- local mon = peripheral.wrap("back")
- if mon then
- redrawText(mon)
- end
- print("Position updated.")
- saveSettingsCustom()
- end
- function changeSize()
- print("Enter the new text size (1 to 5):")
- local size = tonumber(read())
- if size and size >= 1 and size <= 5 then
- textSize = size
- local mon = peripheral.wrap("back")
- if mon then
- mon.setTextScale(textSize)
- redrawText(mon)
- end
- print("Text size updated to " .. textSize)
- saveSettingsCustom()
- else
- print("Invalid size.")
- end
- end
- function changeScrollSpeed()
- print("Enter the new scroll speed in seconds (e.g., 0.1):")
- local newSpeed = tonumber(read())
- if newSpeed and newSpeed > 0 then
- scrollSpeed = newSpeed
- print("Scroll speed updated to " .. scrollSpeed .. " seconds.")
- saveSettingsCustom()
- else
- print("Invalid scroll speed.")
- end
- end
- function changePauseTime()
- print("Enter the new pause time in seconds (e.g., 1):")
- local newPause = tonumber(read())
- if newPause and newPause >= 0 then
- pauseTime = newPause
- print("Pause time updated to " .. pauseTime .. " seconds.")
- saveSettingsCustom()
- else
- print("Invalid pause time.")
- end
- end
- function toggleStartupMarquee()
- startupMarquee = not startupMarquee
- print("Startup Marquee Mode " .. (startupMarquee and "enabled." or "disabled."))
- saveSettingsCustom()
- end
- function toggleStartupClock()
- startupClock = not startupClock
- print("Startup Clock Mode " .. (startupClock and "enabled." or "disabled."))
- saveSettingsCustom()
- end
- function toggleStartupStarryNight()
- startupStarryNight = not startupStarryNight
- print("Startup Starry Night " .. (startupStarryNight and "enabled." or "disabled."))
- saveSettingsCustom()
- end
- -----------------------------------------------------
- -- Starry Night Color Options
- -----------------------------------------------------
- function extrasStarryNightColorOptions()
- local availableColors = {
- {name = "Black", value = "black"},
- {name = "Dark Blue", value = "darkblue"},
- {name = "Dark Green", value = "darkgreen"},
- {name = "Dark Aqua", value = "darkaqua"},
- {name = "Dark Red", value = "darkred"},
- {name = "Dark Purple",value = "darkpurple"},
- {name = "Gold", value = "gold"},
- {name = "Gray", value = "gray"},
- {name = "Light Gray", value = "lightgray"},
- {name = "Blue", value = "blue"},
- {name = "Green", value = "green"},
- {name = "Aqua", value = "aqua"},
- {name = "Red", value = "red"},
- {name = "Magenta", value = "magenta"},
- {name = "Yellow", value = "yellow"},
- {name = "White", value = "white"},
- {name = "Back", value = "Back"}
- }
- local selected = 1
- local function buildOptions()
- local list = {}
- for i, col in ipairs(availableColors) do
- list[#list+1] = col.name
- end
- return list
- end
- while true do
- local options = buildOptions()
- drawCenteredMenu("Starry Night Color Options", options, selected)
- local event, key = os.pullEvent("key")
- if key == keys.up then
- selected = (selected <= 1) and #availableColors or (selected - 1)
- elseif key == keys.down then
- selected = (selected >= #availableColors) and 1 or (selected + 1)
- elseif key == keys.enter then
- local chosen = availableColors[selected]
- if chosen.value == "Back" then
- break
- else
- starryNightColor = colors[chosen.value] or colors.yellow
- print("Starry Night star color updated to " .. chosen.name)
- sleep(1)
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- end
- -----------------------------------------------------
- -- Text Changer Menu
- -----------------------------------------------------
- function textChangerMenu()
- local selected = 1
- local function getTextChangerOptions()
- return {
- "Change Text",
- "Change Color",
- "Change Background Color",
- "Change Position",
- "Change Size",
- "Set Scroll Speed",
- "Set Pause Time",
- "Marquee Mode",
- "Toggle Startup Marquee [" .. (startupMarquee and "ON" or "OFF") .. "]",
- "Back"
- }
- end
- while true do
- local options = getTextChangerOptions()
- drawCenteredMenu("Text Changer", options, selected)
- local event, key = os.pullEvent("key")
- if key == keys.up then
- selected = (selected <= 1) and #options or (selected - 1)
- elseif key == keys.down then
- selected = (selected >= #options) and 1 or (selected + 1)
- elseif key == keys.enter then
- local choice = options[selected]
- if choice == "Change Text" then
- changeText()
- elseif choice == "Change Color" then
- changeColor()
- elseif choice == "Change Background Color" then
- changeBackgroundColor()
- elseif choice == "Change Position" then
- changePosition()
- elseif choice == "Change Size" then
- changeSize()
- elseif choice == "Set Scroll Speed" then
- changeScrollSpeed()
- elseif choice == "Set Pause Time" then
- changePauseTime()
- elseif choice == "Marquee Mode" then
- parallel.waitForAny(marqueeText, terminalStarryNight)
- showCuteScreen()
- elseif choice:find("Toggle Startup Marquee") then
- toggleStartupMarquee()
- elseif choice == "Back" then
- return
- end
- end
- end
- end
- -----------------------------------------------------
- -- Extras Menu
- -----------------------------------------------------
- function extrasMenu()
- local selected = 1
- local function getExtrasOptions()
- return {
- "Starry Night",
- "Starry Night Color Options",
- "Clock",
- "Toggle Startup Starry Night [" .. (startupStarryNight and "ON" or "OFF") .. "]",
- "Toggle Startup Clock [" .. (startupClock and "ON" or "OFF") .. "]",
- "Back"
- }
- end
- while true do
- local options = getExtrasOptions()
- drawCenteredMenu("Extras", options, selected)
- local event, key = os.pullEvent("key")
- if key == keys.up then
- selected = (selected <= 1) and #options or (selected - 1)
- elseif key == keys.down then
- selected = (selected >= #options) and 1 or (selected + 1)
- elseif key == keys.enter then
- local choice = options[selected]
- if choice == "Starry Night" then
- extrasStarryNight()
- elseif choice == "Starry Night Color Options" then
- extrasStarryNightColorOptions()
- elseif choice == "Clock" then
- clockMonitor()
- elseif choice:find("Toggle Startup Starry Night") then
- toggleStartupStarryNight()
- elseif choice:find("Toggle Startup Clock") then
- toggleStartupClock()
- elseif choice == "Back" then
- return
- end
- end
- end
- end
- -----------------------------------------------------
- -- Main Menu
- -----------------------------------------------------
- function displayMainMenu()
- local selected = 1
- local menuOptions = {
- "Text Changer",
- "P2",
- "P1",
- "Extras",
- "Exit"
- }
- -- I had planned some fun diplay features that I never got to. (left the code in)
- while true do
- drawCenteredMenu("Ultimate Screen Maker", menuOptions, selected)
- local event, key = os.pullEvent("key")
- if key == keys.up then
- selected = (selected <= 1) and #menuOptions or (selected - 1)
- elseif key == keys.down then
- selected = (selected >= #menuOptions) and 1 or (selected + 1)
- elseif key == keys.enter then
- local choice = menuOptions[selected]
- if choice == "Text Changer" then
- textChangerMenu()
- elseif choice == "P2" then
- print("Placeholder 1 not implemented.")
- sleep(1)
- elseif choice == "P1" then
- print("Placeholder 2 not implemented.")
- sleep(1)
- elseif choice == "Extras" then
- extrasMenu()
- elseif choice == "Exit" then
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- print("Exiting program.")
- term.setTextColor(colors.white)
- break
- end
- end
- end
- end
- -----------------------------------------------------
- -- Main Program
- -----------------------------------------------------
- function main()
- loadSettingsCustom() -- load from 'settings'
- applySettings() -- update the monitor with saved settings
- -- Auto-start toggles:
- if startupMarquee then
- parallel.waitForAny(marqueeText, terminalStarryNight)
- showCuteScreen()
- end
- if startupStarryNight then
- extrasStarryNight()
- showCuteScreen()
- end
- if startupClock then
- clockMonitor()
- showCuteScreen()
- end
- -- Main Menu
- displayMainMenu()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment