This has been fixed, or at least found a way around it! See further on down.
I have this and it works up until the sendkeys part. I've tested sendkeys outside of the function and it works for what I am trying to do. Whenever I have it in the function is just clicks continue once then sits there when it should be selecting an option. I've also tried MMouse (and HumanMMOuse) doesn't work inside the function either.
Simba Code:
function ChatBox: Boolean;
begin
while (areTalking()) do
clickContinue(true, true); //
sendkeys('2', 250, 250);
clickContinue(true, true);
clickContinue(true, true);
sendkeys('80', 100, 100);
TypeByte(VK_ENTER);
if (FindBlackChatMessage('You''ll need to unlock your money pouch to afford that much seaweed.')) then
begin
writeln('Need to enter pin at bank.');
Result := False;
Exit;
end else begin
clickContinue(true, true);
end;
end;
FIXED!!
Simba Code:
function Arhein_ChatBox: Boolean;
begin
while (areTalking()) do
TypeByte(VK_SPACE);
findNPCChatText('2', ClickLeft);
The problem seems to be with clickContinue(true, true);, not sure why.
Second question is about TPA filtering.
Simba Code:
Function Find_Arhein: Boolean;
var
CTS: Integer;
Black_TPA, White_TPA, Player_TPA: TPointArray;
ATPA: array of TPointArray;
Black_Box: TBox;
begin
if (not (LoggedIn)) then
Exit;
Player_TPA := TPAFromBox(IntToBox(245, 130, 285, 195));
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.46, 6.88);
if FindColorsSpiralTolerance(MSCX, MSCY, Black_TPA, 1316130, MSX1, MSY1, MSX2, MSY2, 5) then // black
begin
Black_TPA := ClearTPAFromTPA(Black_TPA, Player_TPA);
RAaSTPA(Black_TPA, 5);
ATPA := SplitTPAEx(Black_TPA, 20, 20);
SortATPAFromFirstPoint(ATPA, Point(MSCX,MSCY));
DeBugATPABounds(ATPA);
for i := 0 to High(ATPA) do
begin
Black_Box := GetTPABounds(ATPA[i]);
SetColorSpeed2Modifiers(2.58, 3.42); //change for white
if FindColorsSpiralTolerance(MSCX, MSCY, White_TPA, 14805433, MSX1, MSY1, MSX2, MSY2, 15) then //white
White_TPA := ClearTPAFromTPA(White_TPA, Player_TPA);
break;
if i = high(ATPA) then
begin
writeln('Check all the TPA''s, did not find black and white');
LogOut;
TerminateScript;
end;
end;
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
MarkTime(t);
while (not IsUpTextMultiCustom(['Talk', 'Arhein'])) do
begin
MiddleTPAEx(ATPA[i], x, y);
HumanMMouse(x, y, 5, 5);
Writeln(GetUpText);
if WaitUpTextMulti(['Talk', 'Arhein'], 400) then
Writeln('UpText match');
if TimeFromMark(t) > 5000 then
begin
writeln('Took to long to find uptext');
Logout;
TerminateScript;
end;
end;
ClickMouse2(True);
Result := True;
Exit;
end;
end;
I have this and it find Arhein almost every single time. The only problem is there are 'Men' and sometimes other players around who match and it picks up on them a little and sometimes clicks on them.
Debug1.pngDebug1.png
How do I ignore the other points?