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
    Scarab Lord
    15+ Year Old Account
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,040
    Try putting msg in quotation marks, and making sure the name matches completely - capitalization and spelling. Like so
    Code:
    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
    Code:
    SetRaidTarget("player", 2)

  3. #3
    Deleted
    Player name should be a valid unitID though. For 1), are you actually passing a message? It looks correct so far. Post complete code.

  4. #4
    Code:
    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
    Deleted
    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?

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

    Code:
    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.

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

  7. #7
    Deleted
    SetRaidTarget, as opposed to SendChatMessage, expects a unitID. You can't automate this - your best bet is a macrotext button that does:
    Code:
    /targetexact Blingtron 4000
    /run SetRaidTarget("target",2)

  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
  •