Jump to content




Problems with pullEvent + rednet. Bug?

help lua turtle

  • You cannot reply to this topic
6 replies to this topic

#1 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

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.

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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

#3 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

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

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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 ...

#5 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 28 February 2013 - 04:53 AM

View PostTheOriginalBIT, on 28 February 2013 - 03:20 AM, said:

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).


View PostTheOriginalBIT, on 28 February 2013 - 03:20 AM, said:

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?

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 28 February 2013 - 06:42 AM

It should give you both. Are turtle commands eating the other event?

#7 Left4Cake

  • Members
  • 272 posts
  • LocationEarth

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.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users