2014-10-25 9 views
1

월드 오브 워크래프트의 간단한 인터페이스 애드온 코딩에 몇 가지 문제가 있습니다. 다음 중 하나를 달성하려고합니다. 내 주문 중 하나에 재사용 대기열이없는 경우 버튼을 표시하고 싶습니다. 버튼을 클릭하면 주문이 전송되고 쿨 다운 시간 동안 버튼이 숨겨집니다.와우 인터페이스 Addon - 숨기기 및 표시 버튼

캐스트가 정상적으로 작동하지만 버튼을 숨기는 데 문제가 있습니다. 계속 클릭하면 채팅에서 오류 메시지가 표시됩니다. 여기 내 코드입니다 :

TestAddon.toc

## Interface: 60000 
## Title: TestAddon 
## Notes: Test 
## Version: 1.0 
TestAddon.lua 

TestAddon.lua

btn_schutz = CreateFrame("Button", "MyButton", UIParent, "SecureActionButtonTemplate"); 
btn_schutz:ClearAllPoints(); 
btn_schutz:SetAttribute("type", "spell"); 
btn_schutz:SetAttribute("spell", "Schutz"); -- Schutz is name of spell (German) 
btn_schutz:SetAttribute("unit", "player"); 
btn_schutz:SetPoint("CENTER", 0, 0); 
btn_schutz:SetNormalTexture("Interface\\Icons\\ability_monk_guard"); 
btn_schutz:SetSize(48, 48); 
btn_schutz:SetScript("OnUpdate", onUpdate); 
btn_schutz:Show(); 

function onUpdate() 
    local schutz_id = 115295; 
    if GetSpellCooldown(schutz_id) == 0 then 
     btn_schutz:Show(); -- causes error message 
    else 
     btn_schutz:Hide(); -- causes error message 
    end 
end 
+1

무엇이 오류입니까? –

+0

"애드온으로 인해 인터페이스 작업을 수행하지 못했습니다."하지만 영어로 번역되었으므로 문자 그대로는 아닙니다. – Namenlos

답변

2

당신이 표준 더러운 오류를 얻고있는 것 같습니다. 여기에 대해 자세히 알아보기 : Secure Execution and Tainting

캐릭터가 전투 중일 때는 버튼이나 "보안 된 프레임"을 표시하거나 숨길 수 없습니다.