any pokemon after 297 will never be caught because of this line
/set %T $rand(1,297)
also instead of setting the variable you can do
var %T = $r(1,486)