#1
Posted 19 January 2013 - 11:21 PM
iv'e got an error when i send something from my other computer..
and its showing only when im using "print(hey)"
rednet.open("back")
term.clear()
term.setCursorPos(1,1)
i, m = rednet.receive()
write("van "..i.."")
print("hey")
write(m)
beside that.. can i put an varible or a string in a print()?
like this :
print(m)
or
print("you've got "..m.." cakes")
thats the reason im using write
#2
Posted 19 January 2013 - 11:25 PM
what is the exact error?
#3
Posted 19 January 2013 - 11:28 PM
my error is
"startup"6" attempt to call string"
(ps. im dutch.. sorry for the bad english )
#5
Posted 19 January 2013 - 11:37 PM
the one that is sending is:
term.clear()
term.setCursorPos(1,1)
rednet.open("back")
print("Mail box")
print()
write("Name: ")
n=read()
write("to: ")
i=tonumber(read())
print("message:")
print()
m=read()
rednet.send(i, m)
i think its something with "tonumber()" .. i dont know of that is true..
#6
Posted 19 January 2013 - 11:41 PM
so the error is on line 6 of that EXACT code? o.O
have you tried rebooting the computer recently? you may have overridden an OS function at some point...
Edited by TheOriginalBIT, 19 January 2013 - 11:42 PM.
#7
Posted 19 January 2013 - 11:44 PM
On the other hand, your code has no errors...
This is exactly right to concatenate a string and a variable.
print("you've got "..m.." cakes")
Before that, maybe add a print(type(m)) to see if it's a string or whatever.
PS: Please use [code]code here...[/code] tags
#8
Posted 19 January 2013 - 11:45 PM
TheOriginalBIT, on 19 January 2013 - 11:41 PM, said:
so the error is on line 6 of that EXACT code? o.O
have you tried rebooting the computer recently? you may have overridden an OS function at some point...
yeah, i know.. so maybe the receiver must convert the "tonmuber" to a string again?
#9
Posted 19 January 2013 - 11:48 PM
#10
Posted 19 January 2013 - 11:48 PM
phaleron, on 19 January 2013 - 11:45 PM, said:
TheOriginalBIT, on 19 January 2013 - 11:41 PM, said:
so the error is on line 6 of that EXACT code? o.O
have you tried rebooting the computer recently? you may have overridden an OS function at some point...
yeah, i know.. so maybe the receiver must convert the "tonmuber" to a string again?
#11
Posted 19 January 2013 - 11:52 PM
TheOriginalBIT, on 19 January 2013 - 11:48 PM, said:
phaleron, on 19 January 2013 - 11:45 PM, said:
TheOriginalBIT, on 19 January 2013 - 11:41 PM, said:
so the error is on line 6 of that EXACT code? o.O
have you tried rebooting the computer recently? you may have overridden an OS function at some point...
yeah, i know.. so maybe the receiver must convert the "tonmuber" to a string again?
#12
Posted 19 January 2013 - 11:59 PM
first what i have done whas removed print() out of
print("message:")
print() -- this one removed
m=read()
and then i rebooted the computers
so helpfull!
thanks guys!
#13
Posted 20 January 2013 - 12:05 AM
I want to send i, m and n with
rednet.send(i, m, n)
when i do something like this
write("name ")
n=read()
then when i send Varible "n" there stands a number 3.
do you guys know a solusion?
#14
Posted 20 January 2013 - 12:27 AM
phaleron, on 20 January 2013 - 12:05 AM, said:
I want to send i, m and n with
rednet.send(i, m, n)
when i do something like this
write("name ")
n=read()
then when i send Varible "n" there stands a number 3.
do you guys know a solusion?
Sending end
-- read the variables here rednet.send( i, textutils.serialize( {m,n} ) )
Receiving end
-- receive rednet msgTable = textutils.unserialize( receivedMsg ) m = msgTable[1] n = msgTable[2]
This will make a table of all the items you want to send by turning it into a string and sending it... Then at the other end will turn it back into a table where you can use it.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users