Page 4 of 7 FirstFirst ...
2
3
4
5
6
... LastLast
  1. #61
    Quote Originally Posted by XyNN View Post
    First of all, awesome guide!
    Thats what I needed to finally start creating my own AddOns.

    I've made a frame with 2 buttons with help of Ace3. Is there any way to lock the frame size? (something like frame:LockWidth() )
    I dont want to be able to resize the frame with my mouse.

    Ace3 is a tricky monster of a library.
    What you have to do is use some Ace3 defined functions to prevent resizing.

    Also, there is a limitation of the Ace3 library in that the disable resizing method in Ace3 is only defined for windows, and not for frames.

    window = AceGUI:Create("Window")
    window:EnableResize(false)

    You would have to do something like that in order to get that to work.

  2. #62
    Deleted
    My addon refuses to pop up in my addonlist on both my PC and Macbook.
    They are both extremely easy just to see if it'd pop up on the list.

    TOC:
    Code:
    ## Interface: 40000
    ## Title: PvPWarnings
    
    test.lua
    Lua:
    Code:
    print("test")
    I've tried this before on my PC and it worked once, after that it never popped up in the list.
    It did work when it was enabled, but now I can't seem to get it on my addonlist.

  3. #63
    Deleted
    What's your folder name, your TOC filename, and your LUA filename.

  4. #64
    Quote Originally Posted by Blukker View Post
    My addon refuses to pop up in my addonlist on both my PC and Macbook.
    They are both extremely easy just to see if it'd pop up on the list.

    TOC:
    Code:
    ## Interface: 40000
    ## Title: PvPWarnings
    
    test.lua
    Lua:
    Code:
    print("test")
    I've tried this before on my PC and it worked once, after that it never popped up in the list.
    It did work when it was enabled, but now I can't seem to get it on my addonlist.

    Both files need the same name
    test.toc
    test.lua

    and to be safe (and kinda handy) I name the folder the same.
    Signature removed. Please read our guidelines. Venara

  5. #65
    Deleted
    Quote Originally Posted by Solidseal View Post
    Both files need the same name
    test.toc
    test.lua

    and to be safe (and kinda handy) I name the folder the same.
    Actually, folder and toc need to have the same name. Lua needs to be called how you called it in the toc.

  6. #66
    Deleted
    Ah thanks, that worked!

  7. #67
    Quote Originally Posted by Treeston View Post
    Actually, folder and toc need to have the same name. Lua needs to be called how you called it in the toc.
    ah yeah tried it and indeed.
    though I guess when you have just 1 toc and 1 lua it is handy to call them the same
    Signature removed. Please read our guidelines. Venara

  8. #68
    Deleted
    To hard for me tho

  9. #69
    wow great thread! if you didnt enter the guide contest, you should've

  10. #70
    Deleted
    Quote Originally Posted by Ltsmash View Post
    wow great thread! if you didnt enter the guide contest, you should've
    You do realize he won third (?) prize, do you?

  11. #71
    Sixth. Wish I'd gotten third. I want that Ethereal Portal :3

  12. #72
    I have made a mod and it's working just as I hoped. So thanks for the guide

    What I'm wondering now is when two people are using this addon (in the same guild) how can I make the addons share information?

  13. #73

  14. #74

  15. #75

    Lua Problems

    I just started teaching myself programming today, and I decided to make an addon related to dueling. Unfortunately I can't get any part of it to work. In fact, it doesn't do anything at all. Here's the code, hopefully one of you can help me out.

    local DuelRequestedFrame = CreateFrame("DRF")
    DuelRequestedFrame:RegisterEvent("DUEL_REQUESTED")
    DuelRequestedFrame:SetScript("OnEvent", function(self,event,...)
    ChatFrame1:AddMessage("You have been challenged to a duel!"))
    end
    I also must admit that I used one of the articles examples and altered it to fit my needs, and since I'm new to programming there could just be something i didn't know what to do with. Thanks for the article, and Help!

  16. #76
    Deleted
    I see two three errors:
    1. Wrong arguments to the CreateFrame API.
    Code:
    CreateFrame("Frame", "DRF")
    2. One excess bracket in your ChatFrame1 line. Besides, you can use print() instead.
    Code:
    print("You have been challenged to a duel!")
    3. No closing bracket to your SetScript call. It should be at the end of your function definition.
    Code:
    end)
    Complete code:
    Code:
    local DuelRequestedFrame = CreateFrame("Frame", "DRF")
    DuelRequestedFrame:RegisterEvent("DUEL_REQUESTED")
    DuelRequestedFrame:SetScript("OnEvent", function(self,event,...)
        print("You have been challenged to a duel!")
    end)
    PS: You don't have to give your frames a name. Usually, I recommend not giving them one unless they're either a) visible or b) you need your addon to be globally accessable.

  17. #77
    Deleted
    Quote Originally Posted by Treeston View Post
    PS: You don't have to give your frames a name. Usually, I recommend not giving them one unless they're either a) visible or b) you need your addon to be globally accessable.
    I'd have to disagree with that it is REALLY good practice to give your frame a name (the "DRF" bit) this is so if users have issues with odd frames interefering with clicking or anything like that they can use diagnostic tools to work out which frame is the culprit. Frames with no names are truly awful in this respect and cause people doing the debugging to curse the authors so I'd suggest really bad practice to miss out frame names.

    NB. I appreciate you might have thought to cover this under "visible" however for clarity I'd say any frame that is active whether the user can see it or not should be counted as needing a name eg: a frame might be fully transparent but still shown is that counted as "visible"?
    Last edited by mmoca7472cd2b9; 2011-01-18 at 05:32 PM.

  18. #78
    Deleted
    Though, try not to use generic names such as "DRF".

  19. #79
    Thanks for the help, Treeston. All of this is very new to me, and hard to understand, but what you've told me definitely helps. Its people like you that make the internet a resourceful and friendly place

  20. #80
    After reading this I immediatly wanted to try and make some addons of my own. I have some experience as a PHP programmer so I figured that I might be able to learn lua pretty quickly. But I've run into some problems I can't seem to get fixed.

    The addon I'm trying to make is something like titanpanel. A frame at the top of my screen that is styled by the main addon and then make some little addons that put text on that bar. So I started of with the first part, a bar at the top of my screen. I made the following code for that:

    Code:
    -- Frames
    local EventFrame = CreateFrame("Frame")
    local Topbar = CreateFrame("Frame", "jbTopbar", UIParent)
    
    -- Variables
    local ResolutionWidth = GetScreenWidth()
    local BackgroundTexture = "Interface\\Addons\\jbTopbar\\Textures\\jbBackground.tga"
    local BorderTexture = "Interface\\Addons\\jbTopbar\\Textures\\jbBorder.tga"
    
    -- Fonts
    jbFont = CreateFont("jbFont")
    jbFont:SetFont("Interface\\Addons\\jbTopbar\\Fonts\\jbFont.ttf",10)
    jbFont:SetTextColor(1,1,1,1)
    
    -- Events
    EventFrame:RegisterEvent("PLAYER_LOGIN")
    
    -- OnEvent
    EventFrame:SetScript("OnEvent", function(self,event,...) 
        Topbar:SetFrameStrata("BACKGROUND")
        Topbar:SetWidth(ResolutionWidth)
        Topbar:SetHeight(100)
        Topbar:SetPoint("TOPLEFT", 0, 0)
    
        Topbar:SetBackdrop({
            bgFile = BackgroundTexture,
            edgeFile = BorderTexture,
            tile = true,
            tileSize = 16,
            edgeSize = 16,
            insets = {
                left = 0, right = 0, top = 0, bottom = 4
            }
        })
        Topbar:SetBackdropColor(0,0,0,1)
        Topbar:SetBackdropBorderColor(0,0,0,1)
    end)
    Now this gives no errors but it doesn't display a frame either. The font I created is intentionally global so I can use it in the little addons that I'm making to implement in this one. The next one is a little one that is intented to show the players money:

    Code:
    -- Frames
    local EventFrame = CreateFrame("Frame")
    local TopbarMoney = CreateFrame("Frame", "jbTopbarMoney", jbTopbar)
    
    -- Fontstrings
    local TopbarMoneyText = TopbarMoney:CreateFontString("TopbarMoneyText")
    TopbarMoneyText:SetFontObject(jbFont)
    
    -- Variables
    local PlayerMoney
    local PlayerGold
    local PlayerSilver
    local PlayerCopper
    local MoneyString
    
    -- Events
    EventFrame:RegisterEvent("PLAYER_LOGIN")
    EventFrame:RegisterEvent("PLAYER_MONEY")
    
    -- OnEvent
    EventFrame:SetScript("OnEvent", function(self,event,...) 
        PlayerMoney = GetMoney()
        PlayerGold = floor(abs(PlayerMoney / 10000)) 
        PlayerSilver = floor(abs(mod(PlayerMoney / 100, 100))) 
        PlayerCopper = floor(abs(mod(PlayerMoney, 100))) 
        MoneyString = PlayerGold.."G "..PlayerSilver.."S "..PlayerCopper
        TopbarMoneyText:SetText(MoneyString)
    end)
    This one does give an error, bugsack reports this:

    Code:
    1x jbTopbarMoney\jbTopbarMoney.lua:31: TopbarMoneyText:SetText(): Font not set
    jbTopbarMoney\jbTopbarMoney.lua:31: in function <jbTopbarMoney\jbTopbarMoney.lua:25>
    I am currious why it tells me there is no font set while I set it in the main addon file. Or do I still have to include that file into this one? I was thinking that I wouldn't have to because the font is global. So can anyone give me some pointers on what I'm doing wrong?

    Thanks in advance!
    Last edited by Shivano; 2011-07-20 at 05:40 PM. Reason: Typo

Posting Permissions

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