SRL Archive - Reflection Help

Ref Debugger


Smarter Child

2011-06-19 12:53:53

Anyone got a reflection debugger that works with simba?

i luffs yeww

2011-06-19 14:52:26

Reflection has a good chunk of debugging methods itself.

Baked0420

2011-06-19 22:40:23

you can also easily make your own for whatever specific thing you want debugged. Like:

if(IsFKeyDown(2))then
WriteTileData;

and WriteTileData; would display the x and y for the tile that you are either on or hovering your mouse over, if you wanted a path creator. Just something to that effect.

EDIT: sorry not IsFKeyDown(2) because that ends scripts in Simba, but you should know what I mean by my example ;)

Gu3st...

2011-06-19 23:40:36

What kind of debugger are you looking for?

Smarter Child

2011-06-20 17:51:56

Debug object Id's and tiles, although I do remember seeing an all in one sort of Ref debugger.

Yago

2011-06-20 20:15:33

Check out refpaint in the reflection include

http://villavu.com/forum/showthread.php?t=60481&highlight=refpaint

Gu3st...

2011-06-21 08:13:46

From: Yago
Check out refpaint in the reflection include

http://villavu.com/forum/showthread.php?t=60481&highlight=refpaint
Refpaint is heavily outdated and I've found it to be pretty unuseable.

PaintSmart.scar in the SRL include on the other hand is more useful, of which you can use to create your own RefPaint

masterBB

2011-06-21 08:34:51

From: Smarter Child
Debug object Id's and tiles, although I do remember seeing an all in one sort of Ref debugger.


I will make one those tomorrow.

Gu3st...

2011-06-21 08:55:58

Here's something I made in ~10 minutes.. edit it to fit your needs
program ReflectionDebugger;
{$DEFINE SMART}
{$i SRL/SRL.scar}
{$i SRL/SRL/Misc/paintsmart.scar}
{$i Reflection/Reflection.simba}
{$i Reflection/Core/RefPaint.simba}

var
MyTile, t : TTile;
NPCArr : TNPCArray;
PlayerArr : TPlayerArray;
ObjArr : TRSObjectArray;
X, Y, h, i : Integer;

//EDited r_drawline.
procedure Z_R_DrawLine(Clear: Boolean; TP1, TP2: TPoint; Color: TColor);
{$IFDEF SMART}
var
drawing : TBitmap;
begin

drawing := TBitmap.Create;
drawing.canvas.handle := SmartGetDebugDC;
drawing.canvas.Pen.Color := color;

if Clear then ClearRSCanvas(drawing.canvas);

if (TP1.x < 14) and (TP1.y < 14) then exit;
if (TP2.x < 14) and (TP2.y < 14) then exit;
drawing.canvas.moveto(TP1.x,TP1.y);
drawing.canvas.LineTo(TP2.x,TP2.y);


try
FreeBitmap(drawing);
except end;

{$ELSE}
begin
{$ENDIF}

end;

procedure Z_R_DrawTileEx(Tile : TTile; Height : Integer; Color : TColor; Clear : Boolean);
var
TileBox : array [0..3] of TPoint;
I : Integer;
begin
if not TileOnMS(Tile, Height) or not R_LoggedIn then
Exit;
TileBox[0] := TileToMSEx(Tile, 1.0, 0.0, Height);
TileBox[1] := TileToMSEx(Tile, 1.0, 1.0, Height);
TileBox[2] := TileToMSEx(Tile, 0.0, 1.0, Height);
TileBox[3] := TileToMSEx(Tile, 0.0, 0.0, Height);
for I := 0 to 2 do
if (TileBox[I].X < 14) and (TileBox[I].Y < 14) then Continue
else if (TileBox[I+1].X < 14) and (TileBox[I+1].Y < 14) then Continue
else z_R_DrawLine(Clear, TileBox[I], TileBox[I+1], Color);
z_R_DrawLine(Clear, TileBox[3], TileBox[0], Color);
end;

procedure Z_R_DrawTile(Tile : TTile; Color : TColor; Clear : Boolean);
begin
Z_R_DrawTileEx(Tile, 0, Color, Clear);
end;

begin
SMART_SERVER := 1;
SMART_SIGNED := True;
SetupSRL;
SetupReflection;
WriteLn('Start!');
while True do
begin
MyTile := GetMyPos;
ClearSmartCanvas;

Z_R_DrawTile(MyTile, clBlue, False);

for X := MyTile.X-6 to MyTile.X+6 do
for Y := MyTile.Y-6 to MyTile.Y+6 do
begin
if TileOnMS(Tile(X, Y), 0) then
Z_R_DrawTile(Tile(X, Y), clRed, False);
end;

Z_R_DrawTile(MyTile, clBlue, False);

NPCArr := GetNPCs('Banker');
h := high(NPCArr);
for I := 0 to h do
Z_R_DrawTile(NPCArr[I].Tile, clLime, False);

ObjArr := GetAllObjects(0);
h := high(objarr);
for i := 0 to h do
begin
Z_r_drawtile(objarr[i].tile, clpurple, false);
t := TileToMS(objarr[i].tile, 50);
SMART_DrawText(t.x, t.y, CharsNPC, tostr(objarr[i].ID), clRed);
end;

PlayerArr := GetAllPlayers;
h := high(playerarr);
for I := 0 to h do
Z_R_DrawTile(PlayerArr[I].Tile, clYellow, False);
end;
end.

Smarter Child

2011-06-22 18:14:29

Are the hooks outdated, because I get Field not found

KingKong

2011-06-22 18:18:55

Yes, I think so.