SRL Archive - Research & Development Lounge

DropAllExcept([]); - Looking for testers :).


Sandstorm

2008-11-06 18:14:51

I created this as all I could see was DropAll;. All it does is skip the inventory spots you define. Nothing advanced, just useful in my opinion. I couldn't fully test it because my Gametabs are really screwing up, and I wouldn't mind some help :). Anyways, here's the procedure:


{*******************************************************************************
Procedure DropAllExcept(A : Array of Integer);
By: Sand Storm
Description: Drops everything except the user defined inventory spaces.
*******************************************************************************}

procedure DropAllExcept(A : Array of Integer);
var
i: Integer;
begin
For I:=1 To 28 Do
if not(InIntArray(a, i)) then
DropItem(i);
end;

Usage:

DropAllExcept([1, 2, 3, 4, 5]);


{*******************************************************************************
procedure DepositExcept(slot, toslot, vType: Variant; ItemsToSkip: Array of Integer);
by: Edited by Sandstorm, Originally made by: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town
Description: Deposits from Slot to ToSlot, skipping user defined slots.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)
*******************************************************************************}
Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Var
DepositX: Boolean;
All: Variant;
I, T, x, y: Integer;

Begin
If Not BankScreen Then
Exit;
If vType = 2 Then
srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
DepositX := False;
Case VarType(vType) Of
3: Begin
DepositX := Not InIntArray([1, 5, 10], vType);
If vType = 1 Then
All := False
Else
All := True;
End;
11: All := vType;
End;
For I := SlotFrom To SlotTo Do
Begin
If Not ExistsItem(I) Then
Continue;
If not(InIntArray(ItemsToSkip, I)) Then
MouseItem(I, Not All);
If DepositX Then
Begin
ChooseOption('Deposit-X');
T := GetSystemTime;
While (Not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) And (GetSystemTime - T < 3000) Do
Wait(100);
TypeSend(vType);
End Else If VarType(vType) = 3 Then
ChooseOption('Deposit-' + vType)
Else
ChooseOption('Deposit-All');
T := GetSystemTime;
Wait(RandomRange(200, 300));
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);
End;
End;


Usage:

DropExcept(1, 28, true, [1, 2, 3, 4 ,5]);

TViYH

2008-11-06 20:36:08

Good idea.

Should work in theory.

Unable to test due to 256 mb ram, and tons of windows open.

Method

2008-11-06 20:38:01

{*******************************************************************************
Procedure DropAllExcept(A : Array of Integer);
By: Sand Storm
Description: Drops everything except the user defined inventory spaces.
*******************************************************************************}

procedure DropAllExcept(A : Array of Integer);
var
i: Integer;
begin
For I:=1 To 28 Do
if not(InIntArray(a, i)) then
DropItem(i);
end;

The extra begin and end are unnecessary. It looks like it should work.

Sandstorm

2008-11-06 20:39:12

Thanks Method. I had a bit of help to :P.

Blender

2008-11-06 20:39:15

This is EXACTLY what I needed!
I modded D3VIL'S POW3RMIN3R and made it log out every time it does a load of iron and every time it drops. The script has a problems, so I have to drop all slots but 1 and 2. This is VERY useful (like you said) for powerminers.

Sandstorm

2008-11-06 21:01:48

No problem, just looking to help ^.^.

Also, forgot to say.

@TViYH and Method - Thanks :).

Blender

2008-11-07 23:53:00

Again thanks. It works oddly too well. My PowerMiner is running all night on test lvl 15 mining noob account. Not 1 random yet (until I started playing).

senrath

2008-11-08 00:12:36

Works perfectly for me.

Sandstorm

2008-11-08 08:19:26

@Blender - That's got nothing to do with my procedure :P.

@Senrath - That's good, one of the reports I'm looking for ^.^.

Sandstorm

2008-11-08 18:24:16

Sorry for the double post, but I made a DepositExcept Function. It's a bit slow when it finds a part that's in the Items To Skip array, but it works from what I've seen. Looking for more testers. It works for me, but yea, I want to make sure it's not JUST me :P. I really only added one line into Deposit; and added an extra constant :P.


{*******************************************************************************
procedure DepositExcept(slot, toslot, vType: Variant; ItemsToSkip: Array of Integer);
by: Edited by Sandstorm, Originally made by: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town
Description: Deposits from Slot to ToSlot, skipping user defined slots.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)
*******************************************************************************}
Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Var
DepositX: Boolean;
All: Variant;
I, T, x, y: Integer;

Begin
If Not BankScreen Then
Exit;
If vType = 2 Then
srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
DepositX := False;
Case VarType(vType) Of
3: Begin
DepositX := Not InIntArray([1, 5, 10], vType);
If vType = 1 Then
All := False
Else
All := True;
End;
11: All := vType;
End;
For I := SlotFrom To SlotTo Do
Begin
If Not ExistsItem(I) Then
Continue;
If not(InIntArray(ItemsToSkip, I)) Then
MouseItem(I, Not All);
If DepositX Then
Begin
ChooseOption('Deposit-X');
T := GetSystemTime;
While (Not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) And (GetSystemTime - T < 3000) Do
Wait(100);
TypeSend(vType);
End Else If VarType(vType) = 3 Then
ChooseOption('Deposit-' + vType)
Else
ChooseOption('Deposit-All');
T := GetSystemTime;
Wait(RandomRange(200, 300));
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);
End;
End;

Usage:

DepositExcept(1, 28, true, [1, 2, 3, 4 ,5]);

Let me know if you like it :).

Mr_Bum

2008-11-21 23:34:13

Testing DropAllExcept in my Power Cutter script.

Sandstorm

2008-11-21 23:49:07

Alright. I think it'll work fine, but more feedback never hurt :P.

Mr_Bum

2008-11-25 07:07:42

It is very nice. Maybe should be included in next SRL rev? Working smoothly and hasnt failed once.

wanted_crisis

2009-03-02 00:06:53

DropAllExcept works perfectly fine! Thanks a lot..