• 0

    posted a message on SlashCmdList problem
    Thanks for your tips, the PARTY_MEMBERS_CHANGED works too on raid groups, the RAID_ROSTER_CHANGED event I don't know if works on party groups.

    I didn't understand the follow code which you suggest:

    	if event == "ADDON_LOADED" then
    		local addon = ...
    		if addon ~= "HangarNinjas" then return end


    This addon variable is for what?

    I tryed to implement all you suggest here, but not work... I saw your other suggest:

    local frame = CreateFrame("Frame")
    frame:RegisterEvent("ADDON_LOADED")
    frame:SetScript("OnEvent", function(self, event, ...)
    	if event == "ADDON_LOADED" then
    ...
    	else
    		-- event is PARTY_MEMBERS_CHANGED
    	end;
    end);


    But I think this is not giving chance to event PARTY_MEMBERS_CHANGED became active and get checked:

    I did some changes just to check this start event, my entire code now and working perfect:

    HangarNinjas.toc:

    ## Interface: 30300
    ## Title: HangarNinjas
    ## Version: 0.10 - Release
    ## Author: Sandrao (US-Warsong)
    ## Notes: Identifica e alerta a presença de um ninja na sua party/raid
    ## DefaultState: Enabled
    ## LoadOnDemand: 0
    ## SavedVariables: HangarNinjasAtivo
    HangarNinjas.lua


    HangarNinjas.lua:

    ultima = "";
    
    local frame = CreateFrame("Frame")
    if (event ~= "PARTY_MEMBERS_CHANGED") then
    	frame:RegisterEvent("ADDON_LOADED")
    end;
    frame:SetScript("OnEvent", function(self, event, ...)
    	if (event == "ADDON_LOADED") then
    		HangarNinjasAtivo = true;
    
    		self:UnregisterEvent("ADDON_LOADED");
    
    		if HangarNinjasAtivo then
    			frame:RegisterEvent("PARTY_MEMBERS_CHANGED");
    		end
    	else
    		allninjas = "";
    
    		-- Checando os safados
    		local ninjas = { { char="Xavascca", server=" (Horde, Warsong)" }, { char="Xehnom", server=" (Horde, Warsong)" }, { char="Xequemate", server=" (Horde, Warsong)" } }
    
    		for _, ninja in next, ninjas do
    			if UnitExists(ninja.char) then
    				print("Alerta de ninja: " .. ninja.char .. ninja.server)
    
    				if (allninjas == "") then
    					allninjas = ninja.char .. ninja.server .. "; "
    				else
    					allninjas = allninjas .. ninja.char .. ninja.server .. "; "
    				end;
    			end;
    		end;
    
    		if (string.len(allninjas) > 0 and ultima ~= allninjas) then
    			ultima = allninjas;
    			message("Alerta de ninja(s): " .. allninjas)
    		end;
    	end;
    end);
    
    SLASH_HANGARNINJAS1 = "/hangarninjas";
    SLASH_HANGARNINJAS2 = "/hn";
    
    function SlashCmdList.HANGARNINJAS(command)
    	command = string.lower(command);
    
    	if (command == "start") then
    		HangarNinjasAtivo = true;
    		frame:RegisterEvent("PARTY_MEMBERS_CHANGED");
    		print("HangarNinjas ativado");
    	elseif (command == "stop") then
    		HangarNinjasAtivo = false;
    		frame:UnregisterEvent("PARTY_MEMBERS_CHANGED");
    		print("HangarNinjas desativado");
    	elseif (command == "listar") then
    		print("Lista de ninjas:");
    	else
    		print("Addon HangarNinjas - Menu de ajuda");
    	end;
    end;


    Sorry, my english is not good =P
    Posted in: Need Help?
  • 0

    posted a message on SlashCmdList problem
    My actual complete code:

    HangarNinjasAtivo = true;
    
    SLASH_HANGARNINJAS1 = "/hangarninjas";
    SLASH_HANGARNINJAS2 = "/hn";
    
    function SlashCmdList.HANGARNINJAS(command)
    	command = string.lower(command);
    
    	if (command == "start") then
    		HangarNinjasAtivo = true;
    		print("HangarNinjas ativado");
    	elseif (command == "stop") then
    		HangarNinjasAtivo = false;
    		print("HangarNinjas desativado");
    	elseif (command == "listar") then
    print("list...");
    	else
    print("help..");
    	end;
    end;
    
    if HangarNinjasAtivo then
    
    	-- Frame de alerta
    	local frame = CreateFrame("FRAME");
    	frame:RegisterEvent("PARTY_MEMBERS_CHANGED");
    	local function eventHandler(self, event, ...)
    
    		-- Evento certo?
    		if (event == "PARTY_MEMBERS_CHANGED") then
    
    			allninjas = "";
    
    			-- Checando os safados
    --checking
    
    			for _, ninja in next, ninjas do
    				if UnitExists(ninja.char) then
    					print("Alerta de ninja: " .. ninja.char .. ninja.server)
    
    					if (allninjas == "") then
    						allninjas = ninja.char .. ninja.server .. "; "
    					else
    						allninjas = allninjas .. ninja.char .. ninja.server .. "; "
    					end;
    				end;
    			end;
    
    			if (string.len(allninjas) > 0) then
    				message("Alerta de ninja(s): " .. allninjas)
    			end;
    
    		end;
    
    	end;
    
    	frame:SetScript("OnEvent", eventHandler);
    end;
    Posted in: Need Help?
  • 0

    posted a message on SlashCmdList problem
    I already tryed, did you said this?

    HangarNinjasAtivo = true;
    
    SLASH_HANGARNINJAS1 = "/hangarninjas";
    SLASH_HANGARNINJAS2 = "/hn";
    
    function SlashCmdList.HANGARNINJAS(command)
    	command = string.lower(command);
    
    	if (command == "start") then
    		HangarNinjasAtivo = true;
    		print("HangarNinjas ativado");
    	elseif (command == "stop") then
    		HangarNinjasAtivo = false;
    		print("HangarNinjas desativado");
    	elseif (command == "listar") then
    ...
    	else
    ...
    	end;
    end;
    
    if HangarNinjasAtivo then
    ...
    end;
    Posted in: Need Help?
  • 0

    posted a message on Array search - Help to optimize addon code
    Is there any way to set width and lenght of this message() window? Change the "Okay" button label?
    Posted in: Need Help?
  • 0

    posted a message on SlashCmdList problem
    Thanks for your help. I will see this, but in this moment I am with other problem.

    I am trying to do something to stop addon running inside the game, so I the variable:

    HangarNinjasAtivo = 1;


    In the beggining of the addon and I use the following:

    function SlashCmdList.HANGARNINJAS(command)
    	if (command == "start") then
    		HangarNinjasAtivo = 1;
    		print("HangarNinjas ativado");
    	elseif (command == "stop") then
    		HangarNinjasAtivo = 0;
    		print("HangarNinjas desativado");
    	elseif (command == "listar") then
    ...
    	else
    ...
    	end;
    end;
    
    if (HangarNinjasAtivo == 1) then
    -- Addon working, started
    end;
    


    But the start and stop command is not working. I will need to do something else then this code?
    Posted in: Need Help?
  • 0

    posted a message on SlashCmdList problem
    Whats wrong with my SlashCmdList? It's not working :(

    SLASH_HangarNinjas1, SLASH_HangarNinjas2, SLASH_HangarNinjas3, SLASH_HangarNinjas4 = '/hangarninjas start', '/hangarninjas stop', '/hangarninjas listar', '/hangarninjas help';
    
    function SlashCmdList.HangarNinjas(command, editbox)
    	if (command == "start") then
    		HangarNinjasAtivo = 1;
    
    		print("HangarNinjas ativado");
    	elseif (command == "stop") then
    		HangarNinjasAtivo = 0;
    
    		print("HangarNinjas desativado");
    	elseif (command == "listar") then
    		print("Lista de ninjas:");
    		print("Alliance, Gurubashi == Ph\195\166nix, Kadimos");
    		print("Horde, Gurubashi == Kindzadza, Indis");
    		print("Alliance, Warsong == Cosmictone");
    		print("Horde, Warsong == Abdullah, Alehxia, Anak\195\173n,, hlus, Baconboy, Boteco, B\195\184r\195\184mir, Bruce\195\176ickson, D\195\184kas, Burrows, Crackattack, Devastt, C\195\184l\195\184ssus, Drus, Doobmaxi, Durgrum, Elynnare, Fastter, Doidinhu, Faction, Flying, Gabriella, Granamad, Handless, Heltake, Hizaki, Hol\195\189crap, H\195\186lkka, Inmattar, Josephclimb, Justinbarcia, Kayzen, Kazzui, Kebranozes, Khrum, Kyokamiho, Ryukamiho, Laifa, L\195\170dead, Ligaeu, Lilika, Passaralho, Vampirella, Vegetarianna, Lunga, Mmonsterkill, Mal\195\171volo, Mandrakke, Nar\195\161kk, Nar\195\161k, Nekaro, Nogw, Overburned, Phoenixss, Pholler, Plows, Pirimpipim, Romhell, Sentaodedo, Sheepshot, Souconeidai, Strundice, Stompbull, Tksteam, Thorr, Undertanker, Vespill\195\184, Voldinho, Xavascca, Xequemate");
    	else
    		print("Para iniciar o addon, digite: /HangarNinjas start");
    		print("Para parar o addon, digite: /HangarNinjas stop");
    		print("Para listar os ninjas, digite: /HangarNinjas listar");
    	end;
    end;
    Posted in: Need Help?
  • 0

    posted a message on Array search - Help to optimize addon code
    I would like to still use the message(), but if the party/raid have more than one "ninja" when I join in, I receive only one alert by this message().

    Is there any way to use like one operador to increment one variable?

    for _, ninja in next, ninjas do
    if UnitExists(ninja.char) then
    print("Alerta de ninja: " .. ninja.char .. ninja.server)
    allninjas += ninja.char .. "; "
    end;
    end;

    message("Alerta de ninja: " .. allninjas)
    Posted in: Need Help?
  • 0

    posted a message on Out of dated addon
    Quote from Phanx
    Every patch that changes the version number (eg. 3.3.3 did it, but not 3.3.3b) unchecks the "Load out of date addons" box, so if you'd checked the box back when 3.3.3 hit, but didn't start writing your addon until after that, you probaby just didn't notice. I looked at your TOC, though, and it will have appeared as "Out of date" for everyone, even before the patch.


    I didn't know that. Thank you!
    Posted in: Need Help?
  • 0

    posted a message on Out of dated addon
    After the last patch, my addon appears now on addon list as out of dated.

    How I can solve this and people don't need to check the box "Load of date addons"?
    Posted in: Need Help?
  • 0

    posted a message on Array search - Help to optimize addon code
    Thanks, guys! :D
    Posted in: Need Help?
  • 0

    posted a message on Array search - Help to optimize addon code
    Thanks!

    And is this correct?

    ninjas = { { name="player1", server="us-warsong" }, { name="player2", server="us-gurubashi" }, { name="player3", server="us-gurubashi" } }
    
    ...
    
    for _, ninja in next, ninjas do
    	if UnitExists(ninja) then
                    message("Alert:" .. ninja[name] .. ninja[server]);
    	end
    end
    Posted in: Need Help?
  • 0

    posted a message on Array search - Help to optimize addon code
    I am trying to optimize my addon code (http://wow.curse.com/downloads/wow-addons/details/hangarninjas.aspx).

    Actually I am using conditional code to check the presence of "ninjas looters" on raid/party.

    Sample:

    local frame = CreateFrame("FRAME", "FooAddonFrame");
    frame:RegisterEvent("PARTY_MEMBERS_CHANGED");
    local function eventHandler(self, event, ...)
    
    if UnitExists("Ph\195\166nix") then
    	message("Ph\195\166nix" .. mensagem .. allygurubashi)
    
    elseif UnitExists("Kadimos") then
    	message("Kadimos" .. mensagem .. allygurubashi)
    
    ...


    I think to use one array to list all "ninjas looters", but I am with difficult to check it...

    ninjas = { "player1", "player2", "player3" }
    
    local frame = CreateFrame("FRAME", "FooAddonFrame");
    frame:RegisterEvent("PARTY_MEMBERS_CHANGED");
    local function eventHandler(self, event, ...)
    
    
    if UnitExists(ninjas) then
    ...
    end;


    How can I run a search inside the array to check this?
    Posted in: Need Help?
  • 0

    posted a message on Check release of new version
    How can I check ingame, automatically when person login game, if there is a new version of the addon release?
    Posted in: Need Help?
  • 0

    posted a message on UnitExists - Special characters on players name
    I am with some problems to identify players which have names with special characters, like: Vacäø, Behemøth, Draculãx

    I do something like this:

    if UnitExists("Vacäø") then
    	message("Vacäø" .. mensagem)
    elseif UnitExists("Draculãx") then
    	message("Draculãx" .. mensagem)
    ...


    But when I have one player with special characters on his name the addon didn't work.

    Anyone could help me?

    I saw in one addon using like "Pok\195\169hunter" but I dont know where I found this type of code corresponds the char I want to change.
    Posted in: Development Help
  • To post a comment, please or register a new account.