@icon modifier and variables

Is the @icon modifier meant to be used in conjuntion with internal commands/settings only?

I tried to set an icon for a button depending on variable status like so:

@icon:power_adapter,$glob!:idledetection=false @icon:power_time,$glob!:idledetection=true
This did not work out, this is my second attempt at doing so, it seemed "natural" to me, but seems to be no good?
What I tried after that, was setting an icon without any dependency (just using ifset: blocks), but that does not work either?

@ifset:$glob!:idledetection @set glob!:idledetection @icon:power_adapter .. @ifset:else @set glob!:idledetection=true @icon:power_time ..
?!.. o)
Thanks!

Doesn't seem like any of those are ~supposed to work in the first place - judging by the examples given in the Help file. I think support for testing variables might be a feature request.

Ok, thanks. o)
Yes, I'd like to see that implemented - for the sake of consistency at least.. o)

Actually, now that I think on it... I also didn't think we could test variables for their actual 'value' yet... though maybe I missed a change part way through the betas?

But yeah, from a consistency standpoint... first we got the @ifset directive able to test vars... then for the auto-size script I asked for @toggle to be able to use variables. I think I also asked for @icon to follow suit, but I don't recall if it did or not as it wasn't important to what I needed and wasn't mentioned when we got the @toggle update (Beta 5 announcement).

But if it did get similarly updated like @toggle, I suppose a syntax like @icon:power_adapter,$glob!:idledetection would be more likely to work. Even if it doesn't work right now, if my assumption above is true that is probably how it will work if GPSoft decide to implement it to "catch up" and be consistent with these other few @directives...

No, I don't think you miss something. o)
I expected this to work, because nothing stops you from assigning a custom value, but using values for comparison does obviously not lead to success.

Some more:
The @toggle takes an additional ":if" to test for settings, while @icon does not.
You can use negation (!) for @toggle, but you cannot for @icon and @ifset
You see vars with "$" in front and you see them without "$" (only when using @set?), and then you see them bracketed like {$lala}.
"!" in variable names. I always think on negation when it appears - even more if there's an @ifset somewhere on the line. o)

I get confused with these modifiers, I think and hope that's where the "real" scripting kicks in and cleans up a bit? I'll see. o)

Yeah, there will be some difference in the convention between @toggle and @icon since they do different things... We'll see what GPSoft make of the request. Now that I think about it, I actually prefer your second example above... where you attempt an unqualified @icon:<icon_name>.

The ifset:else sort of gives you negation handling and I think that ESPECIALLY with your confusion over where $ and ! are used in variables, that adding explicit negation to @icon might be sort of fugly:

@icon:power_adapter,!$glob!:idledetection

??

For the use of the $ char, you're only using it with vars when referencing them (not when setting them - like you saw about @set)... so testing them with @ifset as well as referencing the value of the variable in a regular button - i.e. using the VALUE of the variable "lala" is done with {$lala}.

The ! char in variable usage is only to specify that you want the variable to be persistent (survive across restarts). Another char could have been used to denote a persistent variable... but, it is what it is :slight_smile:.

Yes, I agree. It is what it is.. o) As the modifiers evolved over the years, I have some understanding for them not working very alike.
That exclamation mark though.. I mean look at the keyboard, there are dozens of chars to choose from, why the exclamation? o))
FWIW, I won't nitpick anyfurther on those modifiers and variables.. o)

I'm going to nitpick on the scripting part now, haha! o) It does not provide a button object in ClickData to modify the button appearance. o))
Maybe worth something to think about? Being able to switch button icons and toggle-states depending on an "external" setting/situation would be very cool.
I tried to use that to indicate the status of the windows idle-timer (disabling it manually from time to time to prevent sleep/screensaving alltogether).

I have 230V plugs connected wirelessly to the computer as well, now image a toolbar showing current switch state of your heating/lighting/garage door. Sweet? o)

Thanks for your attention and opinion Steje.. o)