1. I'm trying to make it so that if the player is detected to be AFK, stuff is put into the chat window. Code:

        function AFKCheck(self)
        local isAFK = UnitIsAFK("player");
        if isAFK then -- Display Text
        DEFAULT_CHAT_FRAME:AddMessage("WYWO: You are AFK. Guild chat, whispers, queues, and invites can now also be found in the chat tab, 'WYWO'");
        DEFAULT_CHAT_FRAME:AddMessage("WYWO: To close this chat window, simply type /wywo close");
        end
     end
    

    This is my first day using LUA, so pardon if that looks like complete utter noobish code, lol. I'm attempting to put this into my XML file, but it's not working. 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="WYWO-AFKCheck.lua"/>
        <Frame name="AFKCheckFrame">
            <Scripts>
                <OnChar text="/away" text="/afk">
                    AFKCheck(self);
                </OnChar>
            </Scripts>
        </Frame>
      </Ui>
    

    when I type /afk on my character to go afk, sometimes the message will appear, sometimes it wont. Same goes for /away. Also of importance, the message only appears those sometimes after the AFK has been cleared by me moving. I don't know how to fix that. Additionally, sometimes it appears multiple times instead of just once.

    Basically, I can't get the message to appear immediately after I type /afk or /away.

    Any help would be amazing.

    What is the purpose of the OnChar? I'm not sure what you're trying to do there, but its almost certainly not the right way to go, that could wind up capturing the key events, which you don't want.

    You would be better off doing this:

     /eventtrace
    

    Then type /afk

    And see what events fire, you may be able to use that to detect when that happens.

    What is the purpose of the OnChar? I'm not sure what you're trying to do there, but its almost certainly not the right way to go, that could wind up capturing the key events, which you don't want.

    You would be better off doing this:

     /eventtrace
    

    Then type /afk

    And see what events fire, you may be able to use that to detect when that happens.

    The purpose of the OnChar was because I didn't know how else for it to know to execute when a person goes afk, so I let it just know it happens when the command is typed. The whole purpose of what I'm trying to do is that when a person goes AFK, a message is put into the chat box like I said above.

    I agree OnChar isn't a very good solution.

    I tried the /eventtrace, and I found that CHAT_MSG_SYSTEM is being fired when I type /afk or /away. I'll look up how to use that right now =)

    It's not ideal, but you might be able to match against that. I don't know how it will work with localisation though =/

    It's not ideal, but you might be able to match against that. I don't know how it will work with localisation though =/

    What do you mean by that? Again, just starting out with this. :P

    Do a /dump MARKED_AFK_MESSAGEand /dump DEFAULT_AFK_MESSAGE. You can probably use them to match the contents of the CHAT_MSG.

    A lazier (though less efficient) method would be simply checking the player's AFK status (using IsChatAFK() on every CHAT_MSG_SYSTEM.

    A lazier (though less efficient) method would be simply checking the player's AFK status (using IsChatAFK() on every CHAT_MSG_SYSTEM.

    Alright, how would I implement that into my xml file? What OnXXXX would I use? OnEvent?

    Its basic event based stuff, it's covered in one of the very early chapters. You need to register the correct event, and then handle that in an OnEvent script. This does not need to be done in a XML file, but could certainly be done that way.

    Its basic event based stuff, it's covered in one of the very early chapters. You need to register the correct event, and then handle that in an OnEvent script. This does not need to be done in a XML file, but could certainly be done that way.

    Awesome. Thanks so much for the help. I'll figure out the rest on my own for this part =)