Jump to content


throwaway4140's Content

There have been 2 items by throwaway4140 (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#277849 rednet.receive() timeout not working?

Posted by throwaway4140 on 20 July 2018 - 12:00 PM in Ask a Pro

View PostBomb Bloke, on 20 July 2018 - 02:34 AM, said:

It's a bug in the pre-release version of ComputerCraft you're using. It's fixed in later builds, check the links through my signature.

Thank you so much! I thought I was running the latest version since I downloaded the mod using the Twitch launcher.



#277839 rednet.receive() timeout not working?

Posted by throwaway4140 on 20 July 2018 - 01:32 AM in Ask a Pro

Hello,

Whenever I try to specify the timeout in rednet.receive() it gives me the following error which I think is a bug:

startup.lua:38: bad argument #2 (expected number, got number)

This is the code I'm using. It's asks the turtles with ids 0,1,2,3,4 for their status.

if command == "next" then
  readyTurtles = 0

  for i = 0, 4 do
   id = 5
   rednet.send(i,"status")
   id,msg,protocol = rednet.receive(2)
  
   if id == i then
	print("ID " .. id .. ": ready")
	readyTurtles = readyTurtles + 1
   else
	print("ID " .. i .. ": not ready")
   end
  end

  if readyTurtles == 5 then
   rednet.broadcast("1337")
  end

else
  rednet.broadcast(command)
end

Using ComputerCraft1.80pr1

I have no clue what I'm doing wrong here, as the wiki does the same thing.