Bixby Sayz Posted September 7, 2012 Share Posted September 7, 2012 (edited) Freddy, Do the files for a custom font have to be named in decimal, or can they be named for their hex value as well? And can they have leading zeros (ie: 065.bmp)? Edit: Nvm. I suck at making fonts. Not having much luck. Edited September 7, 2012 by Bixby Sayz Quote Link to comment Share on other sites More sharing options...
LordJashin Posted September 7, 2012 Share Posted September 7, 2012 Testing out wireless print on Linux ... here's the main tut btw - - Creating your own font set for SCAR Font's aren't too hard. Its using the function that is hard mostly I think. Quote Link to comment Share on other sites More sharing options...
FHannes Posted September 7, 2012 Share Posted September 7, 2012 Freddy, Do the files for a custom font have to be named in decimal, or can they be named for their hex value as well? And can they have leading zeros (ie: 065.bmp)? Edit: Nvm. I suck at making fonts. Not having much luck. Decimal only, no leading 0s, sorry. Quote Link to comment Share on other sites More sharing options...
MarkD Posted September 7, 2012 Share Posted September 7, 2012 You could, obviously, write a script which renames the files to lose the leading zeroes ;-) Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted September 7, 2012 Author Share Posted September 7, 2012 Testing out wireless print on Linux ... here's the main tut btw - - Creating your own font set for SCAR Font's aren't too hard. Its using the function that is hard mostly I think. I followed that guide actually. My chars look exactly (except for using a different font of course) like the ones in the example. Tried 3 different methods of testing my chars and all failed. So then I thought to have a look at OSI's fonts for inspiration. That was a mistake: Some chars have no space to the left, some have 1 pixel, some 2 or more. Same thing on the top, bottom, and right: sometimes no space, sometimes 1 pixel, sometimes 2 or more. No consistency whatsoever. Ugh. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted September 7, 2012 Share Posted September 7, 2012 I followed that guide actually. My chars look exactly (except for using a different font of course) like the ones in the example. Tried 3 different methods of testing my chars and all failed. So then I thought to have a look at OSI's fonts for inspiration. That was a mistake: Some chars have no space to the left, some have 1 pixel, some 2 or more. Same thing on the top, bottom, and right: sometimes no space, sometimes 1 pixel, sometimes 2 or more. No consistency whatsoever. Ugh. Anyone who hasn't got it working before, and dealt with all of it has trouble with it. Me, Shadow, Mark D i think has a thread about this !, Janilabo, Wanted and many more too. The font making is fine in most cases. Just do it like how they have it for now just as a guide to follow have them spaced similarly. Now the function GetTextAt is the main issue. Old wiki sums it up nicely. - function GetTextAtEx(x, y: Integer; Tolerance: Integer; Chars: Integer; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer; TextLength: Integer; Strict: Boolean; Range: TCharRange): string;Reads text at position specified by x, y. Tolerance specifies acceptable color range in for characters that are not completely monochrome, Chars specifies font number returned by LoadChars2 or LoadCharsFromFont2, CheckShadow specifies whether function should look for shadow, CheckOutline specifies whether function should verify if character borders are correct, MinSpacing and MaxSpacing are RS1 and RS2 specific parameters for text with changing spacing between characters, in other cases use MinSpacing=0 and MaxSpacing=0, TextColor specifies text color, if set to -1, will search for text in any color, TextLength - maximal text length to read, if Strict is set to true then it won't find characters that contain additional pixels of character's color in the same area as character is, Range can have following values: tr_AllChars - read all characters; tr_BigLetters - read capital Latin letters; tr_SmallLetters - read lowercase Latin letters; tr_Digits - read digits; tr_BigSymbols - read symbols that are big in size, like "=", "%", "$", etc; tr_SmallSymbols - read small symbols like ".", ",", "'", etc; tr_SecondTableChars - read symbols with character code above 127; tr_Letters = tr_BigLetters or tr_SmallLetters; tr_AlphaNumericChars = tr_Letters or tr_Digits; tr_Symbols = tr_BigSymbols or tr_SmallSymbols; tr_NormalChars = tr_AlphaNumericChars or tr_Symbols; Example: GetTextAtEx(9, 9, 130, UpChars, True, False, 0, 1, $E0E0E0, 20, False, tr_AlphaNumericChars) - read RS2 upper text in this color. GetTextAtEx(96, 387, 0, ChatChars, False, False, 0, 0, -1, 20, True, tr_NormalChars) - read RS2 chat text in any color. UpChars and ChatChars are set up during script initialization like this: UpChars := LoadChars2(AppPath + 'CharsRS22\'); ChatChars := LoadChars2(AppPath + 'CharsChat2\'); So you should use it like this and test changing values somewhat - [sCAR]text := GetTextAtEx(500, 500, 0, FontSetThatWasLoaded, false, false, 0, 5, 000, 20, false, tr_AllChars);[/sCAR] Min and MaxSpacing can either be 0, or change max to like 5-10. I RECOMMEND 0 though more I think. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted September 7, 2012 Author Share Posted September 7, 2012 I generally know the text I want in advance, so use FindColor coupled with FindTextTPAInTPA a lot: Don't need to know the exact position of the text, just a general area. This also failed using my custom font, leading me to suspect my font is not in fact correct. Just to be 200% percent sure I tried grabbing the screen, manipulating it a bit so only the text I wanted was present in white against a black background (just like the font is) and searching for the character bitmap. Nothing. CBF to mess with it anymore. Got too much going on irl and just don't give a damn if I ever it working atm. Quote Link to comment Share on other sites More sharing options...
FHannes Posted September 7, 2012 Share Posted September 7, 2012 Make sure you have font smoothing disabled. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted September 8, 2012 Share Posted September 8, 2012 I think SCAR has a function to disable font smoothing still? Like SetFontSmoothing? Anyway I forgot to mention. When you put the X, AND Y for where you want to find text. Make it the top left pixel of the first letter! Quote Link to comment Share on other sites More sharing options...
MarkD Posted September 8, 2012 Share Posted September 8, 2012 Sjesper has tried something like this as well. Yea, it's a pain in the {*} to get it running. So far there were a lot of problems I've had to hack my way around to get something working, and it's far from finished. I'll try to post something working in the evening. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted September 10, 2012 Author Share Posted September 10, 2012 I am officially giving up on this. I have on the screen in front of me (side by side) The client containing the original text (that was used to create the font), the font character I created (loaded directly from disk), the results of Create Bitmap From Text, and the Results of Create Tpa from Text. The original text and the font character I created match exactly. Both the bitmap and tpa display the same behavior: - Upper case char: 1 pixel taller and 1 pixel narrower than original font - Lower case char: 1 pixel shorter and 1 pixel narrower than original font No wonder it can't find a match. It's looking for the wrong shapes. I suppose I could load each character in from file individually and and create my own search tpa/bitmap but that kinda defeats the purpose. And yes font smoothing is and has been off from the beginning. On a side note when using LoadCharsFromFont2 to load my custom font the script kept bombing later on in the script. If I use rs_LoadChars everything loads but nothing matches up. I can't help but think "It should not be this difficult to perform such a simple task". Quote Link to comment Share on other sites More sharing options...
FHannes Posted September 10, 2012 Share Posted September 10, 2012 You must be doing something wrong, I'm 100% sure it works... I just used it a few days ago... =/ Quote Link to comment Share on other sites More sharing options...
LordJashin Posted September 10, 2012 Share Posted September 10, 2012 I am officially giving up on this. I have on the screen in front of me (side by side) The client containing the original text (that was used to create the font), the font character I created (loaded directly from disk), the results of Create Bitmap From Text, and the Results of Create Tpa from Text. The original text and the font character I created match exactly. Both the bitmap and tpa display the same behavior: - Upper case char: 1 pixel taller and 1 pixel narrower than original font - Lower case char: 1 pixel shorter and 1 pixel narrower than original font No wonder it can't find a match. It's looking for the wrong shapes. I suppose I could load each character in from file individually and and create my own search tpa/bitmap but that kinda defeats the purpose. And yes font smoothing is and has been off from the beginning. On a side note when using LoadCharsFromFont2 to load my custom font the script kept bombing later on in the script. If I use rs_LoadChars everything loads but nothing matches up. I can't help but think "It should not be this difficult to perform such a simple task". Yeah its a real pain in the ass. If I ever have to go through that again, I will make a brand new system, just for that lols. Just borrow some of Janilabos code first Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted September 11, 2012 Author Share Posted September 11, 2012 Note to self: SCAR is incredibly unforgiving on the font path. If you do not include the trailing backslash you are hooped. SCAR will not let you know. It will simply silently fail to load the font and you will spend countless frustrating hours trying to figure out why the damn thing doesn't work. My desk now has an imprint of my forehead and I have a headache. Quote Link to comment Share on other sites More sharing options...
FHannes Posted September 11, 2012 Share Posted September 11, 2012 Note to self: SCAR is incredibly unforgiving on the font path. If you do not include the trailing backslash you are hooped. SCAR will not let you know. It will simply silently fail to load the font and you will spend countless frustrating hours trying to figure out why the damn thing doesn't work. My desk now has an imprint of my forehead and I have a headache. The OCR system dates back from before SCAR 3.00, it will be replaced in the future. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted September 11, 2012 Author Share Posted September 11, 2012 (edited) Creating your own font set for SCARThe problem with the method outlined in this guide is getting the vertical spacing right. I'm looking at the output from the opengl capture and characters I know line up on the bottoms appear as if they all line up along the tops. The author dismisses this as "play around with it until you get the spacing right". Not very helpful. At any rate I have all I need doing it the "hard" way in his guide. Thought I could fill in the remaining punctuation chars using his method but don't think I'll bother. They don't appear to be actually used anywhere in the game. Edit: On a side note if anyone has access to BrainDeath Island can I get a screenshot of talking to 50% Luke (with his name visible in the chat dialog)? Edited September 11, 2012 by Bixby Sayz Quote Link to comment Share on other sites More sharing options...
LordJashin Posted September 12, 2012 Share Posted September 12, 2012 I never tried the OpenGL capture before, if you could, upload a picture of it or something please . Yeah the major problem is figuring out how the old GetTextAt, uses spacing, and how to space your characters in the font set. Also the functions Min and Max settings for spacing... With all the people that have been messing with this. I wonder if Freddy will beat us all once again, or will he adopt Janilabo's methods? Either way, as long as GetTextAt is changed. As it stands now, it is defiled...by RS2 pre Scar-3.00 crap Quote Link to comment Share on other sites More sharing options...