SRL Archive - Reflection Development

R_CountItemsExcept


3Garrett3

2010-06-11 21:21:48

Basically counts the items except the ids specified. I needed this for my fishing script and figured it might be useful.


Function R_CountItemsExceptEx(IDs : TIntegerArray) : Integer;
Var
i : Integer;
Begin
Result := 0;
For i := 1 To 28 Do
If Not (InIntArray(IDs, GetItemIDAt(i))) Then
Inc(Result);
End;

and


Function R_CountItemsExcept(ID : Integer) : Integer;
Begin
Result := R_CountItemsExceptEx([ID]);
End;

i luffs yeww

2010-06-12 02:13:47

R_CountItemsExcept

Shouldn't it be R_CountItemExcept? You have it call for an Integer, not a TIntegerArray.

fre

2010-06-12 06:42:06

From: i luffs yeww
R_CountItemsExcept

Shouldn't it be R_CountItemExcept? You have it call for an Integer, not a TIntegerArray.


Not rly, since you count how many itemS are in your inventory,
without the item specified.

Your result is an integer (how many itemS are left)
Not what items ( id array)

Drakan

2010-06-12 07:40:32

I like it, but what you should do is follow the standard of the include and make a R_CountItemsExceptEx and have that input a TIntegerArray, then R_CountItemsExcept be a sub function of that. Good work :)

3Garrett3

2010-06-12 08:52:00

From: i luffs yeww
R_CountItemsExcept

Shouldn't it be R_CountItemExcept? You have it call for an Integer, not a TIntegerArray.


From: fre
Not rly, since you count how many itemS are in your inventory,
without the item specified.

Your result is an integer (how many itemS are left)
Not what items ( id array)


This ^^. There is often more than one item with the same id. A singular could still result in up to 28 items being found :)

From: drags111
I like it, but what you should do is follow the standard of the include and make a R_CountItemsExceptEx and have that input a TIntegerArray, then R_CountItemsExcept be a sub function of that. Good work :)


That was what I attempted to do? My top function is R_CountItemsExceptEx (used TIntegerArray) and the second one was R_CountItemsExept and used the Integer, and just went "R_CountItemsExceptEx([ID])" like I've seen in the include frequently.

Drakan

2010-06-13 10:08:28

I must have missed that when I replied haha. Sorry :)

3Garrett3

2010-06-13 11:15:20

No worries :)