SRL Archive - Reflection Development

TileToMS


g0tp0t

2010-05-03 13:38:37

umm, i was searching google for the tiletoms source i was converting, and i found a nice handydandy function that i am assumming was written by timer, since it is on 'timer.pastebin.com'. so it doesnt work or something? why wasnt this posted before

function TileToMS(Tile:TPoint; height: integer): TPoint;

var
cx, cy, cz, dx, dy, dz, locX, locY, layer: Integer;
pitch, yaw, sinYaw, cosYaw, sinPitch, cosPitch, rotation: extended;

begin
locX:= Tile.x - SmartGetFieldInt(0, BaseX);
locY:= Tile.y - SmartGetFieldInt(0, BaseY);
if not (InRange(LocX, 0, 103) or InRange(LocY, 0, 103)) then
Exit;
layer:= SmartGetFieldInt(0,BaseLayer);
if (layer < 3) and ((2 and SmartGetFieldArray3DByte(0,GroundSettings,1,locX,locY)) = 2) then
Inc(layer);
cz:= SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY+1) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY+1);
cx:= locX * 128 + 64 - SmartGetFieldInt(0,CamX);
cy:= locY * 128 + 64 - SmartGetFieldInt(0,CamY);
cz:= (cz / 4) - height - SmartGetFieldInt(0,CamZ);
pitch:= SmartGetFieldInt(0,CamPitch) * Pi / 1024;
yaw:= SmartGetFieldInt(0,CamYaw) * Pi / 1024;
sinYaw:= sin(yaw);
cosYaw:= cos(yaw);
sinPitch:= sin(pitch);
cosPitch:= cos(pitch);
rotation:= cosYaw*cy-sinYaw*cx;
dx:= Round(sinYaw*cy+cosYaw*cx);
dy:= Round(sinPitch*cz+cosPitch*rotation);
dz:= Round(cosPitch*cz-sinPitch*rotation);
try
Result.x:= (dx * 512) / dy + 256;
Result.y:= (dz * 512) / dy + 167;
except end;
end;

i was just about to give up on translating and creating my own function too, studdy how to do it and all.

Timer

2010-05-03 15:08:25

That's the old function, you wont find the new one. ;)

Quickmarch

2010-05-03 15:15:57

The quickest and easiest way to fix TileToMS would be to port RSBot's function to SCAR (Pascal). There may be a few hooks missing that are required to make it work, so it might be best to ask the person would finds the hooks to create a pattern for the required hooks.

Timer

2010-05-03 15:40:32

I ported RSBots, it didn't work.. And was too wide spread…
Just make a new one like meh.

Coh3n

2010-05-03 15:41:41

From: Timer
That's the old function, you wont find the new one. ;)

So if there's a new one (and I'm assuming you have/wrote it), is there a reason you haven't shared it? :)

JPHamlett

2010-05-03 15:48:53

From: Coh3n
So if there's a new one (and I'm assuming you have/wrote it), is there a reason you haven't shared it? :)


he thinks villavu is to leechy nowadays

Timer

2010-05-03 15:49:09

From: Coh3n
So if there's a new one (and I'm assuming you have/wrote it), is there a reason you haven't shared it? :)


I have stated my reason before.

Coh3n

2010-05-03 15:50:49

From: J_Pizzle
he thinks villavu is to leechy nowadays

So…?

From: Timer
I have stated my reason before.

Well obviously I haven't read it, care to link me or just state it again?

g0tp0t

2010-05-03 16:12:36

looking at it, i cant se what is wrong, the hooks? or is their a new perspective in rs? or what

EDIT: i thought this thread would get WAY more attention, especially with that title, but timer, if u have any im like msn could u log in?

EDIT2: i want a little help getting my tiletoms done, thats y i want to chat on msn :D. not about u not giving anybody ur version of it. if thats ur opinion thenim not gonna try changing it. hes right, if you look at the number of active user vs total users then :eek: wow!!. like what, 1 hundreth of us are active? nah more like 1/500

EDIT3: smilys are aligned :D, lol, didnt notice b4

noidea

2010-05-03 16:46:55

From: J_Pizzle
he thinks villavu is to leechy nowadays


Are you joking?
I wouldn't use the function, but there are tons of people that could use that function. I'm sure if you released it (If you even had it) that would start developing again because with that function reflection would be almost fully working.
Edit: oh sorry j_pizzle, thought you were talking about yourself.

i luffs yeww

2010-05-03 16:47:42

^ They're aligned with your resolution, not mine. (@ g0tp0t)

Cohen, Timer merely thinks that SRL consists of all leechers.

noidea, Timer thinks that SRL is too leechy; J_Pizzle might not think that. :)

(Also, you're sexy.)

g0tp0t

2010-05-03 17:00:09

From: noidea
Are you joking?
I wouldn't use the function, but there are tons of people that could use that function. I'm sure if you released it (If you even had it) that would start developing again because with that function reflection would be almost fully working.


…almost??? wtf, i thought this was it :(

i luffs yeww

2010-05-03 17:07:27

We also need all the hooks, and an updater. (And possibly more.)

MylesMadness

2010-05-03 17:07:58

Object finding without know what tile it could be on would still be broken AFAIK? Which even when reflection was at its hey day took for ever…

i luffs yeww

2010-05-03 17:21:54

Well what ever happened to the OpenGL stuff? Did that get anywhere? Could it be used in place of reflection or substituted for some parts of reflection? It seemed promising.

Frement

2010-05-03 17:26:03

From: i luffs yeww
Well what ever happened to the OpenGL stuff? Did that get anywhere? Could it be used in place of reflection or substituted for some parts of reflection? It seemed promising.


Thats one of the things im interested in also, shame i did not get into members yet, its only for srl members :/ Or atleast the thread is, or whatever threads there are.

g0tp0t

2010-05-03 17:30:24

lol, k, im making tile toms right now :P

TRiLeZ

2010-05-03 17:31:36

From: Timer
Just make a new one like meh.


Could you please tell me how to do that / where to look in the client to find out how Jagex does it?

g0tp0t

2010-05-03 17:40:01

i kinda really need to know WHY the tiletoms i posted doesnt work.

Frement

2010-05-03 17:48:56

From: g0tp0t
i kinda really need to know WHY the tiletoms i posted doesnt work.


Because the algorithm is different then it was before, or thats atleast how i understood it.

Timer

2010-05-03 17:55:59

Why would I tell any of you how? :)

Frement

2010-05-03 18:02:42

From: Timer
Why would I tell any of you how? :)


Forgive me but, why the fuck are you in this community if your attitude is like that? I just hope your joking…

Coh3n

2010-05-03 18:06:10

From: Frement
I just hope your joking…

Doubt it. He would have done something if he wasn't…

noidea

2010-05-03 18:30:10

From: i luffs yeww
noidea, Timer thinks that SRL is too leechy; J_Pizzle might not think that. :)

