1. Hey im trying to create a lua script that copyes what you send in "say" and writes a whisper automatically with the same text, to a predefined player. the whisper should not be visuable for the sender.

    I have used a few days now on this, and i havnt gotten one step closer...

    the stuff i got so far, and that doesnt work is:

    TALKIE:SetScript("OnEvent", function() TALKIE_OnEvent() end

    function TALKIEOnEvent() if (event == "CHATMSGSAY") and arg2 == UnitName("player") then local msg = arg1; local text = msg..""; SendChatMessage(text,"WHISPER",nil,"playername") end end

    I hope someone that has it easier with these kind of things, will help a poor woman ;)

  2. Hey im trying to create a lua script that copyes what you send in "say" and writes a whisper automatically with the same text, to a predefined player. the whisper should not be visuable for the sender.

    I have used a few days now on this, and i havnt gotten one step closer...

    the stuff i got so far, and that doesnt work is:

    TALKIE:SetScript("OnEvent", function() TALKIE_OnEvent() end

    function TALKIEOnEvent() if (event == "CHATMSGSAY") and arg2 == UnitName("player") then local msg = arg1; local text = msg..""; SendChatMessage(text,"WHISPER",nil,"playername") end end

    I hope someone that has it easier with these kind of things, will help a poor woman ;)

    This is the old method of events, but hasn't been in place for 4 or 5 years now. You can't use the global names event and arg and expect things to work properly.

    Back to your main problem.. hiding the fact that the addon is automatically sending a message is complicated. Very complicated.

     function TALKIE_OnEvent(self, event, arg1, arg2, ...)
       if event == "CHAT_MSG_SAY" and arg2 == UnitPlayer("name") then
         local msg = arg1
         local text = msg .. ""; -- what is this doing... it does nothing..
         SendChatMessage(text, "WHISPER", nil, "NameOfThePlayerYouAreSendingThisToo")
       end
     end
    
     TALKIE:SetScript("OnEvent", TALKIE_OnEvent)
    

    That at least gets you one step closer..

  3. Thanks :)

    Ive made a scrip thats working, for the part as sending the text

     if not MARK then
     MARK = CreateFrame("Frame");
     MARK:SetScript("OnEvent", MARK_OnEvent);
     MARK:RegisterEvent("CHAT_MSG_SAY");
     print("you %L glows faintly.");
     else
     MARK:UnregisterEvent("CHAT_MSG_SAY");
     MARK = nil;
     print("your %L looks normal.");
     end
      
     function MARK_OnEvent(self, event, arg1, arg2)
     if event == "CHAT_MSG_SAY" then
     SendChatMessage(arg1, "WHISPER", nil, "Toriza");
     end
     end
    

    Then i have this part...

     local function HideOutgoing(self, event, msg, author, ...)
         if string.find(msg,"Toriza") then
                     return true
         end
      end
      ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", HideOutgoing)
    

    And i cant get it to work... Any help guys? blinks and smiles sweetly

  4. I don't quite get what the code in your last post is trying to achieve, but this should work:

    local sent = {}
    local playerName = (UnitName("player"))
    local f = CreateFrame("Frame")
    f:SetScript("OnEvent",function(self,event,msg,sender)
        if sender == playerName then
            sent[msg] = true
            SendChatMessage(msg,"WHISPER",nil,"Toriza")
        end
    end)
    f:RegisterEvent("CHAT_MSG_SAY")
    ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM",function(self,event,msg)
        if sent[msg] then
            sent[msg] = nil
            return true
        end
    end)
    
  5. THANK YOU THANK YOU THANK YOU!!!

    hugs and kisses all over

    works like a charm!