-
modem = peripheral.wrap("right") -
modemback = peripheral.wrap("left") -
modem.closeAll() -
modemback.closeAll() -
while true do -
modem.open(1) -
event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message") -
senderChannel = senderChannel + 1 -
modemback.open(senderChannel) -
print(senderChannel) -
print(replyChannel) -
print(message) -
modemback.transmit(senderChannel..replyChannel..message) -
end
2
2 replies to this topic
#1
Posted 13 June 2014 - 05:16 PM
So, recently I've been trying to make a messaging system but I have a dilemma, wireless modems can only transmit 64 blocks and that is where a relay is used, to relay a message from one computer to another over long distances, but my program won't work. It says Unexpected Number when I am giving it the number as a variable.
#2
Posted 13 June 2014 - 05:35 PM
Moved to Ask a Pro.
#3
Posted 13 June 2014 - 05:40 PM
A quick look at your code shows you are concatenating your modem transmit info which is not what you want to do - the data should be comma separated.
change this
to this
Also, you're opening the modem channel every time you iterate through your loop - you should move your 'modem.open' line above the loop so you aren't wasting computing time/power re-opening an already open channel over and over.
change this
modemback.transmit(senderChannel..replyChannel..message)
to this
modemback.transmit(senderChannel,replyChannel,message)
Also, you're opening the modem channel every time you iterate through your loop - you should move your 'modem.open' line above the loop so you aren't wasting computing time/power re-opening an already open channel over and over.
Edited by Dog, 13 June 2014 - 06:58 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users