Jump to content




Using Redstone Bundled Output


8 replies to this topic

#1 Meni

  • Members
  • 59 posts

Posted 09 January 2013 - 03:47 PM

Hi guys this is my first tutorial and i will try to explain the redstone.setBundledOutput() function.

First let look at the order of the cables

Posted Image

Understanding...
This are the cables numbers, but how do i gonna turn on/off this cables?
Simple using:
redstone.setBundledOutput(side,num)
Ok! The side is a string that is where the bundled cable is. They are "left" ,"right" ,"top" ,"bottom" ,"back" ,"front" .
But how i gonna turn on/off this cabes?
Using their numbers!
If i use num as 2 power the number of the cable. W

Why?
If you use num as 1 it will turn on the white cable, if you use 2 you will turn the orange cable, but if you use num as 3 you will turn on the white and orange cables.

OMG I want to turn on just one cable!
Easy just get the cable number and use as exponent of 2

WTF??
To turn the cable witch have the number 5 just use:
redstone.setBundleOutput(side,2^5)

But now i want the bundle cable 5 and the 11!
Simple! Just add 2^11
redstone.setBundleOutput(side,2^5+2^11)
And the result is
Posted Image

Now i want all cables off!
Simple just use num as 0
redstone.setBundledOutput(side,0)

OMG that is too hard!
Ok just use colors.thecolor as the num!
redstone.setBundledOutput(side,colors.white)
--Is the same think as
redstone.setBundledOutput(side,2)


Thank you guys, i hope have helped you! Any questions just reply!
Meni.

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 09 January 2013 - 03:57 PM

Good job, I know a lot of people can be confused by this. However i have a suggestion to make it easier that them having to worry about binary ( 2 ^ n ). Just use the colours API so it would be
rs.setBundledOutput( side, colors.yellow + colors.red )
etc, etc, etc :)

View PostMeni, on 09 January 2013 - 03:47 PM, said:

Now i want all cables off!
Simple just use num as 0
redpower.setBundledOutput(side,0)

Typo 'redpower' should be 'redstone' or 'rs' obviously...

EDIT: Also the images seem to not work...

Edited by TheOriginalBIT, 09 January 2013 - 03:58 PM.


#3 Meni

  • Members
  • 59 posts

Posted 09 January 2013 - 04:27 PM

Oh sorry about that! I edit and now is correct! Im a bit tired! I dont sleep for a day... Thank you!
And about the images here is working fine i used media fire to upload id but i will try another

#4 Andrakon

  • Members
  • 37 posts

Posted 26 February 2013 - 10:31 AM

This helped me out a LOT! I ended up writing an API to handle all the mess of the bundled cables for me based off of using 1, 2,and 2^2 through 2^15 as the color numbers.

#5 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 26 February 2013 - 10:39 AM

Now we can use redset <side> <color> <state> Very helpful API. Also, nice tutorial for players getting into Bundled Cabling. Very nice.

#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 26 February 2013 - 11:07 AM

This is somewhat unclear in that it suggests that the colors are numbered 1-16, then suggests that you raise 2 to the power of the number of the cable (i.e., 2^1 through 2^16), when in fact, the range of numbers is 2^0 through 2^15.

#7 Neekow

  • Members
  • 55 posts

Posted 03 March 2013 - 02:32 PM

Hum ... will try to explain but will be hard ...
command with variable is missing?

So to do it: rs.setBundledOutput("side", variable)

i.e:
local signal = 0


while true do
  rs.setBundledOutput("side", 2^signal)
  signal = signal+1
  if signal > 15 then signal = 0 end
  sleep(0.5)
end

with this, you will see every output 1 by 1.


I know, most of people know this, but not every one ^^

#8 redeye83

  • Members
  • 202 posts
  • LocationUnited Kingdom

Posted 05 March 2013 - 11:46 AM

I know theoriginalbit said this but I wanted to second it, Its so much simpler to use the colors rather than the numbers.

#9 CrazyTech13

  • Members
  • 11 posts

Posted 12 October 2013 - 12:36 PM

An easier/lazier way to do this is:

rs = peripheral.wrap(side) -- Side is the side the cable is on
rs.setBundledOutput(colors.color or number)

That way you don't have to type the side the cable is on every time.
(Correct me if I am wrong)
But good tutorial.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users