SRL Archive - S.M.A.R.T. Questions and Answers.

Reflection - working with 2d object arrays


Shatterhand

2014-10-06 13:07:06

Hi. I am trying to make a debug procedure which would list all the widgets in a hierarchical order.

Example
widget[429][1] name= text=Friends List - World 310
widget[429][2] name= text= quantity=0
widget[429][2][0] name= text=

What I have so far, is not working.
procedure DebugWidgets;
var
WidgetPointer, Pointer, Size1, Size2, i, j : Integer;
begin
Size1 := SmartGetFieldArraySize(SmartCurrentTarget, 0, hook_client_widgets, 0);
Writeln(IntToStr(Size1)); //output: 594

for i:=0 to Size1 do
begin
Pointer := SmartGetFieldArrayObject(SmartCurrentTarget, 0, hook_client_widgets, i);
Size2 := SmartGetFieldArraySize(SmartCurrentTarget, Pointer, '', 0); //Error: Exception: Access violation at line 968
Writeln(IntToStr(Size2));


//for j:=0 to Size2 do
//begin
//WidgetPointer := SmartGetFieldArray2DObject(SmartCurrentTarget, 0, hook_client_widgets, i, j);

//WRITELN PART AND GETTING SUBCHILDREN

//end;

end;
end;

I have done this in my own java client, I am not sure I could do it with SMART's limited functions too.

Help is much appreciated. :)

Hoodz

2014-10-06 13:49:45

tbh i have no idea. but i found out:

Size2 := SmartGetFieldArraySize(SmartCurrentTarget, Pointer, '', 0);

if you add something to the empty string it wont give you the access violation error

Shatterhand

2014-10-06 14:45:14

From: hoodz
tbh i have no idea. but i found out:

Size2 := SmartGetFieldArraySize(SmartCurrentTarget, Pointer, '', 0);

if you add something to the empty string it wont give you the access violation error

Yeah well its not possible to get sizes of a 2d array with SMART functions.

I solved the problems by looking for pointers not equal 0.

tls

2014-10-06 15:38:15

Smartisnull is better than zero pointers.

Shatterhand

2014-10-06 16:23:36

From: tls
Smartisnull is better than zero pointers.

Whats the difference?

In what case does it give different result?

tls

2014-10-06 17:04:26

From: Shatterhand
Whats the difference?

In what case does it give different result?


If the pointer goes out of scope in the game, SmartIsNull will notify you of that.