It is currently April 18th, 2024, 10:44 pm

Quote plugin update slow + toggle between 3 quotes

Get help with creating, editing & fixing problems with skins
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Quote plugin update slow + toggle between 3 quotes

Post by deXxterlab97 »

I have 3 meter (quotes) and 2 buttons
Button 1 toggle (show/hide) meter 1 and 0
Button 2 toggle (show/hide) meter 2 and 0
Meter 0 stays active by default when you don't hit the button
So I just set meter 1 and 2 as hidden so when you toggle meter 1 or 2 becomes non hidden and meter 0 comes hidden, nothing special.

How would I toggle between 1 and 2 instead (if meter 1 is active then when I want to switch to meter 2 it will overlap)? I am thinking of writing a conditional statement to test if meter 1 or 2 is hidden or not then show the corresponding meter.
How would I check if meter is hidden or not?

(all those meters are quotes)

Sometimes the quotes update 1 second after I toggle it, sometimes it uptades before. I would prefer when toggling between quotes I get a new quote when it gets shown, and not have to see it update.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
@Include=#@#Variables.inc
Toggler=[!ToggleMeter "MeterChloeQuotes"][!ToggleMeter "MeterRegularQuotes"][!UpdateMeter "MeterChloeQuotes"][!UpdateMeter "MeterRegularQuotes"][!UpdateMeasure "MeasureChloeQuotes"][!UpdateMeasure "MeasureRegularQuotes"][!Redraw]
Toggler2=[!ToggleMeter "MeterMaxQuotes"][!ToggleMeter "MeterRegularQuotes"][!UpdateMeter "MeterMaxQuotes"][!UpdateMeter "MeterRegularQuotes"][!UpdateMeasure "MeasureMaxQuotes"][!UpdateMeasure "MeasureRegularQuotes"][!Redraw]

[Metadata]
Author=deXxterlab97

[MeasureMaxQuotes]
Measure=Plugin
Plugin=QuotePlugin
PathName=#@#Quotes\Max quotes\max-quotes.txt
UpdateDivider=60

[MeasureChloeQuotes]
Measure=Plugin
Plugin=QuotePlugin
PathName=#@#Quotes\Chloe quotes\chloe-quotes.txt
UpdateDivider=60

[MeasureRegularQuotes]
Measure=Plugin
Plugin=QuotePlugin
PathName=#@#Quotes\quote-list.txt
UpdateDivider=60
Separator=/
RegexpSubstitute=1
Substitute="^\r\n":""

[MeterRegularQuotes]
Meter=String
MeasureName=MeasureRegularQuotes
ClipStringW=870
ClipStringH=200
ClipString=2
FontFace=#FF#
FontColor=#FC#
FontSize=#FS#
AntiAlias=1
SolidColor=0,0,0,50
X=490
Y=270

[MeterChloeQuotes]
Meter=String
MeasureName=MeasureChloeQuotes
ClipStringW=870
ClipStringH=200
ClipString=2
FontFace=#FF#
FontColor=#FC#
FontSize=#FS#
AntiAlias=1
SolidColor=0,0,255,50
Hidden=1
X=490
Y=270

[MeterMaxQuotes]
Meter=String
MeasureName=MeasureMaxQuotes
ClipStringW=870
ClipStringH=200
ClipString=2
FontFace=#FF#
FontColor=#FC#
FontSize=#FS#
AntiAlias=1
SolidColor=255,51,153,50
Hidden=1
X=490
Y=270

[ChloeHead]
Meter=Image
X=295
Y=105
W=67
H=60
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler#

[ChloeBody1]
Meter=Image
X=265
Y=165
W=110
H=140
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler#

[ChloeBody2]
Meter=Image
X=275
Y=305
W=100
H=40
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler#

[ChloeBody3]
Meter=Image
X=280
Y=345
W=90
H=50
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler#

[ChloeBody4]
Meter=Image
X=290
Y=395
W=70
H=195
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler#

[MaxHead]
Meter=Image
X=388
Y=120
W=70
H=75
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler2#

[MaxBody1]
Meter=Image
X=380
Y=195
W=105
H=160
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler2#

[MaxBody2]
Meter=Image
X=400
Y=455
W=55
H=50
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler2#

[MaxBody3]
Meter=Image
X=385
Y=355
W=95
H=100
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler2#

[MaxBody4]
Meter=Image
X=400
Y=505
W=48
H=85
SolidColor=0,0,0,200
LeftMouseUpAction=#Toggler2#
deXxterlab97
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quote plugin update slow + toggle between 3 quotes

Post by jsmorley »

Sorry, but I don't follow this at all. When I run this skin, I just get a big mess on the screen.
1.png
So I can't test this, and am not sure I really follow your question.

However, in a general sense, I'm not a fan of !ToggleMeter for something like this. In fact, I'm not a fan of !ToggleMeter at all to be honest. I'd be tempted to look at a solution where all meters are part of a meter group. Then when you click on a button to "show" one or more meters, you have the action first hide the group (which hides them all) and then show the one(s) you want.

https://docs.rainmeter.net/manual-beta/groups/

So something like:

LeftMouseUpAction=[!HideMeterGroup MyQuoteMeters][!ShowMeter MeterOne][!ShowMeter MeterFour]

Since it all happens in the same action, the !HideMeterGroup will be seamless. If for instance MeterFour was already visible, and this button would leave it visible, that is the effect you will get. You won't see it hide and then show.

As far as updating the measures when the corresponding meters are made visible, you might do:

LeftMouseUpAction=[!HideMeterGroup MyQuoteMeters][!UpdateMeasureGroup MyQuoteMeasures][!UpdateMeterGroup MyQuoteMeters][!ShowMeter MeterOne][!ShowMeter MeterFour]

So we are updating all the measures and all the meters, sorta in the background, while they are all hidden. If you then show a meter, it will have new data. The exception would be if you leave a meter visible, in which case you would see the transition from the old data to the new.

Even if we stay with the approach you are using, which I don't entirely follow, you need to do things in the right order...

Toggler2=[!ToggleMeter "MeterMaxQuotes"][!ToggleMeter "MeterRegularQuotes"][!UpdateMeter "MeterMaxQuotes"][!UpdateMeter "MeterRegularQuotes"][!UpdateMeasure "MeasureMaxQuotes"][!UpdateMeasure "MeasureRegularQuotes"][!Redraw]

If you look at this, you are toggling some meters, then updating the meters, then updating the measures, then doing a redraw. The meters will still have the old value. You need to update the measures to get new data, then update the meters to use that new data, then toggle the meters, then redraw. Things in a single action do all happen during the same update cycle, but they also do happen in the order you define.
You do not have the required permissions to view the files attached to this post.
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Quote plugin update slow + toggle between 3 quotes

Post by deXxterlab97 »

jsmorley wrote:Sorry, but I don't follow this at all. When I run this skin, I just get a big mess on the screen.

1.png

So I can't test this, and am not sure I really follow your question.

However, in a general sense, I'm not a fan of !ToggleMeter for something like this. In fact, I'm not a fan of !ToggleMeter at all to be honest. I'd be tempted to look at a solution where all meters are part of a meter group. Then when you click on a button to "show" one or more meters, you have the action first hide the group (which hides them all) and then show the one(s) you want.

https://docs.rainmeter.net/manual-beta/groups/

So something like:

LeftMouseUpAction=[!HideMeterGroup MyQuoteMeters][!ShowMeter MeterOne][!ShowMeter MeterFour]

Since it all happens in the same action, the !HideMeterGroup will be seamless. If for instance MeterFour was already visible, and this button would leave it visible, that is the effect you will get. You won't see it hide and then show.

As far as updating the measures when the corresponding meters are made visible, you might do:

LeftMouseUpAction=[!HideMeterGroup MyQuoteMeters][!UpdateMeasureGroup MyQuoteMeasures][!UpdateMeterGroup MyQuoteMeters][!ShowMeter MeterOne][!ShowMeter MeterFour]

So we are updating all the measures and all the meters, sorta in the background, while they are all hidden. If you then show a meter, it will have new data. The exception would be if you leave a meter visible, in which case you would see the transition from the old data to the new.

Even if we stay with the approach you are using, which I don't entirely follow, you need to do things in the right order...

Toggler2=[!ToggleMeter "MeterMaxQuotes"][!ToggleMeter "MeterRegularQuotes"][!UpdateMeter "MeterMaxQuotes"][!UpdateMeter "MeterRegularQuotes"][!UpdateMeasure "MeasureMaxQuotes"][!UpdateMeasure "MeasureRegularQuotes"][!Redraw]

If you look at this, you are toggling some meters, then updating the meters, then updating the measures, then doing a redraw. The meters will still have the old value. You need to update the measures to get new data, then update the meters to use that new data, then toggle the meters, then redraw. Things in a single action do all happen during the same update cycle, but they also do happen in the order you define.
Let me rephrase it

Quote Regular displays by default without needed to use leftmouseupaction
If I lefmouseupaction on quote max it will switch to quote max and display it then update every 60 (updatedivider) then it will also hide all other quotes (so one meter visible at a time)
If I leftmouseupaction again on quote max it the meter will be hidden and return to quote regular

If I leftmpuseupaction on quote chloe it will display quote chloe and hide all other meters similar to what I did to quote max

So I can still toggle between quote max and quote regular
and toggle between quote chloe and quote regular

but I can't find away to toggle between quote chloe and quote max

so if I leftmpuseupaction on quote chloe while quote max is visible it will just overlay quote chloe and max on top of each other because I only defined to toggle between quote chloe/max and quote regular

Hope it makes some sort of sense
deXxterlab97
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quote plugin update slow + toggle between 3 quotes

Post by jsmorley »

Sorta... But not really.

The logic doesn't make sense to me. You have three quote plugin measures, Regular, Max and Chloe.

You want them to share a single spot in the skin, to overlay each other, but only one of them to be visible at a time.

You want to do that with three meters, two of which will be hidden at any given time.

You want to switch between them with a single left-click on whatever meter is currently visible.

What I see being described isn't a "toggle", but a "loop" through the three meters. A "toggle" is by definition back-and-forth between two states. What I see is that when the skin starts, it displays the meter for Regular, when you click that, it displays the meter for Max, when you click that, it displays the meter for Chloe, and when you click that it starts over with Regular again.

Nothing else makes a lot of sense to me. You can't have a "toggle" be defined as two different things at the same time. Clicking on Regular has to either show Max or Chloe, and clicking on Max has to show Chloe or Regular. You have to pick one.

So seems to me you want three meters, Regular, Max and Chloe. Then just put a LeftMouseUpAction on each that simply hides itself, and shows the next one in the "loop".
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Quote plugin update slow + toggle between 3 quotes

Post by deXxterlab97 »

jsmorley wrote:Sorta... But not really.

The logic doesn't make sense to me. You have three quote plugin measures, Regular, Max and Chloe.

You want them to share a single spot in the skin, to overlay each other, but only one of them to be visible at a time.

You want to do that with three meters, two of which will be hidden at any given time.

You want to switch between them with a single left-click on whatever meter is currently visible.

What I see being described isn't a "toggle", but a "loop" through the three meters. A "toggle" is by definition back-and-forth between two states. What I see is that when the skin starts, it displays the meter for Regular, when you click that, it displays the meter for Max, when you click that, it displays the meter for Chloe, and when you click that it starts over with Regular again.

Nothing else makes a lot of sense to me. You can't have a "toggle" be defined as two different things at the same time. Clicking on Regular has to either show Max or Chloe, and clicking on Max has to show Chloe or Regular. You have to pick one.

So seems to me you want three meters, Regular, Max and Chloe. Then just put a LeftMouseUpAction on each that simply hides itself, and shows the next one in the "loop".
ah so what i need is a loop. alright. that make sense now
deXxterlab97
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Quote plugin update slow + toggle between 3 quotes

Post by deXxterlab97 »

How about a conditional statement

(not sure about correct syntax)

if max quote hidden = 0 (the max quote is currently active)
leftmouseupaction chloe quote = show chloe quote, hide max quote
leftmouseupaction max quote = show regular quote, hide max quote

if regular quote hidden = 0
leftmouseupaction chloe quote = show chloe quote, hide regular quote
leftmouseupaction max quote = show max quote, hide regular quoute

....
deXxterlab97
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quote plugin update slow + toggle between 3 quotes

Post by jsmorley »

deXxterlab97 wrote:How about a conditional statement

(not sure about correct syntax)

if max quote hidden = 0 (the max quote is currently active)
leftmouseupaction chloe quote = show chloe quote, hide max quote
leftmouseupaction max quote = show regular quote, hide max quote

