Results 1 to 2 of 2

Thread: Reflection Debugging

  1. #1
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default Reflection Debugging

    It's summer time and i'm itching to get back into scripting. I just finished setting up reflection for OSR. Is there a debugging mode to where i can see my coordinates or object/item id's?

    Like this?
    http://snag.gy/u6D4j.jpg

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

    Default

    Debugs NPCs and main objects

    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 = false;
      debugObjects = false;
      debugGroundObjects = true;

    procedure drawDebug;
    var
      p, pt:TPoint;
      npcs:TNPCArray;
      objects:TRSObjectArray;
      items:TGroundItemArray;
      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;
      if (debugGroundObjects) then
        items := R_GetGroundItemsDistance(12);
      writeln(items);
      for k := 0 to high(items) do
      begin
        pt := R_TileToMs(items[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, pt.y - 25, 'statchars07', toStr(items[k].ID), 65280);
          SMART_DrawCircle(false, pt, 1, false, 254);
        end;
      end;
    end;
    begin
      setupsrl;
      SetupReflection;
      repeat
        drawDebug;
        wait(300);
      until false;
    end.





    The only problem is if there is more than 1 ground item in a spot it kind draws the IDs over it CBa to correct it (because smart drawing it sort of slow so everything blinks)


    Also don't set all of them to true at once

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
  •