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

Signal Converter

Started by gngz, 02 January 2013 - 04:29 AM
gngz #1
Posted 02 January 2013 - 05:29 AM
Make a way to convert the signal from RP2 Cables to Modem and vice-versa.

Regards,
Orwell #2
Posted 02 January 2013 - 05:35 AM
That's quite easy to achieve in CC right now. What would be the benefits of this?
Cloudy #3
Posted 02 January 2013 - 06:06 AM
I don't get the aim?
gngz #4
Posted 02 January 2013 - 07:45 AM
The aim is can make a network with cable a wireless modems. To connect citys to anothers.
Leo Verto #5
Posted 02 January 2013 - 07:56 AM

local cableSide = "left"
local modemSide = "right"
while true do
  rednet.open(modemSide)
  id, msg = rednet.receive()
  rednet.close(modemSide)
 
  rednet.open(cableSide)
  rednet.broadcast(msg) -- Can be replaced with rednet.send()
  rednet.close(cableSide)
end
I can't guarantee this will work but doing what you want is about as simple as that, no need to add or change anything.
gngz #6
Posted 02 January 2013 - 08:04 AM

local cableSide = "left"
local modemSide = "right"
while true do
  rednet.open(modemSide)
  id, msg = rednet.receive()
  rednet.close(modemSide)

  rednet.open(cableSide)
  rednet.broadcast(msg) -- Can be replaced with rednet.send()
  rednet.close(cableSide)
end
I can't guarantee this will work but doing what you want is about as simple as that, no need to add or change anything.

I want to connect computers , but computers have to comunicate to another and no broadcast to allnetwork.
Leo Verto #7
Posted 02 January 2013 - 08:24 AM
I want to connect computers , but computers have to comunicate to another and no broadcast to allnetwork.
Replace rednet.broadcast(msg) with rednet.send(99, msg) and change 99 to the receiver's ID:
gngz #8
Posted 02 January 2013 - 08:25 AM
I want to connect computers , but computers have to comunicate to another and no broadcast to allnetwork.
Replace rednet.broadcast(msg) with rednet.send(99, msg) and change 99 to the receiver's ID:

But have to be compatible with created programs. It have to be hardware.
ChunLing #9
Posted 02 January 2013 - 08:29 AM
That sounds suspiciously like "I don't want to program it myself".
Leo Verto #10
Posted 02 January 2013 - 08:34 AM
This is so easy to set up but you want the mighty CC devs to add a new peripheral just because you are too lazy?
gngz #11
Posted 02 January 2013 - 08:36 AM
This is so easy to set up but you want the mighty CC devs to add a new peripheral just because you are too lazy?

No, beacause have to be compatible with all programs that uses rednet… Its like a router.
Leo Verto #12
Posted 02 January 2013 - 08:38 AM
This is so easy to set up but you want the mighty CC devs to add a new peripheral just because you are too lazy?
No, beacause have to be compatible with all programs that uses rednet… Its like a router.
You can use a computer with a simple script (like mine) to do that.
gngz #13
Posted 02 January 2013 - 08:42 AM
This is so easy to set up but you want the mighty CC devs to add a new peripheral just because you are too lazy?
No, beacause have to be compatible with all programs that uses rednet… Its like a router.
You can use a computer with a simple script (like mine) to do that.

No because it's no compatible. If you use a program in computer in A City and you want to send a message to a computer in City B. (Connected by Modems but your city have only a cable network). You have to send a message to computer converter with message and id to the person of the other city and it's no compatible with current programs .
ChunLing #14
Posted 02 January 2013 - 08:42 AM
Yeah, rednet relays are pretty easy. Signal converters are something different, but also pretty easy. Making something that does both, pretty easy.
gngz #15
Posted 02 January 2013 - 08:54 AM
P.S: Another use is to make a larger areas with wireless.

If CC team wants, they can make this sugestion by connecting a bundled cable to a modem.
Leo Verto #16
Posted 02 January 2013 - 08:56 AM
This is so easy to set up but you want the mighty CC devs to add a new peripheral just because you are too lazy?
No, beacause have to be compatible with all programs that uses rednet… Its like a router.
You can use a computer with a simple script (like mine) to do that.
No because it's no compatible. If you use a program in computer in A City and you want to send a message to a computer in City B. (Connected by Modems but your city have only a cable network). You have to send a message to computer converter with message and id to the person of the other city and it's no compatible with current programs .
It depends on how your city's network works, using bundled cables means you need to specify where you want the message and my script does not touch the message at all so it would still include the receiver.
immibis #17
Posted 02 January 2013 - 02:13 PM
It depends on how your city's network works, using bundled cables means you need to specify where you want the message and my script does not touch the message at all so it would still include the receiver.
Wtf are you talking about?
Also, you can't open and close rednet every time you send a message. They have to stay open.

Rednet supports both bundled cable and wireless modems. In both cases, the sender is always set to the computer that sent the message, and the message is only received by the computer you send it to.

Say computer A is connected to computer B, which is connected to C, which is connected to D.
B and C are relays.
When A wants to send a message to D, it will call rednet.send(ID_of_D, message).
B will not receive the message, since B's ID is not the same as D's ID, so the message cannot be relayed.

However, you could override the rednet API on A and D, so that they send specially formatted messages to the relays, translating:
rednet.send(ID_of_D, message)
into:
rednet.send(ID_of_B, "send "..ID_of_D.." "..message)

so that B will be able to relay the message.
Leo Verto #18
Posted 02 January 2013 - 02:24 PM
Snip
Does bundled cable rednet allow you to directly send messages to other computers? Sorry, I wasn't sure about that.

I probably was thinking faster than writing again, I wanted to say "you need to specifiy where you want the message to go" and I thought of something like you explained, maybe I should've explained that further.
I also should have mentioned my term "receiver's ID" is supposed to be the ID of the receiving router.
immibis #19
Posted 02 January 2013 - 06:09 PM
Snip
Does bundled cable rednet allow you to directly send messages to other computers? Sorry, I wasn't sure about that.

I probably was thinking faster than writing again, I wanted to say "you need to specifiy where you want the message to go" and I thought of something like you explained, maybe I should've explained that further.
I also should have mentioned my term "receiver's ID" is supposed to be the ID of the receiving router.

Bundled cable rednet acts exactly like wireless rednet, except it's slower… you could also modify it to intercept messages sent directly to other computers, and probably fake sender IDs. So you *could* have a transparent relay with bundled cables, but you'd have to modify rednet, which might not be worth the trouble.
Sebra #20
Posted 02 January 2013 - 07:34 PM
If CC team wants, they can make this sugestion by connecting a bundled cable to a modem.
You need some calculations to use bundled cable for rednet. It is not easy for "special converter" but easy for Computers.
Program your router yourself or use one of programs from this forum.
immibis #21
Posted 02 January 2013 - 08:00 PM
If CC team wants, they can make this sugestion by connecting a bundled cable to a modem.
You need some calculations to use bundled cable for rednet. It is not easy for "special converter" but easy for Computers.
Program your router yourself or use one of programs from this forum.
That's also a problem. Bundled cables are just 16 redstone wires, how would you reasonably connect one directly to a modem?
Cloudy #22
Posted 03 January 2013 - 06:26 AM
Yeah, this isn't going to happen. We may add a wired networking solution in the future, but we would never make a converter - this would be handled by the computers trivialy.