Sorry to bumb into this old thread, but I also get this error, I know what is causing it but I don't know how to fix it.
when slc is set to 1 or anything else, any keystroke will cause this error and interrupt the loop because it only accepts mouse_click.
Also, it would be nice if paint and edit just closes when an invalid directory is entered or perhaps popup a dialog ^_^/>
--snowfox os (origionally gmod E2 consolescreen OS)
--by "Vadim" Savchenko
diskdriveside = "bottom"
theme = colors.orange
default = "wallpaper"
box1 = paintutils.loadImage("defaultbox1")
box2 = paintutils.loadImage("defaultbox2")
box3 = paintutils.loadImage("defaultbox3")
box4 = paintutils.loadImage("defaultbox4")
slc = 0
term.setBackgroundColor(colors.gray)
term.clear()
term.setCursorPos(10,8)
term.setTextColor(colors.orange)
print("snowFOX 1.0 is loading for you!")
function usIn()
term.setCursorPos(1,1)
term.setBackgroundColor(theme)
term.clearLine()
term.setCursorPos(1,1)
term.setTextColor(colors.black)
print("[ HOME ]")
term.setBackgroundColor(colors.lightGray)
term.setCursorPos(46,1)
local time = os.time()
print (" "..textutils.formatTime(time, true))
end
function initDesk()
term.clear()
wallpaper = paintutils.loadImage(default) --change wallpaper here
paintutils.drawImage(wallpaper, 1, 1)
term.setBackgroundColor(colors.lightGray)
usIn()
end
function homeMenu()
term.setTextColor(256)
term.setBackgroundColor(colors.brown)
term.setCursorPos(1,2)
print("Options ")
term.setCursorPos(1,3)
print("Music ")
term.setCursorPos(1,4)
print("Quickedit ")
term.setCursorPos(1,5)
print("Paint ")
term.setCursorPos(1,6)
print("Pastebin ")
term.setCursorPos(1,7)
print("Programs ")
term.setCursorPos(1,8)
print("X-term ")
term.setCursorPos(1,9)
print("Leave ")
usIn()
end
function music()
paintutils.drawImage(box1, 18,7)
term.setCursorPos(18,7)
term.setBackgroundColor(colors.orange)
print(" Music")
term.setCursorPos(35,7)
term.setBackgroundColor(colors.red)
print("X")
term.setCursorPos(19,9)
term.setBackgroundColor(colors.yellow)
peripheral.wrap(diskdriveside)
if disk.hasAudio(diskdriveside) then
paintutils.drawImage(box2, 18,7)
term.setCursorPos(18,7)
term.setBackgroundColor(colors.orange)
print(" Music")
term.setCursorPos(35,7)
term.setBackgroundColor(colors.red)
print("X")
term.setCursorPos(19,9)
term.setBackgroundColor(colors.yellow)
name = disk.getAudioTitle(diskdriveside)
print(name)
term.setCursorPos(19,11)
print("PLAY STOP")
slc = 3
else
print("No disk or drive")
term.setBackgroundColor(colors.lightGray)
slc = 1
end
end
function leave()
paintutils.drawImage(box1, 18,7)
term.setCursorPos(18,7)
term.setBackgroundColor(colors.orange)
print(" Leave")
term.setCursorPos(35,7)
term.setBackgroundColor(colors.red)
print("X")
term.setCursorPos(19,9)
term.setBackgroundColor(colors.yellow)
print("Restart Turnoff")
slc = 2
end
function terminal()
paintutils.drawImage(box1, 18,7)
term.setCursorPos(18,7)
term.setBackgroundColor(colors.orange)
print(" Kill x-server?")
term.setCursorPos(35,7)
term.setBackgroundColor(colors.red)
print("X")
term.setCursorPos(19,9)
term.setBackgroundColor(colors.yellow)
print(" Yes No ")
slc = 4
end
function editFile()
paintutils.drawImage(box3, 18,7)
term.setCursorPos(18,7)
term.setBackgroundColor(colors.orange)
print(" Edit file")
term.setCursorPos(35,7)
term.setBackgroundColor(colors.red)
print("X")
term.setCursorPos(19,9)
term.setBackgroundColor(colors.yellow)
print("Directory:")
term.setCursorPos(19,11)
term.setBackgroundColor(colors.white)
input = read()
if input == "" then
initDesk()
slc = 0
end
shell.run("edit", input)
initDesk()
usIn()
slc = 0
end
function paintFile()
paintutils.drawImage(box3, 18,7)
term.setCursorPos(18,7)
term.setBackgroundColor(colors.orange)
print(" Paint file")
term.setCursorPos(35,7)
term.setBackgroundColor(colors.red)
print("X")
term.setCursorPos(19,9)
term.setBackgroundColor(colors.yellow)
print("Directory:")
term.setCursorPos(19,11)
term.setBackgroundColor(colors.white)
input = read()
if input == "" then
initDesk()
slc = 0
end
shell.run("paint", input)
initDesk()
usIn()
slc = 0
end
function options()
paintutils.drawImage(box4, 18,6)
term.setCursorPos(18,6)
term.setBackgroundColor(colors.orange)
print(" Preferences")
term.setCursorPos(37,6)
term.setBackgroundColor(colors.red)
print("X")
term.setCursorPos(19,8)
term.setBackgroundColor(colors.yellow)
print("Change wallpaper")
term.setCursorPos(19,10)
print("Change windowcolor")
slc = 5
end
initDesk()
--snowFOX kernel
while true do
local event, button, X, Y = os.pullEventRaw()
if slc == 0 then
if event == "mouse_click" then
if X >=1 and X <=10 and Y==1 and button ==1 then
homeMenu()
slc = 1
else
initDesk()
end
end
elseif slc == 1 then
if X >=1 and X <=11 and button == 1 and Y== 3 then
music()
elseif X >=1 and X <=11 and button == 1 and Y== 9 then
leave()
elseif X >=1 and X <=11 and button == 1 and Y== 8 then
terminal()
elseif X >=1 and X <=11 and button == 1 and Y== 4 then
editFile()
elseif X >=1 and X <=11 and button == 1 and Y== 5 then
paintFile()
elseif X >=1 and X <=11 and button == 1 and Y== 2 then
options()
else
initDesk()
slc = 0
end
elseif slc == 2 then
if X >= 18 and X <= 25 and Y == 9 and button == 1 then
os.reboot()
elseif X >= 28 and X <= 34 and Y == 9 and button == 1 then
os.shutdown()
else
term.setBackgroundColor(colors.lightGray)
initDesk()
slc = 0
end
elseif slc == 3 then
if X >= 18 and X <= 25 and Y == 11 and button == 1 then
disk.playAudio(diskdriveside)
elseif X >= 28 and X <= 34 and Y == 11 and button == 1 then
disk.stopAudio(diskdriveside)
else
term.setBackgroundColor(colors.lightGray)
initDesk()
slc = 0
end
elseif slc == 4 then
if X >= 18 and X <= 25 and Y == 9 and button == 1 then
term.setBackgroundColor(colors.black)
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.white)
print("Have fun!")
term.setTextColor(32)
term.setCursorPos(46,1)
print("[ OK ]")
return(0)
elseif X >= 28 and X <= 34 and Y == 9 and button == 1 then
term.setBackgroundColor(colors.lightGray)
initDesk()
slc = 0
else
term.setBackgroundColor(colors.lightGray)
initDesk()
slc = 0
end
elseif slc == 5 then
if X >= 19 and X <= 34 and Y == 8 and button == 1 then
term.setCursorPos(19,12)
input2 = read()
if input2 == "" then
initDesk()
slc = 0
end
term.setBackgroundColor(colors.lightGray)
default = input2
initDesk()
usIn()
slc = 0
elseif X >= 28 and X <= 34 and Y == 11 and button == 1 then
--mumble muble
else
initDesk()
slc = 0
end
else
term.setBackgroundColor(colors.lightGray)
initDesk()
slc = 0
end --ends continuament mouse input
end --ends the while loop