Created
December 1, 2012 00:57
-
-
Save RoyCurtis/4179862 to your computer and use it in GitHub Desktop.
Timer example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using VpNet.Core; | |
using VpNet.Core.Structs; | |
namespace VPTest | |
{ | |
class VPTest | |
{ | |
static Instance Bot = new Instance(); | |
static bool DoAnnouncements = false; | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("VP Test"); | |
Bot.Connect(); | |
Bot.Login("name", "password", "BarBot"); | |
Bot.Enter("world"); | |
Bot.UpdateAvatar(); | |
Task.Factory.StartNew(() => | |
{ | |
Thread.Sleep(10000); | |
DoAnnouncements = true; | |
}); | |
Console.WriteLine("Connected to world."); | |
Bot.EventAvatarAdd += OnAdd(); | |
while (true) { Bot.Wait(1000); } | |
} | |
static void OnAdd(Instance bot, Avatar eventData) | |
{ | |
if (DoAnnouncements) bot.Say("Hello!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment