public void Move(int x, int y, int precision, int timeout) { uonet.display("Moving From" + uonet.player.CharPosX + "/" + uonet.player.CharPosY + " To " + x + "/" + y); myTimer = new System.Timers.Timer(timeout * 1000); myTimer.Enabled = true; myTimer.AutoReset = false; myTimer.Elapsed += new System.Timers.ElapsedEventHandler(myTimer_Elapsed); int seq = 0; int myx = uonet.player.CharPosX; int myy = uonet.player.CharPosY; while (((x != myx) | (y != myy)) & myTimer.Enabled) { myx = uonet.player.CharPosX; myy = uonet.player.CharPosY; Direction direction = getDirection(x, y, myx, myy); uonet.Send(uonet.MoveRequestPacket(direction, seq, 0, true)); Thread.Sleep(210);// fix this, 190 is min between steps, this static method will break on latency > local server TEST only if (seq != uonet.seq) { uonet.Send(Packets.Send.Packets.resync()); } seq = seq + 1; if (seq == 256) { seq = 1; } } if (!myTimer.Enabled) { uonet.display("Move Timed Out"); } }
public void main() { Active = false; //uoobject tempob = (uoobject)uonet.GameObjects[3]; //Events.Cast(Spell.Agility); uonet.displaywipe(); uonet.display("Script Started!"); Event Events = new Event(uonet); int cnt = 0; while (cnt < 10) { Events.UseObject(1076771726); while (uonet.UOClient.TargCurs == 0) { Thread.Sleep(10); } Events.TargetGround(2563, 489, 0, 0); for (int x = 0; x < 40; x++) { Thread.Sleep(100); String temp = (String)uonet.Journal[0]; if (temp.Contains("loosen")) { uonet.display("FoundLoosen"); break; } } //Thread.Sleep(3000); } uonet.display(Events.IntToEUO(uonet.player.CharID)); uoobject myobj = new uoobject(); foreach (DictionaryEntry Item in uonet.GameObjects) { uoobject mytemp = (uoobject)Item.Value; uonet.display("ID: " + mytemp.serial); } uonet.display("Script Ended!"); //Events.Move(3503, 2580, 0, 5); // uonet.Send(Packets.Send.Packets.MoveRequestPacket(Direction.West,0,0)); // Events.UseSkill(Skill.AnimalLore); //Thread.Sleep(500); //Events.UseSkill(Skill.Tracking); }