Yes, I do this all the time. What I do is make the value of the variable the same as the animation name, then you can make an event like this:
On Q pressed set player var_animation to "animationname"
(whatever trigger you like) set player animation to player.var_animation
or
If player var_animation="walkleft" set animation to player.var_animation