This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Zukamimozu's profile picture

Modem help (RedNet)

Started by Zukamimozu, 24 March 2012 - 02:44 AM
Zukamimozu #1
Posted 24 March 2012 - 03:44 AM
Alright , so I am recently new to this mod and have been trying to get a simple message system working, I followed a tutorial and got that one working but now I want to make a new one myself and it isn't working out for me. So basically I am trying to get to so when you run it, it will ask for an computer Id then after entering that it will ask for the message, but that's not working out for me so I will show you what I have so far.



print "Recipient: "
id = input
input = read()

print "Message: "
message = input
input = read()

rednet.send(id, message)



Yea so any help would be appreciated :(/>/>
oh also I do have another computer hooked up with a receiving message program.
Advert #2
Posted 24 March 2012 - 04:51 AM
You don't need the middleman input variable, and you're assigning them in the wrong order (there are no pointers in Lua, except for tables):


print "Recipient: "
id = input 
input = read() -- Should be swapped with the previous line, and converted to a number; or:
id = tonumber(input())

print "Message: "
message = input
input = read() -- Same as above, except that this time, you dont want to convert it to a number

rednet.send(id, message)
Zukamimozu #3
Posted 24 March 2012 - 05:03 AM
print "Recipient: "



input = read()

id = input
id = tonumber(input())

print "Message: "


input = read()
message = input

rednet.send(id, message)


k, so I put this exactly and after I enter the recipient it says mail:4: attemp to call nil

I do understand that it means something like found an error on line 4 in the program mail. Any help???
Advert #4
Posted 24 March 2012 - 05:47 AM
My bad, that'd be

id = tonumber(input) -- or
id = tonumber(read())
Zukamimozu #5
Posted 24 March 2012 - 02:58 PM
Oh okay that worked thanks :(/>/>