Moving an Addon Frame with a Script [SOLVED]

Hello,

I’m using an addon called TwintopInsanityBar, i would like to run a script in a macro that moves the position of the bar.

I’m working with this, but it doesn’t work. My knowledge of lua is not that great but I’m trying to learn, any help would be appreciated.

/run TwintopInsanityBar.barContainerFrame:SetPoint(“CENTER”, settings.bar.xPos, -150)

1 Like

I don’t know the addon but a couple of things come to mind.
Your code refers to two frames TwintopInsanityBar and barContainerFrame.

Are you sure the bar you want to move is anchored to barContainerFrame? ie. the bar has one or more points using barContainerFrame as the reference (attach to) point.

If the first is correct, does barContainerFrame have multiple (or other (not “CENTER”)) attach points (SetPoints). If so, then not using TwintopInsanityBar.barContainerFrame:ClearAllPoints() first means that any additional anchor points remain fixed in place.

settings.bar.xPos do you know what this contains (did you create the table/keys) or is it a grab from the addon in which case the settings` you are looking at are possibly a global leak from some other addon.

Not specifying an reference (attach point) in you SetPoint call means the frame will still use it’s original anchor parent as the “starting point” for it anchor:

/run TwintopInsanityBar.barContainerFrame:SetPoint(“CENTER”, UIParent, settings.bar.xPos, -150)

changes the “starting point” to UIParent which covers the entire screen so (“CENTER” is center of screen rather than center of the frame used as the original anchor).

One thing you could try to see if it moves to the center of the screen (no offsets) is:

/run TwintopInsanityBar.barContainerFrame:ClearAllPoints() TwintopInsanityBar.barContainerFrame:SetPoint(“CENTER”, UIParent, 0, 0)

Why not just drag and drop the bar or enter the coords you want into the addon’s ui?

Twin set it up so you can move it very precisely.

2 Likes

or there’s that :rofl:.

@Elvenbane
This is true, however you cannot set up profiles for this addon. When I’m in a group i would like the bar to be in a different position then when I am solo.

I tired using the addon “Reflux” for this issue but it was a pain to set it up and when i finally got it after editing some saved variables it ended up causing some issues with my other addon profiles that i did not like.

@Fizzle,
This is the beginning of the lua file of the addon, after reading your comment i believe i was wrong and now think the frame which i need to move is called TwinTopInsanityBarFrame. Let me know your thoughts.

local barContainerFrame = CreateFrame("Frame", "TwintopInsanityBarFrame", UIParent)
local insanityFrame = CreateFrame("StatusBar", nil, barContainerFrame)
local castingFrame = CreateFrame("StatusBar", nil, barContainerFrame)
local passiveFrame = CreateFrame("StatusBar", nil, barContainerFrame)
local barBorderFrame = CreateFrame("StatusBar", nil, barContainerFrame)

local leftTextFrame = CreateFrame("Frame", nil, barContainerFrame)
local middleTextFrame = CreateFrame("Frame", nil, barContainerFrame)
local rightTextFrame = CreateFrame("Frame", nil, barContainerFrame)

insanityFrame.threshold = CreateFrame("Frame", nil, insanityFrame)
passiveFrame.threshold = CreateFrame("Frame", nil, passiveFrame)
leftTextFrame.font = leftTextFrame:CreateFontString(nil, "BACKGROUND")
middleTextFrame.font = middleTextFrame:CreateFontString(nil, "BACKGROUND")
rightTextFrame.font = rightTextFrame:CreateFontString(nil, "BACKGROUND")
1 Like

Spoke with Twin, he asked me to pass along the following:

1 Like

@elvenbane

I think i would be ok with the first option /tib move X Y, I and others would surely appreciate it!

Others may find use with the second command /tib movetemp X Y.

1 Like

You could easily combine it with Macro-Talk to make a toggle macro too.

[added]
Command should be available whenever Curse picks up the new ver.

2 Likes

@Elvenbane

Amazing! I never thought by coming to the forums that the addon author would make these changes. The slash command works perfectly, and I’m going to macro it right now!

Thank you!!!

2 Likes

Hehe this is a bit of a unique case but I’m glad it worked out.

1 Like