Skip to content

Instantly share code, notes, and snippets.

@RoyCurtis
Created December 1, 2012 00:57
Show Gist options
  • Save RoyCurtis/4179862 to your computer and use it in GitHub Desktop.
Save RoyCurtis/4179862 to your computer and use it in GitHub Desktop.
Timer example
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