I do something similar, where I turn text into a command.
Here's the method I use.

Code
if (%condition == $true) {
  $eval(%cmd $nick line1)
}


The fact that the $eval identifier is not actually part of command has yet to cause me any issues.

I was warned before, however, to make sure that you are the sole person able to insert a command here.