Just put a check in...
if (%trivia.h1 !isnum) { set %trivia.h1 $trivhint(%trivia.a,2,*) }
else set %trivia.h1 $trivhint(%trivia.a,0,*)
That assumes 0 will work with your alias... I didn't test it. Personally, I prefer hints that give vowels, but that's up to you.
Note that instead of checking if it's a number, you could also check the $len instead. That will help for short answers that aren't numbers.