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

Bundle Colors Control

Started by SebaTeck, 08 October 2012 - 05:46 PM
SebaTeck #1
Posted 08 October 2012 - 07:46 PM
Asking a god of LUA to script me this..
I need a program that control your bundle cables
Something with with an interface like
White Orange Magent etc
to send a singla just choose a color,and choose again to stop it
and maybe with all the colors interface transfered on a monitor in automatic.
(sorry for my really bad english)
aniway i will be really greatful if someone make me this(im trying to do from a long time D:)
Lyqyd #2
Posted 08 October 2012 - 07:51 PM
Let's see the code you've got so far. I'm far more willing to help people finish and correct code than I am to make code for someone.
SebaTeck #3
Posted 08 October 2012 - 08:05 PM
while true do
input = io.red()
if input == "luci on" then
rs.setBundledOutput("back", color.white, true)
print("Luci sono on")
elseif input == "luci off" then
rs.setBundledOutput("back", color.white,false)
end
SebaTeck #4
Posted 08 October 2012 - 08:16 PM
this i wher i gone e.e
DaWooShit #5
Posted 08 October 2012 - 09:37 PM
http://pastebin.com/qsptraNi

Wrote it pretty fast, didn't have much time… but it might be of use.
You may change the side of the output in the top of the script, write if you got any problems.
MetalMiner #6
Posted 08 October 2012 - 10:28 PM
I wrote a program wich exactly does this.
I used it to control IC2 machines.
But i can't post it now, because i'm in holyday :D/>/>
But i can give you some hints :D/>/>
Use the colors AIP:
colors.test(colors, color)
to test if the wire is on or off.
colors.add(colors, color)
to add the color, wich you want to toggle on.
colors.subtract(colors, color)
to subtract the color, wich you want to toggle of.

Hope i helped

Ps: sorry for my bad english, too ;)/>/>
SebaTeck #7
Posted 09 October 2012 - 01:07 PM
http://pastebin.com/qsptraNi

Wrote it pretty fast, didn't have much time… but it might be of use.
You may change the side of the output in the top of the script, write if you got any problems.
I love you :Q aniway if you can,can you add something that will mark colors on e colors off? and maybe a clock and some decoration to put it on monitor O:
aniway i really love you script,can i share it with my friends ? :3
SebaTeck #8
Posted 09 October 2012 - 01:08 PM
I wrote a program wich exactly does this.
I used it to control IC2 machines.
But i can't post it now, because i'm in holyday :D/>/>
But i can give you some hints :D/>/>
Use the colors AIP:
colors.test(colors, color)
to test if the wire is on or off.
colors.add(colors, color)
to add the color, wich you want to toggle on.
colors.subtract(colors, color)
to subtract the color, wich you want to toggle of.

Hope i helped

Ps: sorry for my bad english, too ;)/>/>
ehm i found 2 day ago a master control program,but i dont understand one thing.. how i connect redpower with MFE and other things? D: (i have technic with some more mods)
DaWooShit #9
Posted 10 October 2012 - 09:51 AM
I love you :Q aniway if you can,can you add something that will mark colors on e colors off? and maybe a clock and some decoration to put it on monitor O:
aniway i really love you script,can i share it with my friends ? :3

You're welcome to share it (As long as you give me credit :P/>/> ), I fixed the script so it now shows the states of the wires.
SebaTeck #10
Posted 10 October 2012 - 02:50 PM
thank you o:dont worry i will :P/>/>
MetalMiner #11
Posted 10 October 2012 - 05:42 PM
I wrote a program wich exactly does this.
I used it to control IC2 machines.
But i can't post it now, because i'm in holyday :)/>/>
But i can give you some hints :P/>/>
Use the colors AIP:
colors.test(colors, color)
to test if the wire is on or off.
colors.add(colors, color)
to add the color, wich you want to toggle on.
colors.subtract(colors, color)
to subtract the color, wich you want to toggle of.

Hope i helped

Ps: sorry for my bad english, too ;)/>/>
ehm i found 2 day ago a master control program,but i dont understand one thing.. how i connect redpower with MFE and other things? D: (i have technic with some more mods)

There's a peripheral called ccSensors:
http://www.computercraft.info/forums2/index.php?/topic/126-mc-125-cc-133-ccsensors-smpssp/page__pid__771#entry771

With this, you can read inventories, world informations, quarry progress, energy storage's energy level and much more. There are a lot good informations on the computercraft wiki. The mod is included in tekkit and i think in technic too.
DaWooShit #12
Posted 20 October 2012 - 10:50 PM
Made an update… Added a neat little clock for the hell of it:

http://pastebin.com/8tVUZqFs


