How do you increment through a logic case?
Quote from Goldenknighttim on January 8, 2014, 12:45 pmI 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?
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?
Quote from CamBen on January 8, 2014, 2:04 pmName 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
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
Aperture Science: We do our science asbestos we can!
Quote from Goldenknighttim on January 8, 2014, 2:07 pmYea, Thats what I already have. So this should be working then?
Yea, Thats what I already have. So this should be working then?

Quote from TeamSpen210 on January 8, 2014, 2:12 pmThat 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.
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.
[spoiler]- BEE2 Addons | (BEE2)
- Hammer Addons
Maps:
- Crushed Gel
- Gel is Not Always Helpful[/spoiler]
Quote from Goldenknighttim on January 8, 2014, 2:18 pmAlright, 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.
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.