Wonder if someone could help - I'm building a solar panel factory and have a counter program (which I finally managed to get working tonight yaaay) that counts a certain number of redstone pulses then outputs another pulse. I have that bit sorted (mainly as a result of all the excellent info on this forum) but i'm just wondering if there is a cleaner way to achieve what i'm trying to do. I'm pretty new to programming so please excuse any newb questions..
I have multiple coloured inputs pulsing and i'm counting these inputs into variables. I would usually use elseifs but the issue with that is that it breaks the if chain as soon as one of them receives a pulse. I need it to monitor all of them. Any way to reduce the number of ifs? I'd imagine i'll end up with over 10 of these so just wonder if there is an 'if or' or similar that would function better? I've done some searching but i'm not getting any hits.
As a side question, any way to only count a redstone pulse only once? This program ends up adding 2 or 3 to the counter on each iteration which isnt really an issue as I just increase the total count but again wonder if there is a better way? I could up the sleep at the end but then I run a risk of missing a pulse (which isnt a disaster but isnt very clean)
Many thanks
Example code below (its a snippet):
while 1 == 1 do
if testIn("back", colors.white) then
pWhite = pWhite + 1
end
if testIn("back", colors.lightBlue) then
pLightBlue = pLightBlue + 1
end
if testIn("back", colors.yellow) then
pYellow = pYellow + 1
end
end