SRL Archive - Reflection Help

R_Inventory help needed.


fre

2011-08-03 20:43:13

Hey all, me again :p

[php]
procedure GetItemId;
var
item: TInvItem;
begin
item := R_GetInvItemAt(1);
writeln(item.id);
end;
[/php]

as a result i get -1…
ofc i have something in my firs slot :p
The same ting with item.name
what am i doing wrong?



Edit:

I logged out and back in and now it does return the right id and name…
weird???

Jakkle

2011-08-03 21:04:07

just do Writeln(R_GetInvItemAt(1))
You will get something like this
(557, 86, 1, 'Earth rune', ['Drop', 'Examine'])
^this is the id(557)

Flight

2011-08-03 21:07:49

Item slots are arrays, and all arrays begin with 0. So it would make sense that your first item slot would be "R_GetInvItemAt(0); ". Try that and see if it works.

fre

2011-08-03 21:14:00

I used the exact same procedure and it worked after i re-loggedIn.
But i have another issue sometimes smart won't start when i start a script.
When i stop the script and restart it, simba closes.
I need to reopen and restart the script multiple times before it works.
It may be a SMART issue.

Jakkle

2011-08-03 21:29:20

Or maybe a simba issue.