This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Asbetha's profile picture

Where is the problem ?

Started by Asbetha, 06 February 2014 - 12:25 PM
Asbetha #1
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)
Edited on 06 February 2014 - 12:53 PM
Kingdaro #2
Posted 06 February 2014 - 02:07 PM
The first line should say "os.pullEvent = os.pullEventRaw" and not "os.pullEvent = os.PullEventRaw".
Edited on 06 February 2014 - 01:07 PM
Asbetha #3
Posted 06 February 2014 - 03:25 PM
The first line should say "os.pullEvent = os.pullEventRaw" and not "os.pullEvent = os.PullEventRaw".
well that sounds equal…
Lyqyd #4
Posted 06 February 2014 - 04:07 PM
No, they are different. Look carefully at the capitalization. Lua is case-sensitive, so it makes a difference.
Asbetha #5
Posted 06 February 2014 - 04:58 PM
ah I can see it … thanks^^"