That's by design. Only a single text event per script will ever trigger. You can put all the content under a single event, or put them in different files.

You can use dynamic variable names as so: %spam [ $+ [ # ] ]