5bitesofcookies

shoddy-os-thememaker-cc

Oct 21st, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. print("Thememaker V1 - Make your own theme/settings!")
  2. local function yn()
  3.     while true do
  4.         local _,l=os.pullEvent"char"
  5.         if l=="y" then
  6.             return true
  7.         elseif l=="n" then
  8.             return false
  9.         end
  10.     end
  11. end
  12. local new = {}
  13. local blacklist = {
  14.     appLocations = true ,
  15.     fileTypeDefIcons = true ,
  16.     extensions = true
  17. }
  18. local function goThrough(thing,s)
  19.     for i,o in pairs(thing) do
  20.         if blacklist[i] then else
  21.             if type(o) == "number" then
  22.                 print(i.." was "..tostring(o)..". Is that a color?")
  23.                 if yn() then
  24.                     print()
  25.                     local colorsByNum = {}
  26.                     local num = 1
  27.                     for k,l in pairs(colors) do
  28.                         if type(l)=="number" then
  29.                             term.setBackgroundColor(l)
  30.                             term.write" "
  31.                             colorsByNum[num]=l
  32.                             num=num+1
  33.                         end
  34.                     end
  35.                     local evts = {os.pullEvent("mouse_click")}
  36.                     new[i] = colorsByNum[evts[3]]
  37.                     term.setBackgroundColor(colors.black)
  38.                     print()
  39.                 else
  40.                     print"Enter value, will convert to number:"
  41.                     new[i] = tonumber(read())
  42.                 end
  43.                 if s then
  44.                                         new[s] = new[s] or {}
  45.  
  46.                     new[s][i]=new[i]
  47.                     new[i]=nil
  48.                 end
  49.             elseif type(o)=="boolean" then
  50.                 print(i.." was boolean. Y for true, N for false")
  51.                 new[i]=yn()
  52.                 if s then
  53.                                         new[s] = new[s] or {}
  54.  
  55.                     new[s][i]=new[i]
  56.                     new[i]=nil
  57.                 end
  58.             elseif type(o)=="string" then
  59.                 print(i.." was string. Enter the new string")
  60.                 new[i]=read()
  61.                 if s then
  62.                     new[s] = new[s] or {}
  63.                     new[s][i]=new[i]
  64.                     new[i]=nil
  65.                 end
  66.             elseif type(o)=="table" then
  67.                 print(i.." was table. goThrough table")
  68.                 goThrough(o,i)
  69.             end
  70.         end
  71.     end
  72.     print("Returning...")
  73. end
  74. goThrough(osStuff.settings)
  75. textutils.pagedPrint(textutils.serialize(new))
  76. local f=fs.open("newSettings","w")
  77. f.write(textutils.serialize(new))
  78. f.close()
  79. print("Outputted to /newSettings. Enjoy your... interesting... settings.")
Advertisement
Add Comment
Please, Sign In to add comment