How do you increment through a logic case?

Avatar
Goldenknighttim
182 Posts
Posted Jan 08, 2014
I was trying to increment through a logic case by using a math counter so that whenever an input is received, the counter "add"s '1' and whenever 'ongetvalue' it gives the output 'invalue' to the logic case. I also have it so when it hits max, it resets to '0'. Does anyone know why this doesn't work, or if there is a better way to do this?
Advertisement
Registered users don’t see ads! Register now!
Avatar
CamBen
973 Posts
Posted Jan 08, 2014
Replied 1 hour later
Name each case you want to be valid in your logic_case an incrementing number from 1 to your highest number. Then then outputs on your math counter should say:

outvalue case_01 invalue
Onhitmax mathcounter_01 setvalue 0

Avatar
Goldenknighttim
182 Posts
Posted Jan 08, 2014
Replied 3 minutes later
Yea, Thats what I already have. So this should be working then?
Avatar
TeamSpen210
608 Posts
Posted Jan 08, 2014
Replied 4 minutes later
That won't work still. Use the OutValue output instead of OnGetValue. OnGetValue is fired when the math_counter recieves a GetValue input. OutValue is fired whenever the input changes. You'd want to use SetValueNoFire instead of SetValue to reset it to 0, so it doesn't re-trigger the logic_case.

Alternatively, you could just add a GetValue input 0.01 seconds after the output(s) that add 1 to the counter.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Goldenknighttim
182 Posts
Posted Jan 08, 2014
Replied 6 minutes later
Alright, This is working now. Thank you so much. I didn't notice that camben said outvalue instead of getvalue. I wasn't thinking of them as different outputs. it works with setvalue instead of setvaluenofire because there is no case with the name 0, and all each case is doing is enabling and disabling logic relays. Again, thank you both.