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

help me with bundled cables

Started by erikvader, 09 July 2012 - 07:26 PM
erikvader #1
Posted 09 July 2012 - 09:26 PM
i dunno what i am doing wrong.




tin = "tin"
copper = "copper"
gold = "gold"
offtin = "offtin"
offcopper = "offcopper"
offgold = "offgold"
curColors = rs.getBundledInput("top")
subColors = rs.getBundledOutput("top")
cobble = "cobble"
dirt = "dirt"
silver = "silver"
iron = "iron"
offcobble = "offcobble"
offdirt = "offdirt"
offsilver = "offsilver"
offiron = "offiron"

while true do
write("tin,Copper or gold")
input = read()
if input == tin then
rs.setBundledOutput("top", colors.combine(curColors,colors.red))
elseif input == offtin then
rs.setBundledOutput("top", colors.subtract(subColors,colors.red))
   elseif input == copper then
   rs.setBundledOutput("top", colors.combine(curColors,colors.white))
   elseif input == offcopper then
   rs.setBundledOutput("top", colors.subtract(subColors,colors.white))
	  elseif input == gold then
	  rs.setBundledOutput("top", colors.combine(curColors,colors.pink))
	  elseif input == offgold then
	  rs.setBundledOutput("top", colors.subtract(subColors,colors.pink))
		 elseif input == cobble then
		 rs.setBundledOutput("top", colors.combine(curColors,colors.orange))
		 elseif input == offcobble then
		 rs.setBundledOutput("top", colors.subtract(subColors,colors.orange))
			  elseif input == dirt then
			  rs.setBundledOutput("top", colors.combine(curColors,colors.yellow))
			 elseif input == offdirt then
			 rs.setBundledOutput("top", colors.subtract(subColors,colors.yellow))
				 elseif input == silver then
				 rs.setBundledOutput("top", colors.combine(curColors,colors.blue))
				 elseif input == offsilver then
				 rs.setBundledOutput("top", colors.subtract(subColors,colors.blue))
					elseif input == iron then
					rs.setBundledOutput("top", colors.combine(curColors,colors.green))
					 elseif input == offiron then
					 rs.setBundledOutput("top", colors.subtract(subColors,colors.green))
else
write("huh?")
end
end


it just toggles from one color to another, not turning on and off the lights i want.
archit #2
Posted 10 July 2012 - 01:26 AM
Never used the RedStone api, but looking at it, seems there is nothing wrong with your code besides the very weird formatting. Judging by the api and your comments, there is nothing wrong with this code, as all it does is set which colors in the bundled wires are to be on or off. As you said that is working then the problem is not with the code turning them on and off, but with the desired results at the end of the wire.

Are you sure you have the ends connected correctly?
Are you testing this in SMP on a linux server? If so, there is a problem as recorded in the api http://computercraft.info/wiki/index.php?title=Redstone_(API)
erikvader #3
Posted 10 July 2012 - 02:25 PM


this is how it is setup. i will change the lamps to wireless redstone that will go to other stuff when i have got this fixed.
and i tried this on singel player to. but same result. do you know a better way to do this code?
Cloudy #4
Posted 10 July 2012 - 03:56 PM
You never define curColors. After input = read() do this:

curColors = rs.getBundledOutput("top")
erikvader #5
Posted 10 July 2012 - 06:57 PM
omg! you are my hero! tytytytyytytyttytyty!