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