Add support for C# script extensions

- Allow defining function for use into the script
- Allow defining a ChatBot for loading it into MCC
- Improve sample script and add more examples
- Todo add new documentation into the readme file
This commit is contained in:
ORelio 2015-06-21 18:45:43 +02:00
parent a6b3bf0481
commit e29b4ee545
6 changed files with 115 additions and 26 deletions

View file

@ -94,9 +94,9 @@ namespace MinecraftClient
public static string AutoRespond_Matches = "matches.ini";
//Custom app variables and Minecraft accounts
private static Dictionary<string, string> AppVars = new Dictionary<string, string>();
private static Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
private static Dictionary<string, KeyValuePair<string, ushort>> Servers = new Dictionary<string, KeyValuePair<string, ushort>>();
private static readonly Dictionary<string, string> AppVars = new Dictionary<string, string>();
private static readonly Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
private static readonly Dictionary<string, KeyValuePair<string, ushort>> Servers = new Dictionary<string, KeyValuePair<string, ushort>>();
private enum ParseMode { Default, Main, AppVars, Proxy, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl, AutoRespond };
@ -491,13 +491,16 @@ namespace MinecraftClient
public static bool SetVar(string varName, string varData)
{
varName = new string(varName.TakeWhile(char.IsLetterOrDigit).ToArray()).ToLower();
if (varName.Length > 0)
lock (AppVars)
{
AppVars[varName] = varData;
return true;
varName = new string(varName.TakeWhile(char.IsLetterOrDigit).ToArray()).ToLower();
if (varName.Length > 0)
{
AppVars[varName] = varData;
return true;
}
else return false;
}
else return false;
}
/// <summary>