SRL Archive - Help

Alching Procedure?


Jokester

2012-04-01 12:56:11

Hey i'm currently writing an infinite farming script. And I need to know how to click the 28th inventory spot after it clicks the HighAlch spell. Can anyone help me with this procedure? I already have the DTM of the spell.

PatDuffy

2012-04-01 12:57:44

I think InvMouse would work for that.

Jokester

2012-04-01 13:00:28

From: PatDuffy
I think InvMouse would work for that.


Could you give me an example? I'm having trouble actually putting it into a script.

PatDuffy

2012-04-01 13:04:16

From: Jokester
Could you give me an example? I'm having trouble actually putting it into a script.


(*
InvMouse
~~~~~~~~

.. code-block:: pascal

function InvMouse(InvSlot, Action: Byte) : boolean;

A combined MouseItem & MMouseItem, will hopefully replace both
procedures one day. Usage is like SRL's MouseBox, Action determines what to do:

- 1: Leftclick
- 2: Rightclick
- 3: Move mouse to item

.. note::

by EvilChicken!

Example:

.. code-block:: pascal

if InvMouse(1, rightClick) then
WaitOption('eposit', 500);

*)
function InvMouse(InvSlot, Action: Byte) : boolean;
var
TB: TBox;
CurrPT : TPoint;
begin
result := false;
if (not InRange(Action, 0, 3)) then
begin
srl_Warn('InvMouse', 'Action #' + IntToStr(Action) + ' is not a valid action', warn_AllVersions);
Exit;
end;
if (not InRange(InvSlot, 1, 28)) then
begin
srl_Warn('InvMouse', 'Inventory slot #' + IntToStr(InvSlot) + ' is not a valid slot', warn_AllVersions);
Exit;
end;
GameTab(tab_inv);
Result := true;
TB := InvBox(InvSlot);
GetMousePos(CurrPT.x,CurrPT.y);
if PointInBox(CurrPT,TB) then
MouseBox(Max(CurrPT.x-random(2),TB.x1),Max(CurrPT.y-random(2),TB.y1),
Min(CurrPT.x+random(2),TB.x2),Min(CurrPT.y+random(2),TB.y2),Action) //LOL Pro-human much!
else
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, Action);
end;

Kinda explains itself, but it basically just moves to an inventory spot then clicks depending on what you tell it to do :p

Jokester

2012-04-01 13:08:28

From: PatDuffy
(*
InvMouse
~~~~~~~~

.. code-block:: pascal

function InvMouse(InvSlot, Action: Byte) : boolean;

A combined MouseItem & MMouseItem, will hopefully replace both
procedures one day. Usage is like SRL's MouseBox, Action determines what to do:

- 1: Leftclick
- 2: Rightclick
- 3: Move mouse to item

.. note::

by EvilChicken!

Example:

.. code-block:: pascal

if InvMouse(1, rightClick) then
WaitOption('eposit', 500);

*)
function InvMouse(InvSlot, Action: Byte) : boolean;
var
TB: TBox;
CurrPT : TPoint;
begin
result := false;
if (not InRange(Action, 0, 3)) then
begin
srl_Warn('InvMouse', 'Action #' + IntToStr(Action) + ' is not a valid action', warn_AllVersions);
Exit;
end;
if (not InRange(InvSlot, 1, 28)) then
begin
srl_Warn('InvMouse', 'Inventory slot #' + IntToStr(InvSlot) + ' is not a valid slot', warn_AllVersions);
Exit;
end;
GameTab(tab_inv);
Result := true;
TB := InvBox(InvSlot);
GetMousePos(CurrPT.x,CurrPT.y);
if PointInBox(CurrPT,TB) then
MouseBox(Max(CurrPT.x-random(2),TB.x1),Max(CurrPT.y-random(2),TB.y1),
Min(CurrPT.x+random(2),TB.x2),Min(CurrPT.y+random(2),TB.y2),Action) //LOL Pro-human much!
else
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, Action);
end;

Kinda explains itself, but it basically just moves to an inventory spot then clicks depending on what you tell it to do :p


Yeah I think I got it thanks.