SRL Archive - SRL Archives

Fast dropping: FastDrop; and ChooseOptionMultiEx


Gu3st...

2009-02-03 09:06:30

procedure FastDropExcept(A : TIntegerArray);
var
Arr: TIntegerArray;
I, J, MS : Integer;
TP : TPoint;
begin
MS := MouseSpeed;
MouseSpeed := 25 + Random(5);
Arr := [1, 5, 9, 13, 17, 21, 25,
2, 6, 10, 14, 18, 22, 26,
3, 7, 11, 15, 19, 23, 27,
4, 8, 12, 16, 20, 24, 28];
for J := 0 to High(A) do
for I := 0 to 27 do
if (A[J] = Arr[i]) then
Arr[i] := 0;
for I := 0 to 27 do
begin
if (Arr[i] = 0) then
Continue;
if not ExistsItem(Arr[i]) then
Continue;
TP := ItemCoords(Arr[i]);
Mouse(TP.x, TP.Y, 0, 0, False);
ChooseOptionMultiEx(['rop'], True);
end;
MouseSpeed := MS;
end;

procedure FastDrop;
begin
FastDropExcept([]);
end;
USE: FastDrop; or FastDropExcept([1, 2, 3, 28]);
This function will drop your logs/ores/anything with 3 options (Use, Drop, Examine) like a human would do it.

I did some comparing and this is the result I got:
FastDrop: 27937ms
DropAll: 44438ms

For this to work as fast as possible, you should have this procedure:
function ChooseOptionMultiEx(Text: TStringArray; ClickUnder : Boolean): Boolean;
var
B: TBox;
TPA: TPointArray;
X, Y, I, C: Integer;
P: TPoint;

begin
Result := False;
GetClientDimensions(B.X2, B.Y2);
B.X1 := 0;
B.Y1 := 0;
FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
If Length(TPA) < 10 Then
Exit;
B.X2 := 0;
B.Y2 := 0;

P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[i].X = TPA[I+1].X - 1 Then
Begin
If C > 5 Then
Begin
B.X1 := P.X;
B.Y1 := P.Y;
Break;
End Else
C := C + 1;
End
Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;
InvertTPA(TPA);
C := 0;
P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[i].X = TPA[I+1].X + 1 Then
Begin
If C > 5 Then
Begin
B.X2 := P.X;
B.Y2 := P.Y;
Break;
End Else
C := C + 1;
End Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;

For i:=0 To High(Text) do
If FindText(X, Y, Text[i], upchars, B.X1, B.Y1, B.X2, B.Y2) Then
Begin
Result := True;
if ClickUnder then
Mouse(B.X1 + 58, y + 3, 4, 0, True)
else
Mouse(B.X1 + 5, y + 1, B.X2 - B.X1 - 5, 13, True);
Exit;
End;

MMouse(B.X1 - 50, B.Y1 - 50, 40, B.Y2 - B.Y1);
Wait(200 + Random(100));
end;
USE: ChooseOptionMultiEx(['rop'], True);. ChooseOptionMultiEx(['rop'], False); would be the same as ChooseOptionMulti(['rop']);

This function clicks at 'Drop' without any randomness.

I honestly think it should be added to SRL :)

EDIT: I added some more information .

EvilChicken!

2009-02-05 06:34:25

Wouldn't this to the exact same thing as SRL's dropping functions, if you just set the mousespeed a bit higher before calling the procedure(s)?

MylesMadness

2009-02-05 07:07:38

Should the array be, for increased fastness
Arr := [1, 5, 9,  13, 17, 21, 25,
26, 22, 18, 14, 10, 6, 2,
3, 7, 11, 15, 19, 23, 27,
28, 24, 20, 16, 12, 8, 4];

Gu3st...

2009-02-05 09:09:47

From: EvilChicken!
Wouldn't this to the exact same thing as SRL's dropping functions, if you just set the mousespeed a bit higher before calling the procedure(s)?

Nope. I'll make a video later showing FastDrop; compared to DropAll;
From: Mylesmadness
Should the array be, for increased fastness

True, it would be maybe 1 sec faster or so :) Thanks
EDIT: No it should not, I will show you why in the vid ;)

Cazax

2009-02-05 09:28:35

I made it .gif for you :):
That is FastDrop;

Gu3st...

2009-02-05 09:33:17

From: Cazax
I made it .gif for you :):
(.gif here; removed to save all ppl with lousy internet dw-speed ;))
That is FastDrop;

Again; Thank you, I never used Movie Maker before so you saved me alot of time :)

Naum

2009-02-05 10:42:31

Why not chnage Arr to this?

Arr := [1..28] :)

Gu3st...

2009-02-05 11:32:31

From: NaumanAkhlaQ
Why not chnage Arr to this?

Arr := [1..28] :)

That would make it drop from 1 to 28 ;)

Naum

2009-02-05 13:15:28

Which is what you want to do??

NiCbaZ

2009-02-06 02:55:32

From: NaumanAkhlaQ
Which is what you want to do??


Look at the gif, it goes long ways down… you should make the Item array a simple case so its random(2) of dropping vertical or horiziontal thus making it more random, and a third option where it grabs a random amound from each array and drops like that ( i do that sometime drop half vertical then change to horizontal).

Good job.

Gu3st...

2009-02-06 09:40:26

From: NiCbaZ
Look at the gif, it goes long ways down… you should make the Item array a simple case so its random(2) of dropping vertical or horiziontal thus making it more random, and a third option where it grabs a random amound from each array and drops like that ( i do that sometime drop half vertical then change to horizontal).

Good job.

Making it drop horiziontal would ruin the point :p

Nava2

2009-02-07 00:42:36

Why is it faster…?

E:
procedure FastDropExcept(A : TIntegerArray);
var
Arr: TIntegerArray;
I, H, II, HH, J, MS : Integer;
TP : TPoint;
begin
MS := MouseSpeed;
MouseSpeed := 25 + Random(5);
Arr := [1, 5, 9, 13, 17, 21, 25,
2, 6, 10, 14, 18, 22, 26,
3, 7, 11, 15, 19, 23, 27,
4, 8, 12, 16, 20, 24, 28];
{ HH := 27;
for I := 0 to HH do
if not ExistsItem(Arr[I]) then
begin
HH := High(Arr);
for II := J to HH - 1 do
Swap(Arr[II], Arr[II] + 1);
SetLength(Arr, HH);
end; }
H := High(A);
for I := 0 to H do
if InIntArrayEx(Arr, J, A[I]) then
begin
HH := High(Arr) - 1;
for II := J to HH do
Swap(Arr[II], Arr[II] + 1);
SetLength(Arr, HH + 1);
end;
H := High(Arr);
for I := 0 to H do
begin
if not ExistsItem(Arr[i]) then
Continue;
TP := ItemCoords(Arr[i]);
Mouse(TP.x, TP.Y, 0, 0, False);
ChooseOptionMultiEx(['rop'], True);
end;
MouseSpeed := MS;
end;


I may have made it faster… not really sure :)