It is currently April 20th, 2024, 6:22 am

Need help with the Random measure formula

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with the Random measure formula

Post by balala »

UndergarmentPhisogue wrote: ↑July 6th, 2020, 7:20 pm Still doing the weird thing :uhuh:, don't understand why it's not working
It just fades out and bye-bye, doesn't reapper, doesn't change coordinates, just isn't visible anymore.
The problem is caused by the useless spaces used between the bangs in the LeftMouseUpAction option of the [MeterMario] meter. Remove those spaces: LeftMouseUpAction=[!UpdateMeasureGroup "Random"][!FadeDuration "1000"][!HideFade][!Delay "16"][!Move "#VarNewXPosition#" "#VarNewYPosition#"][!ShowFade]. Note that I also added some quotes, replaced the parameter of the !Delay bang with 16 (you said in your edit why) and replaced the parenthesis used on the parameters of the !Move bang with quotes.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5398
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Need help with the Random measure formula

Post by eclectic-tech »

Your !Delay bang is not large enough to allow the fade effect, so I increased it from 15 to 1500 milliseconds.
Your [!ShowFade] was on a separate line; I added it to the end of the LeftMouseUpAction bang of [MeterMario].
You don't need parenthesis around variable names; and I like to enclose all bang parameters inside quotes.

This code fades the image, then moves it and fades t back in for me (I used my own image).

Code: Select all

[Rainmeter]
Update=1000
OnRefreshAction=[!Move "#VarDefaultX#" "#VarDefaultY#"]

[Variables]
VarDefaultX=164
VarDefaultY=470
VarNewXPosition=0
VarNewYPosition=0
;VarFlipVisible=0

;(Keep in mind: the skin's position identifies with the top leftmost pixel)
;"Highbound" here is the furthest x coordinate it can teleport to, 121 is the total width of the image to not make it clip outside the desktop
[MeasureCalcX]
Measure=Calc
Group=Random
Formula=(Random)
LowBound=0
HighBound=((#WORKAREAWIDTH#)-121)
UpdateRandom=1
UpdateDivider=-1
DynamicVariables=1
OnUpdateAction=[!SetVariable VarNewXPosition "[MeasureCalcX]"]

;(Keep in mind: the skin's position identifies with the top leftmost pixel)
;"Highbound" here is the furthest y coordinate it can teleport to, 140 is the total height of the image to not make it go outside the desktop
;That other value in "Highbound", "40", is the taskbar's height: in Windows 10 default, the DPI is 100% making the taskbar (which is at the bottom) 40 pixels high
[MeasureCalcY]
Measure=Calc
Group=Random
Formula=(Random)
LowBound=0
HighBound=(((#WORKAREAHEIGHT#)-140)-40)
UpdateRandom=1
UpdateDivider=-1
DynamicVariables=1
OnUpdateAction=[!SetVariable VarNewYPosition "[MeasureCalcY]"]

;Testing for making it flip certain times

;[MeasureCalcFlip]
;Measure=Calc
;Group=Random
;Formula=(Random)
;LowBound=0
;HighBound=1
;UpdateRandom=1
;UpdateDivider=-1
;DynamicVariables=1
;OnUpdateAction=[!SetVariable VarFlipVisible "[MeasureCalcFlip]"]

[MeterMario]
Meter=Image
ImageName=#@#Delivery Ready to go East.png
DynamicVariables=1
LeftMouseUpAction=[!UpdateMeasureGroup "Random"][!FadeDuration 1000][!HideFade][!Delay 1500][!Move "#VarNewXPosition#" "#VarNewYPosition#"][!FadeDuration 1000][!ShowFade]
MiddleMouseUpAction=[!UpdateMeasureGroup "Random"][!Move "#VarDefaultX#" "#VarDefaultY#"]

;Meters I used in testing

; [MeterStringPos]
; Meter=String
; SolidColor=255, 0, 0, 255
; Text=#VarNewXPosition#, #VarNewYPosition#
; DynamicVariables=1
; [MeterStringFlip]
; Meter=String
; Y=16
; SolidColor=0, 255, 50, 255
; Text=#VarFlipVisible#
; DynamicVariables=1
I didn't test the 'flip' portion. :uhuh:
UndergarmentPhisogue
Posts: 9
Joined: June 16th, 2020, 3:46 pm

Re: Need help with the Random measure formula

Post by UndergarmentPhisogue »

balala wrote: ↑July 6th, 2020, 8:37 pm The problem is caused by the useless spaces used between the bangs in the LeftMouseUpAction option of the [MeterMario] meter. Remove those spaces: LeftMouseUpAction=[!UpdateMeasureGroup "Random"][!FadeDuration "1000"][!HideFade][!Delay "16"][!Move "#VarNewXPosition#" "#VarNewYPosition#"][!ShowFade]. Note that I also added some quotes, replaced the parameter of the !Delay bang with 16 (you said in your edit why) and replaced the parenthesis used on the parameters of the !Move bang with quotes.
I can't believe it would have been something so trivial tbh...
Thank you for noticing it πŸ™, I would have been just trying to implement whatever code I'd come up with otherwise


eclectic-tech wrote: ↑July 6th, 2020, 8:44 pm I didn't test the 'flip' portion. :uhuh:
Nah, that's no problem, it's still not even halfaway thought-out
There is still more ideas around it, but I prefer to find my own ways around it, it's funnier at (some) times
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Need help with the Random measure formula

Post by jsmorley »

β€’ deviantART Profile β€’ Current Desktop β€’ Rainmeter Manual β€’
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5398
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Need help with the Random measure formula

Post by eclectic-tech »

jsmorley wrote: ↑July 6th, 2020, 10:08 pm You might revisit my earlier post...

https://forum.rainmeter.net/viewtopic.php?f=5&t=35644#p179685
:17nodding
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with the Random measure formula

Post by balala »

UndergarmentPhisogue wrote: ↑July 6th, 2020, 9:27 pm I can't believe it would have been something so trivial tbh...
Thank you for noticing it πŸ™, I would have been just trying to implement whatever code I'd come up with otherwise
I always recommend to get rid of all those useless characters: not needed spaces (like this time), spaces at the beginning of lines in the .ini files, empty spaces between consecutive sections and so on. Most of them don't cause problems, but some do. And the code is much easier to follow if it is according to the "unwritten rules".