Jump to content




Help with bundeled output


  • You cannot reply to this topic
6 replies to this topic

#1 xxx

  • New Members
  • 28 posts

Posted 16 August 2012 - 07:11 AM

I'm trying to make a program which when run will send 3 pulses of white color redstone output through a bundled cable.
I haven't coded Lua in a long time, so this should be easy for you guys, but I can't figure it out myself, nor with Google.

Thanks for all help!


My code:
rs.setBundledOutput("back", color.white)
os.sleep(1)
rs.setBundledOutput("back", color.white)
os.sleep(1)
rs.setBundledOutput("back", color.white)
os.sleep(1)
shell.run("clear")
end


#2 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 16 August 2012 - 07:16 AM

close, you just need to clear the output between pulses

rs.setBundledOutput("back", color.white)
os.sleep(0.5)
rs.setBundledOutput("back",0)
os.sleep(0.5)
rs.setBundledOutput("back", color.white)
os.sleep(0.5)
rs.setBundledOutput("back",0)
os.sleep(0.5)
rs.setBundledOutput("back", color.white)
os.sleep(0.5)
rs.setBundledOutput("back",0)

and the end is unneeded

#3 xxx

  • New Members
  • 28 posts

Posted 16 August 2012 - 07:20 AM

Thank you for the quick help!

I did exactly what you wrote, but i do only get "attempt to index ? (a nil value).

#4 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 16 August 2012 - 07:24 AM

It's colors.white, plural colors not color.

#5 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 16 August 2012 - 07:25 AM

sorry lol, I was just copying and adapting it... made a blind mistake, corrected again

rs.setBundledOutput("back", colors.white)
sleep(0.5)
rs.setBundledOutput("back",0)
sleep(0.5)
rs.setBundledOutput("back", colors.white)
sleep(0.5)
rs.setBundledOutput("back",0)
sleep(0.5)
rs.setBundledOutput("back", colors.white)
sleep(0.5)
rs.setBundledOutput("back",0)

View Postluanub, on 16 August 2012 - 07:24 AM, said:

It's colors.white, plural colors not color.

yep, beat me to it

#6 xxx

  • New Members
  • 28 posts

Posted 16 August 2012 - 07:26 AM

Thank you, it works!

#7 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 16 August 2012 - 08:29 AM

To condense it do:
for cnt = 1,3 do
rs.setBundledOutput("back", colors.white)
sleep(0.5)
rs.setBundledOutput("back",0)
sleep(0.5)
end
A for loop (for varaible = startnumber,endnumber do end)
will go through the stuff in it with the set variable going up one each time.
Useful for doing something a set number of times or doing something for a multitude of numbers.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users