Posted 16 April 2012 - 05:08 AM
Ok I looked several places but never saw the base code written out in a manner that made sense to me.
To make changes to a wire in a bundled cable attached to your computer use the following:
rs.setBundledOutput("back",rs.getBundledOutput("back") + colors.orange)
What to change:
rs.setBundledOutput("back",rs.getBundledOutput("back") + colors.orange)
Side in this case back is where the bundled cable you want to make changes to connects to your computer.
On/Off the plus sign tells the code to turn on the wire, the minus will turn the wire off.
Color which color wire do you want to turn on?
What does what:
rs.setBundledOutput("back",rs.getBundledOutput("back") + colors.orange)
rs.setBundledOutput (side, value)
This sets the level of the redstone bundle to a certain value overwriting the previous value completely. if you don't tell it what the current state is and what changes you want to make are you will turn on or off all the wires in the bundle.
rs.getBundledOutput("back")
This gets the current value of the bundled cable from the back of the computer. If you look in the colors file you'll find a longer list of the following:
white = 1
orange = 2
magenta = 4
lightBlue = 8
+ colors.orange
This tells the code you want to add two to the current value to turn on the orange wire.
Example:
You currently have the white and magenta wires powered ( white = 1, magenta = 4 ) you want to turn on the orange wire (orange = 2)
rs.setBundledOutput ("back", rs.getBundledOutput("back") + colors.orange)
ie
Set the "back" bundled cable equal to rs.getBundledOutput("back") plus 2
The bundled cable's value pulled by rs.getBundledOutput("back") will be equal to the sum of the cables in the bundle that are powered, in this case 1+4=5.
So this code is telling the computer to Set the bundled cable in back equal to 7 (5 + 2). The computer is smart enough to figure out to get 7 it needs 1+2+4. For how look up binary on google.
Bugs you can run into:
What happens without rs.getBundledOutput(side) or a empty variable?
The value of the cable will be set to orange 2 (0+2=2) and the white and magenta cables would be turned off.
I'm not certain but…. it looks like if you attempted to subtract orange from white and magenta without orange being on to start (1+4-2=3) would get you white and orange powered on (3=1+2) with magenta off. I haven't tested it.
If your math is off or you don't check your variables you'll get screwy results.
To make changes to a wire in a bundled cable attached to your computer use the following:
rs.setBundledOutput("back",rs.getBundledOutput("back") + colors.orange)
What to change:
rs.setBundledOutput("back",rs.getBundledOutput("back") + colors.orange)
Side in this case back is where the bundled cable you want to make changes to connects to your computer.
On/Off the plus sign tells the code to turn on the wire, the minus will turn the wire off.
Color which color wire do you want to turn on?
What does what:
rs.setBundledOutput("back",rs.getBundledOutput("back") + colors.orange)
rs.setBundledOutput (side, value)
This sets the level of the redstone bundle to a certain value overwriting the previous value completely. if you don't tell it what the current state is and what changes you want to make are you will turn on or off all the wires in the bundle.
rs.getBundledOutput("back")
This gets the current value of the bundled cable from the back of the computer. If you look in the colors file you'll find a longer list of the following:
white = 1
orange = 2
magenta = 4
lightBlue = 8
+ colors.orange
This tells the code you want to add two to the current value to turn on the orange wire.
Example:
You currently have the white and magenta wires powered ( white = 1, magenta = 4 ) you want to turn on the orange wire (orange = 2)
rs.setBundledOutput ("back", rs.getBundledOutput("back") + colors.orange)
ie
Set the "back" bundled cable equal to rs.getBundledOutput("back") plus 2
The bundled cable's value pulled by rs.getBundledOutput("back") will be equal to the sum of the cables in the bundle that are powered, in this case 1+4=5.
So this code is telling the computer to Set the bundled cable in back equal to 7 (5 + 2). The computer is smart enough to figure out to get 7 it needs 1+2+4. For how look up binary on google.
Bugs you can run into:
What happens without rs.getBundledOutput(side) or a empty variable?
The value of the cable will be set to orange 2 (0+2=2) and the white and magenta cables would be turned off.
I'm not certain but…. it looks like if you attempted to subtract orange from white and magenta without orange being on to start (1+4-2=3) would get you white and orange powered on (3=1+2) with magenta off. I haven't tested it.
If your math is off or you don't check your variables you'll get screwy results.