-- Replace the following entry in ChatFrame.lua SlashCmdList["CAST"] = function(msg) if(msg ~= "") then CastSpellByName(msg); end end -- with function GetSpellAndRank(msg) local spell = msg; local rank = nil; local index = strfind(spell, "%("); if ( index ) then rank = strsub(spell, index+1, strlen(spell)); spell = strsub(spell, 1, index-1); while (strsub(spell, strlen(spell)) == " ") do spell = strsub(spell, 1, strlen(spell)-1); end index = strfind(rank, "%)"); if ( index ) then rank = strsub(rank, 1, index-1); while (strsub(rank, strlen(rank)) == " ") do rank = strsub(rank, 1, strlen(rank)-1); end while (strsub(rank, 1, 1) == " ") do rank = strsub(rank, 2, strlen(rank)); end end end return spell, rank; end function GetSpellId(spell, spellRank, spellBook) local i = 1; local name, rankName; if ( not spellBook ) then spellBook = "spells"; end name, rankName = GetSpellName(i, spellBook); while name do if ( name == spell ) then if ( not spellRank ) or ( rankName == spellRank ) then return i; end end i = i + 1; name, rankName = GetSpellName(i, spellBook) end return -1; end function CastAnySpell(msg) local name, rank = GetSpellAndRank(msg); local spellBook = "spells"; local spellId = GetSpellId(name, rank, spellBook); if ( spellId > -1 ) then CastSpell(spellId, spellBook); else DEFAULT_CHAT_FRAME:AddMessage("CastAnySpell: Could not find the spell."); end end SlashCmdList["CAST"] = function(msg) if(msg ~= "") then --CastSpellByName(msg); CastAnySpell(msg); end end