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

[lua] Bundled wires will not turn off

Started by chriskopp7, 17 June 2012 - 11:01 PM
chriskopp7 #1
Posted 18 June 2012 - 01:01 AM
here is the code


also what is the lowest delay i can put on it. i think it is 0.25 or something.
MysticT #2
Posted 18 June 2012 - 01:07 AM
First, seting the output to one color removes (turns off) the previous colors. So doing:

rs.setBundledOutput("back", colors.blue) -- blue is on
sleep(0.2)
rs.setBundledOutput("back", colors.yellow) -- yellow is on, blue is off

And you should use the colors api instead of subtracting the colors, since it may no do what you expect. So you should use:

rs.setBundledOutput("back", colors.subtract(rs.getBundledInput("back"), colors.blue))

This are simple functions to add and remove colors, use them if you want:

local function addOutput(side, ...)
  local c = colors.combine(rs.getBundledInput(side), ...)
  rs.setBundledOutput(side, c)
end

local function removeOutput(side, ...)
  local c = colors.subtract(rs.getBundledInput(side), ...)
  rs.setBundledOutput(side, c)
end
Xfel #3
Posted 18 June 2012 - 11:41 AM
You should use at least sleep(0.5), as that is the update rate of minecraft.
Cloudy #4
Posted 18 June 2012 - 11:47 AM
You should use at least sleep(0.5), as that is the update rate of minecraft.

If the update rate was half a second, it would be a pretty slow update rate. The update rate is actually 0.05 per tick (20 ticks per second) and a redstone tick is once every two minecraft ticks (so 0.10).
kazagistar #5
Posted 18 June 2012 - 04:13 PM
I found experimentally that 0.125 is a good value, unless your server or computer starts slowing down.