I tried to get an age myself once for a roman career thing but could never see how to do it. Character records are passed to a lot of triggers and age must be one of the attributes a general has but i never managed to get the syntax for it (if it is possible at all).

I don't know much about scripting but i'd suggest d/ling some mods with scripts and seeing what they've done.