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

Problems with pullEvent + rednet. Bug?

Started by jag, 28 February 2013 - 02:04 AM
jag #1
Posted 28 February 2013 - 03:04 AM
So while I was playing today on a MindCrack server (v8.1.1) I noticed a really weird bug while coding my turtle.
I was sending rednet messages between a main computer and a turtle, but I noticed a clear difference between them.
On the computer I got basically this setup:

while running do
  local ev,p1,p2,p3 = os.pullEvent()
  if ev == "rednet_message" then
	-- do something
  end
end
This worked great, as expected. But when I did this on my turtle I noticed some huge differences.
First off, I noticed that pullEvent wasn't returning "rednet_message", but "modem_message".

OBS: This only applied to one of my turtle programs.

Os.pullEvent returned this:

Should be
rednet_message [id] [message] [distance]

But it returned
modem_message [side of the modem] [some random integer] [id] [message] [distance]

This (for me) is very strange, I understand if they added a update on this, but I don't understand why it only happens on 1 program.

EDIT: Forgot to say it; we are running ComputerCraft v1.5 (rev 887) at the server.
theoriginalbit #2
Posted 28 February 2013 - 03:20 AM
ComputerCraft v1.5 rev 887 ??? o.O

Anyways. this is not a bug. how have you missed such a big change, everyone has been talking about it for ages.

ComputerCraft Changelog (read the first point)

Tutorial on Usage
jag #3
Posted 28 February 2013 - 03:29 AM
One of the reasons I didnt understand the change was because it didnt say anything on the wiki
theoriginalbit #4
Posted 28 February 2013 - 03:32 AM
It says heaps on the wiki … I know of about 3 or 4 pages … however the wiki isn't updated by dev team … its updated by us, the users, so sometimes info is wrong or severely outdated on the forums …
jag #5
Posted 28 February 2013 - 04:53 AM
ComputerCraft v1.5 rev 887 ??? o.O

I looked in the console for my minecraft instance, and it just said Computercraft v1.5 (rev 887).


Anyways. this is not a bug. how have you missed such a big change, everyone has been talking about it for ages.

ComputerCraft Changelog (read the first point)

Tutorial on Usage
I have not missed the change on rednet. I know that they've added channels and I've seen how they're useful. But the thing I have missed is that there's a replacement for the "rednet_message" event.

Could you explain to me; why does pullEvent return "rednet_message" on my other programs but "modem_message" on that just specific program?
Lyqyd #6
Posted 28 February 2013 - 06:42 AM
It should give you both. Are turtle commands eating the other event?
Left4Cake #7
Posted 28 February 2013 - 07:18 AM
I have a simmier issue, and I managed to boil it down to this

while true do
	rednet.send(server, request)
	id, msg = rednet.receive(5)
	print("msg")

	os.pullEvent
end

The computer whos id is server simply respond back with info based on what request it, but for my explanation just assume that it responds with a string no matter what.

The first time msg prints fine but the seond time the msg prints nill. How ever if I remove os.pullEvent it works just fine.