It is currently April 25th, 2024, 9:03 pm
Creating Independent Counters
-
- Posts: 1175
- Joined: June 9th, 2010, 5:56 pm
- Location: Locks heath, UK
Re: Creating Independent Counters
Not the counter, what I'm doing with it - maths...
-
- Posts: 608
- Joined: February 7th, 2011, 7:27 pm
- Location: Thessaloniki, GR
Re: Creating Independent Counters
Oh, ok. Even more scratching.Seahorse wrote:Not the counter, what I'm doing with it - maths...
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
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#)
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Posts: 608
- Joined: February 7th, 2011, 7:27 pm
- Location: Thessaloniki, GR
Re: Creating Independent Counters
Beautiful. Wouldn't that work the same as pausing it, however? It provides some additional functionality, nevertheless.
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
Re: Creating Independent Counters
Yes, that would basically pause the counter at the given value.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Posts: 1175
- Joined: June 9th, 2010, 5:56 pm
- Location: Locks heath, UK
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
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
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
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Posts: 1175
- Joined: June 9th, 2010, 5:56 pm
- Location: Locks heath, UK
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
-
- Posts: 608
- Joined: February 7th, 2011, 7:27 pm
- Location: Thessaloniki, GR
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
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
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
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .