No problem, just try whatever you believe that it will work, the order doesn't matter.Laaglander wrote: ↑January 12th, 2024, 6:17 pm Thank you both.
and yes balala you are right, this is indeed a webparser, so before i going to try the very first option, i will try your options first.
I will at the end show here what i have made, i am very proud of what is have made so far
It is currently April 28th, 2024, 12:48 am
!setvariable help needed
-
- Rainmeter Sage
- Posts: 7178
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: !setvariable help needed
-
- Posts: 15
- Joined: April 25th, 2015, 9:45 pm
Re: !setvariable help needed
Code: Select all
[MeasureSite11]
Measure=Plugin
Plugin=WebParser
URL=https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=#CryptoS11#&convert=EUR&CMC_PRO_API_KEY=#APIKey#
RegExp="price":(\d+\.\d{1,10}).*"percent_change_24h":(-?\d+\.\d{1,2})"
UpdateRate=#RefreshRate#
[MeasurePrice11]
Measure=WebParser
URL=[MeasureSite11]
StringIndex=1
UpdateRate=#RefreshRate#
[MeasureProcentage11]
Measure=WebParser
URL=[MeasureSite11]
StringIndex=2
UpdateRate=#RefreshRate#
[MeasureTotalValue11]
Measure=Calc
Formula=MeasurePrice11*#Amount11#
[MeasureProfit11]
Measure=Calc
Formula=MeasureTotalValue11-#Cost11#
[MeasureProfitSign11]
Measure=Calc
Formula=MeasureProfit11
IfBelowValue=0
IfBelowAction=[!SetOption MeterProfit11 FontColor "#ColorDown#"][!SetOption "MeterProfitImage11" "ImageName" "#@#/Images/Down.png"][!Redraw]
IfAboveValue=0
IfAboveAction=[!SetOption MeterProfit11 FontColor "#ColorUp#"][!SetOption "MeterProfitImage11" "ImageName" "#@#/Images/Up.png"][!Redraw]
[MeasurePercColor11]
Measure=Calc
Formula=MeasureProcentage11
IfBelowValue=0
IfBelowAction=[!SetOption MeterProcentage11 FontColor "#ColorDown#"]
IfAboveValue=0
IfAboveAction=[!SetOption MeterProcentage11 FontColor "#ColorUp#"]
[MeterCoin11]
Meter=String
Text="#CryptoL11#"
X=300
Y=25r
FontSize=15
FontColor=#FFFFFF#
AntiAlias=1
[MeterProfitImage11]
Meter=Image
ImageName=#@#/Images/Steady.png
x=#Col7cXPos#
y=4r
[MeterCryptoL11]
Meter=String
Text="Het aantal:"
X=300
Y=20r
FontSize=10
FontColor=#FFFFFF#
DynamicVariables=1
[MeterCryptoL11b]
Meter=String
Text="#Amount11#"
X=175R
Y=r
StringAlign=Right
FontSize=10
FontColor=117,199,235,255
DynamicVariables=1
[MeterCost11]
Meter=string
Text="Kosten met kopen:"
x=300
y=15r
FontSize=10
FontColor=#FFFFFF#
DynamicVariables=1
[MeterCost11b]
Meter=string
Text="#Cost11# Euro"
x=128R
y=r
StringAlign=Right
FontSize=10
FontColor=117,199,235,255
DynamicVariables=1
[MetersingleValue11]
Meter=String
Text="De huidige waarde:"
X=300
Y=15r
FontColor=#FFFFFF#
DynamicVariables=1
[MetersingleValue11b]
Meter=String
Text="[MeasurePrice11:8] Euro"
X=125R
Y=r
StringAlign=Right
FontColor=117,199,235,255
NumOfDecimals=5
DynamicVariables=1
[MeterTotalValue11]
Meter=String
Text="De totale waarde:"
X=300
Y=15r
FontColor=#FFFFFF#
DynamicVariables=1
[MeterTotalValue11b]
Meter=String
Text="[MeasureTotalValue11] Euro"
X=135R
Y=r
StringAlign=Right
FontColor=117,199,235,255
DynamicVariables=1
[MeterProcentage11]
Meter=String
MeasureName=MeasureProcentage11
Text="change 24u: [MeasureProcentage11]%"
X=320
Y=18r
FontColor=#FFFFFF#
DynamicVariables=1
[MeterProfit11]
Meter=String
MeasureName=MeasureProfit11
Text="winst: [MeasureProfit11] Euro"
X=320
Y=15r
FontColor=#FFFFFF#
DynamicVariables=1
i posted now 1 of the 11 objects. I think that iam almost finished, i have everything i want to see.
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: !setvariable help needed
Not having all needed variables used in your code, we can't check yor skin out, however I have a few comments:Laaglander wrote: ↑January 13th, 2024, 11:00 pm The :5 worked for the best fit i chose 8.
i posted now 1 of the 11 objects. I think that iam almost finished, i have everything i want to see.
- UpdateRate makes sense only on the parent WebParser measure. On child measures you don't have to use this option. You've added it to the [MeasureSite11] measure, where it is alright, this being the parent measure, but have added it to the [MeasurePrice11] and [MeasureProcentage11] measures as well, where they can't be used. In fact using it on those measures as well is not a problem, Rainmeter simply ignores it on both measures. But strictly speaking you should have remove them.
- On both measures [MeasureProfitSign11] and [MeasurePercColor11], thereis a case which is not included in none of the two conditions: when the value of measures is 0. For instance these are the two conditions on the [MeasureProfitSign11] measure:
But what if the value of the measure is exactly0? This case is not included in none of the above IfBelowValue and IfAboveValue options. You should have to add an IfEqualValue option as well, along with the corresponding IfEqualAction. But there is a much simpler solution as well: use IfCondition. In case of the [MeasureProfitSign11] measure, this might look this way, for example:
Code: Select all
[MeasureProfitSign11] ... IfBelowValue=0 ... IfAboveValue=0 ...
With this approach the case in which the value of the measure is exactly 0 is included into the IfFasleAction. If you want to include this case into the IfTrueAction option, just use the following IfCondition: IfCondition=(#CURRENTSECTION#<=0).Code: Select all
[MeasureProfitSign11] Measure=Calc Formula=MeasureProfit11 IfCondition=(#CURRENTSECTION#<0) IfTrueAction=[!SetOption MeterProfit11 FontColor "#ColorDown#"][!SetOption "MeterProfitImage11" "ImageName" "#@#/Images/Down.png"][!UpdateMeter "MeterProfit11"][!UpdateMeter "MeterProfitImage11"][!Redraw] IfFalseAction=[!SetOption MeterProfit11 FontColor "#ColorUp#"][!SetOption "MeterProfitImage11" "ImageName" "#@#/Images/Up.png"][!UpdateMeter "MeterProfit11"][!UpdateMeter "MeterProfitImage11"][!Redraw]
In any case IfCondition is much more simple and much more powerful than the IfActions. Recommend to use IfConditions instead of IfActions. - See that in the above IfTrueAction and IfFalseAction options, I added two bangs, which were not used in your options. I talk about the [!UpdateMeter "MeterProfit11"] and [!UpdateMeter "MeterProfitImage11"] bangs. When you set some options with !SetOption bangs, a simple redraw of the skin (done by the [!Redraw] bang) makes no sense, because if you don't update the appropriate meters, the redraw is in vain. This is why I added these bangs.
-
- Posts: 15
- Joined: April 25th, 2015, 9:45 pm
Re: !setvariable help needed
First of all thanks you had a look at the script!UpdateRate makes sense only on the parent WebParser measure. On child measures you don't have to use this option. You've added it to the [MeasureSite11] measure, where it is alright, this being the parent measure, but have added it to the [MeasurePrice11] and [MeasureProcentage11] measures as well, where they can't be used. In fact using it on those measures as well is not a problem, Rainmeter simply ignores it on both measures. But strictly speaking you should have remove them.
so if the parent has been updated, the child follows?
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: !setvariable help needed
There are two different update mods of a WebParser measure. Such a measure, no matter if it's the parent or the child measure, like any other measure of your code is updated according to the Update option set on the [Rainmeter] section (to make things little bit simpler, let's assume there are no UpdateDivider options set). But this is not the update which lets the parent measure to go outside and acquire the online information which it is supposed to acquire. This information acquiring process is controlled by the UpdateRate option of the parent WebParser measure (once again: I assumed above there is no UpdateDivider defined on any measure, which means it is not on the parent WebParser measure either). When the parent WebParser measure gets the online information, this is taken over by the child measures as well, on the same update cycle (immediately). Why can't you use UpdateRate on the child measures is because this option is meant to control when the WebParser measure goes to read the online information, but a child measure never does this. It just takes over the information acquired by the parent measure, through a "normal" update process.Laaglander wrote: ↑January 14th, 2024, 4:24 pm so if the parent has been updated, the child follows?
Here you have an excelent description of all this things.