Difference between revisions of "User:Oddstr13/Sandbox/Code higlight"

From ComputerCraft Wiki
Jump to: navigation, search
Line 1: Line 1:
<source lang="lua">
+
<code lang="lua">
 
sSide = "front"
 
sSide = "front"
 
redstone.setBundledOutput(sSide, colors.black) -- enable one color (black) and disable all others
 
redstone.setBundledOutput(sSide, colors.black) -- enable one color (black) and disable all others
Line 14: Line 14:
 
redstone.setBundledOutput(sSide,colors.subtract(redstone.getBundledOutput(sSide), colors.black))  
 
redstone.setBundledOutput(sSide,colors.subtract(redstone.getBundledOutput(sSide), colors.black))  
 
-- ^ disable the black wire but keep all other wires enabled, in this case it disables the black wire but keeps the white wire enabled from the last command.
 
-- ^ disable the black wire but keep all other wires enabled, in this case it disables the black wire but keeps the white wire enabled from the last command.
</source>
+
</code>

Revision as of 13:02, 15 March 2015

sSide = "front" redstone.setBundledOutput(sSide, colors.black) -- enable one color (black) and disable all others sleep(2) -- chill out for two seconds redstone.setBundledOutput(sSide, colors.white) -- enable white and disable all others sleep(2) redstone.setBundledOutput(sSide,colors.combine(redstone.getBundledOutput(sSide),colors.brown)) -- ^ combine last input with new input, in this case white is mixed with brown, making those two colors enabled. sleep(2) redstone.setBundledOutput(sSide, 0) -- disable all output sleep(2) redstone.setBundledOutput(sSide, colors.combine(colors.white,colors.black)) -- enable both black and white wires. sleep(2) redstone.setBundledOutput(sSide,colors.subtract(redstone.getBundledOutput(sSide), colors.black)) -- ^ disable the black wire but keep all other wires enabled, in this case it disables the black wire but keeps the white wire enabled from the last command.