Ah making a nature-crafter are we? Give me a second and I'll show you mine with explanations.
Both of these functions are a bit old and might need the colors updated, I'm not sure.
Simba Code:
Function openTheShop: Boolean;
var
mPnt: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
i,CTS,F,X,Y,T: Integer;
label
Start;
begin
if ((not loggedIn()) or (not findSymbol(X, Y, 'Shop'))) then // If no shop symbol is found on the MM or if not logged in, exit
Exit;
if shopOpen() then // Is the shop already open?
Exit(True);
Start:
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.67);
for i:=0 to 5 do // Search for the shop owner colors 6 times
begin
findColorsSpiralTolerance(MSX1, MSY1, TPA, 5537195, MSX1, MSY1, MSX2, MSY2, 11);
if (length(TPA) > 0) then
break;
end;
setColorSpeed2Modifiers(0.02, 0.02);
colorToleranceSpeed(1);
if (F > 5) then
Exit(False);
if (length(TPA) < 1) then // No shop owner colors found
begin
inc(F);
if (F > 2) then
Exit;
GoTo Start;
end;
splitTPAExWrap(TPA, 10, 20, ATPA); // Split the colors into, hopefully, 10x20 boxes
sortATPASize(ATPA, True); // Sort by size (# of colors found per box)
for i:=0 to High(ATPA) do // For each box do...
begin
mPnt := medianTPA(ATPA[i]); // Check for uptext
MMouse(mPnt.X, mPnt.Y, 0, 0);
if waitUpTextMulti(['to Ji','Jimin','minua'], 300) then
break;
end;
// Was the uptext ever found? If not try again from the beginning (max of 6 attempts
if not isUpTextMultiCustom(['to Ji','Jimin','minua']) then
begin
Inc(F);
GoTo Start;
end;
clickMouse2(mouse_right); // Trade and wait until we're close to the flag on the MM
if chooseOptionMulti(['rade Ji','de Jim']) then
fFlag(5);
markTime(T); // Wait for the shop screen to appear (max of 5 seconds)
repeat
if not loggedIn() then
Exit;
if isMoving() then
Wait(10);
if shopOpen() then
break;
until(timeFromMark(T) > 5000)
if not shopOpen() then // Possibly a random event?
findNormalRandoms();
Result := shopOpen(); // If the shop screen is present then this function results True, False if not present
end;
Also you'll need this:
Simba Code:
Function shopOpen(): Boolean;
var
X,Y: Integer;
begin
Result := findColorTolerance(X, Y, 2070783, 185, 30, 250, 45, 30);
end;