SRL Archive - SRL Suggestions

DragItemTo(FromSlot,ToSlot:Integer):Boolean;


Sin

2012-05-08 10:26:24

function DragItemTo(FromSlot,ToSlot:Integer):Boolean;
var
x,y:Integer;
begin
Result := False;
if not LoggedIn then
exit;
if ExistsItem(FromSlot) then
begin
MouseItem(FromSlot,3);
Wait(50 + random(50));
GetMousePos(x,y);
HoldMouse(x,y,mouse_Left);
MouseItem(ToSlot,3);
GetMousePos(x,y);
ReleaseMouse(x,y,mouse_Left);
Wait(50 + random(50));
if ExistsItem(ToSlot) then
Result := True;
end else exit;
end;

Imanoobbot

2012-05-08 10:44:49

Cool function ;)
+rep

Abu

2012-05-08 11:00:01

Are your MouseItem parameters correct?
 MouseItem(FromSlot,3); // '3' should be 0, 1 or 2 no?


What does 3 represent? As far as I'm concerned:
[BANANA]
mouse_Right = 0
mouse_Left = 1
mouse_Middle = 2
[/BANANA]

So 3 is doing nothing? :confused:

Er1k

2012-05-08 11:05:45

Is it mouse_move?

Google

2012-05-08 15:59:15

This function is already in the SRL includes? I don't see how yours is any different.

Sin

2012-05-08 16:01:10

I don't think it is?

Google

2012-05-08 16:02:08


{*********************************************
Procedure DragM;
By: NaumanAkhlaQ
Description: Leftclicks StartX, StartY and
drags mouse to EndX, EndY..
**********************************************}
Procedure DragM(StartX, StartY, SRandX, SRandY, EndX, EndY, ERandX, ERandY: Integer);
begin
MMouse(StartX, StartY, SRandX, SRandY);
Wait(150 + Random(20));
GetMousePos(StartX, StartY);
HoldMouse(StartX, StartY, mouse_left);
Wait(250 + Random(320));
MMouse(EndX, EndY, ERandX, ERandY);
Wait(250 + Random(120));
GetMousePos(EndX, EndY);
ReleaseMouse(EndX, EndY, mouse_left);
end;

This is what I've been using in all my scripts for the past month, instead of the coords you use the slot?

Sin

2012-05-08 16:07:23

Well the function is different, it's DragItem.

Google

2012-05-08 16:13:02

From: Sin
Well the function is different, it's DragItem.


Whatever nevermind they both do the same thing.

Runaway

2012-05-08 16:44:48

From: GOOGLE
Whatever nevermind they both do the same thing.


Using your logic, we mine as well get rid of MouseItem() too, cause we've already got Mouse().

The point is, this is for inventory specific endeavors. If you're using DragM() alot in your inventory, then DragItemTo() would save alot of time since you only need to identify inventory slots instead of using all sorts of static coordinates.

Home

2012-05-08 16:59:59

function DragItemTo(FromSlot, ToSlot :Integer):Boolean;
var
ItemPoint :TPoint;
begin
If ExistsItem(FromSlot) then
begin
ItemPoint := MiddleBox(InvBox(FromSlot));
MMouse(ItemPoint.X, ItemPoint.Y, 0, 0);
HoldMouse(ItemPoint.X, ItemPoint.Y, mouse_Left);
ItemPoint := MiddleBox(InvBox(ToSlot));
MMouse(ItemPoint.X, ItemPoint.Y, 0, 0);
ReleaseMouse(ItemPoint.X, ItemPoint.Y, mouse_Left);
end;
end;


What I have noticed that above OP Function misses items. This will use Middle of the InvSlot.

~Home

Sin

2012-05-08 17:04:22

<3 +rep
From: Runaway
Using your logic, we mine as well get rid of MouseItem() too, cause we've already got Mouse().

The point is, this is for inventory specific endeavors. If you're using DragM() alot in your inventory, then DragItemTo() would save alot of time since you only need to identify inventory slots instead of using all sorts of static coordinates.



Has it really? It's never missed an item for me :o
From: Home
function DragItemTo(FromSlot, ToSlot :Integer):Boolean;
var
ItemPoint :TPoint;
begin
If ExistsItem(FromSlot) then
begin
ItemPoint := MiddleBox(InvBox(FromSlot));
MMouse(ItemPoint.X, ItemPoint.Y, 0, 0);
HoldMouse(ItemPoint.X, ItemPoint.Y, mouse_Left);
ItemPoint := MiddleBox(InvBox(ToSlot));
MMouse(ItemPoint.X, ItemPoint.Y, 0, 0);
ReleaseMouse(ItemPoint.X, ItemPoint.Y, mouse_Left);
end;
end;


What I have noticed that above OP Function misses items. This will use Middle of the InvSlot.

~Home