Question

How do you make a combo of two emotes in lua in World of Warcraft work?

function Button2_OnClick()
    PlaySoundFile("Interface\\Addons\\Fart\\common_fart[1].wav");
    DoEmote("moon");
    DoEmote("sit");
    DoEmote("dance");
    DoEmote("beckon");
end

I am using Wow Addon Studio to make a fart application on Wow. I used this function, and only the sit motion showed, and beckon and moon only showed on the chat window. The dance emote didn't show up anywhere.

Was it helpful?

Solution

Blizzard has explicitly prohibited anything that can be used to make lua wait or pause because it is an essential ingredient to making a gold mining or grinding bot.

There isn't a native (i.e. lua only) way to have lua wait without using all the CPU. Outside of the WOW client, you'd use win.sleep or some other 3rd party API call that calls into the host application or operating systems threading functions.

It may be possible to simulate a wait by having code execute on a frequent event (such as text arriving at the chat window) and then in the event handler checking to see if enough time has passed to permit executing the next command in the sequence. This probably wouldn't be a very accurate timer and it would be rather complex as you'd have to create a data structure to hold the sequence of commands, the timings between each, the current command, etc. and so on.

OTHER TIPS

This may be an intentional limitation of the API to prevent in game automation (botting).

What has worked for me is to have a global variable that is incremented through the loop. Such as

Integer count = 0;
function Button2_OnClick()
    i++
    switch
    case(1)
        PlaySoundFile("Interface\\Addons\\Fart\\common_fart[1].wav");
    case(2)
         DoEmote("moon");
    case(3)
         DoEmote("sit");
    case(4)
         DoEmote("dance");
    case(5)
         DoEmote("beckon");
    default
         i=0;
    end
end

What you would have to do then is to click the button multiple times, but you would get the effect you're going for.

I would suggest you wait some time before doing the next emote. As far as I know, the server disconnects you if you spam too much. This might just trigger it sometimes.

Besides that, I guess maybe the client has a way of preventing it? In either case, I would suggest you add some sort of fraction-of-a-second delay between the emotes.

Cheers,
Amit Ron

Could it be that the last two can't be done while sitting?

infact, integer i = 0, because defining integer 'count' and then using i is incorrect. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top