Hi.
I've create my own rednet receiving program and a sending program.
I've set it up like internet cables.
Everyone on my server has two computers, a send a receive computer.
I also have 2 computers but it is made for intercepting messages from other users, so basicly I can log the chat.
But it will only let me receive one message before ending.
I was wondering on how to repeat it.
I've look on youtube but didn't really find anything on making an infinite loop.
Here is the code:
Program name: receive
Code:
term.clear()
term.setCursorPos(1,1)
rednet.open("top")
print ("Waiting for new message...")
sleep(1)
id, msg, dis = rednet.receive()
print ("You have received a message from #"..id)
print ("The message came from "..dis.." blocks away")
print ("The message is :")
print ("-----------------------")
print (msg)
And that is where the code ends.
I want all this to happen, but for it to repeat infinitely so I can get everyone's chat.
Thanks.
Rednet Receiver
Started by lordzionleader, Dec 04 2013 05:17 PM
2 replies to this topic
#1
Posted 04 December 2013 - 05:17 PM
#2
Posted 05 December 2013 - 12:14 AM
while true do
-- some code here you want to be repeated
endThe while loop (relevant PIL page) runs while the conditional in it evaluates true. And true will always nicely evaluate true. There you have it, the loop is infinite.
#3
Posted 06 December 2013 - 01:24 AM
Could you put that into the code that I pasted in there but add the loop?
I'm not that great with Lua but getting better overtime.
If you were to show me what it looked like you would hugely improve my Lua coding knowledge.
Thanks mate
/>
Wait no never mind I got it working
/>
You're a HUGE help.
Now I can intercept and log messages other players send to each other XD.
I'm not that great with Lua but getting better overtime.
If you were to show me what it looked like you would hugely improve my Lua coding knowledge.
Thanks mate
Wait no never mind I got it working
You're a HUGE help.
Now I can intercept and log messages other players send to each other XD.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











