SRL Archive - OSR Help

Reflection Debugging


jman1208

2014-05-19 11:14:49

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

rj

2014-05-19 15:34:25

Debugs NPCs and main objects

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