Log in

View Full Version : text reading functions



Bobzilla69
08-03-2007, 03:24 PM
can any one help me, i am trying to make a script that will just read text on a web page and then write the text/number in the debug window and also use it later in the script to compare it to another amount of text/number.

for example, if there was text writen that said "Level 2" i want it to write it in the debug window, but it also has to compare that to another level found on the screen and if its higher that the original it will click on a location on the screen.

any help will be apriciated

Pentti
08-03-2007, 03:29 PM
You could use GetPage -function to get text from a website. and then use Between -function to get the text you want.

Bobzilla69
08-03-2007, 03:39 PM
ok, but it will all be on the same page, and it page will change depending on what the out come is.

n3ss3s
08-03-2007, 03:45 PM
What?

Bobzilla69
08-03-2007, 03:59 PM
ok i will include a picture that might explain things.
http://www.freewebs.com/ngincorporated/pet.bmp

so as u can see in the picture there is a level 4 and a level 2.
what i want the script to do is compare the level on the left, level 4, to the one on the right, level 2.
next i want it to compare the two levels and if the one on the left is higher than the one on the right, i want it to click a button, say buton A, but if it is not i want it to click another button, say button B.

itSchRis917
08-03-2007, 05:32 PM
well, idk how well this is going to work, i dont even know if it compiles.. but, here's one way to do it. Remember in the GetTextAtEx function to replace the coordinates at the beginning with the coordinates of the start of the number of the level.


program New;

var
c:integer;
Temptxt, Temptxt2 : String;
temptxtint, temptxtint2 : Integer;

begin
c := LoadCharsFromFont2('Arial', 10, False, False, False, False);
Temptxt := GetTextAtEx(105, 260, 100, c, False, False, 0, 5, -1, 2, False, tr_AllChars);
Temptxt2 := GetTextAtEx(354, 256, 100, c, False, False, 0, 5, -1, 2, False, tr_AllChars);
temptxtint := StrToInt(Temptxt);
temptxtint2 := StrToInt(temptxt2);
If (temptxtint > temptxtint2) then
Begin
//Click Button A.
End
Else
//Click Button B.

end.

LordGregGreg
08-03-2007, 05:33 PM
ok i will include a picture that might explain things.
http://www.freewebs.com/ngincorporated/pet.bmp

so as u can see in the picture there is a level 4 and a level 2.
what i want the script to do is compare the level on the left, level 4, to the one on the right, level 2.
next i want it to compare the two levels and if the one on the left is higher than the one on the right, i want it to click a button, say buton A, but if it is not i want it to click another button, say button B.
Lol, dude, i have already made a script for that game :P

trying to make it better for me?

Edit: oh, and chris, the get text doesn work at all, because the font isnt the same, I played with the tolerance like crazy, nothing.

itSchRis917
08-03-2007, 05:55 PM
Try changing the font, i just put 'Arial' cause that's the default font on my computer..

LordGregGreg
08-03-2007, 05:57 PM
Try changing the font, i just put 'Arial' cause that's the default font on my computer..

I cant change the font of the web page eaily, it is controlled by a css template.

Bobzilla69
08-03-2007, 06:41 PM
thanks for all the help, and lordgreggreg i have tryed urs but it didnt work at all, and dont know whats wrong with it.

LordGregGreg
08-03-2007, 07:05 PM
thanks for all the help, and lordgreggreg i have tryed urs but it didnt work at all, and dont know whats wrong with it.hey bob zilla, it works, trust me, it just has a bitmapo for everyu freaking number, lol.

i left very good instruction inside the script why it wouldnt work :) read them

itSchRis917
08-03-2007, 09:55 PM
I cant change the font of the web page eaily, it is controlled by a css template.

I meant try changing the font that it loads from in the script.. ;)

LordGregGreg
08-04-2007, 03:12 AM
I meant try changing the font that it loads from in the script.. ;)um, the fonts that scar and srl use to find the charaters consist of a tiny bit map of each letter... I don't happen to have all the little bit maps of ariel characters..d o you?

itSchRis917
08-19-2007, 03:32 AM
You dont always need those tiny little letters LordGreggReg. Look through the SCAR Help File and search for LoadCharsFromFont2. Here is the function and description:


function LoadCharsFromFont2(fontname: string; fontsize: Integer; fontbold, fontitalic, fontunderline, fontstrike: Boolean): Integer;
Load characters from Windows font in memory.
Example:
c := LoadCharsFromFont2('Courier New', 10, False, False, False, False);


Notice how it says "FromFont". So all you need to do is input a font name(the EXACT font name) as the variable fontname.

LordGregGreg
08-19-2007, 04:26 AM
Are you serious?!? Omg... im such a noob. thank you SO much for showing me this!!!! Omg , isanoob

itSchRis917
08-19-2007, 05:40 AM
lol, no problem greg. we all have brain burps occasionally.