SRL Archive - Test corner

UpText Experiment


masquerader

2006-11-12 01:41:42

Seeing as the current methods of getting the uptext are spotty at best, and scripters have to resort to things like isuptextmulti, i figured i would try to come up with something new

this here is my second try :tongue:
the first one only used shadows and sucked

anyway, it takes the uptext colors in tpoint arrays, plots them on a bitmap, and then uses that for text stuff

ive had some success with it
the hard part is the colors and tolerances, so it will either be 100% or nothing
i made a debug window, so its easy to see if they work
just push play, then move your mouse over something within 3 sec

i guess what i really need is for people to see if they can come up with any better colors for the uptexts
it seemed like every couple minutes, the colors would completely change and break everything :(

program UpText;
//masquerader

var
textbmp,i,t:integer;
orangepoints,whitepoints,bluepoints,yellowpoints:tpointarray;
debugcanvas:tcanvas;
upchars,handle:integer;
begin
UpChars:=LoadChars2(AppPath + 'includes\SRL\UpChars\');
wait(3000);
t:=getsystemtime;
textbmp:=bitmapfromstring(500,17,'');
fastdrawclear(textbmp,0);

//white
findcolorstolerance(whitepoints,13624288,7,7,507,23,43);
//orange
findcolorstolerance(orangepoints,3705570,7,7,507,23,35);
//blue
findcolorstolerance(bluepoints,13224197,7,7,507,23,60);
//yellow
findcolorstolerance(yellowpoints,711645,7,7,507,23,50);

for i:=0 to getarraylength(whitepoints)-1 do
fastsetpixel(textbmp,whitepoints[i].x-7,whitepoints[i].y-7,16777215);
for i:=0 to getarraylength(orangepoints)-1 do
fastsetpixel(textbmp,orangepoints[i].x-7,orangepoints[i].y-7,16777215);
for i:=0 to getarraylength(bluepoints)-1 do
fastsetpixel(textbmp,bluepoints[i].x-7,bluepoints[i].y-7,16777215)
for i:=0 to getarraylength(yellowpoints)-1 do
fastsetpixel(textbmp,yellowpoints[i].x-7,yellowpoints[i].y-7,16777215)

displaydebugimgwindow(500,17);
debugcanvas:=getdebugcanvas;
copycanvas(getbitmapcanvas(textbmp),debugcanvas,0,0,500,17,0,0,500,17);
handle:=getclientwindowhandle;
settargetbitmap(textbmp);
writeln(gettextatex(0,0,0,upchars,false,false,0,2,16777215,60,false,tr_normalchars));
setclientwindowhandle(handle);
writeln(inttostr(getsystemtime-t)+' ms');
end.

Wizzup?

2006-11-12 02:02:19

RSC font has been loaded
10.02.2006

SCAR will be continued once I get time. The next version
will have sound detection (by Shocker) and other things.
Elite scar scripters community SRL is alive, too.



User specified a new RS window
Successfully compiled
Use Raw shark / 2 more options
47 ms
Successfully executed
Successfully compiled
Walk here Raze The Fox / 2 more options
46 ms
Successfully executed
User specified a new RS window
Successfully compiled
Net Fishing spot / 3 more options
47 ms
Successfully executed
Successfully compiled
Walk here / 3 more options
47 ms
Successfully executed


Is this only for UpText, or also for functions like ClickOption, because then there is also red-coloured text.

Boreas

2006-11-12 02:08:11

Not 100% but still impressive. Sometimes it was like braille, dunno what that is. Sometimes it didnt pick it up at all in certain fonts like View ____ Guide and Cast ___ for guides and spells. Sometimes it got o as c, I/l/1. Most of the time perfect, or at least enough of the phrase. Fast too.

User specified a new RS window
Successfully compiled
Talk-to Dondakan the Dwarf / 2 more options
78 ms
Successfully executed
Successfully compiled
Use Gold ore / 2 more options
47 ms
Successfully executed
User specified a new RS window
Successfully compiled
Use Gold ore / 2 more options
62 ms
Successfully executed
User specified a new RS window
Successfully compiled
Use Mind rune / 2 more options
46 ms
Successfully executed
User specified a new RS window
Successfully compiled
Wield Rune pickaxe / 3 more options
47 ms
Successfully executed
User specified a new RS window
User specified a new RS window
Successfully compiled
. . .. …. . . …… ….. . ………. .. .. … .
32 ms
Successfully executed
User specified a new RS window
Successfully compiled
Use Coins / 2 more options
109 ms
Successfully executed
Successfully compiled
Use Air rune / 2 more options
47 ms
Successfully executed
Successfully compiled
Wield Rune pickaxe / 3 more options
63 ms
Successfully executed
Successfully compiled
Use Mind rune / 2 more options
47 ms
Successfully executed
Successfully compiled
: : .: : : : ' : : : : : : :
63 ms
Successfully executed
User specified a new RS window
Successfully compiled
Use Gold cre / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Law r. ne / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Gold cre / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Gold ore / 2 more options
62 ms
Successfully executed
Successfully compiled
Use Gold ore / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Gold ore / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Gold ore / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Coins / 2 more options
46 ms
Successfully executed
Successfully compiled
Wield Staff of fire / 3 more options
47 ms
Successfully executed
Successfully compiled
Use Air rune / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Mind rune / 2 more options
47 ms
Successfully executed
User specified a new RS window
Successfully compiled
Use Coins / 2 more options
47 ms
Successfully executed
Successfully compiled
Use Air rune / 2 more options
62 ms
Successfully executed
Successfully compiled
Wield Rune pickaxe / 3 more options
46 ms
Successfully executed
Successfully compiled
Walk here
47 ms
Successfully executed
Successfully compiled

47 ms
Successfully executed
Successfully compiled
Use Coins / 2 more options
47 ms
Successfully executed
Successfully compiled

94 ms
Successfully executed
Successfully compiled
Use Mind rune / 2 more options
62 ms
Successfully executed
Successfully compiled
Talk-to Dondakan the Dwarf / 2 more options
62 ms
Successfully executed
Successfully compiled
Walk here / 1 more options
47 ms
Successfully executed
Successfully compiled
Walk here / 1 more options
47 ms
Successfully executed
Successfully compiled

47 ms
Successfully executed
Successfully compiled
: : .. ..c: :
47 ms
Successfully executed
Successfully compiled
:.c..c c : : : : : ' : : : : : : :
47 ms
Successfully executed
Successfully compiled
Remove Gold helmet / 2 more options
47 ms
Successfully executed
Successfully compiled
Remove . : : : :: : / 2 more options
47 ms
Successfully executed
Successfully compiled
Remove . : : : :: : / 2 more options
47 ms
Successfully executed
Successfully compiled
Remove . : : : :: : / 2 more options
47 ms
Successfully executed
Successfully compiled
Remove Rune pickaxe / 2 more options
46 ms
Successfully executed
Successfully compiled
Message Masq / 1 more options
46 ms
Successfully executed
Successfully compiled
Message Srl ls Cool / 1 more options
47 ms
Successfully executed
Successfully compiled
Cook's Assistant
63 ms
Successfully executed
Successfully compiled
View guide
31 ms
Successfully executed
Successfully compiled
View guide
47 ms
Successfully executed
Successfully compiled
View guide
47 ms
Successfully executed
Successfully compiled
lmpale
63 ms
Successfully executed
Successfully compiled
Spike
63 ms
Successfully executed
Successfully compiled
Smash
46 ms
Successfully executed
Successfully compiled
Block
47 ms
Successfully executed
Successfully compiled
Auto Retaliate
47 ms
Successfully executed
Successfully compiled
Cast
47 ms
Successfully executed
Successfully compiled
Cast
63 ms
Successfully executed
Successfully compiled
Select
47 ms
Successfully executed
Successfully compiled
Black Knights' Fortress
47 ms
Successfully executed

IronTeapot

2006-11-12 12:26:33

Very sexy indeed.
I put it into a repeat untill isfkeydown loop so i wouldnt have to keep pressing play.


User specified a new RS window
Successfully compiled
Talk-to Banker / 3 more options
78 ms
Talk-to Banker / 9 more options
62 ms
Walk here Egghead799 / 10 more options
62 ms
Walk here / 1 more options
62 ms
Walk here / 1 more options
47 ms
Walk here / 1 more options
62 ms
Walk here Beadeloria02 / 2 more options
47 ms
Walk here / 1 more options
62 ms
Walk here Kobe B24 / 4 more options .. -
63 ms
Walk here Yellowjet1 . / 4 more options ' .
46 ms
. '
31 ms
Cook's As: s:ant . ' .
47 ms
Black Knigi ts' Fortress . ' .
47 ms
lmp Catch: . ' .
31 ms
Select . ' .
32 ms
Punch . ' .
47 ms
Talk-to Al the Camel / 4 mo:. . . :ions ' .
62 ms
Walk here m Poor206 . / 2 more options | .
47 ms
Walk here / 1 more options . | .
62 ms
Walk here Rapidman 6 . / 2 more options | .
47 ms
Walk here Pluto Arrow . / 2 more options ' .
47 ms
View guide . ' .
46 ms
View . guide . ' .
47 ms
View : . de . '
31 ms
. '
47 ms
Cast . '
31 ms
Cast . '
47 ms
. '
31 ms
Show Equip . : .t Stats . ' .
47 ms
Show Equip . : .t Stats . ' .
47 ms
. |
47 ms
Walk here . 1 ..ore options . | .
47 ms
. |
47 ms
Successfully executed

And like someone mentioned i think, it doesent work for the green text of spells, or orangey text of the skill guides(although thats sorta pointless)

Pyro

2006-11-12 13:28:31

You guys shoudl really try readuptext(text) by i think its be mutant. It makes the bitmap masks individually and checks for them. Hasnt failed me yet.

masquerader

2006-11-12 14:02:24

From: Pyro
You guys shoudl really try readuptext(text) by i think its be mutant. It makes the bitmap masks individually and checks for them. Hasnt failed me yet.

lol, i thought thats what the scar text functions did :tongue:
i was under the impression that loadchars made an array of the char bitmaps and then used that to find text (which would naturally be faster than doing it in a scar script)

this only works for the 4 colors i have made so far (white, orange, yellow, blue)
i'll have to look for the green, but im not going to get colors for all of red-green for player levels
the "braille effect" seems to come from a sudden, drastic change in the text colors
the colors need some work, and i decided that it should have more colors with smaller tolerances than a few colors with high tolerances
theres no problems with duplicity or anything, except for a little speed

so now im looking for 2-4 colors that will find all of the text colors with low tolerances :sasmokin:

tarajunky

2006-11-12 16:46:25

EDIT:: THIS JPG SCREWS UP THE COLORS, LOOK AT THE ATTACHED BMP BELOW FOR AN ACCURATE PICTURE OF THE TEXT ON A BLACK BACKGROUND. I WILL LEAVE THIS JPG UP AS AN EXAMPLE OF WHERE TO GET TEXT ON A BLACK BACKGROUND. ::EDIT

Ok, I'm taking a look at the text colors now.

The first thing I've noticed is that ALL the text colors seem to be a 'pure' color that is then modulated by the background.

So, if you have text on a completely black background you see the 'pure' colors.

In the attached picture you have a black background and all the color text is uniform and pure.

By pure I mean this…


COLOR RED GREEN BLUE
----- --- --- ---
14013909 213 213 213
54741 213 213 0
54635 107 213 0

The first color is the white text. Red=Green=Blue
Second Color is the Yellow Text. Red=Green, Blue=0
Third is the Green text. Red=Green/2, Blue=0.

And in all cases the core color for each parameter is 213. If you reload the world, the core number changes but these other relationships stay the same.

If you have Blue text it would be Red=0, Green=Blue=213.

If we could get a valid range for the core colors, perhaps we could do something special with the colorfinding.

WT-Fakawi

2006-11-12 17:04:15

Yes Tara is right. The UpText is a little transparent, but still the White consists of more then one color even under color 0.

I too am under the impression loadchars loads a BitmapMask array for comparison in memory. Doesnt it work that way?

tarajunky

2006-11-12 17:12:54

Oops, sorry about that. The text IS uniform on a bitmap. The jpg introduced all those messy colors. I cut out just the text part of that same picture from the bitmap that I saved before compressing it, so look at this one for a true representation.

masquerader

2006-11-12 17:55:46

kk, now im working on the font transparency factor
im just looking at the white text now
i got near the water where the text was on both black and the water
i did two tests:
#1
color:14211288 white on black
red:216
blue:216
green:216

color:11306868 water
red:116
blue:172
green:135

color:15920361 white on water
red:233
blue:242
green:236

change:
red +17
blue +26
green +20

#2
color:13355979 white on black
red:203
blue:203
green:203

color:11306868 water
red:116
blue:172
green:135

color:15591138 white on water
red:226
blue:237
green:230

change:
red +23
blue +34
green +27
the water stayed the same, so i dont see why the change in rgb would be different
if anybody can see a pattern, please share ;)

tarajunky

2006-11-12 18:30:09

Just an observation, but if you look at your core colors, they are 13 units apart. Now if you look at the difference between the changes, they are 6-7 units apart. 6-7 just happens to be 13/2, so I wonder if the amount of change is related to the core value you are changing.

Perhaps as the RGB values for white and blue get closer, they increase the amount of change in order to generate contrast. I don't know, but those are some very useful data. How did you get the blue color to stay constant? Just luck? :)

masquerader

2006-11-12 18:51:11

From: tarajunky
Just an observation, but if you look at your core colors, they are 13 units apart. Now if you look at the difference between the changes, they are 6-7 units apart. 6-7 just happens to be 13/2, so I wonder if the amount of change is related to the core value you are changing.

Perhaps as the RGB values for white and blue get closer, they increase the amount of change in order to generate contrast. I don't know, but those are some very useful data. How did you get the blue color to stay constant? Just luck? :)

i didnt reload the client, i just did it again 15 sec later and the white color had changed but the water was the same

data when the text isnt on the black and the water at the same time is probably unreliable because of how the colors seem to change for no reason

Pyro

2006-11-12 19:19:40

Masq abotu the masks. It does but it puts them in a line. And then checks spacing etc then checks all at once. If you look at them each individually spacing doesnt matter.

masquerader

2006-11-22 22:26:39

anyway, im not sure how much farther you can go with this transparency idea
i did another trial, and discovered that the white text when its on black is solid,
but when it was on the solid water color, it became 2 different colors
in other places where the color behind it isnt solid, the text could be dozens of colors

that, combined with the fact that the white text seems to change every 15 seconds, makes this idea seem dead

i'll post my last batch of data, in case anybody can see any trends :p
again, they have the same water color

1
white color:13619151
r:207
b:207
g:207

water color:11109233
r:113
b:169
g:131

white on water color 1: 15656932
r:228
b:238
g:231

white on water color 2: 14079444
r:212
b:214
g:213
2
white color:13158600
r:200
b:200
g:200

water color:11109233
r:113
b:169
g:131

white on water color 1: 15525088
r:224
b:236
g:228

white on water color 2: 13749966
r:206
b:209
g:206
btw, 200 200 200 is about the lowest ive seen the baseline white, i dont know what that means

if anybody thinks its worth pursuing the thing i first posted, reply, or else im done with this :p