It is currently May 14th, 2024, 10:08 pm

IfActions with 2 conditions

Get help with creating, editing & fixing problems with skins
Fulmar
Posts: 21
Joined: July 24th, 2012, 4:50 pm
Location: Belgium

IfActions with 2 conditions

Post by Fulmar »

Hello,

I have next question:
I want to plot dots on a X-Y-axis.
The dots should only be seen if both the X-value and Y-value don't exceed 2.5.

The dot doesn't show, although XhecObject1 and YhecObject1 are smaller than 2.5. I guess it is because I am referring to 2 measures. How can i resolve this?


[MeasureIcon1Object1]
Measure=XhecObject1
Measure2=YhecObject1
IfAboveValue=2.5
IfAboveAction=[!HideMeter Meter1IconObject1]
IfBelowValue=2.5
IfBelowAction=[!ShowMeter Meter1IconObject1]

[MeasureEnableIcon1Object1]
Measure=Calc
Formula=MeasureIcon1Object1

[Meter1IconObject1]
Meter=Image
MeasureName=MeasureEnableIcon1Object1
X=(#Width1#-#Width1#/2+([XhecObject1])*100/2.5)-2
Y=(#Height5#-#Height2#/2-([YhecObject1])*100/2.5)-2
DynamicVariables=1
ImageName=Minor planet.png
Path="#SKINSPATH#\Fm\Resources\Images"
ToolTipText="Distance: [DieaObject1] AU#CRLF#Velocity: [LitiObject1VeloObject1] km/s#CRLF#X: [XhecObject1] AU#CRLF#Y: [YhecObject1] AU"
ToolTipTitle="Minor planet [NameObject1]"


Thanks for your help

:confused:
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: IfActions with 2 conditions

Post by MerlinTheRed »

Since you are already familiar with Lua, why not write a Lua script that does all the positioning of the objects and decides if they should be shown or hidden? I guess you could do it without Lua by using multiple Calc measures with ifActions, but I'm not convinced that would be easily readable, and that's an important thing in my opinion.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: IfActions with 2 conditions

Post by Kaelri »

This is not a valid measure:

Code: Select all

[MeasureIcon1Object1]
Measure=XhecObject1
Measure2=YhecObject1
IfAboveValue=2.5
IfAboveAction=[!HideMeter Meter1IconObject1]
IfBelowValue=2.5
IfBelowAction=[!ShowMeter Meter1IconObject1]
The Measure= key is used only to define the type of measure - Calc, Script, Plugin, etc. As it is, this measure has no type, so as far as Rainmeter is concerned, it doesn't exist. In addition, IfActions act on the value of the current measure, and measures can have only a single number value. So you will need a way to combine the two values that you're recording. Here would be one way:

Code: Select all

[MeasureIcon1Object1]
Measure=Calc
Formula=(XhecObject1 > 2.5) + (YhecObject1 > 2.5)
IfEqualValue=1
IfEqualAction=[!HideMeter Meter1IconObject1]
IfBelowValue=1
IfBelowAction=[!ShowMeter Meter1IconObject1]
I'm also not sure what [MeasureEnableIcon1Object1] is supposed to be doing. Since your meter has both Path and ImageName defined as constants, the measure value will either be ignored, or override those other options. In addition, I don't see a reason to use a Calc measure as a middleman, instead of using [MeasureIcon1Object1] directly.