commandtoserver(addtaggedstring(%command), %args);
Thanks. Useful information. But I'm still using eval, so I don't need to do %arg1, %arg1, %arg2, %arg3, %arg4, %arg5, and so forth.
Why would you use eval for something like this?
Converting thisclientCmdUpdateActionMenu("UI Text#someServerCmd, arg1, arg2, arg3|UI Text#anotherServerCmd, arg1, arg2, arg3|UI Text#someOtherServerCmd, arg1, arg2, arg3");Into a GUI bitmap button controls and doing command = "eval(\"commandToServer(\'" @ %command @ "\'," @ %args @ ");\");"; (I do a bunch of separating and filtering and stuff before this).
But with the command field of a gui control you're creating a string that is going to be evaluated, so you could just do this:command = "commandtoserver(\'" @ %command @ "\'," @ %args @ ");";There's no need for a double eval.
%find = "_"; %replace = " "; %cmd = "\'"@ getword($servercommandgui::command_[%key,%x], 0) @"\'"; for(%a=1; %a<getwordcount($servercommandgui::command_[%key,%x]); %a++) %cmd = %cmd @ ",\"" @ strreplace(getword($servercommandgui::command_[%key,%x], %a), %find, %replace) @ "\""; eval("commandtoserver("@%cmd@");");