(Also, you're sexy.)


Thanks i luffs yeww. Didnt see :S

Timer: I hope this is an age thing and you grow out of it, else you're going to have a hard time in life.

(You're sexy too, i luffs yeww ;) )

Camaro'

2010-05-03 18:32:48

I honestly think he is bullshitting that he made TileToMs.

MylesMadness

2010-05-03 18:41:15

From: Timer
Why would I tell any of you how? :)
Can you get off your high horse please? kthxbai

g0tp0t

2010-05-03 18:48:51

From: noidea
Thanks i luffs yeww. Didnt see :S

Timer: I hope this is an age thing and you grow out of it, else you're going to have a hard time in life.

(You're sexy too, i luffs yeww ;) )



WOW, didnt know srl became a dating service, any matches for me? :tongue:

and @frement you say the algorithims are different, but last time i checked physics hadnt changed, so what do u mean?

Blumblebee

2010-05-03 19:30:04

From: g0tp0t
WOW, didnt know srl became a dating service, any matches for me? :tongue:

and @frement you say the algorithims are different, but last time i checked physics hadnt changed, so what do u mean?


we do not have the same algorithms in SCAR/SRL/Simba. This makes it difficult as you would need to brute-force their algorithms (afaik I haven't looked at it much).

it's do-able, but an incredibly grueling, unenjoyable task.

g0tp0t

2010-05-03 19:33:58

what do you mean algorithms???

Coh3n

2010-05-03 19:36:55

From: g0tp0t
what do you mean algorithms???

http://dictionary.reference.com/browse/algorithm

SCAR's rs_GetUpText is an algorithm for returning RS's uptext.

g0tp0t

2010-05-03 19:39:02

i know what an algorythm is, i just dont understand what ther place in this is, isnt rs_getuptext just reading a variable from rs?

Coh3n

2010-05-03 19:41:55

From: g0tp0t
i know what an algorythm is, i just dont understand what ther place in this is, isnt rs_getuptext just reading a variable from rs?

I'm sure if you looked at the source function it would be a lot more complicated than that. :p

The place is that TileToMS is an algorithm for converting a RuneScape tile to the Mainscreen.

g0tp0t

2010-05-03 19:55:46

lol, k ill look at source, still dont see how reading texyt from var could be so hard :O

Coh3n

2010-05-03 20:19:21

From: g0tp0t
lol, k ill look at source, still dont see how reading texyt from var could be so hard :O

May not be, I don't know, I've never seen the source. I would just assume that it's more complicated than it sounds.

3Garrett3

2010-05-03 20:26:32

From: g0tp0t
lol, k ill look at source, still dont see how reading texyt from var could be so hard :O


What do you mean text from a var? Are you still talking about uptext? Well first it has to detect the position of the text, most likely the colour of it, then the positions of letters relative to eachother. Is it a space or a larger difference between letters? Plus, it can't just read the code and decide the text. This isn't reflection. I'm quite sure that SRL's version of uptext before SCAR integrated it involved TPA counts for letters, bitmaps, all that jazz. You really don't understand how difficult it is.

From: Coh3n
May not be, I don't know, I've never seen the source. I would just assume that it's more complicated than it sounds.


The SRL source was intense, the SCAR integrated version is likely just as crazy.

g0tp0t

2010-05-03 20:26:36


{*******************************************************************************
function R_GetUpText: string;
By: lordsaturn
Description: Gets the uptext using reflection.
*******************************************************************************}

function R_GetUpText: string;

var
Objs : array [0..3] of Integer;
Hi, i: integer;

begin
Hi := GetOptionCount - 1;
if Hi < 1 then Exit;
Objs[0] := SmartGetFieldArrayObject(0, MenuActions, I);
Objs[1] := SmartGetFieldArrayObject(0, MenuOptions, I);
Result := TrimHTML(StringFromString(Objs[0]) + ' ' + StringFromString(Objs[1]));
for i := 0 to 1 do
SmartFreeObject(Objs[i]);
if (Hi > 1) and (Result <> '') then
Result := Result+' / '+inttostr(Hi-1)+' more options';
end;

complicated?? pfft. lol. just reads straight from rs and trims result :P

@ garret who managed to post b4 me:

i do know how difficult it is. also, its a waste of time doing it ur way since rs could change the spacing by 1 pixel and we would ned to figure out what the hell was wrong, easier to find the letters and arrange them in order of their x position

EDIT: just noticed that the var is named hi… :P

3Garrett3

2010-05-03 20:33:26

From: g0tp0t

@ garret who managed to post b4 me:

i do know how difficult it is. also, its a waste of time doing it ur way since rs could change the spacing by 1 pixel and we would ned to figure out what the hell was wrong, easier to find the letters and arrange them in order of their x position


*Garrett please and thanks.

I told you the exact way that you explained. The version you just posted is reflection. Detecting the text with real scripting is much more complex. You detect each letter separately, arrange in order, account for the spaces between letters (taking care to not analyze a large gap between letters which isn't a space) and arrange them according to that order. I recall uptext working according to colour at one point as well, because different colours mean different things.

Baked0420

2010-05-03 21:10:06

This went from TileToMs algorithm to text finding algorithm and SRL's old way to do find it. We should get back on topic, where do these codes come from exactly:


SmartGetFieldArrayObject(parent: longint; path: string; index: longint);

I do know some java and I remember trying to learn how reflection was developed before and it was too hard, maybe if I learned how the include was developed it would help. Can anyone help with the smart procedure/function's at all? Maybe explain them a little bit if they could and where you get the constants (I'm assuming) from, such as MenuActions, MenuOptions (from the uptext done with reflection in an above post).

JPHamlett

2010-05-03 21:37:02

if nayone wants to have a huge tiletoms "party" type thing to figure it out addmy msn and well all talk about it on friday



[email]jphamlett@live.com[/email]

i luffs yeww

2010-05-03 21:38:09

By the way, to everyone posting that Timer is "immature" or anything, that's really not going to help in any way. I'd also like if nobody even mentioned what I just said, because this isn't relevant either.

g0tp0t, I hope you know that this isn't the easiest thing to do, and you really shouldn't just say things like "its a waste of time doing it ur way since," because he's giving you actual information that you need.

But anyway, good luck, and try to talk to Timer/RS-Hacking/RSBot/etc. to get a better understanding. Maybe you could make an updater for hooks as well. :)

Timer

2010-05-03 22:08:23

From: i luffs yeww
By the way, to everyone posting that Timer is "immature" or anything, that's really not going to help in any way. I'd also like if nobody even mentioned what I just said, because this isn't relevant either.

g0tp0t, I hope you know that this isn't the easiest thing to do, and you really shouldn't just say things like "its a waste of time doing it ur way since," because he's giving you actual information that you need.

But anyway, good luck, and try to talk to Timer/RS-Hacking/RSBot/etc. to get a better understanding. Maybe you could make an updater for hooks as well. :)


<3
The message you have entered is too short. Please lengthen your message to at least 3 characters.

Blumblebee

2010-05-03 22:10:17

From: i luffs yeww
By the way, to everyone posting that Timer is "immature" or anything, that's really not going to help in any way. I'd also like if nobody even mentioned what I just said, because this isn't relevant either.

g0tp0t, I hope you know that this isn't the easiest thing to do, and you really shouldn't just say things like "its a waste of time doing it ur way since," because he's giving you actual information that you need.

But anyway, good luck, and try to talk to Timer/RS-Hacking/RSBot/etc. to get a better understanding. Maybe you could make an updater for hooks as well. :)


I wouldn't ask Timer about it until he can prove he fixed TileToMS, otherwise your looking at potentially fictional information, which isn't helpful.

RS-Hacking is a good idea, we could all take a stab at fixing TileToMS, or replicating the math involved in the method provided from RSbot. If I get some spare time in the next couple of months I'll take a stab at it.

Infantry001

2010-05-03 22:20:08

Crap. All these smart people who can't figure the damn thing out. That leaves such little hope for me… but I suppose I can give it a shot after exams are over. I've always wanted to get into Java - I've just lacked the motivation ;)

Method

2010-05-04 00:39:52

It looks like you guys are looking for the calculation done in ISAACCipher.method2337 and SDToolkit.method2765 (from my refactored client). Emulate the code inside those methods (using the fields from the latest client) and you should be able to come up with a working version. From ISAACCipher.method2337 you really only need to look at this part anyway:

int j2 = -i + Class244.getTileHeight(plane, localX, localY);
// ... other code
Node_Sub18_Sub20.currentToolkit.method2765(localX, j2, localY, Class143.mobileScreenPosition);

TRiLeZ

2010-05-04 01:10:32

Edit: Here's TileToMS, pulled from the client then refractored by me:


final Point TileToMS(int localX, int tileHeight, int localY) {
int i = RenderData.xOff + (RenderData.zX * localX + RenderData.zY * tileHeight + RenderData.zZ * localY >> 15);

if ((i < Render.zNear) || (i > Render.zFar)) {
return new Point(-1, -1);
}

int j = Render.xMultiplier
* (RenderData.xOff + (RenderData.xX * localX + RenderData.xY * tileHeight
+ RenderData.xZ * localY >> 15)) / i;

int k = Render.yMultiplier
* (RenderData.yOff + (RenderData.yX * localX + RenderData.yY * tileHeight
+ RenderData.yZ * localY >> 15)) / i;

if ((j >= Render.absoluteX1) && (j <= Render.absoluteX2)
&& (k >= Render.absoluteY1) && (k <= Render.absoluteY2)) {
return new Point(j - Render.absoluteX1, k - Render.absoluteY1);
}

return new Point(-1, -1);
}

Edit2: It's not working in TRiBot. :(
Maybe I could invoke the method… :stirthepot:

JPHamlett

2010-05-04 07:30:37

From: Method
It looks like you guys are looking for the calculation done in ISAACCipher.method2337 and SDToolkit.method2765 (from my refactored client). Emulate the code inside those methods (using the fields from the latest client) and you should be able to come up with a working version. From ISAACCipher.method2337 you really only need to look at this part anyway:

int j2 = -i + Class244.getTileHeight(plane, localX, localY);
// ... other code
Node_Sub18_Sub20.currentToolkit.method2765(localX, j2, localY, Class143.mobileScreenPosition);



thank you so much method i will try it when i get home from school

Coh3n

2010-05-04 08:05:20

From: TRiLeZ
Edit: Here's TileToMS, pulled from the client then refractored by me:


final Point TileToMS(int localX, int tileHeight, int localY) {
int i = RenderData.xOff + (RenderData.zX * localX + RenderData.zY * tileHeight + RenderData.zZ * localY >> 15);

if ((i < Render.zNear) || (i > Render.zFar)) {
return new Point(-1, -1);
}

int j = Render.xMultiplier
* (RenderData.xOff + (RenderData.xX * localX + RenderData.xY * tileHeight
+ RenderData.xZ * localY >> 15)) / i;

int k = Render.yMultiplier
* (RenderData.yOff + (RenderData.yX * localX + RenderData.yY * tileHeight
+ RenderData.yZ * localY >> 15)) / i;

if ((j >= Render.absoluteX1) && (j <= Render.absoluteX2)
&& (k >= Render.absoluteY1) && (k <= Render.absoluteY2)) {
return new Point(j - Render.absoluteX1, k - Render.absoluteY1);
}

return new Point(-1, -1);
}

Edit2: It's not working in TRiBot. :(
Maybe I could invoke the method… :stirthepot:

I don't know much about Java, but that looks like it would return a Point(-1, -1) no matter what. Or does does the method exit as soon as something's returned?

Method

2010-05-04 08:53:43

From: Coh3n
I don't know much about Java, but that looks like it would return a Point(-1, -1) no matter what. Or does does the method exit as soon as something's returned?


Yes, return statements exit the method when they are called.

Coh3n

2010-05-04 08:57:43

From: Method
Yes, return statements exit the method when they are called.

Ah okay. Thanks. :)

g0tp0t

2010-05-04 10:40:17

From: g0tp0t

{*******************************************************************************
function R_GetUpText: string;
By: lordsaturn
Description: Gets the uptext using reflection.
*******************************************************************************}

function R_GetUpText: string;

var
Objs : array [0..3] of Integer;
Hi, i: integer;

begin
Hi := GetOptionCount - 1;
if Hi < 1 then Exit;
Objs[0] := SmartGetFieldArrayObject(0, MenuActions, I);
Objs[1] := SmartGetFieldArrayObject(0, MenuOptions, I);
Result := TrimHTML(StringFromString(Objs[0]) + ' ' + StringFromString(Objs[1]));
for i := 0 to 1 do
SmartFreeObject(Objs[i]);
if (Hi > 1) and (Result <> '') then
Result := Result+' / '+inttostr(Hi-1)+' more options';
end;

complicated?? pfft. lol. just reads straight from rs and trims result :P

@ garret who managed to post b4 me:

i do know how difficult it is. also, its a waste of time doing it ur way since rs could change the spacing by 1 pixel and we would ned to figure out what the hell was wrong, easier to find the letters and arrange them in order of their x position

EDIT: just noticed that the var is named hi… :P


From: i luffs yeww
By the way, to everyone posting that Timer is "immature" or anything, that's really not going to help in any way. I'd also like if nobody even mentioned what I just said, because this isn't relevant either.

g0tp0t, I hope you know that this isn't the easiest thing to do, and you really shouldn't just say things like "its a waste of time doing it ur way since," because he's giving you actual information that you need.

But anyway, good luck, and try to talk to Timer/RS-Hacking/RSBot/etc. to get a better understanding. Maybe you could make an updater for hooks as well. :)



yah, sorry, i said that way more negative than i meant. i didnt mean to be sarcastic/mean. sorry again. stupid thing to say. plz forgive me :[

anyways, im liking the new attention. maybe we can start making this new function together. as a community. it would be way better than timers :P

–
i know this is hard :\. i have still not figured out what u meant mby tiletoms being a different algorythm now. from what i understand, TileToMS takes a square area in space(x y and z) and converts it into a point on a plane(your screen) relative tothe camera. so basicly it converts xyz to xy. so what could have changed to make it not work… resolution change in rs? or maybe the coordinate system updated. thats what i dont understand, if i made any sense :P

Coh3n

2010-05-04 11:30:00

From: g0tp0t
so what could have changed to make it not work… resolution change in rs? or maybe the coordinate system updated. thats what i dont understand, if i made any sense :P

I'd also like to know this. Specifics are always nice. :)

Nava2

2010-05-04 11:38:43

Timer is full of shit. Go fly a kite, Timer.

Yes, its a metaphor.

I will look into this in the next few days, I'm curious actually. Its just trig, and assuming we have the hooks, it shouldn't be too hard to write a new algorithm.

Not making any promises fyi.

g0tp0t

2010-05-04 11:43:38

see, thats what i meantr by physics hasnt changed. im so bad putting my thoughts out. lol, always confuse people cuz i cant explain anything for crap.

mastaraymond

2010-05-04 11:48:57

I'm stuck at this part, RSBot (and KBot) get this Renderdata through a callback function.. This is not possible in SMART, now Method said you can get this data through using fields in 'currentToolkit'.. However, I cannot find these hooks in any of the updater logs..


program new;
{.LoadDLL libsmart}

const
Plane = 'cw.T';
GroundByteArray = 'tk.k';
TileData = 'ta.M';
TileHeights = 'r';


function tilePlaneGetHeight(obj,xx,zz : integer) : integer;
var
x,z : integer;
i,j,k,l : integer;
begin
x := xx shr 7;
z := zz shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
result := 0
else
begin
i := x and (128 - 1);
j := z and (128 - 1);
k := SmartGetFieldArray2DInt(obj,tileheights,x,z) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z) * i) shr 7;
l := SmartGetFieldArray2DInt(obj,tileheights,x,z+1) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z+1) * i) shr 7;
result := k * (128 - j) + (l * j) shr 7;
end;
end;


function GetTileHeight(xx,zz : integer) : integer;
var
p : integer;
x,z : integer;
obj : integer;

begin;
p := SmartGetFieldInt(0,Plane);
x := XX shr 7;
z := ZZ shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
begin
result := 0;
exit;
end;
if ((p < 3) and ((SmartGetFieldArray3DByte(0,GroundByteArray,1,x,z) and 2) <> 0)) then
inc(p);
if SmartGetFieldArraySize(0,TileData) > p then
begin
obj := SmartGetFieldArrayObject(0,TileData,p);
result := tilePlaneGetHeight(obj,xx,zz);
SmartFreeObject(obj);
end;
end;

type
TRenderData = record
xOff,xX,xY,xZ : integer;
yOff,yX,yY,yZ : integer;
zOff,zX,zY,zZ : integer;
end;
TRender = record
absoluteX1,absoluteX2 : extended;
absoluteY1,absoluteY2 : extended;
xMultiplier,yMultiplier : integer;
zNear,zFar : integer;
end;



function w2s(x,y,z : integer) : TPoint;
var
RenderData : TRenderData;
Render : TRender;
_z,_x,_y : integer;
begin;
result := point(-1,-1);
with RenderData do
begin
xOff := 0; xX := 32768; xY := 0; xZ := 0;
yOff := 0; yX := 0; yY := 32768; yZ := 0;
zOff := 0; zX := 0; zY := 0; zZ := 32768;
end;
with Render do
begin
absoluteX1 := 0; absoluteX2 := 0;
absoluteY1 := 0; absoluteY2 := 0;
xMultiplier := 512; yMultiplier := 512;
zNear := 50; zFar := 3500;
end;
_z := (RenderData.zOff + ((RenderData.zX * x + RenderData.zY * y + RenderData.zZ * z) shr 15));
if( (_z < Render.zNear) or (_z > Render.zFar) ) then
exit;
_x := Render.xMultiplier * (RenderData.xOff + ( (RenderData.xX * x + RenderData.xY * y + RenderData.xZ * z) shr 15)) / _z;
_y L= Render.yMultiplier * (RenderData.yOff + ( (RenderData.yX * x + RenderData.yY * y + RenderData.yZ * z) shr 15)) / _z;
if ((_x >= Render.absoluteX1) and (_x <= Render.absoluteX2) and (_y >= Render.absoluteY1) and (_y <= Render.absoluteY2)) then
result := Point((_x - Render.absoluteX1), (_y - Render.absoluteY1));
end;


public static Point w2s(int x, int y, int z)
{
if(Bot.getClient().getDetailInfo() == null)
return new Point(-1, -1);

int detail_lvl = Bot.getClient().getDetailInfo().getDetailLevel();

if(detail_lvl == 0 || detail_lvl == 2)
{
int _z = (int) (RenderData.zOff + ((int) (RenderData.zX * x + RenderData.zY * y + RenderData.zZ * z) >> 15));
if( (_z < Render.zNear) || (_z > Render.zFar) )
return new Point(-1, -1);

int _x = Render.xMultiplier * ((int) RenderData.xOff + ((int) (RenderData.xX * x + RenderData.xY * y + RenderData.xZ * z) >> 15)) / _z;
int _y = Render.yMultiplier * ((int) RenderData.yOff + ((int) (RenderData.yX * x + RenderData.yY * y + RenderData.yZ * z) >> 15)) / _z;

if ((_x >= Render.absoluteX1) && (_x <= Render.absoluteX2) && (_y >= Render.absoluteY1) && (_y <= Render.absoluteY2))
return new Point((int) (_x - Render.absoluteX1), (int) (_y - Render.absoluteY1));
}
else if(detail_lvl == 1)
{
float _z = RenderData.zX * x + RenderData.zY * y + RenderData.zZ * z + RenderData.zOff;
if ( (_z < Render.zNear) || (_z > Render.zFar) )
return new Point(-1, -1);

final int _x = (int) (Render.xMultiplier * (RenderData.xX * x + RenderData.xY * y + RenderData.xZ * z + RenderData.xOff) / _z);
final int _y = (int) (Render.yMultiplier * (RenderData.yX * x + RenderData.yY * y + RenderData.yZ * z + RenderData.yOff) / _z);

if ((_x >= Render.absoluteX1) && (_x <= Render.absoluteX2) && (_y >= Render.absoluteY1) && (_y <= Render.absoluteY2))
return new Point((int) (_x - Render.absoluteX1), (int) (_y - Render.absoluteY1));
}

return new Point(-1, -1);
}






public static int tileHeight(final int X, final int Z) {
int p = Bot.getClient().getPlane();
final int x = X >> 7;
final int z = Z >> 7;

if ((x < 0) || (x > 104) || (z < 0) || (z > 104))
return 0;

if ((p < 3) && ((Bot.getClient().getGroundByteArray()[1][x][z] & 2) != 0)) {
p++;
}

final TileData[] dataArray = Bot.getClient().getTileData();

if ((dataArray.length > p) && (dataArray[p] != null))
return dataArray[p].getHeight(X, Z);
return 0;
}

// Calculations
public static Point tileToScreen(final int x, final int y, final double dX, final double dY, final int height) {
return Calculations.worldToScreen((int) ((x - Bot.getClient().getBaseX() + dX) * 128), (int) ((y - Bot.getClient().getBaseY() + dY) * 128), height);
}

public static Point tileToScreen(final int x, final int y, final int height) {
return Calculations.tileToScreen(x, y, 0.5, 0.5, height);
}

public static Point tileToScreen(final RSTile t) {
return Calculations.tileToScreen(t.getX(), t.getY(), 0);
}

public static Point tileToScreen(final RSTile t, final double dX, final double dY, final int height) {
return Calculations.tileToScreen(t.getX(), t.getY(), dX, dY, height);
}

public static Point tileToScreen(final RSTile t, final int h) {
return Calculations.tileToScreen(t.getX(), t.getY(), h);
}

public static void updateRenderInfo(final org.rsbot.accessors.Render r, final org.rsbot.accessors.RenderData rd) {
if ((r == null) || (rd == null))
return;

Render.absoluteX1 = r.getAbsoluteX1();
Render.absoluteX2 = r.getAbsoluteX2();
Render.absoluteY1 = r.getAbsoluteY1();
Render.absoluteY2 = r.getAbsoluteY2();

Render.xMultiplier = r.getXMultiplier();
Render.yMultiplier = r.getYMultiplier();

Render.zNear = r.getZNear();
Render.zFar = r.getZFar();

RenderData.xOff = rd.getXOff();
RenderData.xX = rd.getXX();
RenderData.xY = rd.getXY();
RenderData.xZ = rd.getXZ();

RenderData.yOff = rd.getYOff();
RenderData.yX = rd.getYX();
RenderData.yY = rd.getYY();
RenderData.yZ = rd.getYZ();

RenderData.zOff = rd.getZOff();
RenderData.zX = rd.getZX();
RenderData.zY = rd.getZY();
RenderData.zZ = rd.getZZ();
}

public static Point worldToMinimap(double x, double y) {
x -= Bot.getClient().getBaseX();
y -= Bot.getClient().getBaseY();
final int calculatedX = (int) (x * 4 + 2) - Bot.getClient().getMyRSPlayer().getX() / 32;
final int calculatedY = (int) (y * 4 + 2) - Bot.getClient().getMyRSPlayer().getY() / 32;

try {
final org.rsbot.accessors.RSInterface mm = DynamicConstants.getMinimapInterface();
if (mm == null)
return new Point(-1, -1);
final RSInterfaceChild mm2 = RSInterface.getChildInterface(mm.getID());

final int actDistSq = calculatedX * calculatedX + calculatedY * calculatedY;

final int mmDist = 10 + Math.max(mm2.getWidth() / 2, mm2.getHeight() / 2);
if (mmDist * mmDist >= actDistSq) {
int angle = 0x3fff & (int) Bot.getClient().getMinimapOffset();
if (Bot.getClient().getMinimapSetting() != 4) {
angle = 0x3fff & Bot.getClient().getMinimapAngle() + (int) Bot.getClient().getMinimapOffset();
}

int cs = Calculations.CURVESIN[angle];
int cc = Calculations.CURVECOS[angle];
if (Bot.getClient().getMinimapSetting() != 4) {
final int fact = 256 + Bot.getClient().getMinimapScale();
cs = 256 * cs / fact;
cc = 256 * cc / fact;
}

final int calcCenterX = cc * calculatedX + cs * calculatedY >> 15;
final int calcCenterY = cc * calculatedY - cs * calculatedX >> 15;

final int screenx = calcCenterX + mm2.getAbsoluteX() + mm2.getWidth() / 2;
final int screeny = -calcCenterY + mm2.getAbsoluteY() + mm2.getHeight() / 2;

// Check if point is within the circel of the minimap instead of
// the
// rectangle!
if ((Math.max(calcCenterY, -calcCenterY) <= mm2.getWidth() / 2.0 * .8) && (Math.max(calcCenterX, -calcCenterX) <= mm2.getHeight() / 2 * .8))
return new Point(screenx, screeny);
else
return new Point(-1, -1);
}
} catch (final NullPointerException ignored) {
}

return new Point(-1, -1);// not on minimap
}


public static Point worldToScreen(final int x, final int z, final int height) {

if ((Bot.getClient().getGroundByteArray() == null) || (Bot.getClient().getTileData() == null) || (Bot.getClient().getDetailInfo() == null) || (x < 128) || (z < 128) || (x > 13056) || (z > 13056))
return new Point(-1, -1);

int y = Calculations.tileHeight(x, z) - height;

Point p = w2s(x, y, z);

if ((p != null) && Calculations.onScreen(p))
return p;

return new Point(-1, -1);
}

private Calculations() {
}
}

function TileToMS(Tile:TPoint; height: integer): TPoint;

function TileToMS(Tile:TPoint; height: integer): TPoint;

var
cx, cy, cz, dx, dy, dz, locX, locY, layer: Integer;
pitch, yaw, sinYaw, cosYaw, sinPitch, cosPitch, rotation: extended;

begin
locX:= Tile.x - SmartGetFieldInt(0, BaseX);
locY:= Tile.y - SmartGetFieldInt(0, BaseY);
if not (InRange(LocX, 0, 103) or InRange(LocY, 0, 103)) then
Exit;
layer:= SmartGetFieldInt(0,BaseLayer);
if (layer < 3) and ((2 and SmartGetFieldArray3DByte(0,GroundSettings,1,locX,locY)) = 2) then
Inc(layer);
cz:= SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY+1) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY+1);
cx:= locX * 128 + 64 - SmartGetFieldInt(0,CamX);
cy:= locY * 128 + 64 - SmartGetFieldInt(0,CamY);
cz:= (cz / 4) - height - SmartGetFieldInt(0,CamZ);
pitch:= SmartGetFieldInt(0,CamPitch) * Pi / 1024;
yaw:= SmartGetFieldInt(0,CamYaw) * Pi / 1024;
sinYaw:= sin(yaw);
cosYaw:= cos(yaw);
sinPitch:= sin(pitch);
cosPitch:= cos(pitch);
rotation:= cosYaw*cy-sinYaw*cx;
dx:= Round(sinYaw*cy+cosYaw*cx);
dy:= Round(sinPitch*cz+cosPitch*rotation);
dz:= Round(cosPitch*cz-sinPitch*rotation);
try
Result.x:= (dx * 512) / dy + 256;
Result.y:= (dz * 512) / dy + 167;
except end;
end;
begin
end.

Note that there is just some copied+pasted code in there, just the top 2 functions are up2date.. And the rest is from RSBot (and the current TileToMS)

g0tp0t

2010-05-04 12:07:33

so by converting those to pascal/scar we could get it to work??

mastaraymond

2010-05-04 12:11:35

From: g0tp0t
so by converting those to pascal/scar we could get it to work??

You post too much without reading..

g0tp0t

2010-05-04 12:12:45

no i dont… im not seing how this is going to be better than the old tile to ms since physics has yet to change. world points still should not have changed

mastaraymond

2010-05-04 12:18:04

From: g0tp0t
no i dont… im not seing how this is going to be better than the old tile to ms since physics has yet to change. world points still should not have changed

That's the exact reason why you shouldn't post.. You are sharing your confusedness with the rest of the world. Oh and please use some Capitals when typing, it makes reading so much easier.

Dynamite

2010-05-04 12:19:59

From: g0tp0t
it would be way better than timers :P


I love the enthusiasm, but this also doesn't help matters.

I hope you guys get it fixed, I would like to say thank you to Method for helping :)

g0tp0t

2010-05-04 12:20:15

OK.
Well, i cant help a ton while i am confused, and i am also not the only one. coh3n said the saim, if you read the thread

Naum

2010-05-04 12:22:07

From: g0tp0t
OK.
Well, i cant help a ton while i am confused, and i am also not the only one. coh3n said the saim, if you read the thread


Then, if you're confused PM or ask someone on MSN (mine is [email]naumanakhlaq@hotmail.com[/email]). There's no need to spam this whole thread up. Just don't feel the need to post on every single thing that comes into your head.

Firstly, an algorithm is not 'physics', it comprises of logical steps to solve a problem.
http://simple.wikipedia.org/wiki/Algorithm

g0tp0t

2010-05-04 13:35:57

OK, im sorry but this is getting really frigging annoying. stop accusing me of not reading or spamming. If you go through the whole post it will make more sense. I know what an algorithm is. all ready stated that. I dont understand what has changed to ruin TileToMS. J have already also asked for help via pm/email/IM. not that your help isn't appreciated. Just that this is getting Way offtopic.


EDIT: okay, this is not coming up in google and i think, but im not sure, it might be a personal scripting style:

int _z = (int) (RenderData.zOff + 

what is the underscore before the variable mean/do, is it just a different variable? or is that underscore doing something like making it a publiv var or something. afaik that isnt possible though

EDIT2:



function TileToMS(TileLoc : TPoint, Height): Tpoint;

var
Detail_Level : integer;
_x,_y,_z : integer;

begin

if {client detail info is empty} then //i havnt found the SMART conversion for this yet
begin
WriteLn('Out of range in TileToMS Input!!!');
result.x := -1;
result.y := -1;
end;

Detail_Leve; := {client det lvl}; //im not running scar so i cant see the functions to repklace this with :\

if(Detail_Level = 0)XOR(Detail_Level = 2) then
begin

_z := round({zoffhere}+(round({renderdatazx} * TileLoc.x * {renderdata zz here} *z) shl{>>} 15))

if _z < {ZNear} XOR ( _z > {ZFar}) then
begin
WriteLn('Out of range in TileToMS Input!!!');
result.x := -1;
result.y := -1;
end;

_x := {Xmultiplier} * (round(XOff)+Round({renderdata xX} * x +{renderdata xY} * y + renderdata xZ *z) shl 15)) / _z;
_y := {ymultiplier} * (round(yOff)+Round({renderdata yX} * x +{renderdata yY} * y + renderdata yZ *z) shl 15)) / _z;

