本帖最后由 MTFX001 于 2024-8-22 11:32 PM 编辑
这两天玩的一个服战场异常欢乐,很多人都开一堆号,在战场即将结束时涌入战场蹭荣誉,因为进的太早会被举报长时间挂机 ,于是我写了一个一键召唤,方便小号在后台不用一个个切换也能迅速加入战场。
原理是,我先制作一个宏,向所有小号发送密语,比如
/W 小号1 AAA 或者 /W 小号1 DDD
/W 小号2 AAA /W 小号2 DDD
/W 小号3 AAA /W 小号3 DDD
然后小号根据密语来判定进入那个战场,再自动点击确认
[Lua] 纯文本查看 复制代码 local function joinBattleground(keyword)
local numBattlegrounds = GetNumBattlegroundTypes()
for i = 1, numBattlegrounds do
local name = GetBattlegroundInfo(i)
if string.find(name, keyword) then
RequestBattlegroundInstanceInfo(i)
JoinBattlefield(2, 0)
return true
end
end
return false
end
local function onEvent(self, event, msg, sender, ...)
local battlegrounds = {
["AAA"] = "歌",
["BBB"] = "阿",
["CCC"] = "奥",
["DDD"] = "风"
}
for command, keyword in pairs(battlegrounds) do
if msg == command then
joinBattleground(keyword)
return
end
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", onEvent)
if StaticPopup1Button1:IsVisible()then
local buttontext=StaticPopup1Button1:GetText()
if buttontext=="进入战斗" then
StaticPopup1Button1:Click()
end
end
现在,大号点击对应战场的密语宏后,就无需理会了,小号自己会完成进入战场的动作
|