收藏4 RE:【問題】請教如何用巨集提示 技能的冷卻剩餘時間
標籤:
※ 引述《andwhose (大巧不工)》之銘言:
> 這個題目有意思, 我參考了:
> http://www.wowwiki.com/API_GetSpellCooldown
> 試寫成如下:
> ---------------------------------
> /script start, duration = GetSpellCooldown( "復生", BOOKTYPE_SPELL); if ( start > 0 and duration > 0) then SendChatMessage("cd剩 " .. duration - ( GetTime() - start) .. " 秒, 沒辦法戰復", "PARTY"); end
> ---------------------------------
> 不確定可不可行, 麻煩試試.
超級感激樓上大大的指引, 測試後可惜的只能使用技能,沒有報時 T.T, 再經過反覆測試小D的啟動後(身邊一直沒死人咩><), 好消息終於誕生...(給自己掌聲一個 >//<)
巨集測試目標為: 沒CD時使用啟動,有CD時報上剩餘時間
根據樓上修正如下:
/script start, duration = GetSpellCooldown(19,BOOKTYPE_SPELL);if (start>0) then SendChatMessage("cd剩 " .. duration - ( GetTime() - start) .. " 秒, 沒辦法啟動", "YELL");end
/cast 啟動
結果出爐: [XXXX]說: cd剩 356.53499999992 秒, 沒辦法啟動
看到這或許完成了, 但因為看到一堆秒數, 實在頭痛, 所以用以上例子再增加SecondsToTime(分與秒):
SecondsToTime - Converts a number of seconds into a readable days / hours / etc. formatted string. (www.wowwiki.com)
/script start, duration = GetSpellCooldown(19,BOOKTYPE_SPELL);if (start>0) then SendChatMessage("cd剩 " .. SecondsToTime(duration - ( GetTime() - start)) .. " , 沒辦法啟動", "YELL");end
/cast 啟動
結果出爐: [XXXX]說: cd剩 5 分鐘 58 秒, 沒辦法啟動
以上藍色的數字是 法術書中的法術編號, 經過測試, 暫沒辦法直接填寫法術技能, 只有找出法術編號一途; 為方便大家, 另外貼上找出法術編號的巨集:
/script for id = 1, 180, 1 do local spellName, subSpellName = GetSpellName(id,SpellBookFrame.bookType);if spellName and string.find(spellName, "復生", 1, true) then ChatFrame1:AddMessage("ID is "..id, 1.0, 1.0, 0.5); end; end;
PS: 法術名稱只需填寫XXX,等級不用填上 [eg. XXX(等級 6)]
以上例子: 找出復生的法術編號
頻上顯示:
ID is 97
ID is 98
ID is 99
ID is 100
ID is 101
ID is 102
(因為復生 共有等級1到6, 所以順序顯示各等級編號)
---------------------------------------------------------------------
這CD剩餘時間的巨集, 自己是覺得不錯用啦 >.< 如果您也覺得不錯, 就推一下囉, 先謝大家 !! ^^
---------------------------------------------------------------------
暗影之月 W.O.A 純恢德 ...... 變樹好可愛喔 ^^
--------------------------------------------------------------------- END