SRL Archive - Reflection Help

Access violation in R_GetAllNPCs


Bixby Sayz

2011-10-14 19:07:56

This is a new setup on a new machine, so I can't help but wonder if it is just my setup, or this is a legit error?

Running this script I get an access violation when calling R_GetAllNPCs.
program new;

{$i srl\srl\misc\smart.scar}
{$i srl\srl.scar}
{$i reflection\reflection.simba}

var
Npcs: TNPCArray;
HiNpcs: integer;
I: integer;

begin
ClearDebug;
ClearReport;

Smart_Server := 152;
Smart_Members := FALSE;
Smart_Signed := TRUE;
Smart_SuperDetail := FALSE;
SetupReflection;

if not R_LoggedIn then
begin
writeln('Not logged in.');
exit;
end;

Npcs := R_GetAllNPCs(FALSE);
HiNpcs := High(Npcs);
writeln(Format('%d npcs found.', [(HiNpcs +1)]));

if (HiNpcs < 0) then
exit;

for I := 0 to HiNpcs do
writeln(Format('Npc id %d (%s) at tile (%d,%d). Distance: %d.', [Npcs[I].Tile.X, Npcs[I].Tile.Y, Npcs[I].Name, R_DistanceFromTile(Npcs[I].Tile)]));

end.
SRL Compiled in 10 msec
SMART Initialized.
Loaded: Server 152, Members: False, Signed: True, Super Detail: False.
Reflection Compiled in 731 msec
Error: Exception: Access violation at line 87
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]

Actually the error is in R_GetNPCActionArray.
    temp := SmartGetFieldArrayString(NPCDef, hook_npcdef_Actions, i);

Harry

2011-10-14 19:18:00

Does no one read my thread in the main public scripts forum??

fre

2011-10-14 19:27:16

I was looking for your thread.
But i couldn't find it.
Perhaps ppl don't expect the script in that section.

Harry

2011-10-14 19:34:32

It's in main public script section. Hard to miss imo..

Yago

2011-10-14 20:09:53

From: Harry
Hard to miss imo..


Its all the way at the bottom…

Bixby Sayz

2011-10-14 20:39:50

From: Harry
Does no one read my thread in the main public scripts forum??

Actually I did read your thread. It is not so obvious that "scripts crash over time" is the same thing as a script crashes on a specific routine every time.