Lipcot
2014-11-28 23:05:44
I've been using tesseract but its far from perfect, i've tried with findtext but it doesent store the text found.
This is a rough function i've made, it works.. but i would like to make it more effective, dont expect much clearness heheh :redface: :
trying to read this:
This is a rough function i've made, it works.. but i would like to make it more effective, dont expect much clearness heheh :redface: :
Function findHouseName: boolean;
var
tries, i, x, y: integer;
p: tpoint;
TPA: TPointArray;
ATPA: T2DPointArray;
rawString, filteredString, filteredString2, filteredString3, filteredString4: string;
possibleNames: TStringArray;
failtimer: TTimemarker;
begin
result:= false;
failtimer.start();
repeat
repeat //bottom part of chatbox where first text appears
rawString := Tesseract_GetText((intToBox(6, 559, 556, 576)), TESS_FILTER_SMALL_CHARS); //i've tried will all filters
writeln(rawString);
filteredString := Between('I', 'I', rawString); //This is because Tesseract sometimes reads []
ExtractFromStr(filteredString, '0'); //as I I or l and / as I
ExtractFromStr(filteredString, '2');
filteredString2 := Between('[', ']', rawString);
ExtractFromStr(filteredString2, '0');
ExtractFromStr(filteredString2, '2');
filteredString3 := Between('I', 'l', rawString);
ExtractFromStr(filteredString3, '0');
ExtractFromStr(filteredString3, '2');
filteredString4 := Between('l', 'l', rawString);
ExtractFromStr(filteredString4, '0');
ExtractFromStr(filteredString4, '2');
if length(filteredstring) >= 2 then
begin
if length(filteredstring) <= 10 then
begin
writeln(filteredString);
PossibleNames.append(filteredString);
end;
end;
if length(filteredString2) >=2 then
begin
if length(filteredstring2) <= 10 then
begin
writeln(filteredString2);
PossibleNames.append(filteredString2);
end;
end;
if length(filteredString3) >=2 then
begin
if length(filteredstring3) <= 10 then
begin
writeln(filteredString3);
PossibleNames.append(filteredString3);
end;
end;
if length(filteredString4) >=2 then
begin
if length(filteredstring4) <= 10 then
begin
writeln(filteredString4);
PossibleNames.append(filteredString4);
end;
end;
inc(tries);
wait(1500);
until Tries >=10;
PossibleNames.clearEquals();
writeln(PossibleNames);
for i := 0 to high(possibleNames) do
if UndorakObjectFinder(GreyPortalHue, GreyPortalSat, 30, 25, GreyPortalColor, GreyPortalTol, MOUSE_RIGHT, ['Enter', 'nter','Portal','ortal'], ['friend'], mainscreen.getbounds()) then
begin
minimap.waitPlayerMoving;
wait(randomrange(1000, 2000));
typeSend((possiblenames[i]), true);
wait(randomrange(8000, 9000));
if findcolorsspiraltolerance(x, y, TPA, PurplePortalColor, mainscreen.getBounds(), PurplePortalTol, colorSetting(2, PurplePortalHue, PurplePortalSat)) then
begin
ATPA := tpa.cluster(20);
ATPA.filterBetween(0,10);
if length(ATPA) >= 1 then
begin
Writeln('Succesfully found a House!');
FoundHouse := True;
HouseName := (possiblenames[i]);
Writeln('Current House name: ' + HouseName);
exit(true);
end;
end else Writeln('Current String was not correct!');
end;
until FoundHouse or failtimer.gettime() >= 300000 or (not isloggedin);
end;trying to read this: