• Log in or sign up for an account here: https://www.sythe.org/login

Farmville Hay Bale Script Mouse Location Problem

valzi

Newcomer
Joined
Nov 10, 2009
Sythe Gold
0
Messages
6
I'm trying to get just one piece of this code to work correctly. The rest works fine. After selecting a hay bale and choosing to sell it, the mouse moves to about an inch above the confirmation dialog to click "accept" rather than where it should be. What do I need to change to help it find the "accept" button?

I found the script here: http://www.sythe.org/showthread.php?t=705528&highlight=farmville

Code:
program FarmVilleAutoSellHayBales;
var x, y, max_x, max_y, fx, fy, hay, accept, sell : integer;
var acc : extended;

function randify(i, q : integer):integer;
begin
if(random(14)<=5)then
begin
q:=q+random(i);
end else
begin
q:=q-random(i);
end;
Result:=q;
end;

function Click(x,y:integer) : boolean;
begin
ClickMouse(x, y, true);
Result:=true;
end;

begin
hay := BitmapFromString(1, 9, 'beNqrE+sIkjneYrghX/ZQh/btGQY' +
       'f1zh+3uDyaZPrPgCtKA3H');
sell := BitmapFromString(1, 60, 'beNpzdv7///+9e/d0dXVVVVWZm' +
       'Zk3bNjwHwxmz57tDAD9XxE7');
accept := 4308116;
x:=0; y:=0;
ClearDebug;
GetClientDimensions(max_x, max_y);
ActivateClient;
GetMousePos(fx, fy);
wait(1000+random(500));

repeat

if(FindDeformedBitmapToleranceIn(hay,x,y,0,80,max_x,max_y,20,0,False,acc))then
begin
Click(x+7, randify(4,y+7));
wait(100+random(100));
repeat
wait(50);
until(FindDeformedBitmapToleranceIn(sell,x,y,0,80,max_x,max_y,20,0,False,acc));
Click(x+7+random(50), randify(2,y+4));
repeat
wait(50);
until(FindColor(x,y,accept,120,150,max_x,max_y));
wait(250+random(250));
Click(257+random(100), randify(11,390));
wait(1000+random(250));
end;

wait(50+random(50));

until(IsFKeyDown(2));

MoveMouse(fx, fy);

end.
 
Code:
until(FindColor(x,y,accept,120,150,max_x,max_y));
wait(250+random(250));
//Click(257+random(100), randify(11,390)); //<---- Problem
Click(x,y); //<-- FIXED
wait(1000+random(250));
end;
 
The cursor moves CLOSER to the accept button now, but it still doesn't make it there. Thanks for the effort.
 
gah, just add a number to x & y then so it clicks the right place....

click(x+10,y+10);

adjust the numbers until it clicks the right spot.
positive number on x moves the mouse to the right, negative to the left.
positive number on y moves the mouse down, negative moves it up.
 
Runescape Gamblingrunescape gambling
Back
Top