It is currently March 28th, 2024, 10:01 pm

Object following another object

Get help with creating, editing & fixing problems with skins
dooderman10
Posts: 7
Joined: May 11th, 2017, 3:32 pm

Object following another object

Post by dooderman10 »

So my script has run PERFECTLY so far, problem is, I can't find out how to make 4 objects follow the one that I move. Here is the script, it just calls the 4 objects.

Code: Select all

[BotDBLR]
Meter=Image
ImageName=#@#Images\BotDBLR.png
H=90
LeftMouseUpAction=["#@#BotDBLR.ahk"] [!ActivateConfig "BotDBLR\BotDBLR1" "BotDBLR1.ini"] [!ActivateConfig "BotDBLR\BotDBLR2" "BotDBLR2.ini"] [!ActivateConfig "BotDBLR\BotDBLR3" "BotDBLR3.ini"] [!ActivateConfig "BotDBLR\BotDBLR2" "BotDBLR2.ini"] [!ActivateConfig "BotDBLR\Edit" "Edit.ini"]
RightMouseUpAction=[!DeactivateConfig "BotDBLR\BotDBLR1" "BotDBLR1.ini"] [!DeactivateConfig "BotDBLR\BotDBLR2" "BotDBLR2.ini"] [!DeactivateConfig "BotDBLR\BotDBLR3" "BotDBLR3.ini"] ["#@#Terminator.ahk"] [!DeactivateConfig "BotDBLR\Edit" "Edit.ini"]
SavePosition=1
AlwaysOnTop=1
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Object following another object

Post by balala »

The meters from second, should be positioned relatively. Add the following position to the second meter:

Code: Select all

[BotDBLR]
...
X=0r
Y=10R
This will place the second meter at the same vertical position as the first one, with 10 pixels below it.
Obviously you have to find the proper position for each of the four meters.
dooderman10
Posts: 7
Joined: May 11th, 2017, 3:32 pm

Re: Object following another object

Post by dooderman10 »

balala wrote:The meters from second, should be positioned relatively. Add the following position to the second meter:

Code: Select all

[BotDBLR]
...
X=0r
Y=10R
This will place the second meter at the same vertical position as the first one, with 10 pixels below it.
Obviously you have to find the proper position for each of the four meters.
Thanks
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Object following another object

Post by balala »

But did help?
dooderman10
Posts: 7
Joined: May 11th, 2017, 3:32 pm

Re: Object following another object

Post by dooderman10 »

balala wrote:But did help?
I have to re-write my other code to use it, so not really.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Object following another object

Post by balala »

dooderman10 wrote:I have to re-write my other code to use it, so not really.
Then for specific help, please post the code you have so far and describe which meter should move and which ones should follow it.
dooderman10
Posts: 7
Joined: May 11th, 2017, 3:32 pm

Re: Object following another object

Post by dooderman10 »

balala wrote:Then for specific help, please post the code you have so far and describe which meter should move and which ones should follow it.
Object 0 (start-up)

Code: Select all

[BotDBLR]
Meter=Image
ImageName=#@#Images\BotDBLR.png
H=90
LeftMouseUpAction=["#@#BotDBLR.ahk"] [!ActivateConfig "BotDBLR\BotDBLR1" "BotDBLR1.ini"] [!ActivateConfig "BotDBLR\BotDBLR2" "BotDBLR2.ini"] [!ActivateConfig "BotDBLR\BotDBLR3" "BotDBLR3.ini"] [!ActivateConfig "BotDBLR\BotDBLR2" "BotDBLR2.ini"] [!ActivateConfig "BotDBLR\Edit" "Edit.ini"] [!ActivateConfig "BotDBLR\Link" "Link.ini"]
RightMouseUpAction=[!DeactivateConfig "BotDBLR\BotDBLR1" "BotDBLR1.ini"] [!DeactivateConfig "BotDBLR\BotDBLR2" "BotDBLR2.ini"] [!DeactivateConfig "BotDBLR\BotDBLR3" "BotDBLR3.ini"] ["#@#Terminator.ahk"] [!DeactivateConfig "BotDBLR\Edit" "Edit.ini"]
SavePosition=1
AlwaysOnTop=1
Object 1 (Object that needs to move with Object 0)

Code: Select all

[Rainmeter]
Update=10
;
[CountingMeasure]
Measure=Calc
Formula=(CountingMeasure + (CountingMeasure < 200 ? 5 : 0))
Disabled=1
;
[MovingMeter]
Meter=Image
ImageName=#@#Images\BotDBLR1.png
H=90
MouseOverAction=[!EnableMeasure CountingMeasure]
LeftMouseUpAction=["#@#StrengthStarter.ahk"]
Y=[CountingMeasure]
DynamicVariables=1
Object 2, 3, and 4 have the same code as Object 1.
Right now, when I run Object 0 it runs the other objects and makes them move 5 pixels every .01 seconds, when I close it, (right click) I need to be able to drag Object 0 around and when I'm finished moving it, still have the other objects slide down from Object 0, what you told me is usable, but I have to take the code and put it into one script, which still didn't work when I did it. (doesn't matter if the objects move with Object 0 when they are showing if you thought that)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Object following another object

Post by balala »

Let's clarify first a thing: what is an object? In Rainmeter, we don't have objects, instead there are skins and each skin has at least one meter. From what I can read from your post, I think you'd like to follow a skin, with other four.
If I'm right, then the solution is pretty simple: you have to add to the "master" skin (which should be followed by the others), the following measure:

Code: Select all

[MeterMove]
Measure=Calc
OnUpdateAction=[!Move "#CURRENTCONFIGX#" "#CURRENTCONFIGY#" "ConfigOfTheFirstFollowerSkin"][!Move "#CURRENTCONFIGX#" "#CURRENTCONFIGY#" "ConfigOfTheSecondFollowerSkin"][!Move "#CURRENTCONFIGX#" "#CURRENTCONFIGY#" "ConfigOfTheThirdFollowerSkin"][!Move "#CURRENTCONFIGX#" "#CURRENTCONFIGY#" "ConfigOfTheFourthFollowerSkin"]
DynamicVariables=1
Obviously you have to replace the ConfigOfTheFirstFollowerSkin, ConfigOfTheSecondFollowerSkin (and so on) with the config names of the skin which should have to be moved by the "master". In the above !Move bangs, the #CURRENTCONFIGX# and #CURRENTCONFIGY# variables return the current position of the "driver" skin. Because I added a last parameter, the !Move bang won't move itself, but the skins of the enumerated configs. As such, they will follow the first one.
As a note, if you want to place the follower skins a bit further away from the first one, you can add some constant values (not necessary the same ones) to each #CURRENTCONFIGX# and #CURRENTCONFIGY# values in the above bangs (be careful that if you add such values, you have to include the sums into parenthesis, otherwise they won't work).
Please let me know if this is what you wanted.