Advertisement
Marlingaming

CC Tweaked CCSPS Iron - Skeleton Desktop

Jan 24th, 2022 (edited)
383
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --this script acts as the Base for CCSPS Iron
  2. local AppPaths = {}
  3. local AppNames = {}
  4. local w, h = term.getSize()
  5.  
  6. local function GetApps()
  7. settings.load(".settings")
  8. AppPaths = settings.get("ClientApps_Paths")
  9. AppNames = settings.get("ClientApps_Names")
  10. end
  11.  
  12. local function Clear()
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. end
  16.  
  17. local function CenterText(y,text)
  18.     local x = math.floor((w - string.len(text)) /2)
  19.     term.setCursorPos(x,y)
  20.     term.clearLine()
  21.     term.write(text)
  22. end
  23.  
  24. function CUI(m,y) --declare function
  25. n=1
  26. local l = #m
  27. while true do
  28. term.setCursorPos(1,y)
  29. for i=1, #m, 1 do --traverse the table of options
  30. if i==n then term.clearLine() print(i, " >",m[i]) else term.clearLine() print(i, " ", m[i]) end --print them
  31. end
  32. a, b= os.pullEvent("key") --wait for keypress
  33. if b==keys.w and n>1 then n=n-1 end
  34. if b==keys.s and n<l then n=n+1 end
  35. if b==keys.enter then break end
  36. end
  37. return n --return the value
  38. end
  39.  
  40. function Desktop()
  41. term.setBackgroundColor(colors.lightBlue)
  42. Clear()
  43. CenterText(1,"Desktop")
  44. local options = AppNames
  45. local n = CUI(options,3)
  46. shell.run(AppPaths[n])
  47. os.sleep(1)
  48. Desktop()
  49. end
  50.  
  51. local function Start()
  52. GetApps()
  53. term.setBackgroundColor(colors.cyan)
  54. Clear()
  55. CenterText(1,"==Start==")
  56. CenterText(3,"press enter to continue")
  57. repeat
  58.     local event, key = os.pullEvent("key")
  59. until key == keys.enter
  60. Desktop()
  61. end
  62.  
  63. Start()
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement