SRL Archive - OSR Help

InvCount?


jman1208

2012-10-17 15:00:59

I'm making a script that buys X items from a store depending on how much free space is in the inventory. So right now I manulay put how much inventory space I have free so
TypeSend(26);
.

I just need to know a function that will input the output of
(28 - Totalcount) 
this gives how much it needs to buy based on free space.

tehq

2012-10-17 15:05:49

program Count;
{$DEFINE SMART}
{$i SRL/srl.simba}

Function InventoryFree: integer;
begin
Result := (28 - InvCount);
Writeln(Result);
end;

begin
TypeSend(IntToStr(InventoryFree));
end.

Nebula

2012-10-17 15:07:23

What you have posted would work with a few changes.

Invcount returns how many inventory slots are filled, so the amount of free spaces would be 28-invcount. That would be an integer, and TypeSend requires a string. So your final piece of code should look like this:


TypeSend(ToStr(28 - Invcount));

jman1208

2012-10-17 15:15:36

From: Nebula
What you have posted would work with a few changes.

Invcount returns how many inventory slots are filled, so the amount of free spaces would be 28-invcount. That would be an integer, and TypeSend requires a string. So your final piece of code should look like this:


TypeSend(ToStr(28 - Invcount));


Thank you! I actually figured it out right before you posted.