Posted 06 February 2014 - 01:25 PM
Well, I'm programing a desktop (it shall looks like a bit of Windows XP).
My problem is now, if I want to start the program "Desktop" the PC immediately is closeing himself
Can someone see my mistake in the codes?
(Sorry for my bad English grammar knowledge)
os.pullEvent = os.PullEventRaw
term.clear()
term.setBackgroundColor(512)
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
term.setBackgroundColor(colors.blue)
term.setTextColor(colors.white)
print(" ")
term.setCursorPos(1,18)
term.setBackgroundColor(008800)
term.setTextColor(colors.white)
write(" START ")
term.setCursorPos(1,1)
while true do local event, button, X, Y = os.pullEvent("mouse_click")
XY = X..","..Y
if XY == "1,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "2,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "3,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "4,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "5,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "6,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "7,18" and button == 1 then
term.clear()
shell.run("programs")
end
end
(http://pastebin.com/W3d4gt2r)
My problem is now, if I want to start the program "Desktop" the PC immediately is closeing himself
Can someone see my mistake in the codes?
(Sorry for my bad English grammar knowledge)
os.pullEvent = os.PullEventRaw
term.clear()
term.setBackgroundColor(512)
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
term.setBackgroundColor(colors.blue)
term.setTextColor(colors.white)
print(" ")
term.setCursorPos(1,18)
term.setBackgroundColor(008800)
term.setTextColor(colors.white)
write(" START ")
term.setCursorPos(1,1)
while true do local event, button, X, Y = os.pullEvent("mouse_click")
XY = X..","..Y
if XY == "1,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "2,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "3,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "4,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "5,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "6,18" and button == 1 then
term.clear()
shell.run("programs")
end
if XY == "7,18" and button == 1 then
term.clear()
shell.run("programs")
end
end
(http://pastebin.com/W3d4gt2r)
Edited on 06 February 2014 - 12:53 PM