It is currently May 11th, 2024, 7:03 pm

Calc and Dynamic Colours

Get help with creating, editing & fixing problems with skins
mazty
Posts: 7
Joined: January 1st, 2012, 4:44 am

Calc and Dynamic Colours

Post by mazty »

Hi, I'm trying to make a skin to monitor server status and activity:

Code: Select all

[Server_Status_Parser]
Measure=Plugin
Plugin=WebParser.dll
Url=https://api.eveonline.com/server/ServerStatus.xml.aspx/
RegExp="(?siU)Open>(.*)<.*Players>(.*)<"
UpdateRate=300
StringIndex=1

[Measure_Server_Status]
Measure=Plugin
Plugin=WebParser.dll
Url=[Server_Status_Parser]
StringIndex=1
Substitute="True":"Online", "False":"Maintenance"

[Server_Status]
MeasureName=Measure_Server_Status
Meter=STRING
MeterStyle=styleServer
DynamicVariables=1
X=150
Y=35

[Measure_Players]
Measure=Plugin
Plugin=WebParser.dll
Url=[Server_Status_Parser]
StringIndex=2

[MeterPlayers]
Meter=STRING
MeasureName=Measure_Players
MeterStyle=styleLeftText
X=150
Y=55

I want the colour of the status to change when the server population is 0, but for some reason, the calc always returns the value of 0, even though MeterPlayers does return the correct value for server population:

Code: Select all

[Calc_Players]
Measure=Calc
Formula=[Measure_Players]
DynamicVariables=1
IfEqualValue=0
IfEqualAction=!SetOption Server_Status FontColor 248,114,023,255
Any ideas why MeterPlayers works and yet the Calc doesn't? Thanks.
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Calc and Dynamic Colours

Post by poiru »

First of all, you don't need an extra Calc. Simply use the IfActions on the WebParser measure. Second, you need to use !SetOption when the value is above zero.

Something like this:

Code: Select all

[Measure_Players]
Measure=Plugin
Plugin=WebParser.dll
Url=[Server_Status_Parser]
StringIndex=2
IfEqualValue=0
IfEqualAction=!SetOption Server_Status FontColor 248,114,023,255
IfAboveValue=0
IfAboveAction=!SetOption Server_Status FontColor 255,255,255,255
Also, in this case, Server_Status does not need DynamicVariables=1.
mazty
Posts: 7
Joined: January 1st, 2012, 4:44 am

Re: Calc and Dynamic Colours

Post by mazty »

Thanks that works wonderfully :D