1. So.. me and my college trying to make a addon. We are both new into this area so we need some help.

    what the addon is doing, is when u press a buttom, u roll a number between 1 - 100, like normal.. the number u roll is shown in my addon.. the party or raid members can then see what i have rolled, and i can see what they have rolled if they have my addon..

    we have made the rolling part, but what we'r haveing problems with is the SendAddonMessage, and getting the party member in the addon..

    we cant receive the info from the SendAddonMessage, and dunno how to handel the info if we actually receive it, allso, how do we make so when a player get in the party, hes/her name get into the addon automatic..

    heres the lua and the xml

    LUA

     SLASH_ROLLINGAME1, SLASH_ROLLINGAME2 = '/rollin', '/rg';
     SlashCmdList["ROLLINGAME"] = function() RollinGame_Toggle() end;
    
     function RollinGame_Toggle()
         if not Frame1:IsVisible() then
             Frame1:Show();
         else
             Frame1:Hide();
         end
     end
    
     function Button1_OnClick()
        local num = math.random(1,100)
         local roll = tostring(num)
        SendChatMessage(roll, "SAY", nil, "General") -- test ing gerneral chat
        SendAddonMessage("RollinGame", roll,"RAID") -- test addon text(roll)
        FontString3:SetText(roll) -- test string text(roll)
     end
    
     function Button2_OnClick()
        Frame1:Hide(); -- Makes the form hide
     end
    
    
     -- Collect incoming rolls --
     -- function Receive.CHAT_MSG_ADDON(prefix, msg, channel, sender)
       -- if prefix == "RollinGame" and channel == "GUILD" or "RAID" then
       -- FontString6:SetText(msg)
       -- end
       -- end
    

    XML XML code

    The problem is you aren't registering for the CHAT_MSG_ADDON event anywhere, and you dont' set an OnEvent handler. I suggest you check out Chapter 13 for more information about how to register for events and respond to them.

    As for when someone joins the party, you want them added. You can register for PARTY_MEMBERS_CHANGED and respond to that, it indicates when someone joins/leave or is moved within your party, along with some other things.

    I answered this in IRC, but here are the changes:

    http://pastebin.com/v0cDS2ut

    You need to register for the events and respond to them. This is the purpose of the code I've added to the XML. Then you need to add an event handler. Add the following:

     function RollinGame_OnEvent(self, event, ...)
       if event == "CHAT_MSG_ADDON" then
         local prefix, message, channel, sender = ...
         if prefix == "RollinGame" then
           print("Got an addon message from ", sender, " on ", channel, " with text ", message)
         end
       elseif event == "PARTY_MEMBERS_CHANGED" then
         print("Party configuration has changed")
       end
     end
    

    Thanks alot mate !

    it worked! where can i find something about listing players in the party in "labels" ? or if theres a easyer way im all listening :)

    One font string per player, just run a SetText() should work..

    Okay thanks a lot :) so i can just use for example

    FontString:SetText(Sender ... " has joined the party") or FontString:SetText(Sender ... " has rolled: " ... message)

    is it rly that easy ?

    Okay thanks a lot :) so i can just use for example

    FontString:SetText(Sender ... " has joined the party") or FontString:SetText(Sender ... " has rolled: " ... message)

    is it rly that easy ?

    Better would be:

     yourFontString:SetFormattedText("%s has joined the party", sender)
     yourFontString:SetFormattedText("%s has rolled %s", sender, message)
    

    Better would be:

     yourFontString:SetFormattedText("%s has joined the party", sender)
     yourFontString:SetFormattedText("%s has rolled %s", sender, message)
    

    thanks it worked! :)

    Hi again..

    we have desited not to use FontStrings, since it needs to be dynamic with the players and we couldnt make the code to add strings for each player who joined the party..

    so we ware gonna use ScrollMessageFrame, or some kinda window that allowed us to enter text with some kinda scroll function..

    i have tryed to use the scrollmessageframe, but i get an error at ( and ) when i try to use the sender, and message strings from the event.. our code are something like this

    msg_box:AddMessage(sender... "has rolled: " ...message)

    the msg_bos is the scrollmessageframe.. what am i missen or overseeing? it just says theres an error near ( or ).. i have tryed searching for the problem but cant seem to find an answer for this..

    thanks yet again

    we have desited not to use FontStrings, since it needs to be dynamic with the players and we couldnt make the code to add strings for each player who joined the party..

    I'm not sure I understand. Why does a font string need to be specific to the player? Why can't it just be the unitid? In a party, there will only ever be "player", "party1", "party2", "party3", and "party4". In a raid, its the same thing just they go up to 40, and player is included in the raid ids.

    I'm not sure I understand this decision at all.

    so we ware gonna use ScrollMessageFrame, or some kinda window that allowed us to enter text with some kinda scroll function..

    i have tryed to use the scrollmessageframe, but i get an error at ( and ) when i try to use the sender, and message strings from the event.. our code are something like this

    msg_box:AddMessage(sender... "has rolled: " ...message)

    the msg_bos is the scrollmessageframe.. what am i missen or overseeing? it just says theres an error near ( or ).. i have tryed searching for the problem but cant seem to find an answer for this..

    I cannot tell you without the actual error message and without the actual code that is being referenced in the error. There are no problems in your example but there are clearly problems with your code.

    I'm not sure I understand. Why does a font string need to be specific to the player? Why can't it just be the unitid? In a party, there will only ever be "player", "party1", "party2", "party3", and "party4". In a raid, its the same thing just they go up to 40, and player is included in the raid ids.

    We need to specific the fontstrings since we need to show all the party-player's roll's, at the same time, and cant see how can do it otherwise when the guild is allso included ind the prefix, so the guildies can roll to even if they are not in the party. We have also tryed to use the unitid and stuff, but we just cant figger out how to get e.g party member 3's roll, inside fontstring 3.. thats why we though a scrollbox would be easyer, to just print out the messages.

    I cannot tell you without the actual error message and without the actual code that is being referenced in the error. There are no problems in your example but there are clearly problems with your code.

    unfortunately im not home atm and dont have the code here, but ill post some when i get some, cuz i cant see the problem either, but its there :p

    heres the LUA

    http://pastebin.com/CWyQNgjZ

    and here's the XML

    http://pastebin.com/DV0cH64n

    i have putted in 3 boxes, but only need 1, thats the scroll-thing.. where the error messages i get, with i dont quite understand :/

    Message: ..\FrameXML\UIPanelTemplates.lua line 364: attempt to index local 'self' (a nil value) Debug: ..\FrameXML\UIPanelTemplates.lua:364: ScrollingEdit_OnCursorChanged()[string "*:OnCursorChanged"]:1

    Message: ..\FrameXML\UIPanelTemplates.lua line 359: attempt to index local 'self' (a nil value) Debug: ..\FrameXML\UIPanelTemplates.lua:359: ScrollingEdit_OnTextChanged()[string "*:OnTextChanged"]:1

    Message: ..\FrameXML\UIPanelTemplates.lua line 375: attempt to index local 'self' (a nil value) Debug: ..\FrameXML\UIPanelTemplates.lua:375: ScrollingEdit_OnUpdate()[string "*:OnUpdate"]:1

    atleast i THINK they are my errors, havent seen them before :/

    The code in your XML file on line 191 makes absolutely no sense. You call functions and pass null. That's a variable that's set to nil, because there is no null in Lua.

    Also, Lua is not an acronym, it's the Portuguese word for moon.

    That's the source of the errors you are seeing right now. Also, if you don't need three, don't put them in the file.. it just makes my job incredibly difficult.

    sry for the late response, have been a bit busy at work..

    and sry if i made the job fore difficult, didn't knew that..

    But dont quite understand the nil/null thing u explained.. I just inserted the Scroll-thing in wow UI Designer, and wrote the lua code i send u earlier.. im just getting the errors after i inserted the scroll-thing, i havent touched the xml or anything, so thats why im not following you with the XML error..

    sry very much if that didnt made any sense

    I would suggest you pick up my book and read how to manually write XML that you can understand what is going on.

    The reason you are getting errors is because your code is wrong. Why it's wrong is something I can't really tell you because it seems you don't even know where the code came from. So I'm at a loss for what to do, I don't really have time to fix each file for you without really knowing what the intent is.

    If you have a specific question, I will try to help.

    Okay. well thanks a lot for the help :) ill try look at some XML then :p

    There's a series of great chapters about it in te book.