SRL Archive - Reflection Help

Error: Out Of Range at line 75


Feroc1ty

2010-12-12 18:24:58

{*******************************************************************************
function GetMenuText: TStringArray;
By: BenLand100
Description: Dumps the data from the MenuNodeList into a TStringArray
*******************************************************************************}
function GetMenuText: TStringArray;
var
count, nodeList, head, next, last, javaString: Integer;
item: string;
begin
nodeList:= SmartGetFieldObject(0, hook_static_MenuNodeList);
head:= SmartGetFieldObject(nodeList, hook_nodelist_Head);
//for some reason, the head has null strings, so skip it

// ERROR ON THIS LINE
next:= SmartGetFieldObject(head, hook_node_Next);


count:= GetMenuCount;
SetLength(result,count);
repeat
javaString:= SmartGetFieldObject(next, hook_menu_Action);
item:= GetJavaString(javaString,256);
SmartFreeObject(javaString);
javaString:= SmartGetFieldObject(next, hook_menu_Option);
item:= item + ' ' + GetJavaString(javaString,256);
SmartFreeObject(javaString);
result[count-1]:= TrimHTML(item);
last:= next;
next:= SmartGetFieldObject(last, hook_node_Next);
SmartFreeObject(last);
count:= count - 1;
until (count = 0);
SmartFreeObject(next);
SmartFreeObject(head);
SmartFreeObject(nodeList);
end;

The error happens only once in a while, and it started happening only after I placed R_IsUpText into a function

Bad Boy JH

2010-12-12 22:03:37

its what happns if you don't have any up text, including Walk Here

Feroc1ty

2010-12-12 22:39:26

Well that's annoying…

3Garrett3

2010-12-12 22:42:11

Add a try, except to your script. Or use normal uptext checks?

Last I checked they still worked pretty well, so I dunno why they wont work.

lordsaturn

2010-12-13 00:34:53

try except doesnt work. because the error occurs inside smart.