It is currently September 26th, 2023, 4:52 am
Reader
Re: Reader
thanks for the quick fix. it's working again.
-
- Posts: 46
- Joined: September 24th, 2012, 2:11 pm
Re: Reader
I'm looking for a way to make my reader cycle between 5 feeds and show for each feed it's corresponding button.
This works more or less, hiding all the wrong buttons and showing me the 3rd feed and the button called RButton3p every time the measure's value is 3.
So, I would expect this:to show me the a different feed and button on every update. What have I got wrong?
Code: Select all
[mReadRotate]
Measure=Calc
Formula=(mReadRotate < 5) ? mReadRotate+1 : 1
IfEqualValue=3
IfEqualAction=[!CommandMeasure mReaderScript Show([mReadRotate])][!HideMeterGroup gRButtonp][!ShowMeter RButton[mReadRotate]p]
So, I would expect this:
Code: Select all
Measure=Calc
Formula=(mReadRotate < 5) ? mReadRotate+1 : 1
IfAboveValue=0
IfAboveAction=[!CommandMeasure mReaderScript Show([mReadRotate])][!HideMeterGroup gRButtonp][!ShowMeter RButton[mReadRotate]p]
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Reader
Rainmeter's IfActions only apply once when the value matches the condition. They don't fire again until after the value changes back to something that does not match. In your case, mReadRotate is always "above" 0, so the action is only triggered once, when the skin first loads.
Since the script already has "ShowNext" and "ShowPrevious" commands built-in, you can use a much simpler counter measure to switch feeds:
The script also creates a variable called "CurrentFeed" variable for the currently-displaying feed number. You can use this to show and hide your button groups - for example, using the "FinishAction" option, also provided by the script:
Since the script already has "ShowNext" and "ShowPrevious" commands built-in, you can use a much simpler counter measure to switch feeds:
Code: Select all
[mReadRotate]
Measure=Calc
Formula=(mReadRotate % 5) + 1
IfEqualValue=0
IfEqualAction=!CommandMeasure mReaderScript ShowNext()
Code: Select all
[mReaderScript]
...
FinishAction=[!HideMeterGroup gRButtonp][!ShowMeter RButton#CurrentFeed#p]
-
- Posts: 46
- Joined: September 24th, 2012, 2:11 pm
Re: Reader
Ugh.. I completely missed the CurrentFeed part. It does make things a lot simpler!
I chose the Formula=(mReadRotate < 5) ? mReadRotate+1 : 1 because I don't really understand the role of % in formulas. Does it have some advantage?
I chose the Formula=(mReadRotate < 5) ? mReadRotate+1 : 1 because I don't really understand the role of % in formulas. Does it have some advantage?
-
- Posts: 46
- Joined: September 24th, 2012, 2:11 pm
Re: Reader
Also, some feeds don't give a description variable. Is there a simple way to make the description meter not show at all if it has nothing to display?
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Reader
Not really, it's just a little cleaner. % is the modular operator, used to calculate values that "wrap around" after a certain value (the "modulus"). The value is divided by the modulus, and the remainder is used as the result of the operation. The easiest way to explain is with some examples:Saiho wrote:I chose the Formula=(mReadRotate < 5) ? mReadRotate+1 : 1 because I don't really understand the role of % in formulas. Does it have some advantage?
Code: Select all
0 % 5 = 0
1 % 5 = 1
2 % 5 = 2
3 % 5 = 3
4 % 5 = 4
5 % 5 = 0
6 % 5 = 1
7 % 5 = 2
8 % 5 = 3
9 % 5 = 4
10 % 5 = 0
11 % 5 = 1
12 % 5 = 2
13 % 5 = 3...
You could add this to the script, I suppose. At the bottom of the Output() function, do something like:Saiho wrote:Also, some feeds don't give a description variable. Is there a simple way to make the description meter not show at all if it has nothing to display?
Code: Select all
if Queue['Item1Desc'] == '' then
SKIN:Bang('!HideMeterGroup', 'GroupName')
end
-
- Posts: 46
- Joined: September 24th, 2012, 2:11 pm
Re: Reader
As much as lua terrifies me, I'll give it a try. Thank you so much for the help!
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Reader
I assure you, that's always the first step to falling in love with it. :)Saiho wrote:As much as lua terrifies me, I'll give it a try.
-
- Posts: 46
- Joined: September 24th, 2012, 2:11 pm
Re: Reader
Teehee ok, that was fun!
After managing to completely break the script, I figured out where to insert your code. But, once I switch to a feed without description, it hides descriptions for all the other feeds too. So I changed it to this:Seems to be working as I want, but a confirmation that it's the right way to do it would be nice.
And another thing that came up now. Do the variables the script generates get transferred with @Include? I'm trying to use #CurrentFeed# in a skin that includes the reader, but it doesn't seem to know what I'm talking about. Is that normal or have I mistyped something?
After managing to completely break the script, I figured out where to insert your code. But, once I switch to a feed without description, it hides descriptions for all the other feeds too. So I changed it to this:
Code: Select all
if Queue['Item1Desc'] == '' then
SKIN:Bang('!HideMeterGroup', 'gDesc')
else
SKIN:Bang('!ShowMeterGroup', 'gDesc')
end
And another thing that came up now. Do the variables the script generates get transferred with @Include? I'm trying to use #CurrentFeed# in a skin that includes the reader, but it doesn't seem to know what I'm talking about. Is that normal or have I mistyped something?
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Reader
Yep, that looks right. :)Saiho wrote:Teehee ok, that was fun!
After managing to completely break the script, I figured out where to insert your code. But, once I switch to a feed without description, it hides descriptions for all the other feeds too. So I changed it to this:Seems to be working as I want, but a confirmation that it's the right way to do it would be nice.Code: Select all
if Queue['Item1Desc'] == '' then SKIN:Bang('!HideMeterGroup', 'gDesc') else SKIN:Bang('!ShowMeterGroup', 'gDesc') end
Any skin that is actually running the Reader script should have the variable. It is a dynamic variable, so make sure you have DynamicVariables=1 wherever you're trying to use it.Saiho wrote:And another thing that came up now. Do the variables the script generates get transferred with @Include? I'm trying to use #CurrentFeed# in a skin that includes the reader, but it doesn't seem to know what I'm talking about. Is that normal or have I mistyped something?