Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
coolian

opencomputers modem_message always returns 0

Question

i have made some code to play around with the modem stuff but for some reason the modem_message event always returns 0 also im am running one of the scripts on a microcontroller and i am running minecraft version 1.7.10

code of the microcontroller:

local rs = component.proxy(component.list("redstone")())

local modem = component.proxy(component.list(modem)())

local identity = 1

 

a ={}

d = "id:"

f = tostring(identity)

a[1] = d

a[2] = f

modem.broadcast(1234, "id:1 is online")

while true do

  computer.pullSignal(0.5)

end

 

code of the not microcontroller:

local component = require('component')

local event = require('event')

local modem = component.modem

 

modem.open(1234)

while true do

  local _, _, from, port, message = event.pull("modem_message")

  print(message)

  os.sleep(0.1)

end

 

obviously both are connected with wires and the file with the modem.open is executed befor starting the microcontroller

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
12 hours ago, Molinko said:

The issue is with your variables returned by event.pull. the 6th rturn value is the message. You're assignment for message is the fifth which is actually distance which will always be 1 from a wired modem.

thanks now it works after adding _ befor message

Link to post
Share on other sites
  • 0

relating to signals are they are only used when utilizing the event.pull method on the wiki they state for example modem_message(Blach:blach, blah:blah) but those are more so the returns than anything you pass to the method and are what a event.pull method returns correct?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.