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

What are the lua commands for bundled cable?

Started by Rampage9112, 09 April 2012 - 09:49 PM
Rampage9112 #1
Posted 09 April 2012 - 11:49 PM
Couldn't find the answer to this question on the wiki.
dylan #2
Posted 09 April 2012 - 11:50 PM
in your terminal type "help redpower"
MysticT #3
Posted 10 April 2012 - 12:10 AM
I don't think you have searched on the wiki. They are in the redstone (or rs for short) API, you can also do what dylan said and type "help redpower" or "help redstone" in the terminal for a list of the functions in the API and some examples.
Rampage9112 #4
Posted 10 April 2012 - 12:25 AM
Oh, must have missed that somehow. Thanks.

edit: is it possible to use a boolean value for a specific cable? (ex. turning red to true, then to false)
MysticT #5
Posted 10 April 2012 - 01:06 AM
No, but you can implement it easly.

function setColor(side, color, :P/>/>
  local c = rs.getBundledOutput(side)
  if b then
    c = colors.combine(c, color)
  else
    c = colors.subtract(c, color)
  end
  rs.setBundledOutput(side, c)
end
You can use it like: setColor("back", colors.red, true) to turn on the red cable.
Cranium #6
Posted 21 July 2012 - 06:51 AM
I am trying to use this code to have the bundled cable on for a designated period of time, which I am using a while/do statement to determine how many times it cycled. The problem is, that the color will never switch off… I have no idea what I'm doing wrong. Here's my code so far:

function setColor(side,color,:)/>/>
local c = rs.getBundledOutput(side)
if b then
  c = colors.combine(c,color)
else
  c = colors.subtract(c,color)
end
rs.setBundledOutput(side,c)
end
x = 0
while x < 1 do
rs.setBundledOutput("back",colors.orange,true)
x = x + 1
end
while x > 1 do
setColor("back",colors.orange,false)
x = x + 1
end
I know I totally copied what was before, but I am totally new to coding, and I'm in way over my head trying to setup a train station system. Any help would be great!

Oh my God, I am such an idiot for not looking at the bundled cable commands, specifically the clear output command on the wiki.
Edited on 21 July 2012 - 08:16 AM