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

ProjectRed Bundle Cable Problem - colors.subtract

Started by Chloe, 22 August 2015 - 07:31 PM
Chloe #1
Posted 22 August 2015 - 09:31 PM
I have a program that I wrote a long time ago that would turn on and off a lamp based on a lever input signal to the computer.

Here is the basic that I am trying to make the lamp go on and off…

I can make the lamp go on, but it won't go back off.




local cablePort1 = "top"


rs.setBundledOutput(cablePort1, 0 ) –CLEARS CABLE OF ALL REDSTONE SIGNALS


rs.setBundledOutput(cablePort1,colors.combine(rs.getBundledOutput(cablePort1),colors.red)) —TURN RED LAMP ON


rs.setBundledOutput(cablePort1,colors.subtract(rs.getBundledOutput(cablePort1), colors.red)) — (SHOULD) TURN RED LAMP OFF




I need to use the subtract command, because I have other input/outputs being used int he cable as well.

Was the subtract feature removed or changed?
Or am I doing something wrong?



I've tried with:

Project Red 4.6.1.80 thru Project Red 4.7.0pre8.92
ComputerCraft 1.74
MC 1.7.10
Forge .1448
Edited on 22 August 2015 - 07:32 PM
HPWebcamAble #2
Posted 22 August 2015 - 10:03 PM
Sounds like it should work, but there are a few minor things that could go wrong…

Just for fun, could you upload the program in question to pastebin, so we can see it?
(Make sure to post the link here)
Chloe #3
Posted 22 August 2015 - 10:08 PM
The command should work - I am using the exact script above. It should clear the cable, then turn on the red lamp, and then turn it off. There is no reason it shouldn't. Even using this basic script above, it doesn't work. I've tried multiple worlds too.

Can someone verify if the subtract command is working for them… maybe its my installation?
HPWebcamAble #4
Posted 22 August 2015 - 10:39 PM
Oh, you used that code?

Ok, it should turn the lamp off.
In fact, it shouldn't appear to do anything, since it turns the lamp on, then immediately off again.
Though you say it only turns it on?

Is the lamp actually connected to the red wire from that bundled cable? (I assume so)
Does another redstone component react the same? Like a piston, for example?

Could you post a screenshot of your setup?
Chloe #5
Posted 22 August 2015 - 10:49 PM
Yes, it is attached. The Framed (RED) wire is attached the the bundle cable coming out the top of the computer, and the Red Lamp is attached to the Red Framed wire. You can see the redstone light up on the end of the cable too… it doesn't matter what is attached to the end of the Red Framed wire… it just stays powered on… when in fact, it should have gone off.

That Subtract command isn't working. I think its a bug. Unless someone else can verify that it actually works with Projectred.

I am thinking that there is a bug.
Edited on 22 August 2015 - 08:53 PM
HPWebcamAble #6
Posted 22 August 2015 - 11:48 PM
The Framed (RED) wire is attached the the bundle cable coming out the top of the computer…
This is the setup you should have:

Computer > Bundled Cable > Color (Red in this case) > Lamp

Note that the color of the lamp doesn't matter at all, its only aesthetic.


Though you may have this correct.
Are you sure you are using CC 1.74? In 1.75, colors.subtract is confirmed to be broken, as the Bit API, which it uses, isn't working

The Bit API changed in CC 1.74, which broke colors.subtract.
For some reason, I thought CC 1.75 is where it was broken. CC 1.75 doesn't actually exist yet :wacko:/>

In any case, try this:
http://www.computerc...post__p__226922
Edited on 23 August 2015 - 04:39 AM
Bomb Bloke #7
Posted 23 August 2015 - 02:25 AM
Are you sure you are using CC 1.74? In 1.75, colors.subtract is confirmed to be broken, as the Bit API, which it uses, isn't working.

Rather, it's broken in 1.74, the build she said she was using. There currently is no 1.75.
HPWebcamAble #8
Posted 23 August 2015 - 06:40 AM
Rather, it's broken in 1.74, the build she said she was using. There currently is no 1.75.

Right. WAY too many versions of things to keep track of :P/>
b1gag3 #9
Posted 06 September 2015 - 11:41 PM
I don't know if you solved the problem already, but I got the same issue and searched for a solution, landing here. The current workaround for me is using the Bit-API;

bit.bxor(currentColor, colors[targetColor])

rs.setBundledOutput(cablePort1,bit.bxor(rs.getBundledOutput(cablePort1), colors.red))
Edited on 07 September 2015 - 06:08 AM