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

Simple Program But Cant Find My Mistake.

Started by Babyrapper, 22 November 2013 - 08:49 AM
Babyrapper #1
Posted 22 November 2013 - 09:49 AM
Hello guys,
first I have to say sorry for my bad english, because I'am german.
I'm a beginner with Coputercraft and tested arround a few programs and tried to write a very simple program to turn on lights for example, but
I doesnt work.

term.clear()
term.setCursorPos(1,1)
print("X")

while true do
event,side,x,y = os.pullEvent()
if event == "monitor_touch" then
if X == 1 and y == 1 then
term.setCursorPos(1,3)
print("Licht an")
rs.setOutput("back", true)

end
end
end

I saved this as 'startup' and connected the computer with a monitor, then I get the 'x' in the top left corner (Pos1,1) but when I click on it with the right mouse button, nothing happens.

Please help me.
Lyqyd #2
Posted 22 November 2013 - 10:20 AM
You've got a capital X where you're checking the coordinates. Lua is case-sensitive, so "X" and "x" are not the same thing.
Babyrapper #3
Posted 22 November 2013 - 11:15 AM
Thank you very much :)/>