public override void main() { Console.WriteLine("Creating new instance, connecting and entering"); bot = new Instance("Sender") .Login(VPNetExamples.Username, VPNetExamples.Password) .Enter(VPNetExamples.World); bot2 = new Instance("Receiver") .Login(VPNetExamples.Username, VPNetExamples.Password) .Enter(VPNetExamples.World); bot.Avatars.Enter += Avatars_Enter; bot2.Console += bot2_Console; bot.GoTo(); bot2.GoTo(); Console.WriteLine("Trying plain broadcast"); bot.ConsoleBroadcast("hello", "Hello everybody!"); bot.Wait(1000); bot2.Wait(1000); Thread.Sleep(1000); Console.WriteLine("Trying styled broadcast"); bot.ConsoleBroadcast(ChatEffect.Bold, new Color(128,0,0), "", "How are you?"); bot.Wait(1000); bot2.Wait(1000); Thread.Sleep(1000); for (var i = 0; i < 100; i++) { bot.Wait(10); bot2.Wait(10); Thread.Sleep(100); } bot.Avatars.Enter -= Avatars_Enter; bot2.Console -= bot2_Console; }
/// <summary> /// Sets up bot instance /// </summary> public void Setup() { // Set logging level LogLevels logLevel; Enum.TryParse<LogLevels>( CoreSettings.Get("LogLevel", "Production"), out logLevel ); Log.LogLevel = logLevel; // Load instance Bot = new Instance( CoreSettings.Get("Name", defaultName) ); userName = NetworkSettings.Get("Username"); password = NetworkSettings.Get("Password"); World = NetworkSettings.Get("World"); // Connect to network ConnectToUniverse(); Log.Info("Network", "Connected to universe"); // Set up global events SetupWeb(); SetupCommands(); SetupUserSettings(); ConnectToWorld(); LoadServices(); Log.Info("Network", "Connected to {0}", World); Bot.ConsoleBroadcast(ChatEffect.None, ColorInfo,"", "Services is now online; say !help for information"); }