This should be fine. Another thing to note is that anything with a "#" before it is commented out. So you will have to comment out the other 3 ranks if you want to give all 4 before any character is hit by this code.
Once it is hit once by this code it won't be hit again by it due to the flag. You will have to go into your quest_globals db table and delete the specific global for your charid if you need it to be ran multiple times.
Code:
sub EVENT_CONNECT {
if(!defined($qglobals{"SpellGem"}) {
$client->IncrementAA(1071); #:: Mnemonic Retention Rk. I
#$client->IncrementAA(4764); #:: Mnemonic Retention RK. II
#$client->IncrementAA(7553); #:: Mnemonic Retention RK. III
#$client->IncrementAA(7681); #:: Mnemonic Retention RK. IV
$client->SetGlobal("SpellGem", 1, 5, "F");
}
# the main key is the ID of the AA
# the first set is the age required in seconds
# the second is if to ignore the age and grant anyways live test server style
# the third is enabled
my %vet_aa = (
481 => [31536000, 1, 1], ## Lesson of the Devote 1 yr
482 => [63072000, 1, 1], ## Infusion of the Faithful 2 yr
483 => [94608000, 1, 1], ## Chaotic Jester 3 yr
484 => [126144000, 1, 1], ## Expedient Recovery 4 yr
485 => [157680000, 1, 1], ## Steadfast Servant 5 yr
486 => [189216000, 1, 1], ## Staunch Recovery 6 yr
487 => [220752000, 1, 1], ## Intensity of the Resolute 7 yr
511 => [252288000, 1, 1], ## Throne of Heroes 8 yr
2000 => [283824000, 1, 1], ## Armor of Experience 9 yr
8081 => [315360000, 1, 1], ## Summon Resupply Agent 10 yr
8130 => [346896000, 1, 1], ## Summon Clockwork Banker 11 yr
453 => [378432000, 1, 1], ## Summon Permutation Peddler 12 yr
182 => [409968000, 1, 1], ## Summon Personal Tribute Master 13 yr
600 => [441504000, 1, 1] ## Blessing of the Devoted 14 yr
);
my $age = $client->GetAccountAge();
for (my ($aa, $v) = each %vet_aa) {
if ($v[2] && ($v[1] || $age >= $v[0])) {
$client->GrantAlternateAdvancementAbility($aa, 1);
}
}
}