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