Posted 01 September 2013 - 07:57 AM
Hi! I wrote a program for call an elevator but the main computer tell me 'startup:11: attempt to compare string with number expected, got string'. I checked the code and I didn't find what is wrong.
The code:
Thanks!
The code:
rednet.open("top")
mouseWidth = 0
mouseHeight = 0
monitor = peripheral.wrap("left")
monitor.clear()
monitor.setBackgroundColour((colours.red))
monitor.setCursorPos(1,3)
monitor.write[[ Llamar ascensor ]]
monitor.setBackgroundColour((colors.black))
function elevatorCaller()
if mouseWidth > 0 and mouseWidth < 9 and mouseHeight == 3 then
for i=1,5 do
rednet.send(2, "down")
sleep(1.1)
end
for i=1,5 do
rednet.send(3, "down")
sleep(1.1)
end
rednet.send(4, "down")
end
end
repeat
event,p1,p2,p3 = os.pullEvent()
if event == "monitor_touch" then
mouseWidth = p1
mouseHeight = p2
elevatorCaller()
end
until event == "char" and p1 == ("x")
Thanks!