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

Hey! I have a bundled Cable question!

Started by PlotTwistGamer, 25 January 2018 - 01:47 AM
PlotTwistGamer #1
Posted 25 January 2018 - 02:48 AM
term.clear()
term.setCursorPos(1,1)

m = peripheral.wrap("top")
term.redirect(m)
term.setBackgroundColor(colors.white)
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.orange)
print "[REACTOR CENTERS]"

term.setTextColor(colors.black)

print "REACTOR 1:"
print "REACTOR 2:"
print "REACTOR 3:"
print "REACTOR 4:"
print "REACTOR 5:"
————————————————————————-
What I'm trying to do here, is that whenever my computer senses a white input, it says "REACTOR 1: ENABLED" and when that signal is gone, it changes it to "REACTOR 1: DISABLED" and so on and so forth moving down the list. How would I do this? (How do I get the computer to change multiple values using BUNDLED CABLE). I already know how to use "while true do" and if statements. I just don't know what the code is for the bundled cable thing. Can anyone help? It would be greatly appreciated. Thanks! :D/>

EDIT: I did put indentations but the site automatically removed them lol
Edited on 25 January 2018 - 01:49 AM
Dog #2
Posted 25 January 2018 - 03:16 AM
Take a look at the Wiki page for the redstone API - that should get you started.

If you want to test for white on the back of the computer, for example, you might do something like this…

if rs.testBundledInput("back", colors.white) then
  --# do stuff if white is detected
else
  --# do stuff if white isn't detected
end

The reason the site removed your indentations is because you aren't using CODE tags around your code. They look like this…
[CODE]
put your code here
[/CODE]
PlotTwistGamer #3
Posted 25 January 2018 - 03:40 AM
Oh thanks! :D/>
PlotTwistGamer #4
Posted 25 January 2018 - 03:59 AM
Take a look at the Wiki page for the redstone API - that should get you started.

If you want to test for white on the back of the computer, for example, you might do something like this…

if rs.testBundledInput("back", colors.white) then
  --# do stuff if white is detected
else
  --# do stuff if white isn't detected
end

The reason the site removed your indentations is because you aren't using CODE tags around your code. They look like this…
[CODE]
put your code here
[/CODE]

The thing is, I want it to be a while true do statement for EACH reactor. Not just one. I've reduce the amount of reactors to 3 for simplicity reasons.

EDIT: NEVERMIND I WAS BEING A DINGUS, IT WORKS NOW THANKS YOU
Edited on 25 January 2018 - 03:12 AM
PlotTwistGamer #5
Posted 25 January 2018 - 04:11 AM
This doesn't work with even one reactor, let alone 3?
EDIT: Nevermind I was being a dingus
Edited on 25 January 2018 - 03:12 AM
Dog #6
Posted 25 January 2018 - 04:11 AM
The thing is, I want it to be a while true do statement for EACH reactor. Not just one. I've reduce the amount of reactors to 3 for simplicity reasons.

I don't understand what the number of loops has to do with what I posted. I'm also unclear as to why you need a separate loop for each reactor. Based on what you've described a single loop with if/else statements seems like the easiest way to go.

while true do
  os.pullEvent("redstone")
  if rs.testBundledInput("back", colors.white) then
    --# do reactor 1 activated stuff
  else
    --# do reactor 1 deactivated stuff
  end
  if rs.testBundledInput("back", colors.green) then
    --# do reactor 2 activated stuff
  else
    --# do reactor 2 deactivated stuff
  end
  if rs.testBundledInput("back", colors.yellow) then
    --# do reactor 3 activated stuff
  else
    --# do reactor 3 deactivated stuff
  end
end

This doesn't work with even one reactor, let alone 3?

Please provide the code you tested with and a description (or screenshots) or the setup you're using.
Edited on 25 January 2018 - 03:13 AM
PlotTwistGamer #7
Posted 26 January 2018 - 02:51 AM
I got it to work, now I'm trying to get the control program for the reactors to not switch each other off. So two can be on at the same time.
Dog #8
Posted 26 January 2018 - 03:22 AM
Please post the code you're working with. FWIW, the code I posted above can control three reactors without interfering with each other theoretically.
PlotTwistGamer #9
Posted 08 March 2018 - 01:10 AM
Thank you, I apologize for being short if I was. I got it working! :D/>

The thing is, the computer I was using (The one controlling the computers, the code posted above was the one reading the wires) was interfering with itself. (Because you cant send two signals at once through the same computer apparently, it overrides itself) so I ended up just using 3 different computers to activate each reactor.
Dog #10
Posted 08 March 2018 - 01:22 AM
With bundled cable you can send up to 16 different signals per side on a computer, with regular redstone you can only send one signal per side. If you are having problems sending more than one color at a time over bundled cable, please post your code and I'd be happy to help you get it working with a single computer.
Edited on 08 March 2018 - 12:23 AM