9 posts
Posted 24 May 2014 - 01:41 AM
Ok about 20-25 minutes ago this code worked. now i get zip. its fairly basic.
http://pastebin.com/fB5AdZT6i get it to print the ID after that it should send a message and print that is has or that is has failed.
nothing about rednet is being sent or printed.
31 posts
Location
Brazil
Posted 24 May 2014 - 05:22 AM
Try putting:
print("This computer ID is "..tostring(i))
Because the print only accept string, so you MUST convert it vefore printing.
7508 posts
Location
Australia
Posted 24 May 2014 - 05:31 AM
Try putting:
print("This computer ID is "..tostring(i))
Because the print only accept string, so you MUST convert it vefore printing.
false. print accepts anything, it calls
tostring on anything you provide. the
only time you need to convert certain data types is with the concat operator
.. but you don't need to do that with strings or numbers!
as for the OPs problem, its with you if statement, rednet.send no longer returns its success in ComputerCraft 1.6+ meaning the
else condition will always be fired.
31 posts
Location
Brazil
Posted 24 May 2014 - 05:52 AM
Well… Good to know, anyways I'm a beginner still, just try to help.. :D/>
7508 posts
Location
Australia
Posted 24 May 2014 - 05:55 AM
Well… Good to know, anyways I'm a beginner still, just try to help.. :D/>
take a look at the source for
print and you'll see :)/>
function print( ... )
local nLinesPrinted = 0
for n,v in ipairs( { ... } ) do
nLinesPrinted = nLinesPrinted + write( tostring( v ) )
end
nLinesPrinted = nLinesPrinted + write( "\n" )
return nLinesPrinted
end
9 posts
Posted 24 May 2014 - 09:25 AM
Well a small edit in code yeilds same result. I have switched it back the the orignal code i made removing the if statement so the secion now reads
rednet.send(i, "start")
print("message reveived")
same thing happens. prints ID and then closes the program.
is there something else i am missing.
Other bug.
When reloading my SP world the entire code works as normal the first time. Do i have to close rednet before i send the signal again ?
^^ just relised how stupid that sounds. I meant to say Do i have to close rednet before i reset the program that opens it and sends the signal. Sorry
Edited on 24 May 2014 - 10:07 PM