balala wrote: ↑September 3rd, 2020, 8:46 pm
Try to remove the
UpdateDivider=-1 option from the [GoldTick] measure.
I did, but in this way I get always "0" for the [GoldTick] measure and it's not what I want...
So basically this whole thing should work like this:
Parse the value for [GoldPrice] ---> compare it to #GoldPricePrevious# with the [GoldTick] measure ---> print the result with [Gold@] meter ---> store [GoldPrice] in Variables.inc
The next cycle will repeat with a NEW parsed [GoldPrice]...
Now if the variable #GoldPricePrevious# is not updated (and by my observation seems to happen randomly, sometimes it is updated properly and sometimes it is not...) the next compare operation will return a wrong result...
Code: Select all
[Site]
Measure=WebParser
URL=#URL#
UpdateRate=-1
Flags=Resync | NoCookies
UserAgent=#UserAgent#
LogSubstringErrors=0
RegExp=(?siU)^(.*)$
StringIndex=1
FinishAction=[!EnableMeasureGroup Child][Play "#@#Sounds\UpdateAlarm.wav"][!Delay 1000][!UpdateMeasureGroup Tick]
[SpotGold]
Measure=WebParser
URL=[Site]
StringIndex=1
RegExp=(?siU)^.*>Spot Gold </a>.*nowrap>(.*)</td>.*nowrap>(.*)</td>.*nowrap>(.*)%</td>.*right'>(.*)</td>.*right'>(.*)</td>.*right'>(.*)</td>
Disabled=1
Group=Child
[GoldPrice]
Measure=WebParser
URL=[SpotGold]
StringIndex=1
[GoldPriceNumber]
Measure=WebParser
URL=[SpotGold]
StringIndex=1
Substitute=",":""
[GoldTick]
Measure=Calc
Formula=([GoldPriceNumber]-#GoldPricePrevious#)
IfCondition=([GoldTick] > 0)
IfTrueAction=[!SetOption Gold@ FontColor #UpColor#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
IfCondition2=([GoldTick] = 0)
IfTrueAction2=[!SetOption Gold@ FontColor #Color2#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
IfCondition3=([GoldTick] < 0)
IfTrueAction3=[!SetOption Gold@ FontColor #DownColor#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
DynamicVariables=1
UpdateDivider=-1
Group=Child | Tick
Disabled=1
So something in the code above, for whatever reason that still elude me, is not doing its job correctly.... Not sure if it's a timing problem (that the reason for
[!Delay 1000][!UpdateMeasureGroup Tick] but I've tried different Delay values with no luck though...)
EDIT - Proof of what happening:
Untitled.png
You do not have the required permissions to view the files attached to this post.