I don't really understand your question.
Is the variable %word2 composed of a command? And you want the script to execute the command whenever you type in "word1"?
If so, try:
On *:INPUT:#: if (word1 == $1-) { %word2 }
I suspect that's not necessarily what you want though .. so please clarify.