SRL Archive - SRL Archives

SRL-15 Deposit(slot, toslot, thetype: Integer) broken


PriSoner

2008-04-07 12:24:49

Unfortunately the new improved Deposit procedure is now completely broken and about as much use as a chocolate teapot.. :fiery:

The main usefull features of the procedure: Slot & ToSlot no longer exist.

You have to deposit all items in your inventory everytime regardless of your options.

It is now no longer possible to have an item remain in an inventory slot and not bank it using this procedure.

Thanks for Deposit X and being able to deposit items one by one, I can't really see why you would need it but thanks anyway! :confused:

It also goes so super fast that it always insists on trying to bank all items twice even though they have already been banked.

Not very safe, no waits, very detectable.

I will be going back to the old version. If it aint broke don't fix it!

{*******************************************************************************
procedure Deposit(slot, toslot, thetype: Integer);
by: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town
Description: Deposits from Slot to ToSlot.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)
*******************************************************************************}

Procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);

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 := 1 To 28 Do
Begin
If Not ExistsItem(I) Then
Continue;
MouseItem(I, Not All);
If DepositX Then
Begin
ChooseOption('Store 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('Store ' + vType)
Else
ChooseOption('Store All');
T := GetSystemTime;
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);
End;
End;

Wizzup?

2008-04-07 14:53:00

The only bug that I can see right now is the for i := 1 to 28, which has to be for i := fromslot to toslot do…
Good find! Changed.
Expect a Revision #16 soon, with some bugfixes. ;)

I'd like to thank you for the comments on this function, they have helped improving the function, although you could have made it constructive critisism instead… :)

EDIT: Depositing one by one, like gems. I don't see why it should not have been put it.
The old deposit only had deposit one by one or all, btw.
I don't see what is so bad about this new deposit…
I added a wait and fixed the for loop.
EDIT2:
Try this one:

Procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);

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;
MouseItem(I, Not All);
If DepositX Then
Begin
ChooseOption('Store 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('Store ' + vType)
Else
ChooseOption('Store All');
Wait(RandomRange(200, 300));
T := GetSystemTime;
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);
End;
End;

XcanadamanX

2008-04-07 15:53:39

for me it doesnt wait until the item is banked it will immediately go to the next item in the inventory. i looks kinda suspicious without the waiting. im guessing that it'd be this not working:
    While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);

Wizzup?

2008-04-07 16:10:10

From: XcanadamanX
for me it doesnt wait until the item is banked it will immediately go to the next item in the inventory. i looks kinda suspicious without the waiting. im guessing that it'd be this not working:
    While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);


Yes. The Chooseoption overlaps your item. :)

XcanadamanX

2008-04-07 16:12:27

any fix for that then? or should i just randomly add some waits :p

edit: added a wait in. now it works fine.

wait(50);
T := GetSystemTime;
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);

PriSoner

2008-04-07 20:10:04

From: Wizzup?
The only bug that I can see right now is the for i := 1 to 28, which has to be for i := fromslot to toslot do…
Good find! Changed.
Expect a Revision #16 soon, with some bugfixes. ;)

I'd like to thank you for the comments on this function, they have helped improving the function, although you could have made it constructive critisism instead… :)

Granted and please accept my appologies. I had a late night, was grumpy, tired and didn't have much time so I threw my dummy out of the pram.

I should have spent more time on the function and sugested a few fixes.

I like standards and to me a revision is very different to a version. In the real world, in revisions you can Fix, Optimise or Add but above all else you cannot break existing functions. Something written for revision 1 should still work in revision 15. When you have enough obsolete and new functions you can then change the version number and roll them all out at once.

From: Wizzup?

EDIT: Depositing one by one, like gems. I don't see why it should not have been put it.
The old deposit only had deposit one by one or all, btw.
I don't see what is so bad about this new deposit…
I added a wait and fixed the for loop.

As I said above about revisions etc. By changing the procedure it broke it's existing functionality and every script that uses this procedure is as a result is now broken. The addition was not a fix, it doesn't add any real advantages and above all it was included without being tested. To me that is why it shouldn't have been put in. It should have gone into a running beta for Version 5 if it was going to be used.

Again sorry for the original rant, i''l try out your updated function and post feedback.

<<–PriSoner–>>