SRL Archive - SRL Suggestions

A Couple Of Changes


Rich

2012-05-15 10:17:41

(*
SearchBankEx
~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function SearchBankEx(var X, Y : Integer; Item : string; TextOrDTM : Integer) : Boolean;

Searches for bank for Item. If Item is exact name, set UseDTM false and set DTM
as 0, else set it true and DTM is the name of your DTM. If not UseDTM, will
return true on item existing in bank slot 1, else will return true on DTM being
found. X, Y will be where it's found.

.. note::

Author: Rich
Last Modified: 15/05/12

Example:

.. code-block:: pascal

if SearchBankEx(X, Y, 'Willow Logs', False, 0) then
Mouse(X, Y, 5, 5, True);

if SearchBank(X, Y, 'Willow', True, WillowLogsDTM) then
Mouse(X, Y, 5, 5, True);
*)
function SearchBankEx(var X, Y : Integer; Item : string; UseDTM : Boolean; DTM : Integer) : Boolean;
var
T, II: Integer;

begin
if (not(BankScreen)) then Exit;
for II := 0 to 2 do
begin
FixBankTab;
Mouse(75, 300, 20, 10, mouse_left);
T:= GetSystemTime;
while ((BankScreen) and (GetSystemTime - T < 6000)) do
begin
Wait(500 + Random(500));
if (FindTextTPA(0, 0, 350, 392, 399, 410, 'search', UpCharsEx, Nothing)) then
TypeSend(Item);
end;
Wait(500 + Random(500));
end;
if UseDTM then
Result:= FindDTM(DTM, X, Y, MSX1, MSY1, MSX2, MSY2)
else
Result:= FindColor(X, Y, 131072, 32, 94, 74, 126);
end;

(*
SearchBank
~~~~~~~~~~

.. code-block:: pascal

function SearchBank(Item : string) : Boolean;

Searches for Item in your bank. Relies on item existing in bank slot 1.

.. note::

Author: Rich
Last Modified: 15/05/12

Example:

.. code-block:: pascal

if SearchBank('Willow Logs') then
Mouse(X, Y, 5, 5, mouse_Left);
*)
function SearchBank(Item : string) : Boolean;
var
X, Y : Integer;

begin
Result:= SearchBankEx(X, Y, Item, False, 0);
end;

(*
SearchBankDTM
~~~~~~~~~~

.. code-block:: pascal

function SearchBankDTM(Item : string; DTM : Integer) : Boolean;

Searches for Item in your bank using. Results true if DTM is found.

.. note::

Author: Rich
Last Modified: 15/05/12

Example:

.. code-block:: pascal

if SearchBankDTM('Willow', WillowLogsDTM) then
Mouse(X, Y, 5, 5, mouse_Left);
*)
function SearchBankDTM(Item : string; DTM : Integer) : Boolean;
var
X, Y : Integer;

begin
Result:= SearchBankEx(X, Y, Item, True, DTM);
end;

(*
MissMouseEx
~~~~~~~~~

.. code-block:: pascal

procedure MissMouseEx(eX, eY, rX, rY : Integer; Action : Variant);

Human-like miss-and-correct mouse movement/clicking.

.. note::

Author: Rich
Last Modified: 15/05/12

Example:

.. code-block:: pascal

MissMouseEx(500, 500, 10, 10, mouse_Left);
*)
procedure MissMouseEx(eX, eY, rX, rY : Integer; Action : Variant);
var
RandSpeed: Extended;
X, Y, A, Dist, MP: Integer;

begin
A:= MouseSpeed;
GetMousePos(X, Y);
Dist:= Distance(X, Y, eX, eY);
MP:= Round(Dist/150);
if (MP < 0) then
MP:= 1;
RandSpeed := ((Random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0);
MMouse(RandomRange(eX-(A*MP), eX+(A*MP)), RandomRange(eY-(A*MP), eY+(A*MP)), 0, 0);
Mouse(eX, eY, rX, rY, Action);
end;


(*
MissMouse
~~~~~~~~~

.. code-block:: pascal

procedure MissMouse(eX, eY);

Human-like miss-and-correct mouse movement.

.. note::

Author: Rich
Last Modified: 15/05/12

Example:

.. code-block:: pascal

MissMouse(500, 500);
*)
procedure MissMouse(eX, eY : Integer);
begin
MissMouseEx(eX, eY, 0, 0, mouse_Move);
end;

Made a function with options on which condition to return true and named it SearchBankEx. Also added SearchBankDTM which will result true on a DTM being found after searching. It seemed illogical for SearchBank to be just a procedure, so is now a function. However it was still work the same and not break any scripts due to no parameter changes.

MissMouse would only move the mouse and have no randomness on the final position, which also seemed illogical. Therefore made MissMouseEx which can click and also has randomness on final stopping point. MissMouse will also still work the same and not break any scripts.

masterBB

2012-05-15 11:02:28

Some critics ;)

TextOrDTM, why isn't it a Variant, the name doesn't really makes sense either. Why do you use 1 for DTM, you know a lot of time the index of the DTM will equal one? Use -1 instead, or even better, make two separate functions. Why doesn't the non-ex variant return a Boolean?

Why do you set the MouseSpeed? You never changed it.

Rich

2012-05-15 17:31:37

From: Rich
You my good sir raise a good number of points. I'm on my phone right now so will sort them out later when I'm home. Thanks man :)


All done. Thanks!

Rich

2012-05-20 08:26:38

Bump :)

Nava2

2012-05-20 11:18:20

For your banking functions, feel free to correct me, but isn't WithdrawItem the same as the first set of functions, but more functional?

Second ones, I've seen these proposed lots of times, I am really not sure why they wouldn't be used.

Laptop mouse is a nice alternative, however unnoticed it is.

Rich

2012-05-20 11:41:18

From: Nava2
For your banking functions, feel free to correct me, but isn't WithdrawItem the same as the first set of functions, but more functional?

Second ones, I've seen these proposed lots of times, I am really not sure why they wouldn't be used.
Similar, but I think WithdrawItem looks through the entire bank, whereas SearchBank(Ex) uses the search function.

I thought it made sense to give the function the ability to click as well, since one that only moved the mouse existed.