public void run() { if (Directory.Exists("GroupCache")) { Directory.Delete("GroupCache", true); // Clear cache on restart } registry = CommandRegistry.Instance; grid = BotSession.Instance.grid; grid.Inventory.InventoryObjectOffered += On_NewInventoryOffer; grid.Groups.GroupRoleDataReply += CacheGroupRoles; grid.Groups.GroupMembersReply += Groups_GroupMembersReply; LastScheduleCheck = DateTime.Now - TimeSpan.FromMinutes(5); Log = BotSession.Instance.Logger; BMem = OCBotMemory.Memory; if (BMem.status != "") { MHE(Destinations.DEST_LOCAL, UUID.Zero, BMem.status); } CM = new CommandManager(); ReloadGroupsCache(); if (grid.Network.CurrentSim.Name != BMem.DefaultRegion && BMem.DefaultRegion != "") { if (BMem.DefaultLocation != Vector3.Zero) { grid.Self.Teleport(BMem.DefaultRegion, BMem.DefaultLocation); } } if (BMem.sit_cube != UUID.Zero) { grid.Self.RequestSit(BMem.sit_cube, Vector3.Zero); } if (BMem.GroupKey != UUID.Zero) { grid.Groups.ActivateGroup(BMem.GroupKey); } BMem.iHaveBeenTeleported = false; BMem.Save(); // disable on relog grid.Self.ScriptDialog += onScriptDialog; }