1. #1
    Deleted

    Looking for lua-savvy to help change addon

    Hi, i recently downloaded the addon Relic. It's a tiny addon which says "Welcome" to anyone who joined the guild and also says Ding *X lvl* in /g and /s.

    Problem i have is it removes other frames in the UI when it says Ding, namely it removes/declines i don't know the join dungeon, which really screws me over as a leveling dps. Nevermind, i don't like the Ding thing either way and i'm wondering if anyone who knows lua could help me point out which part of the code i should remove to make the Ding go away completely.

    Another thing i'm wondering is how i can change the welcome text from "Welcome" to "Welcome, NAME"?

    Here's the whole addon, xml wouldn't copy well so i provided a screenshot. http://puu.sh/XiAR

    Code:
    -- Author      : cpsim
    -- Create Date : 3/28/2011 5:50:00 PM
    
    ml = "";
    function RAGuild_OnEvent(event, ...)
    --DEFAULT_CHAT_FRAME:AddMessage(event.." in onevent");
    --DEFAULT_CHAT_FRAME:AddMessage(...);
    	if event == "CHAT_MSG_SYSTEM"then 
    		local msg = ...;
    		--DEFAULT_CHAT_FRAME:AddMessage("args "..arg1.." "..arg2);
    		if (msg and msg ~= nil) then
    			if ((string.find(msg, "has joined the guild") ~= nil)) then
    				starts, ends = string.find(msg," ")
    				args1 = string.sub(msg, 0, starts-1)
    				if (args1 ~= UnitName("player"))then
    					SendChatMessage("Welcome", "GUILD", ml, arg2);
    				end
    			end
    		end	
    	end	
    	if event == "ADDON_LOADED" then
    	local arg1 = ...;
    		if arg1 == "RAGuild" then
    			if RAGInstalled == nil then
    				RAGInstalled = date()
    			end
    			DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00"..GetAddOnMetadata("RAGuild", "Title") .. " |r|c0000ffffV" .. GetAddOnMetadata("RAGuild", "Version").."|r\nWas Installed on "..RAGInstalled);
    		end
    		
    	end
    	if event == "PLAYER_LEVEL_UP" then
    			local arg1 = ...;
    			if (IsInGuild()) then
    				SendChatMessage("Ding "..arg1.." ", "GUILD", ml, "");
    			end
    			if (GetNumPartyMembers() > 0) then --need to check for number of party members
    				SendChatMessage("Ding "..arg1.." ", "PARTY", ml, "");
    			else
    				SendChatMessage("Ding "..arg1.." ", "SAY", ml, "");
    			end
        end
    	if event == "PLAYER_LEAVING_WORLD" then
            	RAGuild:UnregisterEvent("PLAYER_LEVEL_UP");
    			RAGuild:UnregisterEvent("CHAT_MSG_SYSTEM");
    			RAGuild:UnregisterEvent("ADDON_LOADED");
    	end
    end
    
    function RAGuild_OnLoad()
    	--DEFAULT_CHAT_FRAME:AddMessage("in onload");
    	local ourRace = UnitRace("player");
    	hellofired=false
    	if (ourRace == "Human" or ourRace == "Dwarf" or ourRace == "Gnome" or ourRace == "Night Elf" or ourRace == "Draenei" or ourRace == "Worgen") then
    		ml = "Common";
    	else
    		ml = "Orcish";
    	end
    	
    	RAGuild:RegisterEvent("CHAT_MSG_SYSTEM");
    	RAGuild:RegisterEvent("ADDON_LOADED");
    	RAGuild:RegisterEvent("PLAYER_LEVEL_UP");
    
    end

  2. #2
    High Overlord Structures's Avatar
    10+ Year Old Account
    Join Date
    Nov 2011
    Location
    New York
    Posts
    194
    why would you ever use this add-on. no one likes it. its fucking annoying.

  3. #3
    Deleted
    Here i got my hopes up thinking someone had something intelligent to say.

  4. #4
    High Overlord Structures's Avatar
    10+ Year Old Account
    Join Date
    Nov 2011
    Location
    New York
    Posts
    194
    Quote Originally Posted by Chakra View Post
    Here i got my hopes up thinking someone had something intelligent to say.
    so you like to spam your guild chat?

  5. #5
    Deleted
    Quote Originally Posted by Structures View Post
    so you like to spam your guild chat?
    Not with Ding. Welcoming new members, yes. Very much so.

  6. #6
    Not tested but I think this is how you want it changed.
    Code:
    -- Author      : cpsim
    -- Create Date : 3/28/2011 5:50:00 PM
    
    ml = "";
    function RAGuild_OnEvent(event, ...)
    --DEFAULT_CHAT_FRAME:AddMessage(event.." in onevent");
    --DEFAULT_CHAT_FRAME:AddMessage(...);
    	if event == "CHAT_MSG_SYSTEM"then 
    		local msg = ...;
    		--DEFAULT_CHAT_FRAME:AddMessage("args "..arg1.." "..arg2);
    		if (msg and msg ~= nil) then
    			if ((string.find(msg, "has joined the guild") ~= nil)) then
    				starts, ends = string.find(msg," ")
    				args1 = string.sub(msg, 0, starts-1)
    				if (args1 ~= UnitName("player"))then
    					SendChatMessage("Welcome "+args1, "GUILD", ml, arg2);
    				end
    			end
    		end	
    	end	
    	if event == "ADDON_LOADED" then
    	local arg1 = ...;
    		if arg1 == "RAGuild" then
    			if RAGInstalled == nil then
    				RAGInstalled = date()
    			end
    			DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00"..GetAddOnMetadata("RAGuild", "Title") .. " |r|c0000ffffV" .. GetAddOnMetadata("RAGuild", "Version").."|r\nWas Installed on "..RAGInstalled);
    		end
    		
    	end
    	if event == "PLAYER_LEAVING_WORLD" then
            	RAGuild:UnregisterEvent("PLAYER_LEVEL_UP");
    			RAGuild:UnregisterEvent("CHAT_MSG_SYSTEM");
    	end
    end
    
    function RAGuild_OnLoad()
    	--DEFAULT_CHAT_FRAME:AddMessage("in onload");
    	hellofired=false
    	RAGuild:RegisterEvent("CHAT_MSG_SYSTEM");
    	RAGuild:RegisterEvent("ADDON_LOADED");
    
    end
    Removed Player level up event and the associated actions, that should remove the ding.
    Synthaxx was close with the name but UnitName("player") would add your toons name, not the new person. It looks like the author is already extracting the new persons name from the message into arg1 so I added that to the welcome.
    Last edited by Tahirii; 2012-08-21 at 06:13 AM.

  7. #7
    Deleted
    I got this error once or twice when spam-clicking the invite button with SuperGuildInvite with Synthaxx's code but with your code Tahirii i get it when anyone joins (when it tries to say welcome, name). One thing i forgot to add was, would it be possible to make it say "Welcome to "GUILDNAME", "PLAYERNAME"!"? Not in caps though. Note the exclamation mark. Important.

    I just dinged and the ding removal was perfect, thanks for that.

    Code:
    Message: Interface\AddOns\RAGuild\RAGuild.lua:16: attempt to perform arithmetic on a string value
    
    Time: 08/21/12 08:28:53
    Count: 3
    Stack: [C]: ?
    Interface\AddOns\RAGuild\RAGuild.lua:16: in function `RAGuild_OnEvent'
    [string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>
    
    Locals:

  8. #8
    Deleted
    Code:
    SendChatMessage(format("Welcome to %s, %s!", GetGuildInfo("player"), args1), "GUILD", ml, arg2);

  9. #9
    Doh, yeah should have been "Welcome "..args1 I knew it didn't look right for some reason. Anyways looks like Lombra got your Guild Name request in and fixed my error in a different way.

  10. #10
    Deleted
    Everything works now, the message is perfect and the ding is gone. Thank you very much!

    Here's the code if anyone else would like the same config

    Code:
    -- Author      : cpsim
    -- Create Date : 3/28/2011 5:50:00 PM
    
    ml = "";
    function RAGuild_OnEvent(event, ...)
    --DEFAULT_CHAT_FRAME:AddMessage(event.." in onevent");
    --DEFAULT_CHAT_FRAME:AddMessage(...);
    	if event == "CHAT_MSG_SYSTEM"then 
    		local msg = ...;
    		--DEFAULT_CHAT_FRAME:AddMessage("args "..arg1.." "..arg2);
    		if (msg and msg ~= nil) then
    			if ((string.find(msg, "has joined the guild") ~= nil)) then
    				starts, ends = string.find(msg," ")
    				args1 = string.sub(msg, 0, starts-1)
    				if (args1 ~= UnitName("player"))then
    					SendChatMessage(format("Welcome to %s, %s!", GetGuildInfo("player"), args1), "GUILD", ml, arg2);
    				end
    			end
    		end	
    	end	
    	if event == "ADDON_LOADED" then
    	local arg1 = ...;
    		if arg1 == "RAGuild" then
    			if RAGInstalled == nil then
    				RAGInstalled = date()
    			end
    			DEFAULT_CHAT_FRAME:AddMessage("|c00ffff00"..GetAddOnMetadata("RAGuild", "Title") .. " |r|c0000ffffV" .. GetAddOnMetadata("RAGuild", "Version").."|r\nWas Installed on "..RAGInstalled);
    		end
    		
    	end
    	if event == "PLAYER_LEAVING_WORLD" then
            	RAGuild:UnregisterEvent("PLAYER_LEVEL_UP");
    			RAGuild:UnregisterEvent("CHAT_MSG_SYSTEM");
    			RAGuild:UnregisterEvent("ADDON_LOADED");
    	end
    end
    
    function RAGuild_OnLoad()
    	--DEFAULT_CHAT_FRAME:AddMessage("in onload");
    	local ourRace = UnitRace("player");
    	hellofired=false
    	if (ourRace == "Human" or ourRace == "Dwarf" or ourRace == "Gnome" or ourRace == "Night Elf" or ourRace == "Draenei" or ourRace == "Worgen") then
    		ml = "Common";
    	else
    		ml = "Orcish";
    	end
    	
    	RAGuild:RegisterEvent("CHAT_MSG_SYSTEM");
    	RAGuild:RegisterEvent("ADDON_LOADED");
    	RAGuild:RegisterEvent("PLAYER_LEVEL_UP");
    
    end

Posting Permissions

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