1. #1

    Trying to make an addon that moves/resizes focus cast bar but struggling

    I made this addon in MOP and I can't seem to repeat it. I can get the addon to show up on wow but the script doesn't work
    I believe it may be my file type tho I cant be sure. I recall being able to edit the script and simply reload the ui constantly but the file type currently only saves as LUA.TXT and I'm told the TXT can't be there.

    Bit confused hope I explained it well enough....

    here is the script

    first saved as .toc

    ## Title: Focus
    ## Interface: 50001

    Focus.lua


    second saved as .lua and can't be edited unless it's .lua.txt (which im told i shoudlnt have)

    FocusFrameSpellBar:ClearAllPoints()
    FocusFrameSpellBar:SetPoint("CENTER",UIParent,"CENTER", 0, 235)
    FocusFrameSpellBar.SetPoint = function() end
    FocusFrameSpellBar:SetScale(1.0)

  2. #2
    No, the file needs to be a .lua file. Remove the .txt extension. An easy way is to set windows to show extension on files, then rename the file and remove the .txt from the filename. If you don't use Windows, then I am sure similar methods apply to different systems.

    Get a text editor which supports more formats. Notepad++ is a popular choice.

  3. #3
    Two suggestions...

    Update the TOC to the newest Interface version

    ## Interface: 60200
    Also, when you're saving the file in Notepad, name it whatever.lua and change the "Save As Type" to All Files like this:


    Gershuun @ Borean Tundra US - Interface & Macros Moderator

  4. #4
    Quote Originally Posted by lawomous View Post
    Two suggestions...

    Update the TOC to the newest Interface version


    Also, when you're saving the file in Notepad, name it whatever.lua and change the "Save As Type" to All Files like this:

    yeh ive done this yet it doesnt seem to work. I even tried notepad++

    - - - Updated - - -

    Quote Originally Posted by Blazeflack View Post
    No, the file needs to be a .lua file. Remove the .txt extension. An easy way is to set windows to show extension on files, then rename the file and remove the .txt from the filename. If you don't use Windows, then I am sure similar methods apply to different systems.

    Get a text editor which supports more formats. Notepad++ is a popular choice.

    still isnt working. cant figure out why im failing. I had prev saved as all files and downloaded notepad++ and saved as the proper files. it still shows up in the addons when i launch wow but doesnt change the bar

  5. #5
    Try adding a print statement to your file, to make sure it is actually read and executed correctly.

    You could also try delaying the code execution, in case the element you are trying to modify hasn't been created when your code is executed.
    To delay it, simply create a frame and register the "PLAYER_ENTERING_WORLD" event. Then set the OnEvent script to execute your code.

  6. #6
    Quote Originally Posted by Blazeflack View Post
    Try adding a print statement to your file, to make sure it is actually read and executed correctly.

    You could also try delaying the code execution, in case the element you are trying to modify hasn't been created when your code is executed.
    To delay it, simply create a frame and register the "PLAYER_ENTERING_WORLD" event. Then set the OnEvent script to execute your code.
    i didnt understand any of that.... other than the part about adding something to confim it working or not

  7. #7
    Something like this should work:

    Code:
    local f = CreateFrame("Frame")
    f:RegisterEvent("PLAYER_ENTERING_WORLD")
    
    local function MyOnEvent(self, event)
       self:UnregisterEvent(event)
       
       FocusFrameSpellBar:ClearAllPoints()
       FocusFrameSpellBar:SetPoint("CENTER",UIParent,"CENTER", 0, 235)
       FocusFrameSpellBar:SetScale(1.0)
       
       --It gets re-positioned OnShow, so hook it and set our position again
       local function MySetPoint(self, _, _, _, _, _, PreventLoop)
          if  not PreventLoop then
             FocusFrameSpellBar:ClearAllPoints()
             FocusFrameSpellBar:SetPoint("CENTER",UIParent,"CENTER", 0, 235, true)
          end
       end
       hooksecurefunc(FocusFrameSpellBar, "SetPoint", MySetPoint)
    end
    
    f:SetScript("OnEvent", MyOnEvent)

  8. #8
    Quote Originally Posted by eosgreen View Post
    i didnt understand any of that.... other than the part about adding something to confim it working or not
    ...so, uh, why don't you just download MoveAnything and use it to move the frame? That way you don't need to mess around with trying to write an addon to do something that has an existing, functional, supported solution.

Posting Permissions

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