Call Common Event by variable?

Right now the editor allows you to call a common event by manually selecting it.


How can I call an event by using a game variable? This is to do away with the long trees of forks. Say I set game variable 1 to 5, then I call a command and it will look at game variable 1 and run common event 5. 


Thanks!
$gameTemp.reserveCommonEvent($gameVariables.value(1))


replacing 1 with whatever your variable id is (no leading zeros)

Original thread: https://forums.rpgmakerweb.com/threads/call-common-event-by-variable.64027/