if(_x >= {absolutex1}

end;
unfinished and im not sure about the XOR, i think its logical exclusive in the java…

JPHamlett

2010-05-04 15:48:52

^^ Round({renderdata xX}


how do you expect to get that hook\


and i am gonna do it with the actual client so it should work

g0tp0t

2010-05-04 15:55:55

i was doing that in notepad -.-, i didnt have the srl library to look at so i just put that stuff as reference.

mastaraymond

2010-05-04 16:48:42

That's what I stated in my post 1 page earlier g0tp0t.. The whole problem is getting these fields.. As you none of the updater logs contains these, nor does RSBot/KBot use them.. So we'd have to write our own updater, which I cannot be fucked to do.

TRiLeZ

2010-05-04 17:35:36


getToolkit() bm,V

getAbsoluteX1() fg,L
getAbsoluteX2() fg,B
getAbsoluteY1() fg,y
getAbsoluteY2() fg,nb
getZNear() fg,W
getZFar() fg,lb
getXMultiplier() fg,ab
getYMultiplier() fg,eb
getViewport() fg,z

getXOff() ff,u
getXX() ff,t
getXY() ff,k
getXZ() ff,p
getYOff() ff,o
getYX() ff,r
getYY() ff,s
getYZ() ff,m
getZOff() ff,l
getZX() ff,q
getZY() ff,j
getZZ() ff,n

RSBot injects getters for all of these fields… you just have to find them.

Sir R. M8gic1an

2010-05-04 18:45:32

Guys easy… g0tp0t got confused.. it's no big deal, everyone does.. especially when they're attempting at something new… :)

~RM

mastaraymond

2010-05-04 18:52:49

From: TRiLeZ

getToolkit() bm,V

getAbsoluteX1() fg,L
getAbsoluteX2() fg,B
getAbsoluteY1() fg,y
getAbsoluteY2() fg,nb
getZNear() fg,W
getZFar() fg,lb
getXMultiplier() fg,ab
getYMultiplier() fg,eb
getViewport() fg,z

getXOff() ff,u
getXX() ff,t
getXY() ff,k
getXZ() ff,p
getYOff() ff,o
getYX() ff,r
getYY() ff,s
getYZ() ff,m
getZOff() ff,l
getZX() ff,q
getZY() ff,j
getZZ() ff,n

RSBot injects getters for all of these fields… you just have to find them.

They don't seem to work :redface:.. All return -1..

This might be because those hooks aren't up2date in RSBot? As I'm pretty sure it doesn't use these hooks but a simple callback function ->

ih_append = ih[hd.render.append_index];
ih_append = il.append(ih_append, fac.createGetStatic("client", "callback",
Type.getType(org.rsbot.accessors.Callback.class)));
ih_append = il.append(ih_append, fac.createGetStatic(hd.render.render_class_name,
hd.render.render_field_name, Type.getType(hd.render.render_field_signature)));
ih_append = il.append(ih_append, fac.createGetStatic(hd.render.renderData_class_name,
hd.render.renderData_field_name, Type.getType(hd.render.renderData_field_signature)));
il.append(ih_append, fac.createInvoke(ACCESSOR_PACKAGE + "Callback", "updateRenderInfo",
Type.VOID, new Type[] { Type.getType(org.rsbot.accessors.Render.class),
Type.getType(org.rsbot.accessors.RenderData.class) }, Constants.INVOKEINTERFACE));

mgn.setInstructionList(il);
mgn.setMaxLocals();
mgn.setMaxStack();
mgn.update();
c_rd.replaceMethod(m_rd, mgn.getMethod());

So.. If someone finds out how to get these hooks/values you should have a working TileToMS..


program new;
{.LoadDLL libsmart}
{$define smart}
{$i srl/srl.scar}
const
Plane = 'cw.T';
GroundByteArray = 'tk.k';
TileData = 'ta.M';
TileHeights = 'r';
BaseX = 'ut.a';
BaseY = 'dq.N';

getAbsoluteX1 = 'fg.L';
getAbsoluteX2 = 'fg.B';
getAbsoluteY1 = 'fg.y';
getAbsoluteY2 = 'fg.nb';
getZNear = 'fg.W';
getZFar = 'fg.lb';
getXMultiplier = 'fg.ab';
getYMultiplier = 'fg.eb';
getViewport = 'fg.z';

getXOff = 'ff.u';
getXX = 'ff.t';
getXY = 'ff.k';
getXZ = 'ff.p';
getYOff = 'ff.o';
getYX = 'ff.r';
getYY = 'ff.s';
getYZ = 'ff.m';
getZOff = 'ff.l';
getZX = 'ff.q';
getZY = 'ff.j';
getZZ = 'ff.n';
MyPlayer = 'cn.n';
Currenty = 'q';
Currentx = 'm';



function tilePlaneGetHeight(obj,xx,zz : integer) : integer;
var
x,z : integer;
i,j,k,l : integer;
begin
x := xx shr 7;
z := zz shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
result := 0
else
begin
i := x and (128 - 1);
j := z and (128 - 1);
k := SmartGetFieldArray2DInt(obj,tileheights,x,z) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z) * i) shr 7;
l := SmartGetFieldArray2DInt(obj,tileheights,x,z+1) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z+1) * i) shr 7;
result := k * (128 - j) + (l * j) shr 7;
end;
end;


function GetTileHeight(xx,zz : integer) : integer;
var
p : integer;
x,z : integer;
obj : integer;

begin;
p := SmartGetFieldInt(0,Plane);
x := XX shr 7;
z := ZZ shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
begin
result := 0;
exit;
end;
if ((p < 3) and ((SmartGetFieldArray3DByte(0,GroundByteArray,1,x,z) and 2) <> 0)) then
inc(p);
if SmartGetFieldArraySize(0,TileData) > p then
begin
obj := SmartGetFieldArrayObject(0,TileData,p);
result := tilePlaneGetHeight(obj,xx,zz);
SmartFreeObject(obj);
end;
end;

type
TRenderData = record
xOff,xX,xY,xZ : extended;
yOff,yX,yY,yZ : extended;
zOff,zX,zY,zZ : extended;
end;
TRender = record
absoluteX1,absoluteX2 : extended;
absoluteY1,absoluteY2 : extended;
xMultiplier,yMultiplier : integer;
zNear,zFar : integer;
end;

procedure UpdateRenderInfo(var Render : TRender; var RenderData : TRenderData);
begin
with RenderData do
begin
xOff := SmartGetFieldFloat(0,getXOff);
xX :=SmartGetFieldFloat(0,getXX);
xY := SmartGetFieldFloat(0,getxY);
xZ := SmartGetFieldFloat(0,getxz);
yOff := SmartGetFieldFloat(0,getyoff);
yX := SmartGetFieldFloat(0,getyx);
yY :=SmartGetFieldFloat(0,getyy);
yZ := SmartGetFieldFloat(0,getyz);
zOff := SmartGetFieldFloat(0,getzoff);
zX := SmartGetFieldFloat(0,getzx);
zY := SmartGetFieldFloat(0,getzy);
zZ := SmartGetFieldFloat(0,getzz);
end;
with Render do
begin
absoluteX1 := SmartGetFieldFloat(0, getabsoluteX1);
absoluteX2 := SmartGetFieldFloat(0, getabsoluteX2);
absoluteY1 := SmartGetFieldFloat(0, getabsoluteY1);
absoluteY2 := SmartGetFieldFloat(0, getabsolutey2);
xMultiplier := SmartGetFieldInt(0, getxmultiplier);
yMultiplier := SmartGetFieldInt(0, getymultiplier);
zNear := SmartGetFieldInt(0, getznear);
zFar := SmartGetFieldInt(0, getzfar);
end;
end;

function w2s(x,y,z : integer) : TPoint;
var
RenderData : TRenderData;
Render : TRender;
_z,_x,_y : integer;
begin;
result := point(-1,-1);
with RenderData do
begin
xOff := 0; xX := 32768; xY := 0; xZ := 0;
yOff := 0; yX := 0; yY := 32768; yZ := 0;
zOff := 0; zX := 0; zY := 0; zZ := 32768;
end;
with Render do
begin
absoluteX1 := 0; absoluteX2 := 0;
absoluteY1 := 0; absoluteY2 := 0;
xMultiplier := 512; yMultiplier := 512;
zNear := 50; zFar := 3500;
end;
UpdateRenderInfo(render,renderdata);
Writeln(render);
Writeln(RenderData);
_z := Round(RenderData.zOff + (Round(RenderData.zX * x + RenderData.zY * y + RenderData.zZ * z) shr 15));
if( (_z < Render.zNear) or (_z > Render.zFar) ) then
exit;
_x := Round(Render.xMultiplier * (RenderData.xOff + ( Round(RenderData.xX * x + RenderData.xY * y + RenderData.xZ * z) shr 15)) / _z);
_y := Round(Render.yMultiplier * (RenderData.yOff + ( Round(RenderData.yX * x + RenderData.yY * y + RenderData.yZ * z) shr 15)) / _z);
if ((_x >= Render.absoluteX1) and (_x <= Render.absoluteX2) and (_y >= Render.absoluteY1) and (_y <= Render.absoluteY2)) then
result := Point(Round(_x - Render.absoluteX1), Round(_y - Render.absoluteY1));
end;

function worldToScreen(x,z,height : integer) : TPoint;
var
y : integer;
begin
result := point(-1,-1);
if (x < 128) or (z < 128) or (x > 13056) or (z > 13056) then
exit;
y := GetTileHeight(x,z) - height;
result := w2s(x,y,z);
end;


function TileToMSEx(x,y : integer; dx,dy : double; height : integer) : TPoint;
begin
result := worldToScreen(Round(x-SmartGetFieldInt(0,BaseX) + DX) * 128,
Round(y-SmartGetFieldInt(0,BaseY) + dy) * 128, height);
end;

function TileToMS(x,y,height : integer) : TPoint;
begin
result := TileToMSEx(x,y,0.5,0.5,height);
end;

