PDA

View Full Version : Missclick Invslot



Footy
11-01-2012, 11:10 PM
A user asked for this for an herb cleaner, so here it is. It will "missclick" an item in the inventory and return which slot it did end up clicking. I'm not sure about uses for this, but surely someone can come up with something! :D If anyone see's a way to shorten it or make it work better, let me know!

{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{} {}{}{}{}{}{}{
***************MissInv************************
Description: Will click an invslot touching "inv" Invslot(Up,
down, left, right). Will click using "button" button. Returns
the invslot that was clicked.

Author: Footy
Idea: Nirvana
Shortened by: Nebula
{}{}{}{}{}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{ }{}{}{}{}{}{}

Function MissInv(inv:integer; Button:Variant):integer;
var
i:integer;
TDirectionArray: array of Boolean;
TMissclickArray:TIntegerArray;
slotArr: array of TIntegerArray;
begin
TDirectionArray := [true, true, true, true];
slotArr := [TIntegerArray([1, 2, 3, 4]), TIntegerArray([1, 5, 9, 13, 17, 21, 25]), TIntegerArray([25, 26, 27, 28]), TIntegerArray([4, 8, 12, 16, 20, 24, 28])];
for i := 0 to 3 do
begin
if (not InIntArray(slotArr[i], inv)) then
begin
setlength(TMissclickArray, (Length(TMissClickArray) + 1));
case i of
0: TMissclickArray[high(TMissclickArray)] := inv - 4;
1: TMIssclickArray[high(TMissclickArray)] := inv - 1;
2: TMissclickarray[high(TMissclickArray)] := inv + 4;
3: TMissclickarray[high(TMissclickArray)] := inv + 1;
end;
end;
end;
result := TMissclickArray[random(length(TMissclickArray))];
invmouse(result, Button);
end;

Rezozo
11-01-2012, 11:13 PM
Ooh, this looks useful! Does it work properly for you?

Footy...Satisfying dem Reqs! +Rep

Footy
11-01-2012, 11:14 PM
I tested it briefely, not every invslot, but one on each border, and it worked fine. Thanks!

Ian
11-01-2012, 11:21 PM
Footy, could I use this in my Bone Burier? With credits of course :)

Footy
11-01-2012, 11:22 PM
Of course, I made it to be used! :D

Ian
11-01-2012, 11:24 PM
Thanks! I don't know when I'll add it though because I'll need to change the setup a bit; I use DTM's right now. :)

Nebula
11-02-2012, 12:20 AM
Nice work

I was able to shorten it down quite a bit.
Function MissclickInvSlot(inv:integer; Button:Variant):integer;
var
i:integer;
TDirectionArray: array of Boolean;
TMissclickArray:TIntegerArray;
slotArr: array of TIntegerArray;
begin
TDirectionArray := [true, true, true, true];
slotArr := [TIntegerArray([1, 2, 3, 4]), TIntegerArray([1, 5, 9, 13, 17, 21, 25]), TIntegerArray([25, 26, 27, 28]), TIntegerArray([4, 8, 12, 16, 20, 24, 28])];
for i := 0 to 3 do
begin
if (not InIntArray(slotArr[i], inv)) then
begin
setlength(TMissclickArray, (Length(TMissClickArray) + 1));
case i of
0: TMissclickArray[high(TMissclickArray)] := inv - 4;
1: TMIssclickArray[high(TMissclickArray)] := inv + 4;
2: TMissclickarray[high(TMissclickArray)] := inv - 1;
3: TMissclickarray[high(TMissclickArray)] := inv + 1;
end;
end;
end;
result := TMissclickArray[random(length(TMissclickArray))];
invmouse(TMissclickArray[result], Button);
end;


Also I would like to point out the following:
{Returns the invslot that was clicked}
l := length(TMissclickArray);
i := random(l);
Result := i;

This is incorrect, as it would return a random number from the length of the array, not a random number from the array. So it should be this:
l := random(length(TMissclickArray));
i := (TMissclickArray[l]);
Result := i;

which can be further shortened to this:
result := TMissclickArray[random(length(TMissclickArray))];

Footy
11-02-2012, 01:05 AM
Thanks, I'll update my OP when I get to my comp. :)

EtherFreak
11-02-2012, 03:46 AM
This is the kind of thing that will make botting by us 100% undetectable, the human like element. I cant wait to see this in the srl includes!

Sax
11-02-2012, 02:37 PM
Thanks for doing this to me I am sure it will be very helpful to others

I'll test when I get to my computer

Footy
11-02-2012, 06:22 PM
Anyone think there's a place for this in the include?

Le Jingle
11-02-2012, 06:38 PM
I think, even though I'm not sure on the layout of the SRL 6 plans/blue prints, that this would be a good humanized way to miss-click an item in the inventory. I'd imagine it to go under the antiban.simba include file.

I think this is also much different from Flight's mouse miss-click, in which it's purpose can help antiban idealism as it grows with the removal of randoms and supposed jagex confidence in bot busting. Flight's miss mouse procedure, iirc, doesn't use mouse clicks, so I do indeed think this could be useful, especially for item intensive dropping scripts.

Just my thoughts,
Nice work!

Cheers,
Lj!
:)

Footy
11-02-2012, 09:20 PM
Grrr, Nebula! You broke the function when you shortened it! :p One sec, I'll try to figure out whats wrong. Someones reporting an out of range error.

Also, could someone assist me in requesting to get this added, when it's fixed, of course. I don't know where to start...

