PDA

View Full Version : Alternate OSRS uptext-grabber



Flight
06-05-2013, 06:58 PM
It's almost 2AM and I'm really tired so I'm not going to explain much. With the current '07 getUpText you cannot get any text that's beyond the 125 X mark, and in certain instances, like when using items on objects, your uptext will return disorganized & inaccurate results. So, to get the full uptext I made something similar to how it's done now that will grab all the text (with all colors) and group it all together, then determine the best result. I found it to be immensely more accurate.

I've only tested this in Al-Kharid so if anyone would like to put it to the test in tricky areas I'd encourage that.


Function getUpText2: String;
Var
X,Y: Integer;
FoundText: String;
ATPA: T2DPointArray;
TPA1,TPA2,TPA3,TPA4: TPointArray;
Begin
if not WaitFindColor(X, Y, 14606046, 8, 8, 35, 21, 38, 400) then // Wait until we actually have some uptext
Exit;

findColorsTolerance(TPA1, 14606046, 8, 8, 270, 21, 38); // White (35-43 seems good)
findColorsTolerance(TPA2, 13423640, 8, 8, 270, 21, 60); // Blue (originally 65 tol)
findColorsTolerance(TPA3, 1235160, 8, 8, 270, 21, 40); // Yellow
findColorsTolerance(TPA4, 4687583, 8, 8, 270, 21, 48); // Orange (originally 53 tol)
CombineTPAWrap(TPA1,TPA2,TPA1);
CombineTPAWrap(TPA1,TPA3,TPA1);
CombineTPAWrap(TPA1,TPA4,TPA1);

ATPA := SplitTPAEx(TPA1, 1, 10);
SortATPAFromFirstPointX(ATPA, Point(0,0));

FoundText:= GetTextATPA(ATPA, 5, 'UpChars07');

FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
Result:=FoundText;
End;


Also if you'd like to get a better color & tolerance for the white uptext then you're welcome to use the colors I have so far; no point in re-inventing the wheel. What I have:


14412011
13356750
13356494
14280168
14411754
14412267
14477804
13356751
14478060
14675954
13422544
14675698
14741491
14741747
14741748
13948117
14409187
13948374
14541543
14607332
14607078
13948373
14673124
14014166
14739175
14741233
14014424
14871533
14014423
14014167
14805740
14739947
14872047
14937584
15003377
14871790
14013909
14342874
14408667
14408668
15988213
16053749
15987956
16119542
13092807
14408669
15790834
13487822
13553360
15724785
15659248
15725041
14540255
15593712
15132904
15330283
13027014
15001318
13422029
15527919
13553615
13029841


Oh yeah one more thing before I doze off, I have a few adjustments to the randoms system including a Frog & StrangePlant solver. I also have a safer way of handling talking randoms. I'll post my changes tomorrow on a separate thread and we can go from there.

Olly
06-05-2013, 07:13 PM
Eh, uptext should be alot better when simba 994 gets released, since we can actually use simba's uptext finding.

Also, I would loop though the atpa's deleting the crap ones (ones with like... < 5 length).

Flight
06-06-2013, 12:59 AM
Eh, uptext should be alot better when simba 994 gets released, since we can actually use simba's uptext finding.

Also, I would loop though the atpa's deleting the crap ones (ones with like... < 5 length).

Oh nice then I'd like to see it. Is all the OCR-stuff in mml.pas?

Well I never had any problems with it picking up small bits of color pixels; in that small of an area if any of the color is found that's not part of the uptext it'll be so close together that it will be split together with a single character and possibly give an inaccurate result anyways.

Olly
06-06-2013, 02:28 AM
Oh nice then I'd like to see it. Is all the OCR-stuff in mml.pas?

Well I never had any problems with it picking up small bits of color pixels; in that small of an area if any of the color is found that's not part of the uptext it'll be so close together that it will be split together with a single character and possibly give an inaccurate result anyways.

Yes, wizzup has released a version found here(nvm i see you DL'd it already), if you would like to help and give feedback on this it would be great. :)

If to do so, download the upChars07.rar (attached) and replace them with the current upChars07, and then basicly run the script below, and walk around :) (I would use browser, so you can control and walk around while it prints the uptext).

http://paste.villavu.com/show/RrgWXpa2jUiYwKaWofzl/

Now, Im sure you know this but sorry :p you know Simba's uptext isn't perfect and never will be, but if you keep getting the same error ie. same character being misread please report back as much info as you can.. color, background (picture the best obviously), And tomorrow i can hopefully work with wizzup to make it as good as possible.

Flight
06-06-2013, 05:35 AM
Yes, wizzup has released a version found here(nvm i see you DL'd it already), if you would like to help and give feedback on this it would be great. :)

If to do so, download the upChars07.rar (attached) and replace them with the current upChars07, and then basicly run the script below, and walk around :) (I would use browser, so you can control and walk around while it prints the uptext).

http://paste.villavu.com/show/RrgWXpa2jUiYwKaWofzl/

Now, Im sure you know this but sorry :p you know Simba's uptext isn't perfect and never will be, but if you keep getting the same error ie. same character being misread please report back as much info as you can.. color, background (picture the best obviously), And tomorrow i can hopefully work with wizzup to make it as good as possible.

Will do and thanks for the advice.

Edit:
Yep it works wonderful even in some tricky areas. When will this be included in SRL/SRL-OSR?

Edit2:
This is unrelated but it seems the function 'BankScreen' (in SRL-OSR) is either broken with Simba 1.0 or the 07UpChars set you just provided. Just thought I'd give that out as a warning, it might cause some issues in scripts.

Olly
06-06-2013, 01:23 PM
Will do and thanks for the advice.

Edit:
Yep it works wonderful even in some tricky areas. When will this be included in SRL/SRL-OSR?

Edit2:
This is unrelated but it seems the function 'BankScreen' (in SRL-OSR) is either broken with Simba 1.0 or the 07UpChars set you just provided. Just thought I'd give that out as a warning, it might cause some issues in scripts.

ugh, that makes sense because i added shadows onto the fonts, il see if i can get it working else we will just have to have two font folders.

e: Currently it reads the text when you hover over a item wrong sometimes, so once i finally get simba to compile and can use the ocr tool il look into it more.