function GetMyPos:TPoint;
var
me: Integer;
begin
me := SmartGetFieldObject(0, MyPlayer);
Writeln(SmartGetFieldInt(me, CurrentX));
Writeln(SmartGetFieldInt(0, BaseX));
Result.x := SmartGetFieldInt(0, BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
Result.y := SmartGetFieldInt(0, BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
SmartFreeObject(me);
end;
var
p : TPoint;
begin
Smart_Members := false;
Smart_Server := 49;
Smart_Signed := true;
Smart_SuperDetail := false;
setupsrl;
p := GetMyPos;
p := TileToMS(p.x + 1,p.y - 1,0);
Writeln(p);
MMouse(p.x,p.y,5,5);

end.

TRiLeZ

2010-05-04 19:04:38

From: mastaraymond
They don't seem to work :redface:.. All return -1..


No, they are all up-to-date, the TileToMS method from the client agrees with RSBot and I.

For XOff, XX, XY, XZ, YOff, etc. are you doing: getToolkit().getViewport().__

And for all of the rest, are you doing getToolkit().__?

Edit: Fixed up mastaraymond's code:


program new;
{.LoadDLL libsmart}
{$define smart}
{$i srl/srl.scar}
const
Toolkit = 'bm.V';
Plane = 'cw.T';
GroundByteArray = 'tk.k';
TileData = 'ta.M';
TileHeights = 'r';
BaseX = 'ut.a';
BaseY = 'dq.N';

getAbsoluteX1 = 'L';
getAbsoluteX2 = 'B';
getAbsoluteY1 = 'y';
getAbsoluteY2 = 'nb';
getZNear = 'W';
getZFar = 'lb';
getXMultiplier = 'ab';
getYMultiplier = 'eb';
getViewport = 'z';

getXOff = 'u';
getXX = 't';
getXY = 'k';
getXZ = 'p';
getYOff = 'o';
getYX = 'r';
getYY = 's';
getYZ = 'm';
getZOff = 'l';
getZX = 'q';
getZY = 'j';
getZZ = 'n';

MyPlayer = 'cn.n';
Currenty = 'q';
Currentx = 'm';



function tilePlaneGetHeight(obj,xx,zz : integer) : integer;
var
x,z : integer;
i,j,k,l : integer;
begin
x := xx shr 7;
z := zz shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
result := 0
else
begin
i := x and (128 - 1);
j := z and (128 - 1);
k := SmartGetFieldArray2DInt(obj,tileheights,x,z) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z) * i) shr 7;
l := SmartGetFieldArray2DInt(obj,tileheights,x,z+1) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z+1) * i) shr 7;
result := k * (128 - j) + (l * j) shr 7;
end;
end;


function GetTileHeight(xx,zz : integer) : integer;
var
p : integer;
x,z : integer;
obj : integer;

begin;
p := SmartGetFieldInt(0,Plane);
x := XX shr 7;
z := ZZ shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
begin
result := 0;
exit;
end;
if ((p < 3) and ((SmartGetFieldArray3DByte(0,GroundByteArray,1,x,z) and 2) <> 0)) then
inc(p);
if SmartGetFieldArraySize(0,TileData) > p then
begin
obj := SmartGetFieldArrayObject(0,TileData,p);
result := tilePlaneGetHeight(obj,xx,zz);
SmartFreeObject(obj);
end;
end;

type
TRenderData = record
xOff,xX,xY,xZ : extended;
yOff,yX,yY,yZ : extended;
zOff,zX,zY,zZ : extended;
end;
TRender = record
absoluteX1,absoluteX2 : extended;
absoluteY1,absoluteY2 : extended;
xMultiplier,yMultiplier : integer;
zNear,zFar : integer;
end;

procedure UpdateRenderInfo(var Render : TRender; var RenderData : TRenderData);
var
tk, vp: Integer;
begin
tk := SmartGetFieldObject(0, Toolkit);
vp := SmartGetFieldObject(tk, getViewport);
with RenderData do
begin
xOff := SmartGetFieldInt(vp,getXOff);
xX :=SmartGetFieldInt(vp,getXX);
xY := SmartGetFieldInt(vp,getxY);
xZ := SmartGetFieldInt(vp,getxz);
yOff := SmartGetFieldInt(vp,getyoff);
yX := SmartGetFieldInt(vp,getyx);
yY :=SmartGetFieldInt(vp,getyy);
yZ := SmartGetFieldInt(vp,getyz);
zOff := SmartGetFieldInt(vp,getzoff);
zX := SmartGetFieldInt(vp,getzx);
zY := SmartGetFieldInt(vp,getzy);
zZ := SmartGetFieldInt(vp,getzz);
end;
with Render do
begin
absoluteX1 := SmartGetFieldInt(tk, getabsoluteX1);
absoluteX2 := SmartGetFieldInt(tk, getabsoluteX2);
absoluteY1 := SmartGetFieldInt(tk, getabsoluteY1);
absoluteY2 := SmartGetFieldInt(tk, getabsolutey2);
xMultiplier := SmartGetFieldInt(tk, getxmultiplier);
yMultiplier := SmartGetFieldInt(tk, getymultiplier);
zNear := SmartGetFieldInt(tk, getznear);
zFar := SmartGetFieldInt(tk, getzfar);
end;
SmartFreeObject(tk);
SmartFreeObject(vp);
end;

function w2s(x,y,z : integer) : TPoint;
var
RenderData : TRenderData;
Render : TRender;
_z,_x,_y : integer;
begin;
result := point(-1,-1);
with RenderData do
begin
xOff := 0; xX := 32768; xY := 0; xZ := 0;
yOff := 0; yX := 0; yY := 32768; yZ := 0;
zOff := 0; zX := 0; zY := 0; zZ := 32768;
end;
with Render do
begin
absoluteX1 := 0; absoluteX2 := 0;
absoluteY1 := 0; absoluteY2 := 0;
xMultiplier := 512; yMultiplier := 512;
zNear := 50; zFar := 3500;
end;
UpdateRenderInfo(render,renderdata);
Writeln(render);
Writeln(RenderData);
_z := Round(RenderData.zOff + (Round(RenderData.zX * x + RenderData.zY * y + RenderData.zZ * z) shr 15));
Writeln('_z: ' + IntToStr(_z));
if( (_z < Render.zNear) or (_z > Render.zFar) ) then
exit;
_x := Round(Render.xMultiplier * (RenderData.xOff + ( Round(RenderData.xX * x + RenderData.xY * y + RenderData.xZ * z) shr 15)) / _z);
_y := Round(Render.yMultiplier * (RenderData.yOff + ( Round(RenderData.yX * x + RenderData.yY * y + RenderData.yZ * z) shr 15)) / _z);
if ((_x >= Render.absoluteX1) and (_x <= Render.absoluteX2) and (_y >= Render.absoluteY1) and (_y <= Render.absoluteY2)) then
result := Point(Round(_x - Render.absoluteX1), Round(_y - Render.absoluteY1));
end;

function worldToScreen(x,z,height : integer) : TPoint;
var
y : integer;
begin
result := point(-1,-1);
if (x < 128) or (z < 128) or (x > 13056) or (z > 13056) then
exit;
Writeln('TileHeight: ' + IntToStr(GetTileHeight(x,z)));
y := -312 - height;
result := w2s(x,y,z);
end;


function TileToMSEx(x,y : integer; dx,dy : double; height : integer) : TPoint;
begin
result := worldToScreen(Round(x-SmartGetFieldInt(0,BaseX) + DX) * 128,
Round(y-SmartGetFieldInt(0,BaseY) + dy) * 128, height);
end;

function TileToMS(x,y,height : integer) : TPoint;
begin
result := TileToMSEx(x,y,0.5,0.5,height);
end;

function GetMyPos:TPoint;
var
me: Integer;
begin
me := SmartGetFieldObject(0, MyPlayer);
Result.x := SmartGetFieldInt(0, BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
Result.y := SmartGetFieldInt(0, BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
SmartFreeObject(me);
end;

var
p : TPoint;
begin
Smart_Members := false;
Smart_Server := 49;
Smart_Signed := true;
Smart_SuperDetail := false;
setupsrl;
p := GetMyPos;
p := TileToMS(p.x + 1,p.y - 1,0);
Writeln(p);
MMouse(p.x,p.y,5,5);

end.

JPHamlett

2010-05-04 19:25:15

i should have it done soon i know how to get the hooks values ill get it later one today


edit failed

Camaro'

2010-05-04 19:37:15


program new;
{.LoadDLL libsmart}
{$define smart}
{$i srl/srl.scar}
const
Toolkit = 'bm.V';
Plane = 'cw.T';
GroundByteArray = 'tk.k';
TileData = 'ta.M';
TileHeights = 'r';
BaseX = 'ut.a';
BaseY = 'dq.N';

getAbsoluteX1 = 'L';
getAbsoluteX2 = 'B';
getAbsoluteY1 = 'y';
getAbsoluteY2 = 'nb';
getZNear = 'W';
getZFar = 'lb';
getXMultiplier = 'ab';
getYMultiplier = 'eb';
getViewport = 'z';

getXOff = 'u';
getXX = 't';
getXY = 'k';
getXZ = 'p';
getYOff = 'o';
getYX = 'r';
getYY = 's';
getYZ = 'm';
getZOff = 'l';
getZX = 'q';
getZY = 'j';
getZZ = 'n';

MyPlayer = 'cn.n';
Currenty = 'q';
Currentx = 'm';



function tilePlaneGetHeight(obj,xx,zz : integer) : integer;
var
x,z : integer;
i,j,k,l : integer;
begin
x := xx shr 7;
z := zz shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
result := 0
else
begin
i := x and (128 - 1);
j := z and (128 - 1);
k := SmartGetFieldArray2DInt(obj,tileheights,x,z) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z) * i) shr 7;
l := SmartGetFieldArray2DInt(obj,tileheights,x,z+1) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z+1) * i) shr 7;
result := k * (128 - j) + (l * j) shr 7;
end;
end;


function GetTileHeight(xx,zz : integer) : integer;
var
p : integer;
x,z : integer;
obj : integer;

begin;
p := SmartGetFieldInt(0,Plane);
x := XX shr 7;
z := ZZ shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
begin
result := 0;
exit;
end;
if ((p < 3) and ((SmartGetFieldArray3DByte(0,GroundByteArray,1,x,z) and 2) <> 0)) then
inc(p);
if SmartGetFieldArraySize(0,TileData) > p then
begin
obj := SmartGetFieldArrayObject(0,TileData,p);
result := tilePlaneGetHeight(obj,xx,zz);
SmartFreeObject(obj);
end;
end;

