SRL Archive - SRL Archives

DropAllEx(Skip: TIntegerArray);


Rick

2009-09-11 03:41:10

I wanted to drop all items except a few, and noticed there wasn't a procedure made for that. You can use DropArray but I thought this is quicker.
It can probably be improved. Would anyone use this?


{*******************************************************************************
procedure DropAllEx(Skip: TIntegerArray);
By: r!ch!e
Description: Drops all items in inventory except values of Skip.
*******************************************************************************}
procedure DropAllEx(Skip: TIntegerArray);
var
i: Integer;
begin
for i := 1 to 28 do
if not InIntArray(Skip, i) then
DropItem(i);
end;

noidea

2009-09-11 03:42:53


for i := 0 to 28 do
if not InIntArray(Skip, i) then
drop(i);
Looks cleaner imo
Anyways
there was one of these already made

Rick

2009-09-11 03:49:38

Yeah, that does look a lot cleaner. Thanks.
Do you mind pointing out what it is for future reference?

Sandstorm

2009-09-11 03:58:24

*chuckles* I made one of these a few years (*cough* one *cough*) back :P.

http://www.villavu.com/forum/showthread.php?t=37862&highlight=DropAllExcept

~Sandstorm

Rick

2009-09-11 04:49:16

Lol, well great minds think alike.
Guess I'll just use this in my own scripts then

EvilChicken!

2009-09-11 10:35:55

procedure DropArray(InvSlots:TIntegerArray);


In Inventory.scar.

senrath

2009-09-11 10:36:44

From: EvilChicken!
procedure DropArray(InvSlots: TIntegerArray);


In Inventory.scar.

Um, you might wanna re-read the first post.

EvilChicken!

2009-09-11 10:41:03

From: senrath
Um, you might wanna re-read the first post.


I did.

The function I posted takes the inverse input of his function. Instead of entering the skiparray, it takes the array of the items to be dropped.

senrath

2009-09-11 11:20:33

From: EvilChicken!
I did.

The function I posted takes the inverse input of his function. Instead of entering the skiparray, it takes the array of the items to be dropped.


Then re-read it again:
You can use DropArray but I thought this is quicker.

Main

2009-09-13 04:28:07

Dropall isn't working for me.

EDIT NVM.
Not bad, but is it safe?

EvilChicken!

2009-10-03 18:44:08

This has recently been added to SRL.

Closed.