SRL Archive - OSR Help

[Reflection] Tree Objects


Tonekray

2014-05-17 18:20:39

Hey guys,

I just recently got back into the whole runescape fad for the summer, so I'm trying my hand at scripting again. I've done a few small things so far, but for the life of me, I cannot seem to detect any trees using reflection.

Painting R_GetAllObjects doesn't seem to pick up any trees.

I took at look at some reflection yew cutter, and it was making use of R_GetObjectAt with tiles, so I tried that as well, but I'm just not getting anything. I can pick up ground tiles, but it's like the trees don't exist.

Does anyone have any ideas? This is the code I'm using to find things.

procedure findTreeID();
var
i: integer;
trees: TRSObjectArray;
treePos: TPoint;
begin
trees := R_GetObjectsDistance( 0, 10 );

writeln( length( trees ) );

for i := 0 to high( trees ) do begin
treePos := R_TileToMS( trees[ i ].Tile );

if ( treePos.x > 0 ) then begin
SMART_DrawDot( false, treePos, clYellow );
SMART_DrawText( treePos.x, treePos.y, 'UpChars', inttostr( trees[ i ].ID ), clGreen );
end;
end;
end;

Hoodz

2014-05-17 19:03:52

First: maybe your first param is incorrect
trees := R_GetObjectsDistance( 0, 10 ); the 0 could be 0, 1, 2, 3 i believe. So debug them
Second: if you want to draw on the actual tree then you need to covert the tile where you find the tree to a mainscreenpoint. MS_Point := R_TileToMS(TreeTile); (MS_Point: TPoint;)
I dont know how many dots its drawing around there (might be one which is hard to see) so you might want to draw a box or circle at MS_Point

rj

2014-05-17 19:34:15

For debugging you can try this:

program R_Test;

{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}

const
debugNPC = true;
debugObjects = false;

procedure drawDebug;
var
p, pt:TPoint;
npcs:TNPCArray;
objects:TRSObjectArray;
i, k:integer;
begin
p := R_GetTileGlobal();
if (debugNPC) then
npcs := R_GetAllNPCs();
SMART_ClearCanvas;
SMART_DrawText(5, 5, 'statchars07', 'Tile: ' + toStr(p.x) + ',' + toStR(p.y), 65280);
for i := 0 to high(npcs) do
begin
pt := R_TileToMs(npcs[i].tile);
if ((pt.x - 5) > 0) and ((pt.x - 5) < 515) and ((pt.y - 25) > 0) and ((pt.y - 25) < 337) then
begin
SMART_DrawText(pt.x - 5, pt.y - 25, 'statchars07', toStr(npcs[i].NpcID), 65280);
SMART_DrawCircle(false, pt, 1, false, 254);
end;
end;
if (debugObjects) then
objects := R_GetObjectsDistance(0, 12);
for k := 0 to high(objects) do
begin
pt := R_TileToMs(objects[k].tile);
if ((pt.x - 5) > 0) and ((pt.x - 5) < 515) and ((pt.y - 25) > 0) and ((pt.y - 25) < 337) then
begin
SMART_DrawText(pt.x - 5, pt.y - 25, 'statchars07', toStr(objects[k].ID), 65280);
SMART_DrawCircle(false, pt, 1, false, 254);
end;
end;
end;
begin
setupsrl;
SetupReflection;
repeat
drawDebug;
wait(300);
until false;
end.


Also the object type for trees is indeed 0

Tonekray

2014-05-17 20:42:59

Robert, with your code, I still find nothing.

The reflection just isn't returning anything under OBJ_GAME(0). It isn't just trees; nothing appears to be categorized under OBJ_GAME.

rj

2014-05-17 20:54:18

From: Tonekray
Robert, with your code, I still find nothing.

The reflection just isn't returning anything under OBJ_GAME(0). It isn't just trees; nothing appears to be categorized under OBJ_GAME.


that hook might be broken, but I have no idea since I don't use OSR-reflection

ineedbot

2014-05-17 21:58:06

Yes. I did some testing. I bet the hook is broken and needs an update.

Tonekray

2014-05-18 12:56:32

Bummer. I guess I'll just use color finding for now. Thanks guys.