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

RedPower Bundled Cable

Started by HerrGohlem, 26 January 2013 - 07:25 AM
HerrGohlem #1
Posted 26 January 2013 - 08:25 AM
Hallo i have found this great Storage [media]http://www.youtube.com/watch?v=WQ-9TosCjjQ[/media]

but i dosent work but i dont now why. Computercraft tells me a error on line 81.

it is not possibe to use a variabel for RedPower Bundled Cable
rs.setBundledOutput(side, bcolor)

thank you for reading


--Rohstoff Farben
--Holz		= white	 | Backstein   = magenta	| Lapislazuli   = yellow | Wolle = pink
--Eisenbarren = light gray| Kohle	   = purple	 | Stein		 = brown  | Sand  = red
--Erde		= orange	| Steinziegel = light blue | Diamant	   = lime   | Kies  = gray
--Goldbarren  = cyan	  | Lehm		= blue	   | Pflasterstein = green  | Sandstein = black
side = "back"
white = 1
orange = 2
magenta = 4
lightBlue = 8
yellow = 16
lime = 32
pink = 64
gray = 128
lightGray = 256
cyan = 512
purple = 1024
blue = 2048
brown = 4096
green = 8192
red = 16384
black = 32768

function _header()
	 shell.run("clear")
	print("-------------------------------------------------")
	print("------------- Materialanforderung ---------------")
	print("-------------------------------------------------")
end

function _bfarbe(ausw)			  
		  if ausw == "a" then   --Holz
			 bcolor = colors.white
		  elseif ausw == "b" then  --Erde
			 bcolor = colors.orange  
		  elseif ausw == "c" then  --Backstein
			 bcolor = colors.magenta
		  elseif ausw == "d" then	--Steinziegel
			 bcolor = colors.lightBlue  
		  elseif ausw == "e" then  --Eisenbarren
			 bcolor = colors.lightGray  
		  elseif ausw == "f" then  --Pflasterstein
			 bcolor = colors.green  
		  elseif ausw == "g" then	--Kohle
			 bcolor = colors.purple	
		  elseif ausw == "h" then  --Lapislazulie
			 bcolor = colors.yellow  
		  elseif ausw == "i" then  --Diamant
			 bcolor = colors.lime  
		  elseif ausw == "j" then  --Wolle
			 bcolor = colors.pink
		  elseif ausw == "k" then  --Kies
			 bcolor = colors.gray	  
	elseif ausw == "l" then  --Goldbarren
			 bcolor = colors.cyan	
	elseif ausw == "m" then  --Sandstein
			 bcolor = colors.black
	elseif ausw == "n" then  --Stein
			 bcolor = colors.brown
	elseif ausw == "o" then  --Lehm
			 bcolor = colors.blue
	elseif ausw == "p" then  --Sand
			 bcolor = colors.red
   else
   print("Falsche Taste")
		  end
	  return bcolor
end

bcolor = _bfarbe(ausw)

function _abrufen()
  shell.run("clear")
   for z = 1, meng do
	_header()
	print(newline)
	prozent = math.floor(((100 / meng) * z) + 0.5)
	print("Rohstoffe werden bereitgestellt: " .. prozent .. "% von " .. meng .. " Stk.")
[color=#ff0000]	rs.setBundledOutput(side, bcolor)[/color]
	sleep(0.3)
	rs.setBundledOutput(side, 0)
	sleep(0.3)
	
   end
  print(newline)
  print("Rohstoffe angefordert!!")
  print("Sie können die Rohstoffe in wenigen sekunden aus der Kiste entnehmen.")
  sleep(10)
  shell.run("startup")
end


shell.run("clear")
	 _header()
	print("|	   Welchen Rohstoff benötigen sie?		 |")
	 print("|											   |")
		  print("| Holz		  [a] | Lapislazuli [h] | Lehm [o]|")
		  print("| Erde		  [b] | Diamant	 [i] | Sand [p]|")
		  print("| Backstein	 [c] | Wolle	   [j] |		 |")
		  print("| Steinziegel   [d] | Kies		[k] |		 |")
	print("| Eisenbarren   [e] | Goldbarren  [l] |		 |")
		  print("| Pflasterstein [f] | Sandstein   [m] |		 |")
	print("| Kohle		 [g] | Stein	   [n] |		 |")
		  print("-------------------------------------------------")
		  print(newline)
	write("Auswahl: ")
	ausw = read()
	write("Menge: ")
	meng = read()
	_abrufen()
remiX #2
Posted 26 January 2013 - 08:41 AM
Could you tell us what line 81 is and what it is supposed to do?
HerrGohlem #3
Posted 26 January 2013 - 09:09 AM
sorry the Red CODE
rs.setBundledOutput(side, bcolor)
remiX #4
Posted 26 January 2013 - 10:54 AM
Try moving
bcolor = _bfarbe(ausw)
after this part
        write("Auswahl: ")
        ausw = read()

it's trying to set the output to have the colour of 'bcolor' but it is nil
HerrGohlem #5
Posted 26 January 2013 - 06:34 PM
Yippppie it Runs

thank you remiX