SRL Archive - Reflection Development

DebugItemIDs


Bad Boy JH

2010-12-03 09:26:36

This little thing gathers debugs all the Objects on the screen and shows their IDs on the SMART client. Not sure if this should go here or somewhere else, perhaps a special section for script development tools would be a good idea.

procedure DebugItemIDs(ObjType: Integer);
var
I, X, Y, height: integer;
Temp, tpa: tpointarray;
MyPos: TTile;
TheObject: TRSObject;
ScreenPoint: TPoint;
begin
MyPos := GetMyPos;
for X := MyPos.x - 10 to MyPos.x + 10 do
for Y := MyPos.y - 10 to MyPos.y + 10 do
if TileOnMS(Tile(X, Y), 0) then
begin
ScreenPoint := TileToMS(Tile(X, Y), 0);
TheObject := GetObjectAt(Tile(X, Y), ObjType);
if TheObject = NULL_RSObject then
Continue;
Temp := LoadTextTPA('. ' + IntToStr(TheObject.ID), UpChars, height);
for i:= 0 to High(temp) do
begin
Temp[i].x := Temp[i].x + ScreenPoint.x - Height;
Temp[i].y := Temp[i].y + ScreenPoint.y - Height;
end;
TPA := CombineTPA(TPA, Temp);
end;
SMART_DrawDots(TPA);
end;

BraK

2010-12-03 09:50:14

Nice piece of code your have there I'll try it out later on one of my Quest Scripts that are in progress.

~BraK

Bad Boy JH

2010-12-03 19:56:18

I tried GetAllItems, and then check all of those items to see if they were on screen, but it was slower, (15-35 seconds compared to <5 seconds)

Cstrike

2010-12-03 20:07:30

DebugObjectID's or DebugItemID's? Item would mean mainly inventory AFAIK

You could even do
for i:=0 to 3 do
TheObject := GetObjectAt(Tile(X, Y), i);
and get rid of the type all together if you wanted
Though of course the client would pick up so much crap that way :X

Bad Boy JH

2010-12-03 20:16:45

I could, but what if two items are on the same tile, I might use "for 3 downto 0 do" however I personally don't like the idea.

Troll

2010-12-04 12:19:45

Looks good, but im a noob(whats new?) so am i forgeting to included something or just not upto date.
i get the error

[Error] (54:3): Unknown identifier 'SMART_DrawDots' at line 53
and i have this inclueded

{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}

Cstrike

2010-12-04 13:50:26

From: Troll Man
Looks good, but im a noob(whats new?) so am i forgeting to included something or just not upto date.
i get the error

[Error] (54:3): Unknown identifier 'SMART_DrawDots' at line 53
and i have this inclueded

{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}


Ah, need to include
{$i srl/srl/misc/paintsmart.scar}

that should be it ;)

EDIT: BadBoyJH, great function, going to create a new folder for things like this.

Troll

2010-12-04 14:08:08

Ok thanks, silly me not inclueding the paint in a paint function :p
Like trying to paint with out a brush

Cstrike

2010-12-04 15:46:37

I just made new functions, check the Misc folder when I update

EDIT: Renamed functions to reflect their purpose, and modified them to deal with the new PaintCore.simba

EDIT2: Will enter repository in a few days with other major updates