Results 1 to 7 of 7

Thread: [Reflection] Tree Objects

  1. #1
    Join Date
    Sep 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default [Reflection] Tree Objects

    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.

    Code:
    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;

  2. #2
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    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

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    For debugging you can try this:

    Simba Code:
    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

  4. #4
    Join Date
    Sep 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    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.

  5. #5
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Tonekray View Post
    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

  6. #6
    Join Date
    Aug 2007
    Posts
    539
    Mentioned
    20 Post(s)
    Quoted
    266 Post(s)

    Default

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

  7. #7
    Join Date
    Sep 2006
    Posts
    45
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •