So I recently released my
Server Command Gui, which works great. My goal for version 3 was to make every aspect of the gui recursive, meaning it can be repeated infinitely and can account for any number of commands. As a part of this, I tried to change the way it constructed the command sent to the server.
This is the old way it sent the command:
eval("commandtoclient('"@getword($command),0)@"', strreplace(getword($command,1),%find, %replace), ... ");
With this method, I could support arguments that had more than one word, but I could only have as many arguments as I define in the script.
I tried to replace it with something kinda like this:
%find = "_";
%replace = " ";
%cmd = "commandtoserver("@addtaggedstring(getword($command, 0));
for(%a=1; %a<getwordcount($command); %a++)
%cmd = %cmd @ "," @ strreplace(getword($command, %a), %find, %replace);
%cmd = %cmd @ ");";
eval(%cmd);
This method worked for as many arguments as I could type into the text box, but when I tried to have an argument with more than one word, such as "messagesent hi_my_name_is_pedro" (note that "_" is replaced with " "), I would get a syntax error.
echoing %cmd would give me somthing like this:
commandtoserver(58, hi my name is pedro);
%cmd needs to look like this somehow
commandtoserver(58, "hi my name is pedro");
But that would mean I need two different kinds of strings within another string, and that doesn't make alot of sense to me.
I tried to look for a solution to this, but all I came up with was a vague reference to parse string or something.
Is it possible to write this, so the eval(); is able to evaluate the strings within the strings while still retaining the ability to support infinite recursion?