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

Problem with receiving multiple signals

Question

Problem with receiving multiple signals

Hello,

I am using nuclearcraft and I want to create a program that visualises the reactor information, this information would include RF stored, efficiency, etc.  However, I am using 5 reactors and want all 5 to be shown on one screen, through one computer. I have set up a wired network in which each reactor has it's own computer pulling the reactor information and sending it down the line, through a central relay and to a central computer. My problem is that you have to use event.pull("modem_message") and because of this, you can't differentiate between different inputs.

The closest I got was using multiple ports and using if and elseif statements to print depending on the address of the network card that sent the message. This meant that they would takes turns printing their values but not simultaneously.

To note:

-Using threads or sides is something I thought of

-Using a script or, the aforementioned, threads and then calling to them in a main program

-I tried using if

                    table.insert()

and then printing the table, though this didn't work, the way I did it.

Can somebody help me understand a method in which I can differentiate between inputs coming into to one computer.

Thanks in advance :)

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1

The modem_message event also gives you the component address of the sending card. You could use that.

You could also give each computer an id and have the computer send that on every message.

Share this post


Link to post
Share on other sites
  • 0
4 hours ago, Nexarius said:

The modem_message event also gives you the component address of the sending card. You could use that.

You could also give each computer an id and have the computer send that on every message.

How do I go about  implementing this/how do you do it?

When I was using ifelse statements, I would do :

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

    if messagesender == "--network card ID that sent the message--" then

    print(message)

   ifelse messagessender == "--the other network card--" then

  print(message)

etc

This would print the last signal it received and would print only that. Is "messagesender" what you mean by component address?

 

Share this post


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.