if regular quote hidden = 0
leftmouseupaction chloe quote = show chloe quote, hide regular quote
leftmouseupaction max quote = show max quote, hide regular quoute

....
No, aside from the fact that you can't ask for the "hidden" state of a meter, which we could probably find a reasonable work-around for (the width of a hidden meter is "0" which we could test for with [MeterName:W]), you can't have two LeftMouseUpActions on a single meter. As I said, since only one meter can be visible at a time, you are going to have to "pick one".

Less important to worry about "syntax" at this point, than it is to wrap your (and my) head around what what the logic is. Coming up with some pseudo-code that say "when I do this, I want that to happen".

I'm pretty sure I'm entirely failing to understand what you are trying to do. I can't find the logic in your above code. If the Max quote is currently active, which one do you want to be made visible when you click it?

If what you are saying is:

Skin starts with Regular
When I click Regular it shows Max
When I click Max it goes back to Regular
When I click Regular again it shows Chloe
When I click Chloe it goes back to Regular
...
And so on where what meter is displayed when you click on Regular varies depending on which "other" meter was last toggled to, that might be possible, just need to keep track of which one it last changed to. But there has to be some defined logic. In the above scenario, clicking Max can NEVER change it to Chloe, and clicking on Chloe can NEVER change it to Max.
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Quote plugin update slow + toggle between 3 quotes

Post by deXxterlab97 »

jsmorley wrote:
Skin starts with Regular

When I click Max it goes back to Max (if Max hasn't been shown)
When I click Max again it shows Regular
When I click Chloe it goes back to Chloe (if Chloe hasn't been shown)
When I click Chloe again it goes back to Regular
This is more like I am trying to do
deXxterlab97
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quote plugin update slow + toggle between 3 quotes

Post by jsmorley »

deXxterlab97 wrote:This is more like I am trying to do

Skin starts with Regular

When I click Max it goes back to Max (if Max hasn't been shown)
When I click Max again it shows Regular
When I click Chloe it goes back to Chloe (if Chloe hasn't been shown)
When I click Chloe again it goes back to Regular
Yeah, sorry. Not getting that a bit. How can the first one:

When I click Max it goes back to Max (if Max hasn't been shown)

Make any possible sense? Everything about that is illogical. If you click Max, it changes "back" to Max, uhm. Huh? But only if Max hasn't been shown. Uhm. Didn't you just click on Max? How did you do that if it hasn't been shown?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Quote plugin update slow + toggle between 3 quotes

Post by jsmorley »

So I'm stumped. The only thing I can suggest is that maybe you just want to be able to select any of the three quote measures to display as you like. Something like:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeterRegular]
Meter=String
Group=AllMeters
W=300
H=150
X=150
Y=75
StringAlign=CenterCenter
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
Text=I'm Regular
Hidden=0

[MeterMax]
Meter=String
Group=AllMeters
W=300
H=150
X=150
Y=75
StringAlign=CenterCenter
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
Text=I'm Max
Hidden=1

[MeterChloe]
Meter=String
Group=AllMeters
W=300
H=150
X=150
Y=75
StringAlign=CenterCenter
FontSize=15
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
Text=I'm Chloe
Hidden=1

[MeterSelectRegular]
Meter=String
X=300
Y=20
W=73
FontSize=12
FontWeight=700
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=15,5,5,5
AntiAlias=1
Text=Regular
LeftMouseUpAction=[!HideMeterGroup AllMeters][!ShowMeter MeterRegular][!UpdateMeter *][!Redraw]

[MeterSelectMax]
Meter=String
X=300
Y=10R
W=73
FontSize=12
FontWeight=700
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=15,5,5,5
AntiAlias=1
Text=Max
LeftMouseUpAction=[!HideMeterGroup AllMeters][!ShowMeter MeterMax][!UpdateMeter *][!Redraw]

[MeterSelectChloe]
Meter=String
X=300
Y=10R
W=73
FontSize=12
FontWeight=700
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=15,5,5,5
AntiAlias=1
Text=Chloe
LeftMouseUpAction=[!HideMeterGroup AllMeters][!ShowMeter MeterChloe][!UpdateMeter *][!Redraw]
Click to animate:
GIF.gif
You do not have the required permissions to view the files attached to this post.