It is currently April 20th, 2024, 2:00 am

Randomizing on a specific value

Get help with creating, editing & fixing problems with skins
Ignetia
Posts: 2
Joined: November 30th, 2019, 11:34 pm

Randomizing on a specific value

Post by Ignetia »

Hi,

I'm trying to randomize a set of folders with GIFs inside of them, and every time the GIF reaches a certain frame/PNG, the randomizer should turn on again to switch to another gif, but the randomizer doesn't seem to trigger unless I refresh the skin entirely. Here is the code (I turned on DynamicVariables on all of them because I was unsure which one was at fault):

Code: Select all

[MeasureCalcy]
Measure=Calc
Formula=(Random)
LowBound=1
HighBound=2
DynamicVariables=1

[Variables]
Randomizer=1
DynamicVariables=1

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 44


[ImageMeter]
Meter=Image
ImageName=#@#\Card_Frames\#Randomizer#\frame_[ImageNumberCalc].png
IfCondition=[ImageNumberCalc]=43
IfTrueAction=[!SetVariable Randomizer "[MeasureCalcy]"][!UpdateMeter *][!Redraw]
W= 456
H= 503
AntiAlias=1
DynamicVariables=1
Apologies if the code isn't showing correctly, this is my first time posting.
Last edited by Ignetia on December 1st, 2019, 2:15 pm, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Randomizing on a specific value

Post by mak_kawa »

IfCondition expression can be located only in measurers, not meters. Move it to [ImageNumberCalc] measure.
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Randomizing on a specific value

Post by balala »

mak_kawa wrote: December 1st, 2019, 2:04 am IfCondition expression can be located only in measurers, not meters. Move it to [ImageNumberCalc] measure.
As mak_kawa said, the IfConditions don't make sense on meters, they have to be used on measures. But there are other issues as well.
  • A DynamicVariables=1 variable, declared into the [Variables] section doesn't make sense. Remove it.
  • When checking an IfCondition, section variables don't have to be used, especially that in this case [ImageNumberCalc] returns a number, so its equality with certain value can be checked even if you1re not using section variables (as you did on the IfCondition=[ImageNumberCalc]=43 option of the [ImageMeter] meter - this has to be moved to the [ImageNumberCalc] measure).
  • The #@# variable already has a backslash, so there is no need to add another one. However even if add one or more it still works, but technically it's not needed. I removed it from the ImageName option of the [ImageMeter] meter.
With these, the code should look like this:

Code: Select all

[Variables]
Randomizer=1

[MeasureCalcy]
Measure=Calc
Formula=Random
LowBound=1
HighBound=2
DynamicVariables=1

[ImageNumberCalc]
Measure=Calc
Formula=( Counter % 44 )
IfCondition=(#CURRENTSECTION#=43)
IfTrueAction=[!SetVariable Randomizer "[MeasureCalcy]"][!UpdateMeter "ImageMeter"][!Redraw]

[ImageMeter]
Meter=Image
ImageName=#@#Card_Frames\#Randomizer#\frame_[ImageNumberCalc].png
W=456
H=503
AntiAlias=1
DynamicVariables=1
Ignetia
Posts: 2
Joined: November 30th, 2019, 11:34 pm

Re: Randomizing on a specific value

Post by Ignetia »

That worked perfectly, thank you very much!
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Randomizing on a specific value

Post by balala »

Ignetia wrote: December 1st, 2019, 2:15 pm That worked perfectly, thank you very much!
If you're talking about my above posted code, I'm glad.