Could someone help me with RedNet?
#1
Posted 10 January 2013 - 11:37 AM
#2
Posted 10 January 2013 - 11:40 AM
#3
Posted 10 January 2013 - 11:45 AM
crazyguymgd, on 10 January 2013 - 11:40 AM, said:
#4
Posted 10 January 2013 - 11:50 AM
while true do message = rednet.receive() print(message) response = read() rednet.broadcast(response) end
Is a simple get message, send message loop.
#6
Posted 10 January 2013 - 12:06 PM
textutils.slowPrint("What side is your modem on?")
input = read()
rednet.open(input)
while true do
print("Message (to stop type /stop)")
input = read()
if input == "/stop" then
shell.run("cd disk")
end
else
rednet.broadcast(input)
end
end
#7
Posted 10 January 2013 - 12:08 PM
#8
Posted 10 January 2013 - 12:16 PM
crazyguymgd, on 10 January 2013 - 12:08 PM, said:
I have one working... but it is in its beta...
When I ran a stop program... it crashed my minecraft......
This was the stop command:
if input == "/stop" then break end
#9
Posted 10 January 2013 - 12:20 PM
textutils.slowPrint("What side is your modem on?")
input = read()
rednet.open(input)
textutils.slowPrint("Sadly, this program cannot automagically update")
textutils.slowPrint("To see if you have a new message, type /refresh")
print("Message (to stop type /stop)")
while true do
input = read()
if input == "/stop" then
break
end
elseif input == "/refresh" then
g = rednet.receive()
print(g)
break
end
else
rednet.broadcast(input)
end
end
#10
Posted 10 January 2013 - 12:29 PM
crazyguymgd, on 10 January 2013 - 11:50 AM, said:
while true do message = rednet.receive() print(message) response = read() rednet.broadcast(response) end
Is a simple get message, send message loop.
In this case, message is a number and is the ID of the computer from which the message is received from.
ViextraProgramming, on 10 January 2013 - 12:20 PM, said:
textutils.slowPrint("What side is your modem on?")
input = read()
rednet.open(input)
textutils.slowPrint("Sadly, this program cannot automagically update")
textutils.slowPrint("To see if you have a new message, type /refresh")
print("Message (to stop type /stop)")
while true do
input = read()
if input == "/stop" then
break
-- Whole if block needs only one end
-- Not sure what you're trying to do with the /refresh part here..
else
rednet.broadcast(input)
end
end
Btw, the arguments for rednet.receive() are as follows:
senderID, message, distance = rednet.receive() -- senderID is the ID of which the message is received from -- message is the message recieved -- distance the distance between the two computers
#11
Posted 10 January 2013 - 12:30 PM
#12
Posted 10 January 2013 - 12:32 PM
remiX, on 10 January 2013 - 12:29 PM, said:
crazyguymgd, on 10 January 2013 - 11:50 AM, said:
while true do message = rednet.receive() print(message) response = read() rednet.broadcast(response) end
Is a simple get message, send message loop.
In this case, message is a number and is the ID of the computer from which the message is received from.
ViextraProgramming, on 10 January 2013 - 12:20 PM, said:
textutils.slowPrint("What side is your modem on?")
input = read()
rednet.open(input)
textutils.slowPrint("Sadly, this program cannot automagically update")
textutils.slowPrint("To see if you have a new message, type /refresh")
print("Message (to stop type /stop)")
while true do
input = read()
if input == "/stop" then
break
-- Whole if block needs only one end
-- Not sure what you're trying to do with the /refresh part here..
else
rednet.broadcast(input)
end
end
Btw, the arguments for rednet.receive() are as follows:
senderID, message, distance = rednet.receive() -- senderID is the ID of which the message is received from -- message is the message recieved -- distance the distance between the two computers
Thanks for the catch.
#13
Posted 10 January 2013 - 12:37 PM
remiX, on 10 January 2013 - 12:29 PM, said:
crazyguymgd, on 10 January 2013 - 11:50 AM, said:
while true do message = rednet.receive() print(message) response = read() rednet.broadcast(response) end
Is a simple get message, send message loop.
In this case, message is a number and is the ID of the computer from which the message is received from.
ViextraProgramming, on 10 January 2013 - 12:20 PM, said:
textutils.slowPrint("What side is your modem on?")
input = read()
rednet.open(input)
textutils.slowPrint("Sadly, this program cannot automagically update")
textutils.slowPrint("To see if you have a new message, type /refresh")
print("Message (to stop type /stop)")
while true do
input = read()
if input == "/stop" then
break
-- Whole if block needs only one end
-- Not sure what you're trying to do with the /refresh part here..
else
rednet.broadcast(input)
end
end
Btw, the arguments for rednet.receive() are as follows:
senderID, message, distance = rednet.receive() -- senderID is the ID of which the message is received from -- message is the message recieved -- distance the distance between the two computers
Can I have it just receive a broadcast message?
And I was trying to make it so that it would autoupdate
but it wouldnt work in three different coding situations (program ran, just got stuck)
*btw.. dont have that code anymore...*
so typing /refresh would update the screen.
#14
Posted 10 January 2013 - 12:41 PM
ViextraProgramming, on 10 January 2013 - 12:37 PM, said:
remiX, on 10 January 2013 - 12:29 PM, said:
Can I have it just receive a broadcast message?
And I was trying to make it so that it would autoupdate
but it wouldnt work in three different coding situations (program ran, just got stuck)
*btw.. dont have that code anymore...*
so typing /refresh would update the screen.
Well, you will need to save the message into a table and then re-print them onto the screen.
This involves a lot of rednet stuff and is advanced if you're a beginner. I'd suggest looking through the programs sections, there are quite a few email programs.
#15
Posted 10 January 2013 - 12:50 PM
remiX, on 10 January 2013 - 12:41 PM, said:
ViextraProgramming, on 10 January 2013 - 12:37 PM, said:
remiX, on 10 January 2013 - 12:29 PM, said:
Can I have it just receive a broadcast message?
And I was trying to make it so that it would autoupdate
but it wouldnt work in three different coding situations (program ran, just got stuck)
*btw.. dont have that code anymore...*
so typing /refresh would update the screen.
Well, you will need to save the message into a table and then re-print them onto the screen.
This involves a lot of rednet stuff and is advanced if you're a beginner. I'd suggest looking through the programs sections, there are quite a few email programs.
#16
Posted 10 January 2013 - 12:54 PM
#17
Posted 10 January 2013 - 12:55 PM
ViextraProgramming, on 10 January 2013 - 12:50 PM, said:
I'm not saying you can't do it. I'm sure anyone can if they practice/learn and code over and over. Eventually you will know a lot.
Here's an email program: TCMail - Fully Functional Email
I've never used/tried it but check out the code and see if you can learn from it
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users











