Listening to in-app triggers
There are some possibilities, however both a far beyond scripting and falls more into the development section:


Check the network traffic. If it is an online game it has to receive and send data to the server. If you can sniff that data you know in what state the game is
An app with root permission can get access to the memory of another app. If you know where to look you can find all the data the app contains in it's memory and therefore get info on the game state.