How can I automate keystrokes within a game? AppleScript?

I’m playing an online game (Mac edition) and want to trigger a series of keystrokes by pressing only one key. Basically, when I press key ‘1’, this needs to to trigger ‘2’, ‘3’, ‘4’ and ‘5’ at 5 second intervals, and then loop 2-3-4-5 until ‘1’ is pressed again.

Can this be done with AppleScript?

Model: MacBook Pro 13"
AppleScript: 2.3
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)

Might be easier to look at ControllerMate. It’s currently my favorite “tinkerware,” and it should do exactly what you are asking (look at the WoW discussions, same ideas).

Thanks. I’ll check it out.