• Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Welcome to OpenComputers

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more!

This message will be removed once you have signed in.

  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.6.1 for MC 1.7.10, 1.8.9, 1.9.4 & 1.10.2. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)
  • 0
BKnight

How to set modem's address

Question

Hello

In the documentation modem.send() uses an address:string that identifies the receiver's destination. But modem's addresses are lonnng numbers. I've tried sending messages with just the first characters of the address, but that doesn't seem to work.
It's impractical to use the long default address created for the modem. Is there a way to set this address to something smaller and more practical? Or do I really have to work with the looong default address?

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

component.get(address: string[, componentType: string]): string | (nil, string)
Tries to resolve an abbreviated address to a full address. Returns the full address on success, or nil and an error message otherwise. Optionally filters by component type.

 

Share this post


Link to post
Share on other sites
  • 0

If you use the network loot disk I believe you can call network.icmp.bind('something'). That address will only be recognized by other computers using the network program

Share this post


Link to post
Share on other sites
  • 0

I didn't find a way to replace those addresses, but if u want to get an address easily, you have the sender(s) and the server which receive the message, but the sender need an address, so at the beginning of the infinite loop I put a 

component.modem.open(urport)
_,_,address = event.pull("modem_message")

function sendMsg(data,data2,data3)
  component.modem.send(address,port,data1,data2,data3)
end

And in the server which receive, you put in the infinite loop :

component.modem.open(port)
compoment.modem.broadcast(port)

Of course replace port by ur port ^^

It's not the best way because it send a broadcast message to everyone each loop but u can make something that when the address as been receive you can stop the broadcast

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now