This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
[1.4] cable
Started by svennp, 14 March 2012 - 10:22 AMPosted 14 March 2012 - 11:22 AM
i suggest a cable for connecting the screen and disk drive, would be great if you don't want the screen and disk drive next to the computer!
Posted 14 March 2012 - 12:40 PM
That is a very good idea. The problem would be though, what if I connect a screen and a disk drive and others to one cable? How would the computer be able to adress them?
Posted 14 March 2012 - 02:03 PM
well, the cable would "expand" computer sides, (to a total of maybe 4 'virtual' sides) and everything connected to the cable would be considered attached to the computer as if it was right beside it.
Posted 14 March 2012 - 02:56 PM
I like Liraal's idea.
Lavawire cabling.
lavawire.init(side) - Initializes the connection.
lavawire.close(side) - Breaks the connection
lavawire.list(side) - Returns list of all device types connected to the lavawire cable
lavawire.mount(side, device#, virtualside) - Mounts the device conneted to the lavawire cable to a given virtual side
lavawire.mountFs(side, device#) - mounts the lavawire conneteced computer/turtle block's file system to the "lavashared" folder of the host OS
Lavawire only has a 4 block range (no more than 4 pieces of cable between the device and the host). Maybe extended by hub blocks?
Lavawire cabling.
lavawire.init(side) - Initializes the connection.
lavawire.close(side) - Breaks the connection
lavawire.list(side) - Returns list of all device types connected to the lavawire cable
lavawire.mount(side, device#, virtualside) - Mounts the device conneted to the lavawire cable to a given virtual side
lavawire.mountFs(side, device#) - mounts the lavawire conneteced computer/turtle block's file system to the "lavashared" folder of the host OS
Lavawire only has a 4 block range (no more than 4 pieces of cable between the device and the host). Maybe extended by hub blocks?
Posted 19 March 2012 - 08:23 PM
A nice idea. Would be really useful if you want to connect peripherals but don't want to interact/see the computer
Posted 19 March 2012 - 08:29 PM
only one problem though. coding such a thing does require access to the source code, so basically only dan can do it.
Posted 20 March 2012 - 05:40 AM
Guys, can't you just decompile to get source code of computercraft?
Posted 20 March 2012 - 08:22 AM
Yes we could but that isn't really allowed. We would have to get permissions by dan firstGuys, can't you just decompile to get source code of computercraft?
Posted 20 March 2012 - 11:48 AM
only one problem though. coding such a thing does require access to the source code, so basically only dan can do it.
Why does it? Surely the interface is easy enough to understand - it's just a case of interacting with peripherals and passing the data back to ComputerCraft. You'd pretty much be a transparent proxy. Multiple peripherals to one cable would be more complex, but not impossible.
Posted 20 March 2012 - 02:16 PM
Yeah you've got a point in there. I would try if I would understand modding a little bitWhy does it? Surely the interface is easy enough to understand - it's just a case of interacting with peripherals and passing the data back to ComputerCraft. You'd pretty much be a transparent proxy. Multiple peripherals to one cable would be more complex, but not impossible.
Posted 21 March 2012 - 01:58 AM
Maybe each peripheral will be assigned an id like computers? That way you could have multiple peripherals on one cable.
Posted 23 March 2012 - 05:42 PM
Maybe each peripheral will be assigned an id like computers? That way you could have multiple peripherals on one cable.
Let's not start giving peripherals unique ids. Maybe unique to one side. Attach a disk drive, a monitor, and a turtle to one side's lavacable (I like that, btw), and each would get a number. remove one and replace it with something else (such as removing the turtle and replacing it with another disk drive) and the number is reassigned.
Blatantly I give an example (because I cannot be otherwise eloquent about it):
pList = lavawire.list(side)
for x = 1, pList.len do
if pList(x) == "disk" then
os.copy(path/file,disk.getMountPath(getPeripheral(x))/file)
end
end
etc.
Mass disk writer. For the purposes of this particular code fragment,itallics are pseudo, bold is unmentioned, user-created content. It comes out easier if I just make stuff up as I go. Also why no code tags.
Posted 24 March 2012 - 04:52 AM
What if Peripheral has two cables connected?
What if Peripheral connected with a cable by several sides?
What if you make one cable from two with intersecting sets of Peripherals?
What if Peripheral connected with a cable by several sides?
What if you make one cable from two with intersecting sets of Peripherals?
Posted 24 March 2012 - 06:43 AM
What if Peripheral has two cables connected?
You can already connect peripherals to multiple terminals. Monitors don't like it so much, but I use disk drives like quick-copy machines all the time. It's actually how my turtle network works right now.
What if Peripheral connected with a cable by several sides?
A single cable would only recognize one block the one time, no matter how many cables are attached to it. See: Industrialcraft2 wires that only feed a machine once, even when there are multiple cables attached.
What if you make one cable from two with intersecting sets of Peripherals?
I don't quite understand what you are trying to ask here, but from what I can tell, you are asking about exactly what this latter discussion has been about. Connecting multiple peripherals to multiple computers would have to reference from the terminals, not globally. This is what I was trying to get at in my post. If I've missed something, tell me about it in the morning.
To reiterate: Two computers on a single line would individually look at the line when a new peripheral was attached (peripheral and peripheral_detach). Independently of each other, they would compile a list of peripherals on the line. In fact, you could make sub-sets on a single line by making them a certain space away, if lavawire was implemented. Put three disk drives in the center, with two further wires to each side. I would continue, but I think I made my point, and I'm getting worked up. Rise-Against + late night + pepsi max = not good, assuming good is true.
Posted 24 March 2012 - 07:23 AM
I mean peripheral id is not good idea. If you reuse id on different cables you'll be in bad situations when connect two cables. And should peripheral has different id for different cable?
In another thought peripherals should have internal ids already.
May be cable should be peripheral, which translate methods from {"north","south","west","east","top","bottom"} sides? Like that:
cable=peripheral.wrap("right")
disk=cable.wrap("north")
mon=cable.wrap("top")
It can be done as peripheral without Dan200 efforts. With or without lenght check.
If I'm not mistaken IC2 cables feed each side of machine. Can be wrong, not tested, just read somewhere.
In another thought peripherals should have internal ids already.
May be cable should be peripheral, which translate methods from {"north","south","west","east","top","bottom"} sides? Like that:
cable=peripheral.wrap("right")
disk=cable.wrap("north")
mon=cable.wrap("top")
It can be done as peripheral without Dan200 efforts. With or without lenght check.
If I'm not mistaken IC2 cables feed each side of machine. Can be wrong, not tested, just read somewhere.
Posted 25 March 2012 - 02:51 PM
There could be a lavaconnector(?). You connect it like this:
[C][L][W][W][L][P]
C = computer, L = lavaconnector, W = lavawire, P = peripheral.
The lavaconnectors could have:
1. Colors (a dye in the recipe?)
2. Unique IDs
3. IDs you could set from a computer
If they would be colored, the lavawire would change the color to the color of the lavaconnector connected to the computer. It would only connect to lavaconnectors and lavawires with the same color. The cables would call the peripherals like this:
m = peripheral.wrap("back") –The lavaconnector
disk.eject(m.disk1) – ejects the disk from the first disk drive…
m.monitor1.write("Monitor") –Writes "Monitor" to the first monitor…
They would label them like a computer labels disks.
[C][L][W][W][L][P]
C = computer, L = lavaconnector, W = lavawire, P = peripheral.
The lavaconnectors could have:
1. Colors (a dye in the recipe?)
2. Unique IDs
3. IDs you could set from a computer
If they would be colored, the lavawire would change the color to the color of the lavaconnector connected to the computer. It would only connect to lavaconnectors and lavawires with the same color. The cables would call the peripherals like this:
m = peripheral.wrap("back") –The lavaconnector
disk.eject(m.disk1) – ejects the disk from the first disk drive…
m.monitor1.write("Monitor") –Writes "Monitor" to the first monitor…
They would label them like a computer labels disks.
Posted 25 March 2012 - 06:55 PM
what do you think about this scheme?
Cable
[indent=1]connects like red alloy wire in RP2 or something like that. Can be connected to pc and connector/controller.[/indent]
Connector/controller
[indent=1]It can be colored to make difference between them, it doesnt needs and UID.[/indent]
[indent=1]It can have direction.[/indent]
Computer
Floppy drive
Monitor
Rules:
[indent=1]Each peripheral can be connected to multiplie connectors/controllers.[/indent]
[indent=1]To get peripheral wee ned only side where cable is connected to computer and color of the connector/controller.[/indent]
[indent=1]If there more than one connector/controller with single color then (first found / nearest by cable) will be returned.[/indent]
[indent=1]Each peripheral have its metatable so it can be used as class.[/indent]
Pseudo code to use:
monitor1 = cable.get("right","red")
monitor1.write("Hello!")
floppy = cable.get("right","green")
print(floppy.diskName)
floppy.eject()
something like that ?
Posted 25 March 2012 - 08:22 PM
Sounds like a plan. And you could have one type of peripheral connected to 1 color and you could write use multiple peripherals at once with tha methode
Posted 25 March 2012 - 09:29 PM
Hmm… I don't understand why you have to complicate things. Surely you can just place peripherals next to the cable and it will detect them? Saves messing about.
Posted 25 March 2012 - 09:41 PM
I think the problem is in indexing peripherals in computer. I dont mind adding UID to monitors and floppys but its kinda compicated to use. So easier way is separate everything by color, its kids game :3Hmm… I don't understand why you have to complicate things. Surely you can just place peripherals next to the cable and it will detect them? Saves messing about.
Posted 25 March 2012 - 09:51 PM
I like the idea with the colors more than the idea with UIDsI think the problem is in indexing peripherals in computer. I dont mind adding UID to monitors and floppys but its kinda compicated to use. So easier way is separate everything by color, its kids game :3Hmm… I don't understand why you have to complicate things. Surely you can just place peripherals next to the cable and it will detect them? Saves messing about.
Posted 26 March 2012 - 03:32 PM
Now see, this is why my tag still says Clueless.
Also, now I can see this as being useful for, say, a program to disable terminals remotely. So, if I was not a fan of this suggestion before, I am definitely now.
Also, now I can see this as being useful for, say, a program to disable terminals remotely. So, if I was not a fan of this suggestion before, I am definitely now.
Posted 31 March 2012 - 06:30 AM
At the same time if you use user defined UIDs, you can free up colors for something else.
Posted 31 March 2012 - 10:40 PM
Easy way would be as I stated above. When you initialize the wire connection it creates a list of all the connected peripherals, just use the position on that list as a temporary ID.
As long as the peripheral list creation is consistent, there should be no problems with the ID's not being static.
As long as the peripheral list creation is consistent, there should be no problems with the ID's not being static.
Posted 01 April 2012 - 01:35 AM
We need dan to see this :o/>/>
Posted 01 April 2012 - 10:19 PM
@Neowulf
Good but if you connect something else it may change list order or something. What if make device create static UID on placing ? It can save stackability and allow you use it without any hurt on changes.
Good but if you connect something else it may change list order or something. What if make device create static UID on placing ? It can save stackability and allow you use it without any hurt on changes.
Posted 02 April 2012 - 04:45 PM
Before plug and play and USB, you had to manually set addresses on any ISA card you installed in your machine so it wouldn't use one already in use. Then you had to give those settings to the driver when it was loaded (in either config.sys or autoexec.bat).
Not having the cable system automatically hot swappable is fine by me, it gives people an interesting coding challenge.
I still remember the settings for our soundblaster 16. Hex: 220, IRQ 5, DMA 1, High DMA 5
I don't know how many games I had to put that into…
Not having the cable system automatically hot swappable is fine by me, it gives people an interesting coding challenge.
I still remember the settings for our soundblaster 16. Hex: 220, IRQ 5, DMA 1, High DMA 5
I don't know how many games I had to put that into…
Posted 02 April 2012 - 05:44 PM
say in robot voice
to…good.of..an..idea…*puts gun in mouth…*pulls trigger…
to…good.of..an..idea…*puts gun in mouth…*pulls trigger…
Posted 02 April 2012 - 09:49 PM
@Neowulf
Yes, I remember these good times. So youre talking about things wich was inside PC where all slots is limited and easy accessible. But peripherals is outside and with cable it may be connected in unlimited count so you cant give them IDs by algorythm wich depends on cable placement or something. Also giving them (pseudo)random IDs on their placement (e.x. as chest does) can make some challenge about writing own pnp and device mounting system ;3
Yes, I remember these good times. So youre talking about things wich was inside PC where all slots is limited and easy accessible. But peripherals is outside and with cable it may be connected in unlimited count so you cant give them IDs by algorythm wich depends on cable placement or something. Also giving them (pseudo)random IDs on their placement (e.x. as chest does) can make some challenge about writing own pnp and device mounting system ;3
Posted 02 May 2012 - 09:40 PM
For colors you could use the color api to get the colors.
Only 16 colors(<-Is it right) per cable.
So the max number of peripherals is 96 (16 Colors for each side)
It would have a seperate function in the peripheral Lib
Functions:
peripheral.isCable(side) returns bool
peripheral.callCable(side, color, function)
peripheral.getTypeCable(side, color)
peripheral.getMethodsCable(side, color)
peripheral.isPresentOnCable(side, color)
Only 16 colors(<-Is it right) per cable.
So the max number of peripherals is 96 (16 Colors for each side)
It would have a seperate function in the peripheral Lib
Functions:
peripheral.isCable(side) returns bool
peripheral.callCable(side, color, function)
peripheral.getTypeCable(side, color)
peripheral.getMethodsCable(side, color)
peripheral.isPresentOnCable(side, color)
Posted 03 May 2012 - 07:24 AM
I would prefer a more generic version:
peripheral.bind(cableSide,color,virtualside)
will enable you to call all other methods with the default
peripheral.call(virtualside,name,…)
this would also enable a better event management.
alternative would be to use side names like "cableside:colortag", which would not need binding.
Some kind of cable could even be written as a seperate peripheral, it would only need to add a "peripheral" api file which will override the natives as term or turtle do. I made a coding attempt, however I'm not quite shure how to write a network management system.
peripheral.bind(cableSide,color,virtualside)
will enable you to call all other methods with the default
peripheral.call(virtualside,name,…)
this would also enable a better event management.
alternative would be to use side names like "cableside:colortag", which would not need binding.
Some kind of cable could even be written as a seperate peripheral, it would only need to add a "peripheral" api file which will override the natives as term or turtle do. I made a coding attempt, however I'm not quite shure how to write a network management system.
Posted 28 May 2012 - 12:54 AM
Hii, sry for bad english etc.
but when you add this , why you doint add IDS "as with Redpower" so you can connect mutch monitors etc on 1 cable …
but when you add this , why you doint add IDS "as with Redpower" so you can connect mutch monitors etc on 1 cable …
Posted 28 May 2012 - 05:57 AM
Why? It requires?
Posted 28 May 2012 - 06:22 AM
Well, using an id system would be best, but for that dan would have to do the work. The other, color-tagged system could be implemented as a separate peripheral system. I actually got quite far, but I'm stuck with the routing code giving me infinite loops and stuff.
Posted 28 May 2012 - 07:39 AM
Considering Notch hasn't given CC permission to do the same I imagine it's no big deal unless you actually release the modified code. All things considered I think it would be best to ditch the old side system and use IDs instead. For example:Yes we could but that isn't really allowed. We would have to get permissions by dan firstGuys, can't you just decompile to get source code of computercraft?
handle = rednet.open(8) - Opens the appliance on port 8 (ports 1-6 are sides, ports 7 and beyond are cabled connections).
rednet.broadcast("Hello", handle)
That way you can run multiple things at once.
Posted 28 May 2012 - 08:28 AM
Considering Notch hasn't given CC permission to do the same I imagine it's no big deal unless you actually release the modified code.
?? CC mods MC using an API provided by Notch same as any other mod… You can create periph's(mods) for CC with an API provided by Dan.. :)/>/>
Posted 28 May 2012 - 06:37 PM
Considering Notch hasn't given CC permission to do the same I imagine it's no big deal unless you actually release the modified code.
?? CC mods MC using an API provided by Notch same as any other mod… You can create periph's(mods) for CC with an API provided by Dan.. :)/>/>
The API is not provided by Notch, nor anyone at Mojang.
Posted 31 May 2012 - 02:14 AM
Or how about using ribbon cables from RP2 that are used for it's computers? Also for IDs, for every component (monitor, drive, etc.) to the GUI would be added field for peripheral ID string, this would be any string that is unique among all peripherals linked to specified computer, then wherever "side" parameter is used, it'll be changed to deviceID, so there will be very little changes to maincode and code of apps, given you give peripherals IDstrings related to their position relative to computer.
For those peripherals that already doesn't have GUI, one will be created with just input field for IDstring and OK button. And for the sake of simplicity, all connected monitors will be changed when one of them is changed (I mean IDstring).
For those peripherals that already doesn't have GUI, one will be created with just input field for IDstring and OK button. And for the sake of simplicity, all connected monitors will be changed when one of them is changed (I mean IDstring).
Posted 03 July 2012 - 02:01 PM
Seems solved!
Look at the ARP 1.7
Look at the ARP 1.7
Posted 06 July 2012 - 06:10 PM
Seems solved!
Look at the ARP 1.7
YAY! checking it out right now!
Posted 07 July 2012 - 01:17 AM
I say just use cables from RedPower. Each wire connects to one thing, and if it has multiple connections, just throw an error and disable connections to that wire until the problem if fixed.
Posted 07 July 2012 - 08:40 AM
CC should not require RP2 imho. What Xfel did is amazing it also is an easy access-multiplexer