Posted 31 May 2014 - 09:38 PM
Hey, so I made a program for changing the background color of my desktop but it keeps crashing,
can you guys help me please ? :)/>
can you guys help me please ? :)/>
slc = 0
tBarC = 128
tBartC = 1
term.clear()
function drawDesktop()
term.clear()
bground = paintutils.loadImage("/DogeOs/Images/settings.nfp")
paintutils.drawImage(bground,1,1)
term.setTextColor(colors.black)
term.setCursorPos(2,3)
print("Select any color for you background")
term.setCursorPos(2,11)
print(" If you want to change your username")
print(" or your password, simply go to:")
print(" /DogeOs/API/(username or password)")
print(" using Finder and follow the instructions")
end
drawDesktop()
while true do
local event, button, X, Y = os.pullEventRaw()
if slc == 0 then
if event == "mouse_click" then
if X >=2 and X <=8 and Y==1 and button ==1 then
slc = 1
else
drawDesktop()
-- ORANGE
if X >=2 and X <=3 and Y >=5 and Y <=6 and button ==1 then
h = fs.open("/DogeOs/API/color")
h.writeLine("backg = 2")
h.close()
os.reboot()
-- PINK
elseif X >=5 and X <=6 and Y >=5 and Y <=6 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 4")
h.close()
os.reboot()
-- LIGHT BLUE
elseif X >=8 and X <=9 and Y >=5 and Y <=6 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 8")
h.close()
os.reboot()
-- YELLOW
elseif X >=11 and X <12 and Y >=5 and Y <=6 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 16")
h.close()
os.reboot()
-- LIGHT GREEN
elseif X >=14 and X <=15 and Y >=5 and Y <=6 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 32")
h.close()
os.reboot()
-- LIGHT PINK
elseif X >=17 and X <=18 and Y >=5 and Y <=6 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 64")
h.close()
os.reboot()
-- LIGHT GRAY
elseif X >=20 and X <=21 and Y >=5 and Y <=6 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg =256 ")
h.close()
os.reboot()
-- CYAN
elseif X >=3 and X <=4 and Y >=8 and Y <=9 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 512")
h.close()
os.reboot()
-- PURPLE
elseif X >=6 and X <=7 and Y >=8 and Y <=9 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 1024")
h.close()
os.reboot()
-- BLUE
elseif X >=9 and X <=10 and Y >=8 and Y <=9 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 2048")
h.close()
os.reboot()
-- BROWN
elseif X >=12 and X <=13 and Y >=8 and Y <=9 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 4096")
h.close()
os.reboot()
-- GREEN
elseif X >=15 and X <=16 and Y >=8 and Y <=9 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 8192")
h.close()
os.reboot()
-- RED
elseif X >=18 and X <=19 and Y >=8 and Y <=9 and button ==1 then
fs.delete("/DogeOs/API/color")
h = fs.open("/DogeOs/API/color")
h.write("backg = 16384")
h.close()
os.reboot()
-- END OF COLORS
end
end
end
end
end