What's wrong with just creating custom aliases for whatever the user wants to call the original alias? ie.

Code:
on *:dialog:myoptionsdialog:close:*:{
  alias $did(123) my_original_aliasname $!1-
}


That way your code is a lot easier to work with, doesn't conflict with mIRC's existing ability to use %somevariable at the start of the line to dynamically call regular aliases (with optional parameters), and also doesn't raise the issue of what happens if the variable is deleted or contains an invalid alias name.


Spelling mistakes, grammatical errors, and stupid comments are intentional.