SHOW:
|
|
- or go back to the newest paste.
| 1 | local lsColors = {colors.white, colors.orange, colors.magenta, colors.lightBlue, colors.yellow, colors.lime, colors.pink, colors.gray, colors.lightGray, colors.cyan, colors.purple, colors.blue, colors.brown, colors.green, colors.red, colors.black}
| |
| 2 | ||
| 3 | - | local backColor, appColor, textColor |
| 3 | + | local barColor, appColor, textColor |
| 4 | - | local iBackColor, iAppColor, iTextColor |
| 4 | + | local iBarColor, iAppColor, iTextColor |
| 5 | ||
| 6 | function GetData() | |
| 7 | if (fs.exists("SysData/options.txt")) then
| |
| 8 | file = fs.open("SysData/options.txt", "r")
| |
| 9 | - | backColor = tonumber(file.readLine()) --Background color |
| 9 | + | barColor = tonumber(file.readLine()) --Background color |
| 10 | appColor = tonumber(file.readLine()) --App color | |
| 11 | textColor = tonumber(file.readLine()) --Text color | |
| 12 | file.close() | |
| 13 | else | |
| 14 | - | backColor = colors.cyan --Background color |
| 14 | + | barColor = colors.blue --Background color |
| 15 | appColor = colors.yellow --App color | |
| 16 | - | textColor = colors.white --Text color |
| 16 | + | textColor = colors.black --Text color |
| 17 | end | |
| 18 | ||
| 19 | for i=1,#lsColors,1 do | |
| 20 | - | if (backColor==lsColors[i]) then iBackColor = i+1 end |
| 20 | + | if (barColor==lsColors[i]) then iBarColor = i+1 end |
| 21 | if (appColor==lsColors[i]) then iAppColor = i+1 end | |
| 22 | if (textColor==lsColors[i]) then iTextColor = i+1 end | |
| 23 | end | |
| 24 | end | |
| 25 | ||
| 26 | function SaveData() | |
| 27 | file = fs.open("SysData/options.txt", "w")
| |
| 28 | - | file.writeLine(backColor) --Background color |
| 28 | + | file.writeLine(barColor) --Bar color |
| 29 | file.writeLine(appColor) --App color | |
| 30 | file.writeLine(textColor) --Text color | |
| 31 | file.close() | |
| 32 | end | |
| 33 | ||
| 34 | function Gui() | |
| 35 | - | term.setBackgroundColor(backColor) |
| 35 | + | term.setBackgroundColor(colors.white) |
| 36 | term.clear() | |
| 37 | local win = window.create(term.current(),1,1,26,20) | |
| 38 | - | win.setBackgroundColor(backColor) |
| 38 | + | win.setBackgroundColor(colors.white) |
| 39 | win.clear() | |
| 40 | ||
| 41 | --Title | |
| 42 | - | paintutils.drawPixel(4,2,backColor) |
| 42 | + | paintutils.drawPixel(4,2,barColor) |
| 43 | term.setCursorPos(4,2) | |
| 44 | term.setTextColor(textColor) | |
| 45 | term.write("-Design Options-")
| |
| 46 | ||
| 47 | --Return button | |
| 48 | paintutils.drawPixel(2,2,colors.red) | |
| 49 | term.setCursorPos(2,2) | |
| 50 | term.setTextColor(textColor) | |
| 51 | term.write("x")
| |
| 52 | ||
| 53 | --Color pickers | |
| 54 | for i=1,#lsColors,1 do | |
| 55 | paintutils.drawPixel(i+1,5,lsColors[i]) | |
| 56 | paintutils.drawPixel(i+1,9,lsColors[i]) | |
| 57 | paintutils.drawPixel(i+1,13,lsColors[i]) | |
| 58 | end | |
| 59 | ||
| 60 | --Background color Picker | |
| 61 | - | paintutils.drawPixel(2,4,backColor) |
| 61 | + | paintutils.drawPixel(2,4,barColor) |
| 62 | term.setCursorPos(2,4) | |
| 63 | term.setTextColor(textColor) | |
| 64 | - | term.write("Background color")
|
| 64 | + | term.write("Bar color")
|
| 65 | - | paintutils.drawPixel(iBackColor,6,backColor) |
| 65 | + | paintutils.drawPixel(iBarColor,6,barColor) |
| 66 | - | term.setCursorPos(iBackColor,6) |
| 66 | + | term.setCursorPos(iBarColor,6) |
| 67 | term.setTextColor(textColor) | |
| 68 | term.write("*")
| |
| 69 | ||
| 70 | --App color Picker | |
| 71 | - | paintutils.drawPixel(2,8,backColor) |
| 71 | + | paintutils.drawPixel(2,8,barColor) |
| 72 | term.setCursorPos(2,8) | |
| 73 | term.setTextColor(textColor) | |
| 74 | term.write("App color")
| |
| 75 | - | paintutils.drawPixel(iAppColor,10,backColor) |
| 75 | + | paintutils.drawPixel(iAppColor,10,barColor) |
| 76 | term.setCursorPos(iAppColor,10) | |
| 77 | term.setTextColor(textColor) | |
| 78 | term.write("*")
| |
| 79 | ||
| 80 | --Text color Picker | |
| 81 | - | paintutils.drawPixel(2,12,backColor) |
| 81 | + | paintutils.drawPixel(2,12,barColor) |
| 82 | term.setCursorPos(2,12) | |
| 83 | term.setTextColor(textColor) | |
| 84 | term.write("Text color")
| |
| 85 | - | paintutils.drawPixel(iTextColor,14,backColor) |
| 85 | + | paintutils.drawPixel(iTextColor,14,barColor) |
| 86 | term.setCursorPos(iTextColor,14) | |
| 87 | term.setTextColor(textColor) | |
| 88 | term.write("*")
| |
| 89 | end | |
| 90 | - | --Change peripheral Button |
| 90 | + | |
| 91 | - | paintutils.drawPixel(2,17,colors.yellow) |
| 91 | + | |
| 92 | - | term.setCursorPos(2,17) |
| 92 | + | |
| 93 | ||
| 94 | - | term.write("Change ")
|
| 94 | + | |
| 95 | - | term.setCursorPos(2,18) |
| 95 | + | |
| 96 | - | term.write("Peripheral")
|
| 96 | + | |
| 97 | elseif (y==5) then | |
| 98 | - | --Change peripheral Button |
| 98 | + | barColor = lsColors[i] |
| 99 | - | paintutils.drawPixel(13,17,colors.red) |
| 99 | + | iBarColor = x |
| 100 | - | term.setCursorPos(13,17) |
| 100 | + | |
| 101 | appColor = lsColors[i] | |
| 102 | - | term.write("Unequip ")
|
| 102 | + | |
| 103 | - | term.setCursorPos(13,18) |
| 103 | + | |
| 104 | - | term.write("Peripheral")
|
| 104 | + | |
| 105 | iTextColor = x | |
| 106 | end | |
| 107 | end | |
| 108 | ||
| 109 | -- Main -- | |
| 110 | local click=false | |
| 111 | GetData() | |
| 112 | while(true) do | |
| 113 | local e,b,x,y | |
| 114 | - | backColor = lsColors[i] |
| 114 | + | |
| 115 | - | iBackColor = x |
| 115 | + | |
| 116 | Gui() | |
| 117 | sleep(2) | |
| 118 | end, | |
| 119 | function() | |
| 120 | e,b,x,y = os.pullEvent("mouse_click")
| |
| 121 | click = true | |
| 122 | - | elseif (y>=17 and y<=18 and x>=2 and x<=11) then |
| 122 | + | |
| 123 | - | pocket.equipBack() |
| 123 | + | |
| 124 | - | elseif (y>=17 and y<=18 and x>=13 and x<=22) then |
| 124 | + | |
| 125 | - | pocket.unequipBack() |
| 125 | + | |
| 126 | Buttons(x,y) | |
| 127 | end | |
| 128 | end |