Nebula
11-02-2012, 10:30 PM
Sorry :p. Didn't catch that. fixed.

Function MissclickInvSlot(inv:integer; Button:Variant):integer;
var
i:integer;
TDirectionArray: array of Boolean;
TMissclickArray:TIntegerArray;
slotArr: array of TIntegerArray;
begin
TDirectionArray := [true, true, true, true];
slotArr := [TIntegerArray([1, 2, 3, 4]), TIntegerArray([1, 5, 9, 13, 17, 21, 25]), TIntegerArray([25, 26, 27, 28]), TIntegerArray([4, 8, 12, 16, 20, 24, 28])];
for i := 0 to 3 do
begin
if (not InIntArray(slotArr[i], inv)) then
begin
setlength(TMissclickArray, (Length(TMissClickArray) + 1));
case i of
0: TMissclickArray[high(TMissclickArray)] := inv - 4;
1: TMIssclickArray[high(TMissclickArray)] := inv + 4;
2: TMissclickarray[high(TMissclickArray)] := inv - 1;
3: TMissclickarray[high(TMissclickArray)] := inv + 1;
end;
end;
end;
result := TMissclickArray[random(length(TMissclickArray))];
invmouse(result, Button);
end;

Footy
11-02-2012, 10:35 PM
That wasn't the only thing broke. You also broke the part where we add stuff to TMissclickArray. Here is the fixed version. ;)

If the function gets added to SRL6, I'll credit you for shortening in.
Function MissclickInvSlot(inv:integer; Button:Variant):integer;
var
i:integer;
TDirectionArray: array of Boolean;
TMissclickArray:TIntegerArray;
slotArr: array of TIntegerArray;
begin
TDirectionArray := [true, true, true, true];
slotArr := [TIntegerArray([1, 2, 3, 4]), TIntegerArray([1, 5, 9, 13, 17, 21, 25]), TIntegerArray([25, 26, 27, 28]), TIntegerArray([4, 8, 12, 16, 20, 24, 28])];
for i := 0 to 3 do
begin
if (not InIntArray(slotArr[i], inv)) then
begin
setlength(TMissclickArray, (Length(TMissClickArray) + 1));
case i of
0: TMissclickArray[high(TMissclickArray)] := inv - 4;
1: TMIssclickArray[high(TMissclickArray)] := inv - 1;
2: TMissclickarray[high(TMissclickArray)] := inv + 4;
3: TMissclickarray[high(TMissclickArray)] := inv + 1;
end;
end;
end;
result := TMissclickArray[random(length(TMissclickArray))];
invmouse(result, Button);
end;

Nebula
11-02-2012, 10:40 PM
Nah you don't have to credit me I didn't really do much. And I just caught that too btw. I tested it with every integer and it seems to be working 100% now.

Your original case statement had the following: 24..28 which is wrong :p

Footy
11-02-2012, 10:43 PM
Oh really? Whoops... :p

How do I request this to be added into the include? I've heard stuff about the git, pushing, pulling, blah blah blah. Do you have any idea?

Nebula
11-02-2012, 10:54 PM
make a github account (github.com)

go here: https://github.com/SRL/SRL-5/tree/master/SRL/core

click the file you want to put it in.

click edit in the top right corner

throw it in at the bottom

add a proper heading


(*
MissInv
~~~~~~~~~~~~~~

.. code-block:: pascal

function MissInv(inv:integer; Button:Variant): Integer;

Will click an invslot touching "inv" Invslot(Up,
down, left, right). Will click using "button" button. Returns
the invslot that was clicked.

.. note::

Author: Footy

Example:

.. code-block:: pascal

MissInv(6, true) left clicks either slot 2, 5, 7, or 10.
*)

Footy
11-02-2012, 10:56 PM
Ah, great, thanks! I can't rep you, you help me too much!

riwu
11-12-2012, 06:29 AM
I've actually used something like this for a crafting script, although it's only to randomize slot near 14 & 15.

What's the TDirectionArray for? Don't see it being used?
Also would it be better to have a Chance parameter where users define the Chance it will click the surrounding slot instead of the specified slot? So that you don't have to do the randomization to call this in the script.


function InvMissMouse(InvSlot, Chance: Integer; Action: Byte): Boolean;
var
randArr: TIntegerArray;
incSlot: Integer;
begin
if (Random(100) < Chance) then //chance in %, like HPPercent
begin
randArr:= [1, -1, 4, -4];
if InIntArray([4, 8, 12, 16, 20, 24], InvSlot) then
DeleteValueInIntArray(randArr, 0)
else
if InIntArray([5, 9, 13, 17, 21, 25], InvSlot) then
DeleteValueInIntArray(randArr, 1);

incSlot:= InvSlot;
IncEx(incSlot, randArr[Random(Length(randArr))]);

if InRange(incSlot, 1, 28) then //prevents slot going out of range
begin
InvSlot:= incSlot;
Result:= True; //returns true if surrounding slot is selected instead of input slot
end;
end;

InvMouse(InvSlot, Action);
end;


or maybe this will be more efficient to set the randArr:

case InvSlot of
4, 8, 12, 16, 20, 24:
randArr:= [-1, 4, -4];

5, 9, 13, 17, 21, 25:
randArr:= [1, 4, -4];

else
randArr:= [1, -1, 4, -4];
end;


Reasonably the surrounding slot should not be clicked more often simply because the input slot is at edge, so don't filter edge points.