SRL Archive - Jr. Member General Help and Discussion

Accurately reading player text and storing it


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: :

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:


Ashaman88

2014-11-29 09:43:47

Could we see a pic of what you're trying to read?

Lipcot

2014-11-30 13:16:05

From: Ashaman88
Could we see a pic of what you're trying to read?



what is between '[' and ']' . The blue letters. I've asked this after trying over and over again with different ways of doing this, but i dont have any experience with tesseract and text reading! really new to it

Lipcot

2014-12-01 13:33:50

bump!

3Garrett3

2014-12-01 13:48:36

Please don't bump posts.

Tesseract text grabbing is pretty simple. From a previous posts a few days ago in the help section, I suggested the use of the following:


tesText := tesseractGetText(intToBox(138,76,433,92), TESS_FILTER_SMALL_CHARS);

The box is just where the text should be. It can grab multiple lines of text and be manipulated that way if desired. There are 3 filters that I'm aware of, they are listed in the tesseract simba file in SRL-6.

If none of the typical SRL methods are working well then I suggest trying tesseract.

Edit: I don't think there are any filter differences for colour of text. The one I suggested above works for both white and yellow text in the GE, if you'd like an example of what that filter works with.

Lipcot

2014-12-01 14:25:08

From: 3Garrett3
…


sorry for the bump, i'm just getting frustrated at this. I've used the same function you said in my procedure, and it does not read accurately the text.

this: "[gogoaltar]" will be read sometimes as "[gogoaltarI" or "[gogoaltarl" or "IgogoaltarI" and many different ways and "/" is always read as I or l so it's hard to analyze data this way.

I'm asking if someone knows of any other way of reading text? since Tesseract is not reading it accurately(unless im doing something wrong, thats why i put my procedure there). Maybe i've been misleading with the title, my bad.

NKN

2014-12-01 14:28:46

From: undorak7
sorry for the bump, i'm just getting frustrated at this. I've used the same function you said in my procedure, and it does not read accurately the text.

this: "[gogoaltar]" will be read sometimes as "[gogoaltarI" or "[gogoaltarl" or "IgogoaltarI" and many different ways and "/" is always read as I or l so it's hard to analyze data this way.

I'm asking if someone knows of any other way of reading text? since Tesseract is not reading it accurately(unless im doing something wrong, thats why i put my procedure there). Maybe i've been misleading with the title, my bad.


I may have a method for you in a few hours when I get home from school. Can't access the snippet from a school PC.

Lipcot

2014-12-01 18:14:35

From: NKN
I may have a method for you in a few hours when I get home from school. Can't access the snippet from a school PC.


cool! im excited!

3Garrett3

2014-12-01 18:35:13

From: undorak7
cool! im excited!


The other option is that we bug @Clarity again (sorry!) about releasing some OGL include so we can have perfect text reading (among a lot of other stuff)

NKN

2014-12-01 18:37:57

From: undorak7
cool! im excited!


add me on skype:

NKNScripts

(it needs a bit of modifying)

Lipcot

2014-12-01 20:34:49

From: NKN
add me on skype:

NKNScripts

(it needs a bit of modifying)


added :)

Clarity

2014-12-03 00:30:36

From: 3Garrett3
The other option is that we bug @Clarity again (sorry!) about releasing some OGL include so we can have perfect text reading (among a lot of other stuff)


I think you've misunderstood what I've been telling you in PM, some of this stuff is available now (written by Brandon)! Let's Skype!

3Garrett3

2014-12-03 10:21:04

From: Clarity
I think you've misunderstood what I've been telling you in PM, some of this stuff is available now (written by Brandon)! Let's Skype!


I probably have been misunderstanding. I know some of it is available but you made it sound like you'd re-written a lot of custom functions for performance, etc. I want it all! I won't be able to skype until the weekend probably but I'll be available for almost all of it. I also idle on IRC in the mornings (now) throughout most of the work day but you're never on ;)

Lipcot

2014-12-03 10:53:54

forgot to update this… NKN gave me a great snippet which reads with far better accuracy (although not 100% but goood enough). Thanks @NKN;

NKN

2014-12-03 16:07:12

From: undorak7
forgot to update this… NKN gave me a great snippet which reads with far better accuracy (although not 100% but goood enough). Thanks @NKN;


@Olly wrote it, should thank him as well.