Posted 08 August 2013 - 12:23 PM
slc = 0
dbc = 1
tbbc = 2048
tbtc = 16384
tbbuc = 8192
function drawTitleBar()
term.setCursorPos(1,1)
term.setBackgroundColor(tbbc)
term.setTextColor(tbtc)
term.clearLine()
term.setBackgroundColor(tbbuc)
print("System")
end
function drawDesktop()
term.setBackgroundColor(dbc)
term.clear()
dpic = paintutils.loadImage("SporreKing/sk-os/desktop")
djpic = paintutils.loadImage("SporreKing/sk-os/play")
paintutils.drawImage(dpic,-7,1)
term.setCursorPos(0,0)
drawTitleBar()
paintutils.drawImage(djpic,-12,1)
end
function drawSystem()
term.setCursorPos(1,1)
term.setBackgroundColor(32)
term.setTextColor(tbtc)
print("System")
term.setBackgroundColor(256)
term.setTextColor(128)
term.setCursorPos(1,2)
print("Terminate ")
term.setCursorPos(1,3)
print("Reboot ")
term.setCursorPos(1,4)
print("Shutdown ")
term.setCursorPos(1,5)
print("Cancel ")
end
drawDesktop()
while true do
local event, button, X, Y = os.pullEventRaw()
if slc == 0 then
if event=="mouse_click" then
if Y==1 and X >0 and X < 7 then
drawSystem()
slc=1
else
drawDesktop()
end
if X>1 and X<12 and Y>2 and Y<8 then
shell.run("dj")
drawDesktop()
end
end
elseif slc == 1 then
if X>0 and X<11 and Y==2 and button==1 then
term.SetBackgroundColor(0x8)
term.setTextColor(0x1)
term.clear()
term.setCursorPos(22,10)
print("Goodbye!")
term.setCursorPos(-1,-1)
sleep(4)
term.setBackgroundColor(0x8000)
clear()
term.setCursorPos(1,1)
error()
end
if X>0 and X<11 and Y==3 and button==1 then
os.reboot()
end
if X>0 and X<11 and Y==4 and button==1 then
os.shutdown()
end
if X>0 and X<11 and Y==5 and button==1 then
drawDesktop()
slc=0
end
if X>0 and X<7 and Y==1 and button==1 then
drawDesktop()
slc=0
end
end
end
Whenever i click within the area specified at line 65 i get a skos:66: attempt to call nil error.
This area:
if X>0 and X<11 and Y==2 and button==1 then
term.SetBackgroundColor(0x8)
term.setTextColor(0x1)
term.clear()
term.setCursorPos(22,10)
print("Goodbye!")
term.setCursorPos(-1,-1)
sleep(4)
term.setBackgroundColor(0x8000)
clear()
term.setCursorPos(1,1)
end
I can't see why, i can't spot anything wrong at line 66/65. The other areas specified at the if statements just below works fine :/
Thanks in advance.