9 posts
Posted 09 August 2012 - 03:43 AM
print("Who do you want to send mail to?")
write("id: ")
id = read()
print("Whats the message you want to send?")
write("message:")
mail = read()
print("OK sending...")
rednet.open("top")
rednet.send(who, mail)
id, msg = rednet.receive()
print(id)
print("sent")
print(msg)
the error that comes back is
rednet:347: positive number expected
i could use some help here please ;)/>/>
3790 posts
Location
Lincoln, Nebraska
Posted 09 August 2012 - 03:58 AM
When sending the message, it expects a string. I think you need to change that line to rednet.send(1, "mail"), where 1 is just the ID of the computer you want it sent to.
9 posts
Posted 09 August 2012 - 04:05 AM
When sending the message, it expects a string. I think you need to change that line to rednet.send(1, "mail"), where 1 is just the ID of the computer you want it sent to.
i wanted it easy to use so when it asks for what computer you want it to send to you just put the id when it ask then it takes that input and puts it in the id spot in the rednet.send(id, message) and all this works in ssp but for some reason it doesnt in smp
3790 posts
Location
Lincoln, Nebraska
Posted 09 August 2012 - 04:11 AM
What you may need to do is define your users as variables, and do it that way… Such as if it were to ask them if they want to send a message, you say yes, and then it asks to whom, and gives a list from a table you create. If you select a specific one, then it would input that user's computer ID into that place, and then it will ask the message to be send
edit: Wow, I just noticed that all you need to do is switch out who for id. then it should work.
8543 posts
Posted 09 August 2012 - 04:20 AM
If it still gives you trouble after switching out the variable name, try using tonumber().
9 posts
Posted 09 August 2012 - 04:21 AM
What you may need to do is define your users as variables, and do it that way… Such as if it were to ask them if they want to send a message, you say yes, and then it asks to whom, and gives a list from a table you create. If you select a specific one, then it would input that user's computer ID into that place, and then it will ask the message to be send
edit: Wow, I just noticed that all you need to do is switch out who for id. then it should work.
yea i thought that too when i looked at it but the strange thing is that it works dont ask me how or why but it works in single player that is i did switch it in multiplayer thought and it still didn't work
9 posts
Posted 09 August 2012 - 04:27 AM
If it still gives you trouble after switching out the variable name, try using tonumber().
whats that
9 posts
Posted 09 August 2012 - 04:32 AM
omg for some reason im getting the error because im changing the id in id = read() to match the spot in rednet.send this is every weird so if i leave everything the same it will work in single player still doesnt work in multiplayer
3790 posts
Location
Lincoln, Nebraska
Posted 09 August 2012 - 02:34 PM
print("Who do you want to send mail to?")
write("ID: ")
who = read()
print("What is the message you want to send?")
write("Message:")
mail = read()
print("Sending message to: ", who)
sleep(1)
rednet.open("top")
rednet.send(who, mail)
print("Sent message.")
sleep(1)
id, msg = rednet.receive()
print(id,"sent:",msg)
This should work. I think you got the most recent error because you were declaring "id" in two different places. I haven't tested this, but I don't see why it wouldn't work.
7 posts
Posted 10 August 2012 - 12:49 AM
If it still gives you trouble after switching out the variable name, try using tonumber().
whats that
It changes the string or whatever to a number instead of it being a string.