Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 17

Lua Scripting • Re: Lua for conditional operators with strings as result.

$
0
0
So I've created this little testing skin:
ConditionalExample_1.0.rmskin
Desktop2024.10.18-18.55.42.01-ezgif.com-video-to-gif-converter.gif

The idea is a little radio button that enables and disables by clicking it. The conditional function is used on certain options, clicking the button will set a ButtonState variable from 0 to 1 and the button will enable, when it enables the button changes color and the text changes from disabled to enabled as well as its colors. This is pretty nice because it saves from having a measure and multiple set option bangs.

The only problem I've noticed so far is on the Shape's Fill option. On first load and on refresh, it will log Invalid shape modifier: 0 (ConditionalExample\Example.ini - [Button])
Captura de pantalla 2024-10-18 185722.png
Any idea to solve this would be appreciated.

This happens with any of the conditional functions. While the example is using the first conditional function, the script.lua file contains all three functions for testing. Just remember each of them requires a somewhat different syntax on the condition.

One solution I've found is creating a new variable and use the escaped function on that variable. That way the Fill option on the shape can stay as
Fill=Fill Color [#ButtonColor] and the ButtonColor Variable as: ButtonColor=[&*C:con(([#*ButtonState*]=0),'[#*ButtonDisabledColor*]','[#*ButtonEnabledColor*]')*]

Like this:

Code:

[Variables]...ButtonColor=[&*C:con(([#*ButtonState*]=0),'[#*ButtonDisabledColor*]','[#*ButtonEnabledColor*]')*]...[Button]......Fill=Fill Color [#ButtonColor]...
And no error will be logged.

Here's a second example skin using the functions only on variables:
ConditionalExample2_1.rmskin

Any other idea to fix the first problem is still welcome though.

Statistics: Posted by RicardoTM — Yesterday, 11:58 pm



Viewing all articles
Browse latest Browse all 17

Trending Articles