Add set varname=value MCC command

- Allow to use vars declared in scripts or directly by the user
- Commands my now use %variable% as well
- Moved "help" command from RemoteControl to inner MCC command manager
- The only special command is "wait", which is only available in scripts
Todo: Solve ambiguity between MCC help and Server help commands
Note: Auto accept tpa suggested by MousePak
Note: Manually choosing MC version suggested by ZizzyDizzyMC
This commit is contained in:
ORelio 2014-06-14 18:48:43 +02:00
parent 8b5ce567a6
commit 87d4687394
5 changed files with 96 additions and 76 deletions

View file

@ -233,9 +233,7 @@ namespace MinecraftClient
break;
case ParseMode.AppVars:
string varName = new string(argName.TakeWhile(char.IsLetterOrDigit).ToArray()).ToLower();
if (varName.Length > 0)
AppVars[varName] = argValue;
setVar(argName, argValue);
break;
}
}
@ -353,6 +351,24 @@ namespace MinecraftClient
}
}
/// <summary>
/// Set a custom %variable% which will be available through expandVars()
/// </summary>
/// <param name="varName">Name of the variable</param>
/// <param name="varData">Value of the variable</param>
/// <returns>True if the parameters were valid</returns>
public static bool setVar(string varName, string varData)
{
varName = new string(varName.TakeWhile(char.IsLetterOrDigit).ToArray()).ToLower();
if (varName.Length > 0)
{
AppVars[varName] = varData;
return true;
}
else return false;
}
/// <summary>
/// Replace %variables% with their value
/// </summary>