add a new function for setting status

This commit is contained in:
zontreck 2024-03-28 13:41:38 -07:00
parent 8e915b20c8
commit c7154880d9
7 changed files with 23 additions and 16 deletions

View file

@ -0,0 +1,5 @@
function setStatus(message)
term.setCursorPos(2, 4)
term.clearLine()
term.write("STATUS: " .. message)
end

View file

@ -12,11 +12,14 @@ function main()
require("settingsFile") require("settingsFile")
require("version") require("version")
require("header")
readSettings() readSettings()
term.clear() term.clear()
drawTitle() drawTitle()
setStatus("IDLE")
if not fs.exists("/fosdata/.init") then if not fs.exists("/fosdata/.init") then
writeSettings() writeSettings()
options = newSystemOptions options = newSystemOptions
@ -85,12 +88,12 @@ end
function deselect(index) function deselect(index)
term.setBackgroundColor(colors.black) term.setBackgroundColor(colors.black)
term.setTextColor(colors.lime) term.setTextColor(colors.lime)
term.setCursorPos(2, 4 + index) term.setCursorPos(2, 5 + index)
term.write(options[index]) term.write(options[index])
end end
function highlight(index) function highlight(index)
term.setCursorPos(2, 4 + index) term.setCursorPos(2, 5 + index)
term.setBackgroundColor(colors.lime) term.setBackgroundColor(colors.lime)
term.setTextColor(colors.black) term.setTextColor(colors.black)
@ -101,7 +104,7 @@ function highlight(index)
end end
function flicker(index) function flicker(index)
term.setCursorPos(2, 4 + index) term.setCursorPos(2, 5 + index)
term.setBackgroundColor(colors.red) term.setBackgroundColor(colors.red)
term.setTextColor(colors.black) term.setTextColor(colors.black)
@ -114,8 +117,8 @@ function flicker(index)
end end
function drawMenuOptions() function drawMenuOptions()
term.setCursorPos(2, 5) term.setCursorPos(2, 6)
local line = 5 local line = 6
for i = 1, #options do for i = 1, #options do
local option = options[i] local option = options[i]
term.write(option) term.write(option)

View file

@ -1,4 +1,5 @@
require "settingsFile" require "settingsFile"
require "header"
readSettings() readSettings()
@ -11,6 +12,4 @@ adminPin = read("*")
writeSettings() writeSettings()
term.setCursorPos(2,4) setStatus("ADMIN PIN UPDATED")
term.clearLine()
term.write("ADMIN PIN UPDATED")

View file

@ -5,12 +5,10 @@ readSettings()
term.clear() term.clear()
drawTitle() drawTitle()
term.setCursorPos(2, 6) term.setCursorPos(2, 6)
term.write("ENTER THE HOSTNAME> ") term.write("ENTER THE HOST NAME> ")
hostname = read() hostname = read()
writeSettings() writeSettings()
term.setCursorPos(2,4) setStatus("HOST NAME UPDATED")
term.clearLine()
term.write("HOSTNAME UPDATED")

View file

@ -11,6 +11,4 @@ name = read()
writeSettings() writeSettings()
term.setCursorPos(2,4) setStatus("USER NAME UPDATED")
term.clearLine()
term.write("USER NAME UPDATED")

View file

@ -1,4 +1,4 @@
local myVersion = "1.0.032824.1301" local myVersion = "1.0.032824.1338"
function printVersion() function printVersion()
term.setCursorPos(2,18) term.setCursorPos(2,18)

View file

@ -22,10 +22,14 @@ shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/fa
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/updateWordList.lua") shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/updateWordList.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/version.lua") shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/version.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/mainMenu.lua") shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/mainMenu.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/deps/settingsFile.lua") shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/deps/settingsFile.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/deps/header.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/setupCompleted.lua") shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/setupCompleted.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/setHostname.lua") shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/setHostname.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/setUser.lua") shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/setUser.lua")
shell.run("wget https://git.zontreck.com/zontreck/FalloutOS/raw/branch/master/programs/setAdminPin.lua")
print("") print("")
print("ROBCO OS - UPDATING SOFTWARE UPDATER") print("ROBCO OS - UPDATING SOFTWARE UPDATER")