The one that doesn't work fine is the seventh option- the plan is to leave the Six "on" colors on and just activate the Cyan one. However every time it activates, the Cyan is the ONLY one active- the others deactivate. I'm going in circles. Anyone got an idea what I did wrong?
colors.combine and colors.subtract not doing their jobs?
Started by Tassyr, Apr 08 2013 08:49 AM
lua
8 replies to this topic
#1
Posted 08 April 2013 - 08:49 AM
So I'm trying to set up a system where by detault the computer keeps output steady on six redstone colors (Green, Red, Gray, White, Blue and Black.) and one that keeps off (Cyan.) Each of the six "on" colors can be toggled off for 10 seconds, then will reactivate. THAT part I have working just fine.
The one that doesn't work fine is the seventh option- the plan is to leave the Six "on" colors on and just activate the Cyan one. However every time it activates, the Cyan is the ONLY one active- the others deactivate. I'm going in circles. Anyone got an idea what I did wrong?
The one that doesn't work fine is the seventh option- the plan is to leave the Six "on" colors on and just activate the Cyan one. However every time it activates, the Cyan is the ONLY one active- the others deactivate. I'm going in circles. Anyone got an idea what I did wrong?
Spoiler
#2
Posted 08 April 2013 - 08:51 AM
EDIT: nvm, you just did it.
Edited by theoriginalbit, 08 April 2013 - 08:52 AM.
#3
Posted 08 April 2013 - 08:51 AM
The BB interpreter messed it up. Pastebin please.
EDIT: Yay ninja'd...
EDIT: Yay ninja'd...
#4
Posted 08 April 2013 - 08:55 AM
one of your problems is colors.combine and colors.subtract aren't magic, they don't look for what the bundled output is already, they combine the colours that you supply, you are only supplying one colour. make it something like
EDIT: Also use elseif's for your checking of what the user entered.
c = colors.combine(colors.cyan, rs.getBundledInput("right"))
rs.setBundledOutput("right",c)
EDIT: Also use elseif's for your checking of what the user entered.
Edited by theoriginalbit, 08 April 2013 - 08:57 AM.
#5
Posted 08 April 2013 - 09:19 AM
oh for the love of... I'm an idiot. I forgot I meant to put
But your code works better. x.x
Also is there some colossal problem with using if instead of elseif?
c = colors.combine(c, colors.cyan)
But your code works better. x.x
Also is there some colossal problem with using if instead of elseif?
#7
#8
Posted 09 April 2013 - 02:13 AM
if anyone cares about a couple more CPU cycles from simple if statements they sould just go write in lua bytecode to achieve maximum efficiency
#9
Posted 09 April 2013 - 03:08 AM
PixelToast, on 09 April 2013 - 02:13 AM, said:
if anyone cares about a couple more CPU cycles from simple if statements they sould just go write in lua bytecode to achieve maximum efficiency
But using elseif instead of another if is a quick win of efficency
writing bytecode is more efficient but not worth the work it takes
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











