Dervish
2012-06-23 13:43:39
This part of my script is driving me crazy.
Although it clearly doesn't find the sailor, it prints out "Found.". The uptexts are, of course wrong but it still emits a positive result..
Anyone know why ?
2012-06-23 13:43:39
2012-06-23 13:46:36
2012-06-23 13:57:55
From: abu_jwka
I've realised as well there's been a problem (very) recently with uptexts…
I use WaitOption() but it just never seems to select the option…
2012-06-23 14:15:55
{$I SRL/SRL.Simba}
const
UptextFS = true; //UptextFailSafe
Function FindTextCustom(TextToSearchFor: TStringArray; Box: TBox; Colour, Tolerance: Integer; PrintResult: Boolean; Font: String): boolean;
var
Data: string;
ListOfFonts, AllFonts: TStringArray;
I, J: Integer;
begin
Result:= False;
AllFonts:= ['BigChars', 'CharsNPC', 'CharsTrade', 'FriendChars', 'LoginChars', 'SmallChars', 'SmallCharsNS', 'StatChars', 'UPChars', 'UpCharsEx', 'XPChars'];
if (LowerCase(Font) = 'all') then
ListOfFonts:= AllFonts
else
begin
if (Not InStrArr(Font, AllFonts, false)) then
begin
SRL_WARN('FindTextCustom', 'Invalid Font!', 0);
exit;
end;
ListOfFonts:= [Font];
end;
For J:= 0 To High(ListOfFonts) do
begin
Data:= GetTextAtExWrap(Box.X1, Box.Y1, Box.X2, Box.Y2, 0, 5, 2, Colour, Tolerance, ListOfFonts[J]);
For I:= 0 To High(TextToSearchFor) do
begin
if (TextToSearchFor[I] <> '') then
begin
TextToSearchFor[I] := Replace(TextToSearchFor[I], '?', '.');
Result:= ExecRegExpr('.*'+TextToSearchFor[I]+'.*', Data);
end;
if Result then
begin
If PrintResult then
writeln(Data);
exit;
end;
end;
end;
end;
Function FindAllText(Uptexts: TStringArray; Box: TBox; Colours: TIntegerArray; Tolerance: Integer; PrintResults: Boolean; Font: String): Boolean;
var
I: Integer;
begin
For I:= 0 To High(Colours) do
begin
Result:= FindTextCustom(UpTexts, Box, Colours[I], Tolerance, PrintResults, Font);
If Result then
exit;
end;
end;
Function UptextsBroken(Uptexts: TStringArray): Boolean;
var
ListOfColours: TIntegerArray;
begin
If UptextFS then
begin
try
ListOfColours := [14211799, 6667731, 14672351, 1169359, 2721999, 14212565,
13751822, 14474972, 13816530, 1803484, 2656464, 3249636,
3380704, 2461153, 14803936, 15067364, 13684943, 15198949,
15396073, 15593452, 15659246, 14474460, 6338516, 6207445,
3552820, 8641269, 8181491, 16645627, 183554, 5941953, 184322,
185813];
Result:= FindAllText(Uptexts, IntToBox(5, 9, 338, 23), ListOfColours, 60, True, 'UpChars');
except
Result:= true;
end;
end;
end;
begin
SetupSRL;
If UptextsBroken(['Ring', 'ing']) then
if UptextsBroken(['ele', 'eleport', 'port']) then
begin
//Run some func.
end;
end.
2012-06-23 14:27:47
From: Dervish
Works perfectly.. Would it only concern NPC uptexts ?
2012-06-23 14:53:35
From: abu_jwka
WaitOption() applies to everything.
2012-06-23 14:55:41
From: Dervish
I thought waitoption was for choosing an option ? as in right click options. I've come to the conclusion that UpText recognition works for objects but not NPCs.
2012-06-23 14:56:15
2012-06-23 14:57:04
From: Kyle Undefined
He's thinking of WaitUpText();
2012-06-23 15:01:21
2012-06-23 15:16:46
From: abu_jwka
If you're talking about me… nope.
WaitOption() is broken for me.
I'll check WaitUpText though…
2012-06-23 15:17:41
From: Dervish
So all text recognition would be broken..? Quite a grave issue, anything I can do ?
2012-06-23 15:29:19
2012-06-23 15:41:32
From: Kyle Undefined
He's not choosing an option, he's finding an Object. WaitOption is pointless to use for that and makes no sense.
2012-06-23 23:10:33