strawberryshortcake wrote: ↑October 18th, 2020, 8:34 amIncredible work as usual. Your username fits you well. You're like a superstar coding genius.
Yeah, me and Bill are buddies, LMAO. Bill Gates, of course, not Bill Clinton.
A: Well, it's not much to wrap your head around, really. The syntax and the examples are there in the manual, and the specifics always depend on context, there's not a fixed "formula" for it. Generally, assuming you have the appropriate options set to the variables controlling the animation in your other measures/meters and the update variable (i.e.
#U#) or bangs sequence is correctly updating and redrawing things, simultaneously is just about adding the change of the variable (i.e. !SetVariable) controlling the other animation(s) to your main repeating sequence in the AT measure along the already existing one(s), and sequentially is about adding the other actions after the
| delimiter, in the desired action list(s). Otherwise, if the animations are not connected in any way, it's about replicating the existing AT measure to a new one and modifying it according to your needs.
B: Not sure you understood this properly. I'm not changing any sound file duration anywhere - Rainmeter can't do that. I'm just playing the same sound file for a limited number of times (or cycles), that's all.
C: Sure, it's more suited as a bin size indicator - I never disagreed with that. The only reason why I did this for the raindrops and not the bin size is because - again - I do NOT use the bin at all, so it never gets to more than 0 Bytes for me (although I had to enable it to be able to test the previous versions of the code), therefore it was much easier for me to test with the raindrops than by finding the files needed to make the recycle bin of a certain size. That being said, although I like to work on this and such, the main purpose of the thread is hopefully to make YOU understand and be able to do more by yourself. The only way one can do this is by experimenting yourself, and by this I don't mean copy pasting stuff, but actually modifying things on your own and try to find the best solutions to achieve something, in practice. For example, although the code you posted earlier was messy and had redundant parts, I actually liked the fact that you managed to make it functional in the sense of having the expected behavior - that's the way to go. It's not only about being creative from an artistic point of view, it's about being creative from a coding point of view as well. More compact solutions will come, in time - you can't expect this to happen overnight. I'll tell you a "secret": it's not a coincidence that people trying to help here prefer to post simple examples built from the ground up (i.e. from 0) when demonstrating ahievement of a certain goal: the code is much cleaner this way and makes the job easier for the coder, as he doesn't have to manipulate entirely different parts taken from somewhere, that may or may not have conflicting behaviors, variables, or generally requiring some effort to integrate everything into a functional and logical whole.
Anyway, back to the code:
Code: Select all
[Variables]
TriggerSlide=0
Cycle=0
Frame=0
FrameCount=48
SpheresAngle=0
SpheresAngleIncrement=3
Speed=75
BinIconSize=32
BinIconEmpty=#@#BinEmpty.png
BinIconFull=#@#BinFull.png
OrbIndex=0
OrbTint0=128,128,128,255
OrbTint1=0,0,255,255
OrbTint2=0,255,0,255
OrbTint3=255,255,0,255
OrbTint4=255,128,0,255
OrbTint5=255,0,255,255
OrbTint6=255,0,0,255
SphereSize=25
SphereRotationRadius=22
SphereWhite_X=([MeterStartButton:X]+[MeterStartButton:W]/2-20)
SphereWhite_Y=(#SphereSize#/2+#SphereRotationRadius#+10)
SphereBlue_X=([MeterStartButton:X]+[MeterStartButton:W]/2+20)
SphereBlue_Y=(#SphereSize#/2+#SphereRotationRadius#+10)
SphereGreen_X=([MeterStartButton:X]+[MeterStartButton:W]/2)
SphereGreen_Y=(#SphereSize#/2+#SphereRotationRadius#)
U=[!UpdateMeasure MeasurePlay][!UpdateMeasure MeasureSlider][!UpdateMeasure MeasureSpheresAngle][!UpdateMeter MeterRaindrops][!UpdateMeterGroup SpheresGroup][!Redraw]
Action1=[!SetVariable Cycle 0][!ShowMeter MeterBinIconEmpty][!HideMeter MeterBinIconFull][!HideMeter MeterBinCount][!HideMeter MeterSphereGreen][!HideMeter MeterSphereWhite][!HideMeter MeterSphereBlue][!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 1"]
Action2=[!SetVariable Cycle 0][!HideMeter MeterBinIconEmpty][!ShowMeter MeterBinIconFull][!ShowMeter MeterBinCount][!ShowMeter MeterSphereGreen][!ShowMeter MeterSphereWhite][!ShowMeter MeterSphereBlue][!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 2"]
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1
---Measures---
[MeasurePlay]
Measure=Calc
UpdateDivider=-1
IfCondition=(#Frame#%12=8) && (#Cycle#<3)
IfTrueAction=[!SetVariable Cycle (#Cycle#+1)][Play "#@#WaterDrop.wav"]
IfConditionMode=1
DynamicVariables=1
[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Reset | Wait #Speed# | Repeat Slide,#Speed#,#FrameCount# | Wait #Speed#
ActionList2=Repeat Slide,#Speed#,#FrameCount# | Wait #Speed# | Rerun | Wait #Speed#
Reset=[!SetVariable Frame 0]#U#
Slide=[!SetVariable Frame ((#Frame#+1)%#FrameCount#)][!SetVariable SpheresAngle ((#SpheresAngle#+#SpheresAngleIncrement#)%360)]#U#
Rerun=[!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 2"]
UpdateDivider=-1
DynamicVariables=1
[MeasureBinCount]
Group=RecycleGroup
Measure=RecycleManager
RecycleType=Count
[MeasureBinSize]
Group=RecycleGroup
Measure=RecycleManager
RecycleType=Size
OnUpdateAction=[!SetVariable OrbIndex (Sgn([MeasureBinSize:])*Clamp((Ceil(Ln([MeasureBinSize:])/Ln(2))-27),1,6))][!UpdateMeter MeterStartButton]
DynamicVariables=1
[MeasureAction]
Measure=Calc
Formula=(Sgn(MeasureBinCount)+1)
IfCondition=(MeasureBinCount=0)
IfTrueAction=[#Action[&MeasureAction]]
IfFalseAction=[#Action[&MeasureAction]]
IfCondition2=(#TriggerSlide#=1)
IfTrueAction2=[#Action[&MeasureAction]]
DynamicVariables=1
[MeasureSpheresAngle]
Measure=Calc
Formula=#SpheresAngle#
MinValue=0
MaxValue=360
UpdateDivider=-1
DynamicVariables=1
---Styles---
[Style]
StringAlign=Right
FontFace=Roboto
FontSize=9
FontColor=255,255,255,255
AntiAlias=1
---Meters---
[MeterStartButton]
Meter=Button
ButtonImage=#@#StartOrbGreen.png
X=15
AntiAlias=1
Greyscale=1
ImageTint=[#OrbTint[#OrbIndex]]
UpdateDivider=-1
MouseOverAction=[!SetVariable TriggerSlide 1][!ShowMeter MeterBinSize][Play "#@#WaterDrip.wav"][!UpdateMeasure MeasureAction]
MouseLeaveAction=[!SetVariable TriggerSlide 0][!HideMeter MeterBinSize][!Redraw]
LeftMouseUpAction=[Play "#@#WaterFlush.wav"][!CommandMeasure MeasureBinCount "OpenBin"]
RightMouseUpAction=[Play "#@#WaterFlush.wav"][!CommandMeasure MeasureBinCount "EmptyBin"][!UpdateMeasureGroup RecycleGroup][!UpdateMeasure MeasureAction]
DynamicVariables=1
[MeterRaindrops]
Meter=Image
ImageName=#@#Raindrop-#Frame#.png
UpdateDivider=-1
DynamicVariables=1
[MeterBinIconEmpty]
Meter=Image
X=10
Y=20
W=#BinIconSize#
ImageName=#BinIconEmpty#
AntiAlias=1
UpdateDivider=-1
[MeterBinIconFull]
Meter=Image
X=10
Y=20
W=#BinIconSize#
ImageName=#BinIconFull#
AntiAlias=1
UpdateDivider=-1
[MeterBinSize]
Hidden=1
Meter=String
MeterStyle=Style
X=55
Y=0
AutoScale=1
NumOfDecimals=1
MeasureName=MeasureBinSize
Text=%1B
[MeterBinCount]
Meter=String
MeterStyle=Style
X=0r
Y=13r
MeasureName=MeasureBinCount
Text=%1 file
[MeterSphereGreen]
Group=SpheresGroup
Meter=Rotator
X=#SphereGreen_X#
Y=#SphereGreen_Y#
ImageName=#@#SphereGreen.png
StartAngle=(-PI/2)
RotationAngle=(PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1
[MeterSphereWhite]
Group=SpheresGroup
Meter=Rotator
X=#SphereWhite_X#
Y=#SphereWhite_Y#
ImageName=#@#SphereWhite.png
StartAngle=(-PI/2+PI/3)
RotationAngle=(-PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1
[MeterSphereBlue]
Group=SpheresGroup
Meter=Rotator
X=#SphereBlue_X#
Y=#SphereBlue_Y#
ImageName=#@#SphereBlue.png
StartAngle=(-PI/2-PI/3)
RotationAngle=(PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1
The changes made were minor - that's the advantage of having a good base to build on: an OrbIndex, more OrbTints, removing updating the orb from #U# as it served no purpose since it wasn't about raindrops anymore, setting the #OrbIndex# and updating [MeterStartButton] in the update action of [MeasureBinSize] and using the said index in the ImageTint option of [MeterStartButton] instead of the old #Cycle# variable.
I didn't follow exactly the sizes you mentioned: the biggest two are 2 GB and 4 GB instead of 1.5 GB and 2 GB, because it suited the formula as they're powers of 2. In the formula, considering that you can use "only" natural logarithm (i.e. base
e) and base 10 logarithm in Rainmeter and I needed base 2 logarithm to find out to which power should 2 be raised to get [MeasureBinSize:], I used the logarithm property which says that
the base-2 logarithm is equal to the natural logarithm divided by ln 2, the natural logarithm of 2 (basically getting base 2 logarithm from the other two logarithms, base
e and base 10). It's not as complicated as it seems:
2^28 = 268 435 456 = 256 (MB), so I needed more or less to find the difference between the power that 2 needed to be raised to get to [MeasureBinSize:] (i.e. the measure value's base 2 logarithm) and 28, and that was, again more or less, going to be the needed index. More or less because due to the particularity of these values and the required result, I needed to aply some tweaks, e.g. 27 instead of 28,
Ceil(), Clamp() and Sgn().
If you want those >MIN and <=MAX intervals to be adjustable, you'll have to use either IfConditions (like in your previous attempt regarding those colors), or
conditionals inside the formula. That will be your job, if you really want to, as they're not complicated, just much longer. I like short ones, where possible, hence the chosen approach.