1
我正在为魔兽世界制作一个插件,彻底检修界面,以适应我的游戏风格。魔兽世界Lua - 更改框架:SetAttribute()
在这个插件中,我想要一个大的按钮,作为我的法师的“主要DPS旋转”。我希望它可以根据任何给定时间的最佳状态来改变它施展的法术。它不会自动施放咒语,它只是为用户呈现下一个最佳选择。
这是到目前为止我的代码:
print "Interface Overhaul : LOADED"
heatingUpIsActive = false
print(heatingUpIsActive)
local Button = CreateFrame("Button", "MyButton", UIParent,"SecureActionButtonTemplate")
Button:SetWidth(256)
Button:SetHeight(256)
Button:SetFrameStrata("HIGH")
Button:SetPoint("LEFT")
Button:SetText("Main Rotation")
Button:RegisterForClicks("AnyUp")
Button:SetAttribute("type", "spell")
Button:SetAttribute("spell", "Fireball")
Button:RegisterEvent("UNIT_AURA");
local function auraGained(self, event, ...)
if (UnitAura("player", "Heating Up")) then
if (heatingUpIsActive == false) then
heatingUpIsActive = true
print (heatingUpIsActive)
print ("Heating Up is active!")
Button:SetAttribute("spell", "Inferno Blast")
end
else
heatingUpIsActive = false
print("Heating Up is NOT active.")
print(heatingUpIsActive)
end
end
Button:SetScript("OnEvent", auraGained);
local tex = Button:CreateTexture("ARTWORK");
tex:SetPoint("LEFT")
tex:SetWidth(256)
tex:SetHeight(256)
tex:SetTexture("Interface\\AddOns\\InterfaceOverhaul\\Button2")
如果heatingUpIsActive == true
,我想按钮投票("spell", "Inferno Blast")
而不是("spell", "Fireball")
,但如果我地方,到if
的正确部分这是行不通的声明。
有什么想法?
“如果我**,它不起作用” - 您告诉我们您没有*出现的代码不起作用,这是毫无价值的。向我们展示不起作用的实际代码。如果您试图以编程方式重新绑定按钮,那么在您进入战斗的那一刻就不会起作用。 – Mud 2013-04-05 01:27:38
@Mud“如果你试图用编程方式重新绑定按钮......”你似乎得到了它的要点,但我编辑了这篇文章,以反映我之前提到的。有没有办法解决这个问题? – GreenWire 2013-04-05 01:33:39
不可以。不可能在5或6年前,人们习惯于将一把钥匙绑定到他们的整个旋转中,让剧本为他们选择拼写。然后暴雪彻底改造了系统以防止这种情况发生。你可以做你原先说你想做的事(即不施放咒语,只向用户呈现下一个咒语),但是基于脚本逻辑,在战斗中你不能有一个按钮开关咒语。不是法师现在旋转一两个按钮,anyhoo? :) – Mud 2013-04-05 01:48:20