SRL Archive - Reflection Development

Welcome Object Recognition!


n3ss3s

2008-07-23 04:05:05

I still have to finish the actual finder, but here are the functions it'll use -

Const
getGroundArray = 'g.fb';

getObject1 = 'o';
getObject2 = 'q';
getObject3 = 'r';
getObject4 = 's';

getObject5Array = 'H';




Function GetUIDAt(tX, tY: Integer): Integer;

Var
X, Y, Z, I, UID, o5a, C, Q: Integer;
getObj: TStringArray;
Begin
X := tX - SmartGetFieldInt(0, BaseX);
Y := tY - SmartGetFieldInt(0, BaseY);
For Q := 0 To 3 Do
Begin
Z := SmartGetFieldArray3DObject(0, getGroundArray, Q, X, Y);
If Z = 0 Then Continue;
getObj := [getObject1, getObject2, getObject3, getObject4, getObject5Array];
For I := 0 To 4 Do
If I < 4 Then
Begin
UID := SmartGetFieldObject(Z, getObj[i]);
If UID > 0 Then
Begin
Result := UID;
SmartFreeObject(UID);
Exit;
End;
End Else
Begin
o5a := SmartGetFieldObject(Z, getObj[i]);
For C := 0 To SmartGetFieldArraySize(o5a, '') - 1 Do
Begin
UID := SmartGetFieldArrayObject(o5a, '', C);
If UID > 0 Then
Begin
Result := UID;
SmartFreeObject(o5a);
SmartFreeObject(UID);
Exit;
End;
End;
End;
End;
End;


Function GetObjectType(UID: Integer): Integer; // Ben's math.

Begin
Result := (UID shr 14) and $7fff;
End;



Type of an object stays always the same and UID changes, so for the finder when it finishes you're going to input the Type.


Thanks to Ben for his UID to Type algorithm and Yakman for teaching about the groundArray :)


Finder is done too, I'll just mess around a bit before releasing it.

Naike

2008-07-23 07:00:00

Explain what this is doing? xD
I get that this is reflection stuff, That i have no idea off.

mastaraymond

2008-07-23 07:11:02

What the ***? I swear I just saw this topic with lots more replies…
And I replied with: "Get proper standards". ^^

Santa_Clause

2008-07-23 07:25:11

Probably in the Developers section…

By the way, I think this requires some stuff that has been released to Developers only?

MylesMadness

2008-07-23 08:00:33

From: Santa_Clause
Probably in the Developers section…

By the way, I think this requires some stuff that has been released to Developers only?
Check out srl-development in srl members

n3ss3s

2008-07-23 09:37:43

If you have Hooks.scar (updated one, don't know if Widget updated the SRL Development file), and the constants in the script above, that's all you need.

Explain what this is doing? xD
I get that this is reflection stuff, That i have no idea off.


It knows where an object is.

BenLand100

2008-07-23 10:08:42

Hmm, I didn't catch this in the pm, but I noticed a few problems:
First, Z *must* be freed or eventually you will run out of memory.
Second, the UID is of type int in the client correct? Currently you are returning an Integer reference (which is not the value of the uid) which might be the reason the other algorithms for types aren't working. What you need to do is use:
function SmartGetFieldInt(parent: integer; path: String): integer;
function SmartGetFieldArrayInt(parent: integer; path: String; index: integer): integer;
What through you off was that all of them (for the most part) return integers, but the integer returned by an "Object" method is a memory address in the jvm of a java object.

Edit: Also, it is *very important* to free objects returned by methods with the name Object in them. Otherwise, you are creating massive memory leaks.

n3ss3s

2008-07-23 10:12:53

I commented out the freeing in the above code because some of them caused SCAR to close.

It 'works' at the moment, it finds a number and your converting algorithm returned a number too, but I can't be sure if those numbers are 'correct'.

I'll see later if switching to an Int from Object makes any difference in what they return…

Wanted

2008-07-23 10:35:13

Anything in runescape that does not ever move (which includes most objects) does not need anything more than TileToMS.

However object finding can be useful for finding say - arrows on the ground dropped by your ranger or bones ect.. ect..

Bank booths/ doors/ all have a tile that you can use (For doors use the midpoint equation and use the tiles infront of and behind the door) on TileToMS with some MMouse with offset/ randomness/ uptext check ect. ect..

Very useful, I hope to see types and UIDS fully working soon.

Nice work.

-IceFire

BenLand100

2008-07-24 23:41:12

From: n3ss3s
I commented out the freeing in the above code because some of them caused SCAR to close.

It 'works' at the moment, it finds a number and your converting algorithm returned a number too, but I can't be sure if those numbers are 'correct'.

I'll see later if switching to an Int from Object makes any difference in what they return…

n3ss3s, I am 100% positive that the results will be different and at the moment it is wrong.

n3ss3s

2008-07-25 04:07:37

Oh my god I forgot to post, - report:

a) Freeing Z resulted SCAR and SMART to close.
b) Using int didn't find any ints pl0z, but object did.

Updated the non-crashing one up there. I also have the finder but it needs some tweaking.

Hm, I think that the GetUIDAt might return different things from same tile sometimes, the type it got from the BH rogue scoreboard tile changed after I ran it a few times?

StrikerX

2008-07-25 06:30:28

Great i get none of it…..Mind explaining?

TheGuyWhoGotOn

2008-07-25 15:59:55

From: n3ss3s
Oh my god I forgot to post, - report:

a) Freeing Z resulted SCAR and SMART to close.
b) Using int didn't find any ints pl0z, but object did.

Updated the non-crashing one up there. I also have the finder but it needs some tweaking.

Hm, I think that the GetUIDAt might return different things from same tile sometimes, the type it got from the BH rogue scoreboard tile changed after I ran it a few times?


So what you have posted…Is it working properly? Should I put it in Reflection.scar or does it still need some tweaking? If what you have works that's awesome! If not…Get back to work :p!

n3ss3s

2008-07-26 02:54:49

Don't put it in yet, I'm waiting for Ben's reply.

ShowerThoughts

2008-08-01 11:09:27

Does this works or not?

n3ss3s

2008-08-01 11:46:37

No.