It is currently June 26th, 2019, 4:54 pm

Help Set random position to skin

Help with creating, editing & fixing problems with skins
maxwell1
Posts: 9
Joined: March 28th, 2019, 8:22 pm

Help Set random position to skin

maxwell1 » March 28th, 2019, 8:27 pm

Hi, as titled I wanted to know if there was a way to set a random position to a skin.
Like for example, I have a floating gif as a skin and I would like it to change position every 10 second or so.
(I really don't know anything about programming so thank you in advance !)

Have a good day :D
Last edited by maxwell1 on April 24th, 2019, 10:05 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 8319
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help Set random position to skin

balala » March 28th, 2019, 9:19 pm

maxwell1 wrote:
March 28th, 2019, 8:27 pm
Hi, as titled I wanted to know if there was a way to set a random position to a skin.
Like for example, I have a floating gif as a skin and I would like it to change position every 10 second or so.
(I really don't know anything about programming so thank you in advance !)
For first, Rainmeter is not a programming language. We don't programming.
Anyway, here is a solution: add the following measures to your code:

Code: Select all

[MeasureX]
Measure=Calc
Formula=Random
LowBound=0
HighBound=(#SCREENAREAWIDTH#-#CURRENTCONFIGWIDTH#)
UpdateRandom=1
UpdateDivider=-1
DynamicVariables=1
Group=Position

[MeasureY]
Measure=Calc
Formula=Random
LowBound=0
HighBound=(#SCREENAREAHEIGHT#-#CURRENTCONFIGHEIGHT#)
UpdateRandom=1
UpdateDivider=-1
DynamicVariables=1
Group=Position

[MeasureTimer]
Measure=Calc
Formula=( COUNTER % 10 )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!UpdateMeasureGroup "Position"][!Move "[MeasureX]" "[MeasureY]"]
[MeasureTimer] counts up to 9, then it jumps to 0. In this moment, the !UpdateMeasureGroup bang update the [MeasureX] and [MeasureY] measures, which due to the used Random functions get new random values. These values are set in a way to keep the skin on screen (I added these even if by default the skins anyway aren't going outside of the screen, due to the "Keep on screen" setting, available through right click).
When the measures are updated, the !Move bang moves the skin to the position established by the new measure values.
maxwell1
Posts: 9
Joined: March 28th, 2019, 8:22 pm

Re: Help Set random position to skin

maxwell1 » March 29th, 2019, 12:06 am

Wow ! Thank you very much for your quick reply ! I'm gonna test it ou right now !
Thank you so much !!
User avatar
balala
Rainmeter Sage
Posts: 8319
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help Set random position to skin

balala » March 29th, 2019, 4:35 pm

maxwell1 wrote:
March 29th, 2019, 12:06 am
I'm gonna test it ou right now !
Have you tested it? Have you got it working as intended?
maxwell1
Posts: 9
Joined: March 28th, 2019, 8:22 pm

Re: Help Set random position to skin

maxwell1 » April 24th, 2019, 9:59 pm

Yeah and it works perfectly ! Tahnk you so much for your help :)
User avatar
balala
Rainmeter Sage
Posts: 8319
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help Set random position to skin

balala » April 25th, 2019, 5:46 am

You're welcome. :thumbup: