1. #1
    Deleted

    Want to make a function to alter a Shadowed Unit Frame's Y position value!

    Hi every one.

    I am using this script:

    Code:
    function ShadowPos()
    
    ShadowedUFDB = {
    	["profiles"] = {
    		["MyProfile"] = {
    			["positions"] = {
    				["targettarget"] = {
    					["y"] = 80,
    				}
    			}
    		}
    	}
    }
    end
    hoping that this would alter the Y value of the target of target frame however there are 3 major issues with this. Firstly it does not alter the Target of Targets Y position to 80, secondly it deletes all other data and gives me the very basic default settings and lastly it requires me to "/reload" the UI in order to see the change and I want it to be instant.

    Is this possible? I have seen other addons change the value of settings on the fly like that before and thought this is how its done ut incidentally not.

  2. #2
    thats because the way you are doing it is setting an already saved variable which wont be loaded until you reload ui

    you will need to get the name of the frame and use SetPoint. example:

    frame:SetPoint(250, 80)

    where frame is the name of the frame you want to move :P

  3. #3
    Deleted
    Okay well I hope by using this, it saves the new point in the SavedVariables list...

    Also I tried:
    /run SUFUnitfocustarget:SetPoint(0,80)

    for a test and got this Lua error:
    Code:
    Message: [string "SUFUnitfocustarget:SetPoint(0,80)"]:1: SUFUnitfocustarget:SetPoint(): Unknown region point
    Time: 07/02/13 18:03:22
    Count: 1
    Stack: [C]: ?
    [C]: in function `SetPoint'
    [string "SUFUnitfocustarget:SetPoint(0,80)"]:1: in main chunk
    [C]: in function `RunScript'
    Interface\FrameXML\ChatFrame.lua:2158: in function `?'
    Interface\FrameXML\ChatFrame.lua:4391: in function `ChatEdit_ParseText'
    Interface\FrameXML\ChatFrame.lua:4085: in function `ChatEdit_SendText'
    Interface\FrameXML\ChatFrame.lua:4124: in function `ChatEdit_OnEnterPressed'
    [string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>
    
    Locals:
    Do you know what I could do to fix this? I'm no Lua expert ^^

  4. #4
    Looking at the syntax for setPoint, you've got to provide an anchor.

    http://www.wowwiki.com/API_Region_SetPoint


    Try this:

    Code:
    SUFUnitfocustarget:SetPoint("CENTER",0,80)

  5. #5
    Deleted
    Well that makes sense so thank you.

    It no longer spits out a Lua error however it just does not do anything.. Will look into this but not sure why.

  6. #6
    100% sure you got the frame name correct? if you type /fstack and mouse over the frame it will get the name of it

  7. #7
    Deleted
    Yes it is definitely the correct name :/

    - - - Updated - - -

    Ah it is working now. It is to do with a Shadowed Unit Frame option. There is an Anchor Point and Anchor to drop down menu for the unit frame and Anchor Point by default is set to nothing so once I have set it to anything you can use the SetPoint command!

    - - - Updated - - -

    The issue is however that the

    /run SUFUnittargettarget:SetPoint("CENTER", 0,200)

    Command does not save so when you "/reload" the UI. It goes back to where it originally was positioned which I was afraid of so I cannot use it :/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •