• 0

    posted a message on how to compare w/ list by one operator?
    agree.
    Posted in: AddOn HELP!
  • 0

    posted a message on how to compare w/ list by one operator?
    local str_list = "|string1|string2|string3|stringx|"
    local _, flag = string.match(str_list,"(.-)"..var.."(.+)")
    if (flag) then ...


    closed :mad:
    Posted in: AddOn HELP!
  • 0

    posted a message on how to compare w/ list by one operator?
    i've wrote same example in op message. its not what i've asked. thx.
    Posted in: AddOn HELP!
  • 0

    posted a message on how to compare w/ list by one operator?
    Hi

    i can write
    if ((var == "string1") or (var == "string2") or (var == "stringx")) then ...

    it looks "ok" till list of strings becoming huge.

    how in LUA make something like
    local strings_table = {"string1","string2","stingx"}
    if (var in strings_table) then ...


    pls help

    p.s. i know about possibility of "for idx, str_to_compare in pairs(strings_table) do if (var == str_to_compare) then ..."
    Posted in: AddOn HELP!
  • 0

    posted a message on hook AddMessage problem
    tyvm

    function XXX_AddMessage([COLOR="Red"]this,[/COLOR] text, r, g, b, id, addToStart)
    	this:XXX_Old_AddMessage(text, r, g, b, id, addToStart);
    end
    Posted in: AddOn HELP!
  • 0

    posted a message on hook AddMessage problem
    Quote from Slakah
    XXX_AddMessage(text, r, g, b, id, addToStart)
    should be
    XXX_AddMessage(self, text, r, g, b, id, addToStart)
    as with <frame>:AddMessage()

    no
    http://www.wowwiki.com/API_ScrollingMessageFrame_AddMessage

    anyway tryed AddMessage(self, ...) - isn't working.

    several other addons use exact the same code as in initial post and it works. i'm unsure about .xml stuff.
    Posted in: AddOn HELP!
  • 0

    posted a message on hook AddMessage problem
    Just tryed with "this." and "self." in XXX_ChatFrame_OnEvent() func, it doesnt change anything.

    The only thing is affecting something if i call it that way:
    function XXX_AddMessage(text, r, g, b, id, addToStart)
    	this.XXX_Old_AddMessage(text, r, g, b, id, addToStart);
    end

    it let pass all /say text, guid chat and combatlog, but all other messages isn't shown.
    missing channels General/Local Defence, also isnt working
    /script DEFAULT_CHAT_FRAME:AddMessage("123")
    /print "123"


    code in initial post is ok, other addons use code like this, with "func x(self, ...)" and hook to "this." and it working.

    From my pov it look like my .lua script isnt assigned to frame correctly. what did i miss?
    Posted in: AddOn HELP!
  • 0

    posted a message on hook AddMessage problem
    Hello.

    I'm trying to make chat addon and have some troubles hooking AddMessage. I think problem is in .xml, but cant find it self. Please help.

    xxx.xml
    <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="XXX.lua"/>
    	<Frame name="XXXOptionsFrame" hidden="true">
    		<Layers>
    			<Layer level="ARTWORK">
    				<FontString inherits="GameFontNormalLarge" text="XXX">
    				</FontString>
    			</Layer>
    		</Layers>
    		<Scripts>
    			<OnLoad>
    				XXX_Options_OnLoad(self);
    			</OnLoad>
    		</Scripts>
    	</Frame>
    </Ui>
    


    xxx.lua
    local XXX_Old_ChatFrame_OnEvent;
    
    function XXX_Options_OnLoad(self)
    	self.name = "XXX";
    	InterfaceOptions_AddCategory(self);
    
    	SLASH_XXX1 = "/XXX"
    	SlashCmdList["XXX"] = function()
    		InterfaceOptionsFrame_OpenToCategory("XXX");
    	end
    
    	if (XXX_Old_ChatFrame_OnEvent == nil) then
    		XXX_Old_ChatFrame_OnEvent = ChatFrame_OnEvent;
    		ChatFrame_OnEvent = XXX_ChatFrame_OnEvent;
    	end
    end
    
    function XXX_AddMessage(text, r, g, b, id, addToStart)
    	this:XXX_Old_AddMessage(text, r, g, b, id, addToStart);
    end
    
    function XXX_ChatFrame_OnEvent(self, event, ...)
    	XXX_Old_ChatFrame_OnEvent(self, event, ...)
    	if (this.XXX_Old_AddMessage == nil) then
    		this.XXX_Old_AddMessage = this.AddMessage;
    		this.AddMessage = XXX_AddMessage;
    	end
    end
    


    ok, what happens is when
    this.XXX_Old_AddMessage = this.AddMessage;
    this.AddMessage = XXX_AddMessage;

    executed my chat silences.

    pls point me to some direction. other addons done exact same thing and it works...
    i've tryed hook ChatFrame_MessageEventHandler, but it not filter everything in chat window.
    Posted in: AddOn HELP!
  • To post a comment, please or register a new account.