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

Redpower Bundled Cables

Started by Jman, 29 January 2013 - 06:47 AM
Jman #1
Posted 29 January 2013 - 07:47 AM
Okay so I'm trying to step up my programming to bundled cables so I toggle my frame motors and move my submarine in all 6 directions with an extra value for a frame position reset since torches only fire once. But the issue is that I can't ever seem to find an English tutorial on Bundled cables there fore I'm clueless and my wires remain un placed and my sub remains stationary, please help, this bad boy has been finished structuraly for 4 hours and is ready to soak, and rust in my water world instead of remaining 1 block above ground next to my giant dormant volcano island. I get as far as
--Direction to Color Definer
Forward = yellow
Reverse = green
Left = blue
Right = red
Rise = white
Dive = black
Reset = orange
--Direction to Bundled Color
F = colors.combine(colors.yellow) -- (f) = Forward or Yellow
B = colors.combine(colors.green) -- [b] = Reverse or Green
L = colors.combine(colors.blue) -- (l) = Left or Blue
R = colors.combine(colors.red) -- (r) = Right or Red
U = colors.combine(colors.white) -- (u) = Rise or White
D = colors.combine(colors.black) -- (d) = Down or Black
P = colors.combine(colors.orange) -- (p) = Purge or Orange [Reset]
--Bundled Color to Function
function Forward()
rs.setBundledOutput("left", F)
sleep(1)
end
function Reverse()
rs.setBundledOutput("left", B)/>
sleep(1)
end
function Left()
rs.setBundledOutput("left", L)
sleep(1)
end
function Right()
rs.setBundledOutput("left", R)
sleep(1)
end
function Rise()
rs.setBundledOutput("left", U)
sleep(1)
end
function Dive()
rs.setBundledOutput("left", D)
sleep(1)
end
function Reset()
rs.setBundledOutput("left", P)
sleep(1)
end
--GUI
--[[Typing Right now in edit, will update per 5 lines]]
----[GUI]
--Functions
function Interface()
--[[stopping GUI edit here to test whether pictures work on computer craft
--will delete these two lines when resume]]
EDIT: Just figured out how to turn inputs on but now I cant turn them off, still renders the knowledge of turning stuff on useless for the script until I know how to turn off the colors and make it a toggleable function for each color
OmegaVest #2
Posted 29 January 2013 - 10:09 AM
colors.subtract(side, color)

Also, using colors.combine like that really doesn't work. You'd want to do this:
Spoiler

f = colors.yellow
b = colors.green
r = colors.red
l = colors.blue
u = colors.white
d = colors.black

function Reverse()
   rs.setBundledOutput("left", colors.combine(rs.getBundledOutput("left"), B)/>/>)
   sleep(0.8)
   rs.setBundledOutput("left", colors.subtract(rs.getBundledOutput("left"), B)/>/>)
end

And so on for each direction.