Posted 25 August 2012 - 12:43 AM
Hey everyone again!
Here I find myself left wondering what is wrong…. My problem you must ask? Well see, for some reason my first function just doesn't seem to work! It might be a problem of timing,although I don't think so. But anyway here is my code (feel free to optimize)
Thanks for any help in advance!
Here I find myself left wondering what is wrong…. My problem you must ask? Well see, for some reason my first function just doesn't seem to work! It might be a problem of timing,although I don't think so. But anyway here is my code (feel free to optimize)
function received()
rednet.open("right")
X = 0
Y = 1
e, id, msg = os.pullevent
if e == "rednet_message" then
Y = Y +1
sleep(1)
if Y > 18 then
term.scroll()
term.setCursorPos(X, Y)
print(id, msg)
received()
else
term.setCursorPos(X, Y)
print(id, msg)
received()
end
else
sending()
end
end
function sending()
local name = os.computerID()
while true do
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if (param == 28) then
sending = read()
Y = Y +1
if Y > 18 then
term.scroll(1)
rednet.close("right")
rednet.open("left")
rednet.broadcast(sending)
sleep(1)
rednet.close("left")
rednet.open("right")
else
rednet.close("right")
rednet.open("left")
rednet.broadcast(sending)
sleep(1)
rednet.close("left")
rednet.open("right")
end
end
end
end
sleep(1)
received()
end
received()
Thanks for any help in advance!