Thread Tools Display Modes
08-08-10, 06:13 AM   #1
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post Ding help

hi there all im trying to add my ding code to a addon im building. and it all seems ok. but when loaded it shows things in dubble. i looked into what it could be and it seems to be the xml used for the ding. is there a way i can add this to the code without the need of the xml.

Code:
AutoDingFunc = true
--AutoDing
if AutoDingFunc then
function AutoDing_OnLoad()
  this:RegisterEvent("PLAYER_LEVEL_UP");

  DEFAULT_CHAT_FRAME:AddMessage("AutoDing Loaded", 1, 1, 0);
end

function AutoDing_OnEvent()
  local DingMsg;
  if (event == "PLAYER_LEVEL_UP") then
    DingMsg = "DING! " .. tostring(arg1);
    DEFAULT_CHAT_FRAME:AddMessage(msg, 1, 1, 0);

    SendChatMessage(DingMsg,"PARTY");
    SendChatMessage(DingMsg,"GUILD");
    SendChatMessage(DingMsg,"Raid");
      end
   end
end
and the xml

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
  <Script file ="wUltz.lua"/>
  <Frame name="AutoDingFrame" parent="UIParent" >
    <Scripts>
      <OnLoad>AutoDing_OnLoad();</OnLoad>
      <OnEvent>AutoDing_OnEvent();</OnEvent>
    </Scripts>
  </Frame>
</Ui>
so do i 1st need to make a

local Ding = CreateFrame("Frame")

then set the onload and on event to something else for the main part to call.


thanks all for your help
  Reply With Quote
08-08-10, 07:10 AM   #2
Soulofsin_007
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 125
Are you trying to build a separate addon from your earlier post? Or are you putting it all in one?

Edit: I'm retarded, I read what you posted over again.

I'd do it like this

Code:
local EventFrame = CreateFrame("Frame")
EventFrame:SetPoint("CENTER")
EventFrame:SetScript("OnEvent", function()
     if event == "PLAYER_LEVEL_UP" then
          local dingmsg = ""
          dingmsg == "DING! "..arg1
          DEFAULT_CHAT_FRAME:AddMessage(dingmsg, 1, 1, 0);
         SendChatMessage(dingmsg,"PARTY");
         SendChatMessage(dingmsg,"GUILD");
         SendChatMessage(dingmsg,"RAID");

     end
end)
EventFrame:RegisterEvent("PLAYER_LEVEL_UP")
Above is untested, but it should work.

Last edited by Soulofsin_007 : 08-08-10 at 07:23 AM.
  Reply With Quote
08-08-10, 07:17 AM   #3
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post

Originally Posted by Soulofsin_007 View Post
Are you trying to build a separate addon from your earlier post? Or are you putting it all in one?
all in one. so i will have all types of addons ive been working on. some i did with no falt. but others i had probs with.

this is the last one. at this time i had to have it set to false. due to what i said about dubble posting in game. so it will say ding ding two times hehe. and any other messages my addons has. like it will say my addon name two times on load. but when set to false its ok. so its the xml. so i would like a way i can not use the xml. or if the xml can be set to work to the ding part of the code. as you can see the xml is to work with the hole addon. and is why the dd postings.

thanks for your time

--edit thanks for that. going to test it now.
was going to say i need to add local dingmsg = ""
dingmsg == "DING! "..arg1
but you had put it. thanks again

should it be like

if event == "PLAYER_LEVEL_UP" then
local dingmsg = "DING! "
dingmsg = "DING! "..arg1
not
if event == "PLAYER_LEVEL_UP" then
local dingmsg = ""
dingmsg == "DING! "..arg1

Last edited by weasoug : 08-08-10 at 07:33 AM.
  Reply With Quote
08-08-10, 07:28 AM   #4
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
you have your script loaded in xml and in toc ... that way you get
it run twice. So if you get rid of your xml you get rid of your fault
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
08-08-10, 07:40 AM   #5
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post

Originally Posted by Rilgamon View Post
you have your script loaded in xml and in toc ... that way you get
it run twice. So if you get rid of your xml you get rid of your fault
i see, but with the old code it didnt work without the xml. but very glad that Soulofsin_007 helped me with that tidy code.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Ding help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off