Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this script acts as the Base for CCSPS Iron
- local AppPaths = {}
- local AppNames = {}
- local w, h = term.getSize()
- local function GetApps()
- settings.load(".settings")
- AppPaths = settings.get("ClientApps_Paths")
- AppNames = settings.get("ClientApps_Names")
- end
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function CenterText(y,text)
- local x = math.floor((w - string.len(text)) /2)
- term.setCursorPos(x,y)
- term.clearLine()
- term.write(text)
- end
- function CUI(m,y) --declare function
- n=1
- local l = #m
- while true do
- term.setCursorPos(1,y)
- for i=1, #m, 1 do --traverse the table of options
- if i==n then term.clearLine() print(i, " >",m[i]) else term.clearLine() print(i, " ", m[i]) end --print them
- end
- a, b= os.pullEvent("key") --wait for keypress
- if b==keys.w and n>1 then n=n-1 end
- if b==keys.s and n<l then n=n+1 end
- if b==keys.enter then break end
- end
- return n --return the value
- end
- function Desktop()
- term.setBackgroundColor(colors.lightBlue)
- Clear()
- CenterText(1,"Desktop")
- local options = AppNames
- local n = CUI(options,3)
- shell.run(AppPaths[n])
- os.sleep(1)
- Desktop()
- end
- local function Start()
- GetApps()
- term.setBackgroundColor(colors.cyan)
- Clear()
- CenterText(1,"==Start==")
- CenterText(3,"press enter to continue")
- repeat
- local event, key = os.pullEvent("key")
- until key == keys.enter
- Desktop()
- end
- Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement