1. Hello,

    hope you guys could help me out. I'm in process to create an addon that shows battle rezz informations into your interface. What still works is the the counts of free br's, the players (druids) that have rebirth ready and the ones that are on rebirth cooldown.

    I added now a button (chatmessagebtn) to the rezzer frame - but what I want to do now is, when you click on that chatmessagebtn (button) a function sends a SendChatMessage to the raid and or give's a rais_warning when raidlead or raid assistent with the informations of whitch druids are on cooldown (and how long) plus a messsage of druids that have rebirth ready for use.

    Hope you guys could help me out - I tryed alot of diffrent things, but nothing was working so far. Thanks in advance!!

    JC

    Chapter 14 shows how you can log information and then transmit it to the "party" or "say" channels. Altering that code to work for raid is a trivial exercise!

    Thanks for your quick reply. So wouldn't be a big deal to send as RAID_WARNING when Raidlead or Raid-Assistent, too.

    I guess I have to read again .... all what I did now wasn't successful at all.

    Greetings,

    JC

    PS: Btw - wonderful book ... right now I'm in progress of reading and enjoyed it very much so far!!

    Correct, if you have the rights, you could be able to send on that channel as well!

    It's me again. So now I was trying to get this informations send to RAID or as RAID_WARNING.

    As you see above code - cdnames is the variable that shows the cooldown, so here's the function I created:

    Questions:

    1.) What do you think is the code okay and should work?

    2.) Do I have to register the function Rezzer_Report_Raid_Cooldowns in function ZONE_CHANGED_NEW_AREA?

    3.) Hope you could give me some tips if I'm on the right way - I'm a bit lost because I want to work with LUA only (not XML for Frame creations)

    Thanks in advance - hope I'm not totaly wrong with my thoughts? ^^

    JC

    It's me again. So now I was trying to get this informations send to RAID or as RAID_WARNING.

    As you see above code - cdnames is the variable that shows the cooldown, so here's the function I created:

     function Rezzer_Report_Raid_Cooldowns()
      local rank = GetRaidRosterInfo()
      local msgformat = “Druids with Rebirth on Cooldown: “
      local msg = string.format(msgformat, cdnames)
      if rank = 1 or 2 then
         rezzer.chatmessagebtn:SetScript ("OnClick", function() SendChatMessage(msg, “RAID_WARNING“)
      else
         rezzer.chatmessagebtn:SetScript ("OnClick", function() SendChatMessage(msg, "RAID")
      end
     end
    

    Questions:

    1.) What do you think is the code okay and should work?

    I don't know.. does it work?

    2.) Do I have to register the function Rezzer_Report_Raid_Cooldowns in function ZONE_CHANGED_NEW_AREA?

    I'm not sure I understand what you're asking here.. you don't register functions.

    3.) Hope you could give me some tips if I'm on the right way - I'm a bit lost because I want to work with LUA only (not XML for Frame creations)

    I'm not sure why XML matters? All you need to do is call the SendChatMessage funtion().. that's just Lua.

    Thanks in advance - hope I'm not totaly wrong with my thoughts? ^^

    I don't think you are.. but are you testing? I can help with specific questions, but something like 'should this work' doesn't give me much to go on at all.. whats important is DOES it work.

    Thanks. It's not that easy to test this code - because it's always hidden when not in Raid (when productive it's great - but in testing phase it's not that easy! ^^)

    So I have to wait till this evening when my guild is raiding again. As you see I'm little bit confused right now, because I tryed alot of things.

    Do you think I set up the chatmessagebtn correctly and the call within the function is okay? I'm sure when I successfully created this first button stuff - I'll never forget!

    Sorry for my bad english - but I'm a german reader of your book - so something sounds alittle confused.

    Thnaks!!

    JC

    I don't think its a language barrier issue, but the types of questions you are asking =) You have to understand that for me to tell you something looks okay, I have to fully read it, test it, and understand it and that's just something I don't have the time for. You should be able to test this code when you're not in the raid.. just alter the code to show when you're not in a raid and have it send a dummy message in that case to 'SAY' or 'PARTY'. Then at least you know the onclick stuff is set up right.

    That's my suggestion, don't wait until you're in a raid to see if you've done some basic things right!

    For testing it's, as I said, not that easy - because this is a raid addon and I need informations like GetRaidRosterInfo, GetInstanceInfo etc.

    But I understand what you mean - I would be happy if this was easy testable outside of raids.

    Thanks.

    JC

    Cut that logic out. Just have the button and the send chat message. There's always a way to maek it work =)

    Hi,

    I'm still working on that Addon. Right now I fixed everything that the frames and buttons are viewable and the main frame (with Cooldowns etc. is showing up and working).

    I still have a problem with this SendChatMessage Function I created for the infoframe - when I click the buttons no message was send to raid or as raidwarning:

    Infoframe = the Mainframe of the clickable buttons / chatmessagecoolbtn = Button for sending cooldown message to Chat / chatmessagereadybtn = Button for sending ready members to Chat

    This is the function that (beside some other stuff) fills the cdnames (colldownnames) and readynames (members that rebirth is ready) variables plus includes the Button - SendChatMessage Functions:

    Now my problem is - everything is showing up (buttons included) - but when I click on Cooldown or Ready-Button nothing happens (nor any error message etc.)

    I guess there's a small problem or I missed something. For my opinion everything should work. Would be great if you could give me some tips. Thanks in advance

    (See above):

    Have some thoughts about that "ButtonClickFuntions".

    - do I have to use: self:RegisterEvent("Rezzer_Report_Raid_Cooldown") - within the COMBAT_LOG_EVENT_UNFILTERED function to call the OnClick-SendChatMessage functions.

    Was trying different scenarios, but nothing was working so far, unfortunately.

    Thanks.

    (See above):

    Have some thoughts about that "ButtonClickFuntions".

    - do I have to use: self:RegisterEvent("Rezzer_Report_Raid_Cooldown") - within the COMBAT_LOG_EVENT_UNFILTERED function to call the OnClick-SendChatMessage functions.

    You can't call that RegisterEvent because its non-sensical. RegisterEvent is for events, which are blizzard's events.. so you can't just make your own up i.e. RezzerReportRaid_Cooldown.

    Was trying different scenarios, but nothing was working so far, unfortunately.

    Are your onclick functions being called? Add a print statement and see. Is your SetScript ever happening? Add a print statement and see.

    I don't see anything blatantly wrong, but its a whole lot of code to look at. Make stuff simple to begin with, make sure it works, and then make it more complicated. Get the buttons doing something when they're clicked, like printing a message so you can see it happens.

    Yes - thats what I did - I did some small test scripts to test frames, buttons and SetScripts. Within my small scenarios everything was working - but putting it into my addon code it doesn't work at all.

    It looks like the SetScript for sending Chatmessage never starts (but will include a print to get sure if the code ever goes that way into the button click functions). But with all what I tested yet - it looks like the code didn't get to the SetScript - SendChatMessage Part.

    It's a pain ... I'll test and look over it for hours ... and can't find the problem why this button onclicks don't work (there isn't any LUA Error - so it should work). And besides that my small test scripts work - too ... but in between the code it doesn't. I'm lost right now.

    Yes - thats what I did - I did some small test scripts to test frames, buttons and SetScripts. Within my small scenarios everything was working - but putting it into my addon code it doesn't work at all.

    I'm not saying test outside. I'm saying test within your addon.

    It looks like the SetScript for sending Chatmessage never starts (but will include a print to get sure if the code ever goes that way into the button click functions). But with all what I tested yet - it looks like the code didn't get to the SetScript - SendChatMessage Part.

    Then you have to figure out why that happens.

    It's a pain ... I'll test and look over it for hours ... and can't find the problem why this button onclicks don't work (there isn't any LUA Error - so it should work). And besides that my small test scripts work - too ... but in between the code it doesn't. I'm lost right now.

    You only get an error if you've done something wrong. If your code is not being called because of a logic error, the program is just doing what you've told it do do.

    Do as I said. See if your SetScripts() are being called. That's easy to verify. If they aren't, then that's your problem. If they are, then ensure your OnClick scripts are being called. If not, then that's your problem.

    Sorry - my misstake. I meant I tested my stuff within my addon code also - of course. But before for learning purpose I made some smaller script to get an feeling of everything.

    Thanks for the tip - so I'll include some prints to see whats going on. I'm sure I'll get back to you soon!! :)

    Sometimes it's a pain in the a...., you get alot harder stuff to run and the easy stuff you'll have that huge problems with. It's horrible!! haha

    All what I wanna do is to get my readynames and cdnames to RAID or Raidwarning ... that easy ... and that hard ^^

    Do as I said. See if your SetScripts() are being called. That's easy to verify. If they aren't, then that's your problem. If they are, then ensure your OnClick scripts are being called. If not, then that's your problem.

    One small question to see if I got you:

    infoframe.chatmessagereadybtn:SetScript ("OnClick", function() SendChatMessage(msg, "RAID_WARNING") end)

    The Onclick is in between the SetScript - so what do you mean with check if your SetScript is called and if yes check your OnClick called?

    Do you mean something like:

     print("Code enters the function correctly")
     infoframe.chatmessagereadybtn:SetScript ("OnClick", function() SendChatMessage(msg, "RAID_WARNING") print("Onclick is called") end)
    

    Thanks.

     print("Code enters the function correctly")
     infoframe.chatmessagereadybtn:SetScript ("OnClick", function() SendChatMessage(msg, "RAID_WARNING") print("Onclick is called") end)
    

    I'd do:

      print("Calling SetScript() for chatmessagereadybtn")
      infoframe.chatmessagereadybtn:SetScript ("OnClick", function()
        print("OnClick triggered")
        SendChatMessage(msg, "RAID_WARNING"
      end)
    

    But yeah.

    Okay - I tested it - and no print pops up. Not the SetScript and not the call of Onclick. So it looks like the function is never called:

    Heres the code of the functions plus the function where I call the button function:

     --Raid Cooldown Chat/Raidwarning Info:
    

    So my guess I do something wrong calling the function itself. What do you think? Thanks

    I'm not really sure what to tell you. You'll need to do some more basic troubleshooting in order to see what's going on. If those functions aren't being called, then what is the value of rank when the comparisons are being done. Are the functions that do those comparisons ever even called?

    I wish I had a magical way to tell you what the problem is, but unfortunately I don't. But all you have to do is some basic troubleshooting in order to figure out where things are breaking down. You've done the first step, now just take it back a level and see what you can find out!

    Okay, now I get an LUA error:

    LINE 250 is following Line:

    RezzerReportRaid_Cooldown()

    It's where I call the Fubction for the button SetScript.

    That's because you named the function Rezzer_Report_Raid_Cooldowns not RezzerReportRaid_Cooldown`, i.e. not plural. Lua errors tell you precisely what is wrong =)

    Now I was able to check whats the problem is:

    1.) Calling rank = GetRaidRosterInfo() -- looks like is wrong calling rank from the API 2.) The position where I call my Button Functions (RezzerReportRaidCooldown() and RezzerReportRaidReady() )

    But have to put it at the end of the rezzer:COMBAT_LOG_EVENT_UNFILTERED(time, event, _, name, _, _, tarName, _, spellId, spellName) Funktion - because I need the outcome of the variable readynames and cdnames in their. Any trck I could save the outcome of readynames and cdnames for use ourside of the function?

    Thats the problems - tested it with setting rank == 0 (so not GetRaidRosterInfo()) and put the calling the buttton functions outside and everything worked. So above their are my 2 problems I have right now.

    You can see it on the code you pasted here: Posted by jc on Wed, 09 Mar 2011 08:07:12

      function Rezzer_Report_Raid_Cooldowns()
         local rank = GetRaidRosterInfo()
         local msgformat = “Druids with Rebirth on Cooldown: “
         local msg = string.format(msgformat, cdnames)
         if rank = 1 or 2 then
            rezzer.chatmessagebtn:SetScript ("OnClick", function() SendChatMessage(msg, “RAID_WARNING“)
         else
            rezzer.chatmessagebtn:SetScript ("OnClick", function() SendChatMessage(msg, "RAID")
         end
      end
    

    The errors don't lie. If it says you are attempting to access 'blah', and says its a nil value it means just that, you are trying to use 'blah' and 'blah' is undefined. There's only so much I can do to help you, I don't have the full code (and I don't have time to go through all of it). But you've got everything you need in order to do it =)

    ahh I checked was an old Lua Error Message - sry !!^^

    See above - there is the problem I tested everything now and came to this point (above your post).

    Thanks.

    I am very confused because your sentences don't really make all that much sense.

    Why don't you store what you need in the rezzer table. Then you dont' have to worry about the placement of your variables or anything like that.

    You have everything you need to make this work, way more than I have. If you have specific questions, I'll do my best to answer them, but I'll be going to sleep soon.

    Sorry, was late yesterday after a long evening of trying Omnitron HC. So I guess my words just made not much sense.

    As I said I only have the 2 problems right now:

    1.) Get RaidRosterInfo -> there a problem calling it

     --Raid Cooldown Chat/Raidwarning Info:
    

    Have to test if [ if (( rank == 1) or (rank == 2)) then ] this works. Makes sense?

    2.) Second is to the Rezzer_Report_Raid_Cooldown() / Rezzer_Report_Raid_Ready() calls outside the function where I generate the readynames and cdnames - but need the ourput on both variables within the Cooldown and Readybuttons to show on SendChatMessage.

    If I'll fix this 2 things everything should work as it should. I'm sure when I ever get it done I'll never forget how to set it up.

    Thanks for your help - really appreciate your input.

    Sorry, was late yesterday after a long evening of trying Omnitron HC. So I guess my words just made not much sense.

    As I said I only have the 2 problems right now:

    1.) Get RaidRosterInfo -> there a problem calling it

     --Raid Cooldown Chat/Raidwarning Info:
     function Rezzer_Report_Raid_Cooldown()
          local _, rank = GetRaidRosterInfo()
          local msgformat = "Druids with Rebirth on Cooldown: "
          local msg = msgformat .. cdnames
          if (( rank == 1) or (rank == 2)) then
              print("Calling SetScript() for chatmessagecoolbtn to Raidwarning")
              infoframe.chatmessagecoolbtn:SetScript ("OnClick", function() 
              print("OnClick triggered - chatmessagecoolbtn to Raidwarning")
              SendChatMessage(msg, "RAID_WARNING") 
                 end)
     
          else
              print("Calling SetScript() for chatmessagecoolbtn Raid")
              infoframe.chatmessagecoolbtn:SetScript ("OnClick", function() 
              print("OnClick triggered - chatmessagecoolbtn to Raid")
              SendChatMessage(msg, "RAID") 
              end)
          end
     end 
    

    Have to test if [ if (( rank == 1) or (rank == 2)) then ] this works. Makes sense?

    No, saying 'there's a problem calling it' doesn't tell me anything at all. I don't think you've ever actually explained what the problem is. I don't need code, just tell me what the issue is.

    2.) Second is to the Rezzer_Report_Raid_Cooldown() / Rezzer_Report_Raid_Ready() calls outside the function where I generate the readynames and cdnames - but need the ourput on both variables within the Cooldown and Readybuttons to show on SendChatMessage.

    Again, this isn't really a report or telling me what's wrong. What do you mean 'calls outside the function'. I've already given you a solution to this, just store the 'output' that you need to access later in the addon's table...

    If I'll fix this 2 things everything should work as it should. I'm sure when I ever get it done I'll never forget how to set it up.

    Thanks for your help - really appreciate your input.

    I just need good information. I can't help if all you say is 'it doesn't work' and then post code =)

    Okay, understand. Thought it's just easier when you see the functions itself.

    1.) The first error is in the GetRaidRosterInfo declaration - getting a LUA error says that it's nil. What I use to set the local is: local _, rank = GetRaidRosterInfo()

    2.) Trying to add the varialbles cdnames and readynames outside the function - so it should be useable within the Button click functions.

    Sorry for all these stupid questions, but I guess you remember it's not that easy getting started and you have to learn from misstakes and stupidness. Thats life.

    Looks like going you on your nerves - so I'll stop posting. Sorry.

    Okay, understand. Thought it's just easier when you see the functions itself.

    1.) The first error is in the GetRaidRosterInfo declaration - getting a LUA error says that it's nil. What I use to set the local is: local _, rank = GetRaidRosterInfo()

    I need the specific error to see what is nil.

    2.) Trying to add the varialbles cdnames and readynames outside the function - so it should be useable within the Button click functions.

    I've told you how to do that already. Just store them in the frame table.

    Sorry for all these stupid questions, but I guess you remember it's not that easy getting started and you have to learn from misstakes and stupidness. Thats life.

    Looks like going you on your nerves - so I'll stop posting. Sorry.

    You're not getting on my nerves, but I can't help if I don't have good information. I just don't want to waste your time with a back and forth for hours when I can give you the answer with the right information. Please don't stop posting.

    Okay - now I did alot more testing with print's. And it looks like my variables I fill can't be used into my Raid Warning functions (cdnames and readynames).

    I always get a "attempt to concatenate a global a nil value" for both variables using the SendChatMessage. So the problem is within the variables cdnames and readynames - don't know why they are of nil value because when I set a print within the function where they are created - they print out the names of player that have rebirth on cooldown or rebith ready.

    So any idea why this variables get a nil value?

    Thanks.

    Because they are nil, there's no other option. And without the code and the precise error message its hard to be more specific. The error messages Lua give you are always correct. I know this is frustrating for you.

    You're struggling with a number of things at once here. You don't seem to understand the basic rules of scoping and the visibility of variables. Have you been through the first 6 chapters of the book including the examples? Almost anything you need to know about Lua for writing addons is covered there, that's why its such a large portion of the book.

    You're fighting multiple battles here. You're using libraries without fully understanding the way the underlying system works and you're fighting Lua syntax right alongside it. That's a difficult battle, but if you can provide me with information I'll continue to do my best to help you.

    Yes - read everything twice. But don't know why the variables don't get filled with value. To show you what I mean I have to post some code - sorry - but I'm sure you'll see what I mean.

    First Function is where cdnames and readynames where created - working and also SetText to the frame works fine:

    Here the Function: http://paste.ideaslabs.com/show/mEtiFZwIO

    Second Code is the Raid and Raid_Warning Function using global cdnamesmessage and readynamesmessage (globals set with value of cdnames and readynames) where everything gets to the SenChatMessage parts and then I get a nil value within variables:

    Here's the Function: http://paste.ideaslabs.com/show/pOhendysXE

    As you can see cdnames and readynames where generated within the first code function - then I create globals to set value of cdnames and readynames and call them cdnamesmessage and readynamesmessage. After that I trying to use them within the Raid Warning Function (second code) - but all what I get is a nil value - but there should be an value with player names ready and on cooldown (as I said Settext(cdnames) and SetText(readynames) works fine and shows up on the frame) - so there is a value.

    Thanks!!

    Please just put the entire script up on a pastey site along with exactly the error message you get. Also, if you want this to be quicker (for right now, since I'm there) you can go on IRC using this link, with the channel set to #wowprogramming.

    Either way, I'll be waiting for the link to your code and the error message. I am 100% shooting in the dark without them.

    Hi James,

    again - thanks for taking your time to helps us here!! Just want to give a report about my status:

    • No LUA Error's anymore
    • But SendChatMessage doesn't fire up - always get a "OnClick triggered" print but afterwards no message send to chat when clicking Raid_Report Buttons.

    So as there's no LUA error and the Onclick print shows up - don't know why the sendchatmessage never send to chat.

    Possible to let me know whenever you are in IRC again?

    Thanks!!

    JC

    I'm always in IRC, its just a matter of whether I'm active or not.. which is normally during EU times.

    I have notifications up, but my name in IRC isn't 'James', it's jnwhiteh. Address something to me there and if I'm around I will show up.

    Alternatively post your code here so I can take a look at it.

    Hi,

    okay - didn't know that you have a bot notification running there. So here's the modification I did (see above - no LUA errors and the print "On Click ..." fires up - after that no sendchatmessage to chat. When I test it with a normal string variable (not readynamemessage or cdnamesmessage) it works.

    I'll look around on IRC today - eventually I could reach you there.

    Thanks again!!