Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mouseSlot overload function #264

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion lib/interfaces/gametabs/backpack.simba
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ Example:
writeln('We moved the mouse to Backpack slot 1');

*)
function TRSTabBackpack.mouseSlot(slot, mouseAction: integer = MOUSE_MOVE): boolean;
function TRSTabBackpack.mouseSlot(slot: integer; mouseAction: integer = MOUSE_MOVE): boolean;
begin
if (not self.open()) or (not self.isSlotValid(slot)) then
exit(false);
Expand All @@ -656,6 +656,47 @@ begin
mouseBox(self.getSlotBox(slot), mouseAction);
end;

(*
mouseSlot
---------

.. code-block:: pascal

function TRSTabBackpack.mouseSlot(slot, waitTime: integer; mouseAction: integer = MOUSE_MOVE; uptext: TStringArray): boolean; overload;

Overload function, additional parameters **waitTime** and **upText**.
Returns true if it finds the correct **upText** at the desired backpack **slot**.
The **upText** parameter is a TStringArray, and uses both the text in top left
corner or the mouseOver popup, while the **waitTime** parameter is used to wait
after the **mouseAction**

.. note::

- by Thomas
- Last Updated: 13 November 2016 by Thomas

Example:

.. code-block:: pascal

if tabBackpack.mouseSlot(1, randomRange(100, 200), MOUSE_LEFT, ['Dragon bones', 'Big bones']) then
writeln('We clicked the bones in Backpack slot 1');

*)

function TRSTabBackpack.mouseSlot(slot, waitTime: integer; mouseAction: integer = MOUSE_MOVE; upText: TStringArray): boolean; overload;
begin
if (not self.open()) or (not self.isSlotValid(slot)) then
exit(false);

mouseBox(self.getSlotBox(slot), MOUSE_MOVE);
result := (isUpText(upText) or isMouseOverText(upText));

if result then
mouseBox(self.getSlotBox(slot), mouseAction);
wait(waitTime);
end;

(*
isSlotActivated
---------------
Expand Down