1. #1

    SendChatMessage and SetRaidTarget help

    I have no LUA experience, so could someone point out what I need to change to make the following work? Thanks!

    1. I want to whisper myself (character name "aarjun") some message in an addon. I am doing the following, but it's not sending a whisper to myself.

    SendChatMessage(msg, "WHISPER", nil, "aarjun")

    2. Similarly I want to put a raid mark on me, but that doesn't work either.

    SetRaidTarget("aarjun", 2)

  2. #2
    Try putting msg in quotation marks, and making sure the name matches completely - capitalization and spelling. Like so
    SendChatMessage("message goes here", "WHISPER", nil, "Aarjun")
    And for your second one, I believe it expects a UnitID, so your name won't work. Try this one
    SetRaidTarget("player", 2)
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

  3. #3
    Player name should be a valid unitID though. For 1), are you actually passing a message? It looks correct so far. Post complete code.
    UI & AddOns expert | Interface & Macros moderator - My work

  4. #4
    local msg = "Item is ready."
    SendChatMessage(msg, "WHISPER", nil, "Aarjun")
    That still doesn't send a whisper to me (Aarjun). If this is incorrect, how do I get the unitID for myself?

  5. #5
    1. The unitID for yourself is always "player".
    2. SendChatMessage doesn't take a unitID.

    Make sure Lua errors are enabled. Add debug output (print()). This code on its own works fine - post more context. How does it get triggered?
    UI & AddOns expert | Interface & Macros moderator - My work

  6. #6
    Thanks Treeston. I changed it to the following and that worked for sending whisper to myself.

    SendChatMessage(msg, "WHISPER", nil, GetUnitName("player"))
    How do I go about getting a raid mark set on a summoned npc, such as the Blingtron or Jeeves? I tried the following, but doesn't work.

    SetRaidTarget(GetUnitName("Blingtron 4000"), 2)

  7. #7
    SetRaidTarget, as opposed to SendChatMessage, expects a unitID. You can't automate this - your best bet is a macrotext button that does:
    /targetexact Blingtron 4000
    /run SetRaidTarget("target",2)
    UI & AddOns expert | Interface & Macros moderator - My work

  8. #8
    Great. Thanks again for your help.

Posting Permissions

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