1. #1

    /w mouseover macro help

    Trying to add a /w to a pi macro on my priest. Not on my machine so this is shorthand of it

    /cast [target=mouseover] pi

    than I don't know what to put on the next line to tell the person I cast it on they have it.
    Pondering returning.
    Nikoll - Retribution Paladin

  2. #2
    Scarab Lord AetherMcLoud's Avatar
    15+ Year Old Account
    Join Date
    Sep 2008
    Location
    Wandering Isles
    Posts
    4,492

    Re: /w mouseover macro help

    /cast [@mouseover] Power Infusion
    /tell %t You have Power Infusion!

    should work. You can also check out the aftercast addon which lets you only whisper someone (or do another action) if the cast didn't fail.
    You know what is better than drinking a beer? Brewing your own beer. And then drinking it. And then... Drinking another beer. And then, punching somebody in the snout! That's what!

  3. #3

    Re: /w mouseover macro help

    Quote Originally Posted by AetherMcLoud
    /cast [@mouseover] Power Infusion
    /tell %t You have Power Infusion!

    should work. You can also check out the aftercast addon which lets you only whisper someone (or do another action) if the cast didn't fail.

    if your using a mouseover macro ,the target does not physically change. You have to do it via a /script(or /run)


    /cast [@mouseover]Power Infusion
    /run SendChatMessage("You have Power Infusion!","WHISPER",GetDefaultLanguage("player"),UnitName("mouseover"))


    should work

  4. #4

    Re: /w mouseover macro help

    Quote Originally Posted by Brusalk

    if your using a mouseover macro ,the target does not physically change. You have to do it via a /script(or /run)


    /cast [@mouseover]Power Infusion
    /run SendChatMessage("You have Power Infusion!","WHISPER",GetDefaultLanguage("player"),UnitName("mouseover"))


    should work
    Did this actually work? There's no feedback here to say whether it did or not, but I was also looking into something of this nature for a few different spells.

  5. #5
    Deleted

    Re: /w mouseover macro help

    Normally, people will only respond in the instance of something not working however it shouldn't take too much effort at all on your part to copy and paste the desired line of coding into a macro.

  6. #6

    Re: /w mouseover macro help

    Quote Originally Posted by Miatela
    Normally, people will only respond in the instance of something not working however it shouldn't take too much effort at all on your part to copy and paste the desired line of coding into a macro.
    I'm at work for another 5 hours and then I have a few minutes to eat dinner, put my daughter to bed and hop on before raid time. I'd rather know it is or is not going to work ahead of time than get there, find out it doesn't and not have time to fix it before the raid. But yes, on a weekend I would have just plugged it in and tested it.

  7. #7
    Deleted

    Re: /w mouseover macro help

    It would work, but is overly complicated.
    Code:
    /cast [@mouseover]Power Infusion
    /run SendChatMessage("You have Power Infusion!", "WHISPER", nil, (UnitName("mouseover")))
    However, you could use the following code:
    Code:
    local a = CreateFrame("Frame")
    local pguid
    a:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    a:SetScript("OnEvent", function(self,event,...)
    	if not pguid then pguid = UnitGUID("player") end
    	if (select(3,...))~=pguid then return end
    	if (select(10,...))~="Power Infusion" then return end
    	if (select(2,...))~="SPELL_CAST_SUCCESS" then return end
    	SendChatMessage("You have Power Infusion!", "WHISPER", nil, (select(7,...)) or (UnitName("player")))
    end)
    How to use this.
    Just cast PI normally/using the macro you use currently, this will detect any outgoing PI and whisper the target.
    EDIT: Code tested, fixed an error.

  8. #8

    Re: /w mouseover macro help

    Quote Originally Posted by Treeston
    Just cast PI normally/using the macro you use currently, this will detect any outgoing PI and whisper the target.
    EDIT: Code tested, fixed an error.
    This will whisper the target of the spell cast and not who I am currently targeting (unless of course my current target is who I cast the spell on) correct? While I don't necessarily need to understand everything in the code (I'm a Software Engineer, but work mostly with Java/C#/JavaScript/Ruby) I would like to know if you could point me to a credible source of info on Lua for WoW. I'm curious about these select(3,...) statements or where you find info about which parameters to pass into a function like SendChatMessage().

    Thank you for the sample code as well.

    Edit: I found this http://wowprogramming.com/ and it appears to have every api call listed with information about parameters and such Perhaps I'll play around with this when I've got some time.

  9. #9
    Deleted

    Re: /w mouseover macro help

    In lua, the "..." argument takes a list of all arguments passed to the function (that haven't been assigned yet).
    Code:
    function(self,event,...)
    The first argument is assigned to the local variable self, the second one to the local event, all the remaining ones are dumped into the vartable "...".
    The only way to read from a vartable is to use select(num, vartable), which returns all contents of the vartable starting at index "num". The extra set of paranthesis around the select() call means that lua should discard all but the first return value of the call.
    So (select(7,...)) returns the 7th additional argument to the call (the 9th in total). If you check [url=http://www.wowwiki.com/API_COMBAT_LOG_EVENT]WoWwiki's page on COMBAT_LOG_EVENTs, you will notice that the 7th argument (the first two are always the frame itself and the name of the vent as a string) is destName. So, the script I provided whispers either this destName or (if that is nil, which sometimes happens when you cast on yourself) yourself.

    As for reliable information, WoWprogramming and WoWwiki are the most used pages. I personally prefer wowprogramming, but you should know both.

    EDIT: Yes, I know that the explaination of the ... isn't actually correct when it comes to the internal workings of LUA. However, I think I made it easier to understand this way.

  10. #10

    Re: /w mouseover macro help

    Thanks again I found the select statement on WoW Wiki and got a better idea of what its purpose is now. I've been interested in doing some of my own Lua work for WoW, but just haven't had much time to play around with it. Plus it's hard to get motivated to do side projects when I spend 10 hours a day designing, writing and testing code.

Posting Permissions

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