type
TRenderData = record
xOff,xX,xY,xZ : extended;
yOff,yX,yY,yZ : extended;
zOff,zX,zY,zZ : extended;
end;
TRender = record
absoluteX1,absoluteX2 : extended;
absoluteY1,absoluteY2 : extended;
xMultiplier,yMultiplier : integer;
zNear,zFar : integer;
end;

procedure UpdateRenderInfo(var Render : TRender; var RenderData : TRenderData);
var
tk, vp: Integer;
begin
tk := SmartGetFieldObject(0, Toolkit);
vp := SmartGetFieldObject(tk, getViewport);
with RenderData do
begin
xOff := SmartGetFieldInt(vp,getXOff);
xX :=SmartGetFieldInt(vp,getXX);
xY := SmartGetFieldInt(vp,getxY);
xZ := SmartGetFieldInt(vp,getxz);
yOff := SmartGetFieldInt(vp,getyoff);
yX := SmartGetFieldInt(vp,getyx);
yY :=SmartGetFieldInt(vp,getyy);
yZ := SmartGetFieldInt(vp,getyz);
zOff := SmartGetFieldInt(vp,getzoff);
zX := SmartGetFieldInt(vp,getzx);
zY := SmartGetFieldInt(vp,getzy);
zZ := SmartGetFieldInt(vp,getzz);
end;
with Render do
begin
absoluteX1 := SmartGetFieldInt(tk, getabsoluteX1);
absoluteX2 := SmartGetFieldInt(tk, getabsoluteX2);
absoluteY1 := SmartGetFieldInt(tk, getabsoluteY1);
absoluteY2 := SmartGetFieldInt(tk, getabsolutey2);
xMultiplier := SmartGetFieldInt(tk, getxmultiplier);
yMultiplier := SmartGetFieldInt(tk, getymultiplier);
zNear := SmartGetFieldInt(tk, getznear);
zFar := SmartGetFieldInt(tk, getzfar);
end;
SmartFreeObject(tk);
SmartFreeObject(vp);
end;

function w2s(x,y,z : integer) : TPoint;
var
RenderData : TRenderData;
Render : TRender;
_z,_x,_y : integer;
begin;
result := point(-1,-1);
with RenderData do
begin
xOff := 0; xX := 32768; xY := 0; xZ := 0;
yOff := 0; yX := 0; yY := 32768; yZ := 0;
zOff := 0; zX := 0; zY := 0; zZ := 32768;
end;
with Render do
begin
absoluteX1 := 0; absoluteX2 := 0;
absoluteY1 := 0; absoluteY2 := 0;
xMultiplier := 512; yMultiplier := 512;
zNear := 50; zFar := 3500;
end;
UpdateRenderInfo(render,renderdata);
Writeln(render);
Writeln(RenderData);
_z := Round(RenderData.zOff + (Round(RenderData.zX * x + RenderData.zY * y + RenderData.zZ * z) shr 15));
Writeln('_z: ' + IntToStr(_z));
if( (_z < Render.zNear) or (_z > Render.zFar) ) then
exit;
_x := Round(Render.xMultiplier * (RenderData.xOff + ( Round(RenderData.xX * x + RenderData.xY * y + RenderData.xZ * z) shr 15)) / _z);
_y := Round(Render.yMultiplier * (RenderData.yOff + ( Round(RenderData.yX * x + RenderData.yY * y + RenderData.yZ * z) shr 15)) / _z);
if ((_x >= Render.absoluteX1) and (_x <= Render.absoluteX2) and (_y >= Render.absoluteY1) and (_y <= Render.absoluteY2)) then
result := Point(Round(_x - Render.absoluteX1), Round(_y - Render.absoluteY1));
end;

function worldToScreen(x,z,height : integer) : TPoint;
var
y : integer;
begin
result := point(-1,-1);
if (x < 128) or (z < 128) or (x > 13056) or (z > 13056) then
exit;
Writeln('TileHeight: ' + IntToStr(GetTileHeight(x,z)));
y := -312 - height;
result := w2s(x,y,z);
end;


function TileToMSEx(x,y : integer; dx,dy : double; height : integer) : TPoint;
begin
result := worldToScreen(Round(x-SmartGetFieldInt(0,BaseX) + DX) * 128,
Round(y-SmartGetFieldInt(0,BaseY) + dy) * 128, height);
end;

function TileToMS(x,y,height : integer) : TPoint;
begin
result := TileToMSEx(x,y,0.5,0.5,height);
end;

function GetMyPos:TPoint;
var
me: Integer;
begin
me := SmartGetFieldObject(0, MyPlayer);
Result.x := SmartGetFieldInt(0, BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
Result.y := SmartGetFieldInt(0, BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
SmartFreeObject(me);
end;

var
p : TPoint;
begin
Smart_Members := false;
Smart_Server := 49;
Smart_Signed := true;
Smart_SuperDetail := false;
setupsrl;
p := GetMyPos;
p := TileToMS(p.x + 1,p.y - 1,0);
Writeln(p);
MMouse(p.x,p.y,5,5);

end.


I haven't really read much, but all we need is all of those hooked in an updater? I can try hooking them…


Anyone here want to add me on MSN so we can work on these together?

mastaraymond

2010-05-04 20:18:22

From: TRiLeZ
No, they are all up-to-date, the TileToMS method from the client agrees with RSBot and I.

For XOff, XX, XY, XZ, YOff, etc. are you doing: getToolkit().getViewport().__

And for all of the rest, are you doing getToolkit().__?

Edit: Fixed up mastaraymond's code:


program new;
{.LoadDLL libsmart}
{$define smart}
{$i srl/srl.scar}
const
Toolkit = 'bm.V';
Plane = 'cw.T';
GroundByteArray = 'tk.k';
TileData = 'ta.M';
TileHeights = 'r';
BaseX = 'ut.a';
BaseY = 'dq.N';

getAbsoluteX1 = 'L';
getAbsoluteX2 = 'B';
getAbsoluteY1 = 'y';
getAbsoluteY2 = 'nb';
getZNear = 'W';
getZFar = 'lb';
getXMultiplier = 'ab';
getYMultiplier = 'eb';
getViewport = 'z';

getXOff = 'u';
getXX = 't';
getXY = 'k';
getXZ = 'p';
getYOff = 'o';
getYX = 'r';
getYY = 's';
getYZ = 'm';
getZOff = 'l';
getZX = 'q';
getZY = 'j';
getZZ = 'n';

MyPlayer = 'cn.n';
Currenty = 'q';
Currentx = 'm';



function tilePlaneGetHeight(obj,xx,zz : integer) : integer;
var
x,z : integer;
i,j,k,l : integer;
begin
x := xx shr 7;
z := zz shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
result := 0
else
begin
i := x and (128 - 1);
j := z and (128 - 1);
k := SmartGetFieldArray2DInt(obj,tileheights,x,z) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z) * i) shr 7;
l := SmartGetFieldArray2DInt(obj,tileheights,x,z+1) * (128 - i) + (SmartGetFieldArray2DInt(obj,tileheights,x+1,z+1) * i) shr 7;
result := k * (128 - j) + (l * j) shr 7;
end;
end;


function GetTileHeight(xx,zz : integer) : integer;
var
p : integer;
x,z : integer;
obj : integer;

begin;
p := SmartGetFieldInt(0,Plane);
x := XX shr 7;
z := ZZ shr 7;
if ((x < 0) or (x>104) or (z < 0) or (z>104)) then
begin
result := 0;
exit;
end;
if ((p < 3) and ((SmartGetFieldArray3DByte(0,GroundByteArray,1,x,z) and 2) <> 0)) then
inc(p);
if SmartGetFieldArraySize(0,TileData) > p then
begin
obj := SmartGetFieldArrayObject(0,TileData,p);
result := tilePlaneGetHeight(obj,xx,zz);
SmartFreeObject(obj);
end;
end;

type
TRenderData = record
xOff,xX,xY,xZ : extended;
yOff,yX,yY,yZ : extended;
zOff,zX,zY,zZ : extended;
end;
TRender = record
absoluteX1,absoluteX2 : extended;
absoluteY1,absoluteY2 : extended;
xMultiplier,yMultiplier : integer;
zNear,zFar : integer;
end;

procedure UpdateRenderInfo(var Render : TRender; var RenderData : TRenderData);
var
tk, vp: Integer;
begin
tk := SmartGetFieldObject(0, Toolkit);
vp := SmartGetFieldObject(tk, getViewport);
with RenderData do
begin
xOff := SmartGetFieldInt(vp,getXOff);
xX :=SmartGetFieldInt(vp,getXX);
xY := SmartGetFieldInt(vp,getxY);
xZ := SmartGetFieldInt(vp,getxz);
yOff := SmartGetFieldInt(vp,getyoff);
yX := SmartGetFieldInt(vp,getyx);
yY :=SmartGetFieldInt(vp,getyy);
yZ := SmartGetFieldInt(vp,getyz);
zOff := SmartGetFieldInt(vp,getzoff);
zX := SmartGetFieldInt(vp,getzx);
zY := SmartGetFieldInt(vp,getzy);
zZ := SmartGetFieldInt(vp,getzz);
end;
with Render do
begin
absoluteX1 := SmartGetFieldInt(tk, getabsoluteX1);
absoluteX2 := SmartGetFieldInt(tk, getabsoluteX2);
absoluteY1 := SmartGetFieldInt(tk, getabsoluteY1);
absoluteY2 := SmartGetFieldInt(tk, getabsolutey2);
xMultiplier := SmartGetFieldInt(tk, getxmultiplier);
yMultiplier := SmartGetFieldInt(tk, getymultiplier);
zNear := SmartGetFieldInt(tk, getznear);
zFar := SmartGetFieldInt(tk, getzfar);
end;
SmartFreeObject(tk);
SmartFreeObject(vp);
end;

