Code:
function OpenShop: Boolean;
var
x, y, I, II, III, A: Integer;
NewX: Integer;
begin
repeat
if IsFKeyDown(10) then TerminateScript;
MoveMouse(ShopX-257+X1, ShopY);
begin
Wait(10);
A := A + 1;
if A = 150 then
begin
ClickMouse(790-258+X1, 253, True);
Wait(80);
ClickMouse(790-258+X1, 253, True);
Wait(80);
MoveMouse(ShopX-257+X1, ShopY-50);
end;
if A = 300 then
begin
for A := 300 to 400 do
begin
NewX := ShopX+A-300;
MoveMouse(NewX-257+X1, ShopY-75);
Wait(100);
if (CountColorTolerance(255463, 315-258+X1, 5, 360-258+X1, 15, 35) > 6) then Break;
NewX := ShopX-A+300;
MoveMouse(NewX-257+X1, ShopY);
Wait(100);
if (CountColorTolerance(255463, 315-258+X1, 5, 360-258+X1, 15, 35) > 6) then Break;
end;
if A < 400 then ShopX := NewX
else TerminateScript;
end;
end;
ClickMouse(ShopX-257+X1, ShopY, False);
III := 0;
while (III < 50) do
begin
if FindColor(x, y, 65535, ShopX-280+X1, ShopY-30, ShopX-255+X1, ShopY+80) then
begin
ClickMouse(ShopX-75, Y+20, True);
Break;
end;
Inc(III);
Wait(5)
end;
if III > 49 then Continue;
//Wait(100);
//ClickMouse(ShopX-258+X1, ShopY+42, True);
I := 0;
repeat
Wait(10);
I := I+1;
until(ShopScreen or (I > 200));
until(ShopScreen);
MoveMouse(445-258+X1, 130);
Wait(50);
ClickMouse(445-258+X1, 130, False);
wait(50);
ClickMouse(435-258+X1, 216, True);
Wait(100);
CloseShop;
repeat
Wait(10);
II := II+1
until(((GetColor(960-258+X1, 450) <> 3357765) and (GetColor(920-258+X1, 450) <> 3357765))) or (II > 200);
end;