Side="back"
local running = true
local selected = 1
local Output = 0
X=0
States={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
--[[numbers]]--
function Numbers(Number,X,Y)
if Number==0 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("##   #")
  term.setCursorPos(X,Y+2)
  print("# #  #")
  term.setCursorPos(X,Y+3)
  print("#  # #")
  term.setCursorPos(X,Y+4)
  print("#   ##")
  term.setCursorPos(X,Y+5)
  print("######")
end

if Number==1 then
  term.setCursorPos(X,Y)
  print("	 #")
  term.setCursorPos(X,Y+1)
  print("   ###")
  term.setCursorPos(X,Y+2)
  print("	 #")
  term.setCursorPos(X,Y+3)
  print("	 #")
  term.setCursorPos(X,Y+4)
  print("	 #")
  term.setCursorPos(X,Y+5)
  print("	 #")
end

if Number==2 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("	 #")
  term.setCursorPos(X,Y+2)
  print("######")
  term.setCursorPos(X,Y+3)
  print("#	 ")
  term.setCursorPos(X,Y+4)
  print("#    ")
  term.setCursorPos(X,Y+5)
  print("######")
end

if Number==3 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("	 #")
  term.setCursorPos(X,Y+2)
  print("######")
  term.setCursorPos(X,Y+3)
  print("	 #")
  term.setCursorPos(X,Y+4)
  print("	 #")
  term.setCursorPos(X,Y+5)
  print("######")
end

if Number==4 then
  term.setCursorPos(X,Y)
  print("#    #")
  term.setCursorPos(X,Y+1)
  print("#    #")
  term.setCursorPos(X,Y+2)
  print("######")
  term.setCursorPos(X,Y+3)
  print("	 #")
  term.setCursorPos(X,Y+4)
  print("	 #")
  term.setCursorPos(X,Y+5)
  print("	 #")
end

if Number==5 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("#	 ")
  term.setCursorPos(X,Y+2)
  print("######")
  term.setCursorPos(X,Y+3)
  print("	 #")
  term.setCursorPos(X,Y+4)
  print("	 #")
  term.setCursorPos(X,Y+5)
  print("######")
end

if Number==6 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("#	 ")
  term.setCursorPos(X,Y+2)
  print("######")
  term.setCursorPos(X,Y+3)
  print("#    #")
  term.setCursorPos(X,Y+4)
  print("#    #")
  term.setCursorPos(X,Y+5)
  print("######")
end

if Number==7 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("	 #")
  term.setCursorPos(X,Y+2)
  print("    # ")
  term.setCursorPos(X,Y+3)
  print("   #  ")
  term.setCursorPos(X,Y+4)
  print("  #   ")
  term.setCursorPos(X,Y+5)
  print(" #	 ")
end

if Number==8 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("#    #")
  term.setCursorPos(X,Y+2)
  print("######")
  term.setCursorPos(X,Y+3)
  print("#    #")
  term.setCursorPos(X,Y+4)
  print("#    #")
  term.setCursorPos(X,Y+5)
  print("######")
end

if Number==9 then
  term.setCursorPos(X,Y)
  print("######")
  term.setCursorPos(X,Y+1)
  print("#    #")
  term.setCursorPos(X,Y+2)
  print("######")
  term.setCursorPos(X,Y+3)
  print("	 #")
  term.setCursorPos(X,Y+4)
  print("	 #")
  term.setCursorPos(X,Y+5)
  print("######")
end

end
--[[functions in menu]]--
function Change()
if States[selected]==0 then
  X=1
else
  X=0
end
table.remove(States,selected)
table.insert(States,selected,X)
end
function PrintClock()
Hours=math.floor(os.time())
Minuts=math.floor(60*(os.time()-Hours))
Greatminuts=0
Greathours=0

while Minuts>=10 do
  Greatminuts=Greatminuts+1
  Minuts=Minuts-10
end

while Hours>=10 do
  Greathours=Greathours+1
  Hours=Hours-10
end

Numbers(Greathours,32,2)
Numbers(Hours,40,2)

Numbers(Greatminuts,32,10)
Numbers(Minuts,40,10)
 
end
--[[Menues:]]--
menuA = {
[1]  = {text = "White	  "},
[2]  = {text = "Orange	 "},
[3]  = {text = "Magenta    "},
[4]  = {text = "Light blue "},
[5]  = {text = "Yellow	 "},
[6]  = {text = "Lime green "},
[7]  = {text = "Pink	   "},
[8]  = {text = "Gray	   "},
[9]  = {text = "Light gray "},
[10] = {text = "Cyan	   "},
[11] = {text = "Purple	 "},
[12] = {text = "Blue	   "},
[13] = {text = "Brown	  "},
[14] = {text = "Green	  "},
[15] = {text = "Red	    "},
[16] = {text = "Black	  "}
}
--[[print function]]--
function PrintMenu( menu )
for i=1,#menu do
  if i == selected then
   io.write(">> ")
  else
   io.write("   ")
  end
  io.write(menu[i].text)
  for H=1,#menu[i].text do
   io.write(" ")
  end
   io.write(States[i])
   io.write("n")
end
print("   ",Output)
end
--[[Keydetecter]]--
function Keypressed( key, menu )
if key == 28 then
  Change()
 
elseif key == 200 then
  if selected > 1 then
   selected = selected - 1
  end

elseif key == 208 then
  if selected < #menu then
   selected = selected + 1
  end

end
end
--[[Select]]--
function SelectCurrentItem(menu)
menu[selected].handler()
end
--[[Main]]--
function main()
  while running do
  term.clear()
  term.setCursorPos(1,1)
  PrintMenu(menuA)
  PrintClock()
 
  os.startTimer(1)
  event, key = os.pullEvent()
  Keypressed(key,menuA)
  Output = 0
 
  X=1
 
  for i=1,16 do
   if States[i]==1 then
   Output=Output+X
   end
   X=X*2
  end
 
  rs.setBundledOutput(Side, Output)
 
  end
end
--[[Start menu]]--
main()