SRL Archive - SRL Archives

A few more procedures.


Naum

2009-10-11 06:05:23

Hello,


1) Due to the new PercentColorMM, the PercentBlackMM in AntiRandoms/Common.Scar could be changed from this:

function PercentBlackMM: Integer;
var
cts: Integer;
p: TPointArray;

begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsTolerance(p, 0, MMX1, MMY1, MMX2, MMY2, 1);
Result := Round((Length(p) / 18163.0) * 100.0);
ColorToleranceSpeed(cts);
end;


To:

Function PercentBlackMM : Byte;
Begin
Result := PercentColorMM(ClBlack, 1);
End;




2) A new FindRange() in cooking.scar:

Function FindRange(Var X, Y : Integer) : Boolean;
Var TPA : Array [0..1] Of TPointArray;
ATPA : Array Of TPointArray;
I : Integer;
ColTolArray : TIntegerArray;
Begin
ColTolArray := [595884, 12, 1648052, 20];
For I := 0 to 1 Do
FindColorsSpiralTolerance(MSCX, MSCY, TPA[I], ColTolArray[I * 2], MSX1, MSY1, MSX2, MSY2, ColTolArray[(I * 2)+1]);

TPA[0] := MergeATPA(TPA);
ATPA := SplitTPA(TPA[0], 3);
SortATPASize(ATPA, True);

For I := 0 To High(ATPA) Do
If (GetArrayLength(ATPA[I]) >= 3) And MiddleTPAEx(ATPA[i], X, Y) Then
Begin
CircleMouse(X, Y, 3, 3);
Result := WaitUpText('option', 70+Random(30));
If Result Then Break;
End;
End;

The current one just fails. :(




3) A DragMouse(); procedure:

From: NaumanAkhlaQ

4) A DragMouse(); procedure:

Procedure DragMouse(StartX, StartY, SRandX, SRandY, EndX, EndY, ERandX, ERandY : Integer);
Begin
MMouse(StartX, StartY, SRandX, SRandY);
Wait(150 + Random(20));
GetMousePos(x, y);
HoldMouse(x, y, True);
Wait(50 + Random(20));
MMouse(EndX, EndY, ERandX, ERandY);
Wait(150 + Random(20));
ReleaseMouse(x, y, True);
End;

Would help cut down on the code for few things, for example DragItem, Bee_DragMouse and a few others.

Usage: If I wanted to click on 500, 500 with 6 randomness on the x and 7 on the y co-ord, I would do:

DragMouse(500, 500, 6, 7 ....);

If I wanted to drag it to 800, 800 and release it with 3 randomness and 6 for x and y respectively, I would then add:

DragMouse(500, 500, 6, 7, 800, 800, 3, 6);

:)


If This will be added, then procedures like DragInvItem and Drag_BeePart can be edited as so:

procedure DragItem(inv1, inv2: Integer);
var
X, Y: Integer;
begin
InvMouse(Inv1, 3);
GetMousePos(X, Y);
HoldMouse(X, Y, True);
Wait(150 + Random(50));
InvMouse(Inv2, 3);
GetMousePos(X, Y);
ReleaseMouse(X, Y, True);
end;


To:

procedure DragItem(inv1, inv2: Integer);
Var InvAr : Array [0..1] Of TBox;
begin
InvAr[0] := InvBox(Inv1);
InvAr[1] := InvBox(Inv2);
DragMouse(InvAr[0].x1, InvAr[0].y1, InvAr[0].x2, InvAr[0].y2,
InvAr[1].x1, InvAr[1].y1, InvAr[1].x2, InvAr[1].y2);
end;

(The one's in ()'s represent the randomness, you should just change it to 16 and 20 for x and y repectively, but it's much more accurate that way).

AND:

procedure Bee_DragMouse(Pt1, Pt2: TPoint);
var
x, y: integer;
begin
MMouse(Pt1.x, Pt1.y, 5, 5);
GetMousePos(x, y);
HoldMouse(x, y, True);
Wait(200+Random(100));
MMouse(Pt2.x, Pt2.y, 10, 10);
GetMousePos(x, y);
Wait(200+Random(100));
ReleaseMouse(x, y, True);
Wait(100+Random(100));
end;

To:

procedure Bee_DragMouse(Pt1, Pt2: TPoint);
begin
DragMouse(Pt1.x, Pt1.y, 5, 5, Pt2.x, Pt2.y, 10, 10);
end;

May be a bit unreadable :/




4) In Prayer.Scar:

Function PrayerPoints : Byte;
Var TmpStr : String;
Begin
Result := GetMMLevels('pray', TmpStr);
End;

Could be a good fail safe for functions like ClickPrayer, as there's no point on activating a prayer if they're no prayer points left.

Will add more when I think of them :p.

EvilChicken!

2009-10-12 08:57:57

Aaaand we're back to foul standards again?

Voice 1: By all means, let us release our hate on someone innocent!
Voice 2: Oh, yes, what a wonderful idea! But who?
Voice 3: IT MUST BE EC! BECAUSE HE TRULY DESERVES IT.
Voice 1: LET US ALL KILL HIM BY CAPITALIZING ALL BOLD WORDS IN SCAR!

.. you get the point.

By the way, by this:
procedure DragItem(inv1, inv2: Integer);
I hope you mean TPoint instead of Int.
.. which will cause compatability issues. Inv1&2 represent inventory spots, and cannot be replaced by Tpoints. Find a way around, with math.


Fix stuff mentioned above and I will gladly commit, homie.

Naum

2009-10-12 12:02:20

Thanks, fixed my silly mistake:

Procedure DragItem(inv1, inv2: Integer);
Var InvAr : Array [0..1] Of TBox;
Begin
InvAr[0] := InvBox(Inv1);
InvAr[1] := InvBox(Inv2);
DragMouse(InvAr[0].x1, InvAr[0].y1, InvAr[0].x2, InvAr[0].y2,
InvAr[1].x1, InvAr[1].y1, InvAr[1].x2, InvAr[1].y2);
End;

You can remove the array variables of course, that was for speed. But it doesn't look like you really need to save time on this :p.

EDIT: I can't help capitalizing bold words, it's become second nature to me. Sorry if I pissed you off :(

EvilChicken!

2009-10-14 09:57:28

  • You didn't change the syntax like you said you did.
  • Array of TPA = T2DPointArray
  • Next time, make all of your functions with those comment tags. You even made a generator for them!
  • DragMouse doesn't work, fixed it. Atleast compile before posting, yes?
  • Your FindRange doesn't compile either. CircleMouse -> MouseCircle. Again, compile? Though, kinda weird, since you made MouseCircle. O__o

Good job, I committed all of this.
ALL of this.

You should be impressed over yourself.
And happy.


Mostly happy.

Naum

2009-10-14 11:42:45

From: EvilChicken!
  • You didn't change the syntax like you said you did.
  • Array of TPA = T2DPointArray
  • Next time, make all of your functions with those comment tags. You even made a generator for them!
  • DragMouse doesn't work, fixed it. Atleast compile before posting, yes?
  • Your FindRange doesn't compile either. CircleMouse -> MouseCircle. Again, compile? Though, kinda weird, since you made MouseCircle. O__o

Good job, I committed all of this.
ALL of this.

You should be impressed over yourself.
And happy.


Mostly happy.



Hurr!!! :drool:

  • Can't help it :crying:
  • Yar!
  • Oh yes I did lol, I just need to tweak it a bit then i'll release :)
  • Blehgr, my honest mistake. I had two notepad versions, picked the wrong one :confused:
  • ^ Same as above ^

Thanks a lot mate :thumbsup: