It is currently March 28th, 2024, 11:28 am
Creating Independent Counters
Re: Creating Independent Counters
Not the counter, what I'm doing with it - maths...
Re: Creating Independent Counters
Oh, ok. Even more scratching.Seahorse wrote:Not the counter, what I'm doing with it - maths...
Re: Creating Independent Counters
Disabling the counter would make it's value 0. To actually stop it while retaining the value:
Code: Select all
[Counter]
Measure=Calc
Formula=Counter+(Counter<#Value#)
Re: Creating Independent Counters
Beautiful. Wouldn't that work the same as pausing it, however? It provides some additional functionality, nevertheless.
Re: Creating Independent Counters
Yes, that would basically pause the counter at the given value.
Re: Creating Independent Counters
There is a pause after the last number before it starts counting up again, is there a way of removing this? my test skin is counting to 4:smurfier wrote:Having it reset after a given value is easy and is accomplished the same way as if you were using the Counter variable.This will have the counter reset to zero after it hits 30. Always add 1 to whatever value you want it to reset after otherwise it will reset at that value.Code: Select all
[cCounter] Measure=Calc Formula=(cCounter+1)%31
Code: Select all
[CalcCounter]
Measure=Calc
Formula=(CalcCounter+1)%5
Re: Creating Independent Counters
There should not be a delay like that, or at least none that I have experienced.
Also, if you want it to count 1-4 instead of 0-4 use (cCounter%4)+1
Also, if you want it to count 1-4 instead of 0-4 use (cCounter%4)+1
Re: Creating Independent Counters
Delay is there I can time it. Your suggestion removes the problem:
Code: Select all
[CalcCounter]
Measure=Calc
Formula=(CalcCounter%4)+1
Re: Creating Independent Counters
Just a post to cover something that isn't completely covered on the awesome first post:
You can make a counter reset automatically using %value and reset manually using a variable:
In this example, it's a counter that automatically counts till 60, where it restarts and fires !bangs. But I wanted to restart the counter each time I was pressing a button. So the above code will work. I am using it in Kaelri's Evereader, to make the pages scroll automatically, and restart the scroll counter each time I click to see a page (so that I don't see the page for a few seconds before the counter takes it away from me)
You can make a counter reset automatically using %value and reset manually using a variable:
Code: Select all
[ScrollCounter]
Measure=Calc
Formula=((ScrollCounter+1)*#restart1#)%61
DynamicVariables=1
IfEqualValue=60
IfEqualAction=!Execute !bangs
IfBelowValue=1
IfBelowAction=!SetVariable restart1 1
Re: Creating Independent Counters
To be honest I covered it as well as I felt was necessary. Also, you should be able to cut back on the parenthesis by following the order of operations.
Code: Select all
[ScrollCounter]
Measure=Calc
Formula=(ScrollCounter+1)%61*#restart1#
DynamicVariables=1
IfEqualValue=60
IfEqualAction=!Execute !bangs
IfBelowValue=1
IfBelowAction=!SetVariable restart1 1