Log in

View Full Version : TInvenItem uses



EtherFreak
04-07-2011, 04:45 AM
So I came across this cool thing in inventory.

GetInven(integer);

but I am unsure of how to work it to my will. I would like to take the value it gives me and perhapse excract a piece, or compare it to something. but all I can seem to do is colect it, store it, and compare colected to stored. For example:


var
IT:TInvenItem;
begin
IT:=GetInven(1);
writeln(IT(1)); //this is not valid :(
writeln(IT)
IT:=(20, 14, 62, (695, 438, 715, 452), (705, 444), 1); //this is not valid :(
writeln(IT);
end;


How can I input the data (20, 14, 62, (695, 438, 715, 452), (705, 444), 1) into a simple variable? how can I extract pieces from this data.

If there is a tutorial for this, I will apologize, I could not find it.

Sex
04-07-2011, 04:54 AM
Wtf. I could not get one word you were saying. Um, is this in Reflection or something? Can you post the include file that this type TInvenItem is found in?

Brandon
04-07-2011, 04:56 AM
SRL/SRL/core/Inventory.scar



program new;
{$i SRL/SRL/Core/Inventory.scar}

var
i:Integer;
p: TInvenItem;
begin
p:= GetInven(i);

p.CenterPoint;
p.Count
p.ExistsItem
p.Height
p.ItemBox
p.Width
end.


Do something like that... its just a quick write up.. next time u can just look at the include itself and it tells u the results...

Now store those values in an array and whala..

Yeah Yeah I know.. im missing writeln and stuff but im just showing the usage..

Sex
04-07-2011, 05:00 AM
I'll write something up right now.

In the mean time, check this (http://villavu.com/forum/showthread.php?t=47780&highlight=ultimate+type+tutorial) out.

Edit:

program new;
{$include SRL/SRL.scar}
var
Item : TInvenItem;
begin
SetupSRL;
Item := GetInven(1);
Writeln(Format('Item Slot: %d', [1]));
Writeln('ExistsItem: ' + ToStr(Item.ExistsItem));
if not Item.ExistsItem then
exit;
Writeln(Format('Width: %d, Height: %d', [Item.Width, Item.Height]));
Writeln(Format('ItemBox: (x1=%d,y1=%d,x2=%d,y2=%d)', [Item.ItemBox.x1, Item.ItemBox.y1, Item.ItemBox.x2, Item.ItemBox.y2]));
Writeln(Format('CenterPoint: (%d, %d)', [Item.CenterPoint.x, Item.CenterPoint.y]));
end.
TInvenItem is a record.

EtherFreak
04-07-2011, 06:35 AM
p.CenterPoint;
p.Count
p.ExistsItem
p.Height
p.ItemBox
p.Width

This is the key, I have been working with matlab too much lately. I have grown use to the old IT(1) stuff. Guess I completely forgot about the .somthing stuff.

thanks

bg5
11-24-2011, 04:06 PM
I have problem with it:

program new;
var
InvPos : array[1..28] of TInvenItem;
begin
end.


Compiling failed.
[Error] (4:11): Unknown type 'TInvenItem' at line 3

marpis
11-24-2011, 05:01 PM
I have problem with it:

program new;
var
InvPos : array[1..28] of TInvenItem;
begin
end.


Compiling failed.
[Error] (4:11): Unknown type 'TInvenItem' at line 3

Always remember to include SRL.

program new;
{.include srl/srl.scar}

begin
end.