TPA function for opening the grand exchange.
Input the string for whatever option you'd like to choose in the GE
Examples are:
- Talk-to
- Exchange
- History
- Sets
Simba Code:
function OpenGE(Option: String): Boolean;
var
Options: TStringArray;
Colors, NPCArray :TPointArray;
ATPA: T2DPointArray;
MSNPC, NPCPoint :TPoint;
CTS, ii, i :Integer;
NPCBox: TBox;
begin
//
case Lowercase(Option) of
'talk': Options := ['to G', 'alk', 'k-to'];
'exchange': Options := ['ge G'];
'history': Options := ['istory', 'ry G'];
'sets': Options := ['ets', 'ts G'];
else
begin
Writeln('Please choose a valid option!');
Exit;
end;
end;
//
SetAngle(SRL_ANGLE_LOW);
NPCArray := GetMinimapDots('NPC');
if Length(NPCArray) < 1 then
Exit;
SortTPAFrom(NPCArray, Point(MMCX, MMCY));
for i := 0 to High(NPCArray) do
begin
NPCPoint := MMToMS(NPCArray[i])
if NPCPoint = Point(-1, -1) then
Continue;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.63, 0.11);
NPCBox := IntToBox(Max(NPCPoint.X - 40, MSX1), Max(NPCPoint.Y - 40, MSY1), Min(NPCPoint.X + 40, MSX2), Min(NPCPoint.Y + 40, MSY2));
if FindColorsSpiralTolerance(NPCPoint.x, NPCPoint.y, Colors, 2891041, NPCBox.x1, NPCBox.y1, NPCBox.x2, NPCBox.y2, 5) then
begin
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(Colors, 15, 20);
SortATPASize(ATPA, True);
for ii := 0 to High(ATPA) do
begin
MSNPC := MiddleTPA(ATPA[ii]);
MMouse(MSNPC.X, MSNPC.Y, 3, 3);
if WaitUpTextMulti(['rand', 'xcha', 'change'], 200) then
begin
ClickMouse2(mouse_Right);
Result := WaitOptionMulti(Options, 600);
if Result then
Exit;
end;
end;
end;
end;
end;
Edited with Runaway's addition