Incremental walking position update coordinate. Need help with three questions!

02/09/2012 09:38 vutle#1
Hi guys, I've started coding bot yesterday by modifying the simplex_proxy from Drew to run in multithreaded using C#.

At the moment I can make the bot walk to a specific location in VSRO using the packet with opcode 0x7021.

I know I can get character server location from opcode 0xB021. Where packet structure is

ObjectID Uint32
ground click or sky click UInt8()
xSec Uint8
ySec Uint8
x UInt16
z UInt16
y UInt16

ComesFrom UInt8 //need confirmation
xSec0 Uint8 //need confirmation
ySec0 Uint8 //need confirmation
x0 UInt16 //need confirmation
z0 UInt16 //need confirmation
y0 UInt16 //need confirmation

---------------------------------------------------------------------------------
I have three questions I need help with.

Question 1
------------
Is my second part for the packet with opcode 0xB021 correct?

Question 2
------------
How do I get the position or X Y coordinate while the character is moving?
The packet 0xB021 gives me the location but it's only provided once when I click or execute the 0x7021 packet.

Is the x y position update can only be read from client memory address?
Is there other method to estimate imcremental character x y position overtime?

The reason I ask for question 2 is I want the walk to be realistic. Like when I'm near the first x, y position I exectue the next x, y position. That way my character don't mementary stop between point.


Question 3:
-------------
Does anyone have or know where I can find packet opcode structure information or map?

------------------------------------------
Thankyou very much for helping guys.
02/09/2012 10:21 vorosmihaly#2
1.: yes
2.: well,you receive the speed of your character from the characterdata packet,so all you have to do is to calculate the time it will take to walk there,and then in each second(or whenever you want),you refresh your position by modifying the value according to the time/speed/distance (can't remember the exact formula,but I'm sure you can find it in some old emulators :P )
3.:silkroadonline.be/PacketWiki/
^^

good luck with your bot :)
02/09/2012 11:43 jremy#3
1. Source Z should be a float

2. For calculating the time it get's to arrive the destination i've been using this formula i found from xcoding emulator source

Code:
float speed = 50.0f;
float time = 0f;

speed = speed * (float)0.0768;

double tx = (DesX - x);
double ty = (DesY - y);
double distance = Math.Sqrt(tx * tx + ty * ty);

time = (float)distance / speed;

decimal intervalTime = (decimal)time;

intervalTime = Math.Round(intervalTime);
Though multiplying speed with 0.0768 seemed a little bit too slow for my bot/loop, i use 0.1 which seems to be pretty accurate
02/09/2012 13:06 vutle#4
Thanks jremy.

In 1)

The destination position is correctly display.
The problem I had is the source coordinate display incorrectly for X and Y position.

For exampe the packet below:

Code:
[S -> C][B021]
F6 A7 78 01                                       ..x.............
01                                                ................
98 66                                             .f..............
90 00                                             ................
8B FF                                             ................
5E 07                                             ^...............
01                                                ................
98 66                                             .f..............
C6 02                                             ................
0A 5B EE C2                                       .[..............
B6 49                                             .I..............
x: 3278 y: 2109 Desination
x2: 3335 y2: 3807 Source


Is the source calculation different to destination calculation?

x = ((Xsector - 135) * 192 + (X / 10));
y = ((Ysector - 92) * 192 + (Y / 10));

--------------------------
2) That assume normal walking speed right?
02/09/2012 13:47 jremy#5
Quote:
Originally Posted by vutle View Post
Is the source calculation different to destination calculation?

x = ((Xsector - 135) * 192 + (X / 10));
y = ((Ysector - 92) * 192 + (Y / 10));
Try

x = ((Xsector - 135) * 192 + (Xoffset / 100));
y = ((Ysector - 92) * 192 + (Yoffset / 100));

I get 3271, 2109

Quote:
Originally Posted by vutle View Post
2) That assume normal walking speed right?
Yes, 50.0f is the run speed of noob character without clothes. You have to get the run/walk/zerk speed from chardata packet and 0x30D0 speed update packet.
02/09/2012 14:03 vutle#6
Thanks guys, all is working perfectly.

Request to close thread.