highestrank

Returns the highest known spell rank for the spell ID. The spell must be present in the players spell book.

highestrank(spellId) : spellId

Example

if castable(highestrank(635)) then
return print('you can cast 639 (Holy Light (Rank 2))')
end