1) Well the only time your AI ever sets the can-train-skirm goal which is required for skirms to be trained (in your AI) to no is when
Code: Select all
(goal transition-time gv-yes)
(not(town-under-attack))
2) The other condition is having the SN g-train-skirms to contain a value of at least 1. The only time your AI ever sets that SN to 0 is right at the start of the script. So your AI only needs it to set it to a value of 1 or higher once and after that it will never go back to 0 since your AI is missing a rule that checks if the enemy doesn't have archers at all (in which case the AI should set the SN to 0 again). To solve this you could also simply set strategic-number tg-archers to 0 in a (true) rule without a (disable-self) at the start of your script. It would then be set to 1+ in your other rules again if the enemy has archers (so it will remain 0 if the enemy doesn't have archers and your AI won't train skirmishers).
You could also implement a maximum amount of skirmishers to be trained if the value of that SN is 1, a higher maximum amount if the goal is 2, same for 3 etc. Or just use one maximum amount in total. You pretty much never want an army consisting only out of skirmishers. If you have 80 skirmishers and reached the pop cap you won't be able to do any real damage with these units (on the offense) while you're also prone to being overrun by enemy cavalry (if the enemy scouts that you have so many (and only) skirmishers then he will most likely just go for cavalry, siege units or even heavy infantry).
I hope that helps!
Funnily enough i had the same issue when i started scripting (i had a rule somewhere that trained skirmishers pretty much non-stop and it took me a while to find it).