function w2s(x,y,z : integer) : TPoint;
var
RenderData : TRenderData;
Render : TRender;
_z,_x,_y : integer;
begin;
result := point(-1,-1);
with RenderData do
begin
xOff := 0; xX := 32768; xY := 0; xZ := 0;
yOff := 0; yX := 0; yY := 32768; yZ := 0;
zOff := 0; zX := 0; zY := 0; zZ := 32768;
end;
with Render do
begin
absoluteX1 := 0; absoluteX2 := 0;
absoluteY1 := 0; absoluteY2 := 0;
xMultiplier := 512; yMultiplier := 512;
zNear := 50; zFar := 3500;
end;
UpdateRenderInfo(render,renderdata);
Writeln(render);
Writeln(RenderData);
_z := Round(RenderData.zOff + (Round(RenderData.zX * x + RenderData.zY * y + RenderData.zZ * z) shr 15));
Writeln('_z: ' + IntToStr(_z));
if( (_z < Render.zNear) or (_z > Render.zFar) ) then
exit;
_x := Round(Render.xMultiplier * (RenderData.xOff + ( Round(RenderData.xX * x + RenderData.xY * y + RenderData.xZ * z) shr 15)) / _z);
_y := Round(Render.yMultiplier * (RenderData.yOff + ( Round(RenderData.yX * x + RenderData.yY * y + RenderData.yZ * z) shr 15)) / _z);
if ((_x >= Render.absoluteX1) and (_x <= Render.absoluteX2) and (_y >= Render.absoluteY1) and (_y <= Render.absoluteY2)) then
result := Point(Round(_x - Render.absoluteX1), Round(_y - Render.absoluteY1));
end;

function worldToScreen(x,z,height : integer) : TPoint;
var
y : integer;
begin
result := point(-1,-1);
if (x < 128) or (z < 128) or (x > 13056) or (z > 13056) then
exit;
Writeln('TileHeight: ' + IntToStr(GetTileHeight(x,z)));
y := -312 - height;
result := w2s(x,y,z);
end;


function TileToMSEx(x,y : integer; dx,dy : double; height : integer) : TPoint;
begin
result := worldToScreen(Round(x-SmartGetFieldInt(0,BaseX) + DX) * 128,
Round(y-SmartGetFieldInt(0,BaseY) + dy) * 128, height);
end;

function TileToMS(x,y,height : integer) : TPoint;
begin
result := TileToMSEx(x,y,0.5,0.5,height);
end;

function GetMyPos:TPoint;
var
me: Integer;
begin
me := SmartGetFieldObject(0, MyPlayer);
Result.x := SmartGetFieldInt(0, BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
Result.y := SmartGetFieldInt(0, BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
SmartFreeObject(me);
end;

var
p : TPoint;
begin
Smart_Members := false;
Smart_Server := 49;
Smart_Signed := true;
Smart_SuperDetail := false;
setupsrl;
p := GetMyPos;
p := TileToMS(p.x + 1,p.y - 1,0);
Writeln(p);
MMouse(p.x,p.y,5,5);

end.

Yay, it seems that it's indeed getting the renderdata now.. However it still fails at working.. :mad:

Camaro'

2010-05-04 20:23:42

From: mastaraymond
Yay, it seems that it's indeed getting the renderdata now.. However it still fails at working.. :mad:


Yeah, the GetTileHeight function is whats not working, I think TRiLeZ is working on it now, that's my assumption.

mastaraymond

2010-05-04 20:32:10

[QUOTE=Camaro';707539]Yeah, the GetTileHeight function is whats not working, I think TRiLeZ is working on it now, that's my assumption.
Hmm, I've tried it with tile heights ranging from 6000 to -6000 and none of them seemed to give a valid screen position.. So maybe the calculation is messed up somewhere? (Or there are some invalid hooks)

Camaro'

2010-05-04 20:35:04

From: mastaraymond
Hmm, I've tried it with tile heights ranging from 6000 to -6000 and none of them seemed to give a valid screen position.. So maybe the calculation is messed up somewhere? (Or there are some invalid hooks)


Whats that characters TileHeight according to RSBot?

Nevermind, -6k - 6k should probably cover the tile height :)


inb4fixbytrilez!

TRiLeZ

2010-05-04 20:54:11

AHHHHHHHHHHHHHHHHHHHH


I can't get getTileHeight working though… and worldToScreen (TileToMS) only works at a certain camera pos (maybe to do with getTileHeight not working.

This has only been done in TRiBot though.

Btw, TileToMS requires your local position, not global position.

Camaro'

2010-05-04 20:55:11

From: TRiLeZ
AHHHHHHHHHHHHHHHHHHHH


I can't get getTileHeight working though… and worldToScreen (TileToMS) only works at a certain camera pos (maybe to do with getTileHeight not working.

This has only been done in TRiBot though.

Btw, TileToMS requires your local position, not global position.


Well done!!!! High five!

mastaraymond

2010-05-04 21:01:01

From: TRiLeZ
AHHHHHHHHHHHHHHHHHHHH


I can't get getTileHeight working though… and worldToScreen (TileToMS) only works at a certain camera pos (maybe to do with getTileHeight not working.

This has only been done in TRiBot though.

Btw, TileToMS requires your local position, not global position.

Might be this line in Tileheight?

i := x and 128 - 1;
j := z and 128 - 1;
As this is how the math was in the client by Method, however in KBot the math looked like this

i := x and (128 - 1);
j := z and (128 - 1);
So.. Might wanne try both of these?

Oh and what exactly is the difference between local and global position?

TRiLeZ

2010-05-04 21:02:47

From: mastaraymond
Might be this line in Tileheight?

i := x and 128 - 1;
j := z and 128 - 1;
As this is how the math was in the client by Method, however in KBot the math looked like this

i := x and (128 - 1);
j := z and (128 - 1);
So.. Might wanne try both of these?

Oh and what exactly is the difference between local and global position?


I'm using RS's exact tile height method. I'm still trying to figure out where it goes wrong.

From: mastaraymond
Oh and what exactly is the difference between local and global position?

Your local position is the position that you are on in the map region. Global position is your global tile coordinate.

JPHamlett

2010-05-05 07:39:11

From: mastaraymond
Hmm, I've tried it with tile heights ranging from 6000 to -6000 and none of them seemed to give a valid screen position.. So maybe the calculation is messed up somewhere? (Or there are some invalid hooks)


tileheights should be somewhere around -300

TRiLeZ

2010-05-05 22:30:24

TileToMS completely fixed in TRiBot. Now I'm gonna convert it to pascal. :D:D:D:D:D:D:D:D:D:D

Thanks Method for helping me find RS's TileToMS function!

Coh3n

2010-05-05 22:49:42

From: TRiLeZ
TileToMS completely fixed in TRiBot. Now I'm gonna convert it to pascal. :D:D:D:D:D:D:D:D:D:D

Thanks Method for helping me find RS's TileToMS function!

Awesome! I'm sure it's going to be harder than it seems. :p

After TileToMS, is there anything else that's broken with regards to reflection?

Method

2010-05-05 22:55:33

Everything else that changed in Runetek5 probably needs to be fixed as well (item finding, object finding, menu items, etc.).

Coh3n

2010-05-05 23:43:04

From: Method
Everything else that changed in Runetek5 probably needs to be fixed as well (item finding, object finding, menu items, etc.).

Well then I'm just going to assume that those aren't has hard as TileToMS. :p

Method

2010-05-05 23:45:38

None of it was really hard to fix, but none of you guys really knew where to look in the client to find the new algorithms for things so the process became extremely elongated.

Coh3n

2010-05-05 23:48:33

From: Method
None of it was really hard to fix, but none of you guys really knew where to look in the client to find the new algorithms for things so the process became extremely elongated.

Not to mention the people like me who wouldn't even know to look in the client (or anywhere else for that matter). It would have been nice to help out with this, but I've been busy with lots of other stuff. :)

i luffs yeww

2010-05-05 23:53:37

;D Oh, Cohen. You've helped with so much stuff. Apffff. Don't even worry about this. :D

Coh3n

2010-05-05 23:59:39

From: i luffs yeww
;D Oh, Cohen. You've helped with so much stuff. Apffff. Don't even worry about this. :D

Haha I try. :p

Camaro'

2010-05-06 06:59:11

From: Method
Everything else that changed in Runetek5 probably needs to be fixed as well (item finding, object finding, menu items, etc.).


Well according to Timer, only a few things after TileToMs have to be fixed.

Baked0420

2010-05-06 07:35:29

a reflection dev should start a thread in the subforum Reflection Development telling us what's left that is broken so if anyone does know how to help they know what needs fixing. I'm pretty sure we don't have a thread yet on what's fixed and broke, but just listing the broken procedures/functions would be good enough.

g0tp0t

2010-05-06 07:54:33

this is a handy thread in the reflection section. they could post it here

Blumblebee

2010-05-06 16:14:09

[QUOTE=Camaro';707834]Well according to Timer, only a few things after TileToMs have to be fixed.[/QUOTE]

Timer has yet to prove anything he says as factual.

mastaraymond

2010-05-06 16:27:17

From: TRiLeZ
TileToMS completely fixed in TRiBot. Now I'm gonna convert it to pascal. :D:D:D:D:D:D:D:D:D:D

Thanks Method for helping me find RS's TileToMS function!

Yay! Please commit to the reflection SVN (+ update the hooks while your at it).

mormonman

2010-05-06 19:53:04

[QUOTE=Camaro';707834]Well according to Timer, only a few things after TileToMs have to be fixed.[/QUOTE]

Most of the "fixing" is just getting a stable updater that will have all of the hooks we need. I have looked through the include and lots of interfaces need to be changed, object finding is completely different, item finding needs to be changed, but I do believe I had npc's working at one point after the runetek5 update we just need to find all the hooks. I'm absolutely rubbish at finding patterns in the client, so I am of no use, sorry.