如何在《魔兽世界》中用 lua 制作两个表情的组合?

发布于 2024-07-24 09:30:02 字数 344 浏览 10 评论 0原文

如何在《魔兽世界》中用 lua 制作两个表情的组合?

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

我正在使用 Wow Addon Studio 在 Wow 上制作一个放屁应用程序。 我用了这个功能,聊天窗口只显示坐下动作,招手和月亮只显示。 舞蹈表情没有出现在任何地方。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

梦行七里 2024-07-31 09:30:02

暴雪明确禁止任何可以用来让 lua 等待或暂停的东西,因为它是制作金矿或研磨机器人的重要组成部分。

没有一种本机(即仅限 lua)方法可以让 lua 等待而不使用所有 CPU。 在 WOW 客户端之外,您可以使用 win.sleep 或其他一些调用主机应用程序或操作系统线程函数的第 3 方 API 调用。

可以通过对频繁事件(例如到达聊天窗口的文本)执行代码来模拟等待,然后在事件处理程序中检查是否已经过去了足够的时间来允许执行序列中的下一个命令。 这可能不是一个非常准确的计时器,而且会相当复杂,因为您必须创建一个数据结构来保存命令序列、每个命令之间的计时、当前命令等。

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.

迟到的我 2024-07-31 09:30:02

这可能是 API 的有意限制,以防止游戏自动化(机器人)。

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

欢烬 2024-07-31 09:30:02

对我有用的是有一个通过循环递增的全局变量。 例如,

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

玩心态 2024-07-31 09:30:02

我建议你等一下再做下一个表情。 据我所知,如果您发送太多垃圾邮件,服务器会断开您的连接。 这可能有时会触发它。

除此之外,我想也许客户有办法阻止它? 无论哪种情况,我都建议您在表情之间添加某种零点几秒的延迟。

干杯,
阿米特·罗恩

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

枫以 2024-07-31 09:30:02

难道后两项不能坐着做吗?

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

森林很绿却致人迷途 2024-07-31 09:30:02

事实上,integer i = 0,因为定义整数“count”然后使用 i 是不正确的。 :)

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文