Page 2 of 6 FirstFirst
1
2
3
4
... LastLast
  1. #21
    Quote Originally Posted by Tangent View Post
    Theres a Visual studio based wow addon creator called "Addon Studio". It lets you create the windows and menus in a visual way such as with visual basic and similar languages. Has all Lua built in to it for help with auto correction and things like that. Auto generates TOC and things like that I believe also.
    It hasn't been updated in almost two years, and according to their website, it is being worked on again but will no longer feature a visual editor.
    Last edited by Riokou; 2011-01-04 at 12:03 AM.

  2. #22
    If anyone has further questions about writing an addon, feel free to join the #wowuidev channel on IRC and ask there. If you're not familiar with IRC, the easiest way to use it is to go to webchat.freenode.net, pick a custom nick, and enter #wowuidev in the channel editbox.

  3. #23
    High Overlord Rilancio's Avatar
    Join Date
    Jun 2009
    Location
    Constanta,Romania
    Posts
    120
    Awesome guide.
    Rilanciownz-Outland Eu
    Desertwolf-Sylvanas Eu

  4. #24
    nice guide, maybe you should add something about basics of oop
    Last edited by Mroz123; 2011-01-03 at 10:29 PM.

  5. #25
    High Overlord
    Join Date
    Jun 2010
    Location
    Wales, UK
    Posts
    113
    The first guide i've found useful

  6. #26
    really awesome guide m8! really intrested on learning some lua coding ;]

  7. #27
    Keyboard Turner
    Join Date
    Jan 2011
    Location
    Sydney
    Posts
    1
    Oh god.. so many bad programming memories!

    But a great guide none the less

    I'll use it when the nightmares go away :P

  8. #28
    Alrighty. Updated the guide a few hours ago thanks to some suggestions and errors I had in the original. Thanks for the help!

  9. #29
    Little typo (or is it intended?) I noticed. In the example where you cite me, you're not definiting it as a method, merely putting the function as another value into the table. You might want to explain that defining it as a method allows usage of "self".
    UI & AddOns expert | Interface & Macros moderator - My work

  10. #30
    Blademaster wiccan999's Avatar
    Join Date
    Nov 2010
    Location
    Holland
    Posts
    28

    Can anyone tell my why this addon is not loading/working?

    I'm trying to get this old addon to work , its quite simple i guess, but I have no clue why it is not loading at all.

    function SellSound_OnEvent()
    if ( event == "ADDON_LOADED" and arg1 == "SellSound") then
    DEFAULT_CHAT_FRAME:AddMessage("SellSound 2.4 loaded!");
    end
    if event == "CHAT_MSG_SYSTEM" and strfind(arg1,"A buyer has been found") then
    PlaySoundFile("Interface\\Addons\\SellSound\\cashregister.mp3");
    end
    end

    local frame = CreateFrame("Frame");

    frame:SetScript("OnEvent", SellSound_OnEvent);

    frame:RegisterEvent("CHAT_MSG_SYSTEM");

    frame:RegisterEvent("ADDON_LOADED");


    and the toc :

    ## Interface: 40000
    ## Title: SellSound
    ## Notes: Simple addon that plays a cash register sound when you sell something at auction.
    ## Author:
    ## Version: 4.0
    ## LoadOnDemand: 0
    ## DefaultState: Enabled

    sellsound.lua


    edit: somehow when i copy paste it here , cashregister has a space in it , but this is not the case in my lua file
    <--- Warlocks...because DPS is the best form of Crowd Control ----->

  11. #31
    I believe there is a logical error in the example code.
    Code:
    for name,number in pairs(mySavedVar) do 
            if UnitName("Player") == name then
                    mySavedVar[name] = mySavedVar[name] + 1
            else
                    mySavedVar[UnitName("Player")] = 1
            end
    end
    Perhaps it should read:
    Code:
    local found = 0
    for name,number in pairs(mySavedVar) do 
            if UnitName("Player") == name then
                    mySavedVar[name] = mySavedVar[name] + 1
                    found = 1
            end
    end
    if found == 0 then
            mySavedVar[UnitName("Player")] = 1
    end

  12. #32
    Quote Originally Posted by wiccan999 View Post
    I'm trying to get this old addon to work , its quite simple i guess, but I have no clue why it is not loading at all.

    <snip>


    edit: somehow when i copy paste it here , cashregister has a space in it , but this is not the case in my lua file
    If you want to do little modification, replace line 1 with this:
    Code:
    function SellSound_OnEvent(self, event, arg1)
    If you want to optimize the whole thing, replace the Lua file with:
    Code:
    local frame:CreateFrame("Frame")
    frame:SetScript("OnEvent", function(self, event, a1)
        if event == "ADDON_LOADED" and a1 == "SellSound" then
            print("SellSound 2.4 loaded!")
            self:UnregisterEvent("ADDON_LOADED")
            return
        end
        if event == "CHAT_MSG_SYSTEM" and a1:find("A buyer has been found") then
            PlaySoundFile("Interface\\AddOns\\SellSound\\cashregister.mp3")
        end
    end)
    frame:RegisterEvent("CHAT_MSG_SYSTEM")
    frame:RegisterEvent("ADDON_LOADED")
    EDIT: Oh yeah, use [code] tags.
    UI & AddOns expert | Interface & Macros moderator - My work

  13. #33
    Blademaster wiccan999's Avatar
    Join Date
    Nov 2010
    Location
    Holland
    Posts
    28
    thank you so much for helping with this , also makes me understand it better.....<3
    <--- Warlocks...because DPS is the best form of Crowd Control ----->

  14. #34
    Quote Originally Posted by Treeston View Post
    Little typo (or is it intended?) I noticed. In the example where you cite me, you're not definiting it as a method, merely putting the function as another value into the table. You might want to explain that defining it as a method allows usage of "self".
    Thanks again for the catch

    ---------- Post added 2011-01-04 at 05:14 PM ----------

    Quote Originally Posted by Tatu View Post
    I believe there is a logical error in the example code.
    Code:
    for name,number in pairs(mySavedVar) do 
            if UnitName("Player") == name then
                    mySavedVar[name] = mySavedVar[name] + 1
            else
                    mySavedVar[UnitName("Player")] = 1
            end
    end
    Perhaps it should read:
    Code:
    local found = 0
    for name,number in pairs(mySavedVar) do 
            if UnitName("Player") == name then
                    mySavedVar[name] = mySavedVar[name] + 1
                    found = 1
            end
    end
    if found == 0 then
            mySavedVar[UnitName("Player")] = 1
    end
    There isn't a problem with the logic I believe. The way I did it the first time checks to see if the name of the current character is already stored in the mySavedVar variable, and if it isn't adds it to the table.

    Yours does the same thing, but is a little bit more long-winded. Unless maybe I'm just not understanding what you mean by a error in the logic.
    Care to elaborate?

  15. #35
    Let's take a scenario where the table contains the following data and the player logs in with Brusalk character.
    Code:
    mySavedVar["Brusalk"] = 10
    mySavedVar["Thiran"] = 10
    The first iteration of the loop would set mySavedVar["Brusalk"] to 11 and the next iteration sets it to 1. Resulting data:
    Code:
    mySavedVar["Brusalk"] = 1
    mySavedVar["Thiran"] = 10

  16. #36
    Ah, yep. Your exactly right. Thanks for the catch.

  17. #37
    Still useless. pairs() should only be used to check for values, not check for keys.
    UI & AddOns expert | Interface & Macros moderator - My work

  18. #38
    Blademaster
    Join Date
    Jan 2011
    Location
    Seattle, WA
    Posts
    41
    Quote Originally Posted by Brusalk View Post
    There isn't a problem with the logic I believe. The way I did it the first time checks to see if the name of the current character is already stored in the mySavedVar variable, and if it isn't adds it to the table.

    Yours does the same thing, but is a little bit more long-winded. Unless maybe I'm just not understanding what you mean by a error in the logic.
    Care to elaborate?
    Interject! Your logic works properly for only one character (one 'name' index in 'mySavedVar'). If mySavedVar has more than one character index (you login with a different character), the iterator will wind up traversing 'name' values that don't match UnitName("Player"), which will trip the 'else' case and reset mySavedVar[UnitName("Player")] to 1.

  19. #39
    Quote Originally Posted by PetiteMort View Post
    Interject! Your logic works properly for only one character (one 'name' index in 'mySavedVar'). If mySavedVar has more than one character index (you login with a different character), the iterator will wind up traversing 'name' values that don't match UnitName("Player"), which will trip the 'else' case and reset mySavedVar[UnitName("Player")] to 1.
    Add a break after the =1 then. Also, use true and false instead of 1/0. a) it matches a "if (not) x then" condition b) it saves memory (bool [=tinyint(1)] instead of int32 [64(?)])
    UI & AddOns expert | Interface & Macros moderator - My work

  20. #40
    I guess you could write it as following. It would not fit the guide because no beginner would understand it and it would not demostrate how to use the for loop.
    Code:
    local c = UnitName("player")
    mySavedVar[c] = (mySavedVar[c] or 0) + 1

Posting Permissions

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