PDA

View Full Version : Learning me some ruleset coding...



Varsuuk
February 26th, 2017, 04:50
So... I am reading references as well as going through the tutorials recommended earlier by Trenloe and others in my last post.

Right from the get-go - starting by looking at CoreRPG and I don't seem to know where to look to see where the "options" for the following line are described. I don't see it in the reference section listing xml/lua elements. But that is probably OBVIOUS to all but a beginner that it is not the right place, ie Apples/Oranges.

<announcement text="CoreRPG ruleset v3.2.2 for Fantasy Grounds\rCopyright 2015 Smiteworks USA, LLC" font="emotefont" icon="rulesetlogo_CoreRPG" />

So...
1. What is valid for an "<announcement> element?
2. Is there some way to give something like "fontsize=..." or do those fonts need to be in the graphics/fonts per size already? (you see, I am also ignorant about fonts/graphics... just really into C++ server coding...)
3. Lastly, I don't imagine you can mix fonts on on "line" of output. I can't imagine how it would be represented in the XML, but figured I'd ask.

Varsuuk
February 26th, 2017, 05:21
So I decided to add a second line under the Title for a "by Dan Delgado" etc

I used the standard emote font, but I wanted it to indent and line up beneath the ruleset name.
I haven't yet even added "placeholder" graphics, so it is using the CoreRPG d20 icon.

I didn't know how to indent (tried a "\tby Dan..." to see where a tab would move me in, knowing it couldn't line up but maybe good enough... nope, no movement.) so I took the png of the icon, erased all of the image and renamed it to rulesetlogo_Blank.png. That "worked" perfectly. However, figure there is a more right way to do it, maybe there are attributes for x,y pos (see first question). Figure loading an icon uses up some resources and since it is a blank one, it is extra worthless :) - Thoughts/tips?

celestian
February 26th, 2017, 05:24
Can't answer all the question but I can point ya to some files that might help.

emotefont originates in CoreRPG/graphics/graphics_fonts.xml
the icon originates from CoreRPG\graphics\graphics_icons.xml

If you've not already done so, check out notepad++ and use the "find in all files" option. It REALLY helps fine this stuff. You'd just search for "emotefont" in all files and trace back to where it came from. You're really gonna need it for a lot of reasons.

Also, if you've not already "opened up" the CoreRPG and dumped it into a local directory for that, you want to do it also.

To make fonts you'll need to use the FGFontGenerator.exe. Far as I know you can't use a fontsize but Trenlo will know for sure I imagine.

Varsuuk
February 26th, 2017, 06:23
Can't answer all the question but I can point ya to some files that might help.

emotefont originates in CoreRPG/graphics/graphics_fonts.xml
the icon originates from CoreRPG\graphics\graphics_icons.xml

If you've not already done so, check out notepad++ and use the "find in all files" option. It REALLY helps fine this stuff. You'd just search for "emotefont" in all files and trace back to where it came from. You're really gonna need it for a lot of reasons.

Also, if you've not already "opened up" the CoreRPG and dumped it into a local directory for that, you want to do it also.

To make fonts you'll need to use the FGFontGenerator.exe. Far as I know you can't use a fontsize but Trenlo will know for sure I imagine.

I found and setup the new fonts I added. Was just wondering if the <announcements> element had other attributes, especially font related.

I recall there being this FGFontGenerator.exe, where is it? I didn't see it in what I think is the install dir (I have both Steam and standalone, so it is ONE of those 2 I found) with the other exes.
Never used it.

celestian
February 26th, 2017, 06:35
I found and setup the new fonts I added. Was just wondering if the <announcements> element had other attributes, especially font related.

I recall there being this FGFontGenerator.exe, where is it? I didn't see it in what I think is the install dir (I have both Steam and standalone, so it is ONE of those 2 I found) with the other exes.
Never used it.

I'm not 100% certain but check your Fantasy Grounds install directory. I "think" it comes with it... if, not well, that's where I put it when I got it.

You can get it here in any case.

https://www.fantasygrounds.com/filelibrary/FGFontGenerator.exe

Bidmaron
February 26th, 2017, 13:30
You can also use truetype fonts without using the generator. See here (https://www.fantasygrounds.com/forums/showthread.php?20836-HTML-Symbols&p=172406&highlight=truetype#post172406). Seems like this is finally documented somewhere, but I could not locate it.

Varsuuk, search the forums, as I asked the question about announcement a few months back and MW explained it I think. They REALLY need to update their documentation files for that and the font tag (and there is at least one other missing from the documentation too, if I remember correctly).

There is no easy way to line up text in the chat box. Tabs do not work. (well, I've never gotten them to work, anyway).

Talyn
February 26th, 2017, 15:51
I don't really code for lining up in the chat window but for attempting to line text up in the text areas, I use hard spaces quite a bit. Often just to get around some wonkiness with FG's rendering of certain combined elements, such as a bold or italic combined with either a carriage return code #13 or with any punctuation, where FG renders an extra space that shouldn't be there. So I'll start the entire section with a hard space #160, that way every line is vertically aligned, though it's "indented" a single space.

The catch is text areas are formatted text while the <announcement> tag is a string. No idea if there's an escape code for a hard space...

Andraax
February 26th, 2017, 16:10
The catch is text areas are formatted text while the <announcement> tag is a string. No idea if there's an escape code for a hard space...

Try: "&nbsp;"

Varsuuk
February 26th, 2017, 16:24
You can also use truetype fonts without using the generator. See here (https://www.fantasygrounds.com/forums/showthread.php?20836-HTML-Symbols&p=172406&highlight=truetype#post172406). Seems like this is finally documented somewhere, but I could not locate it.

Varsuuk, search the forums, as I asked the question about announcement a few months back and MW explained it I think. They REALLY need to update their documentation files for that and the font tag (and there is at least one other missing from the documentation too, if I remember correctly).

There is no easy way to line up text in the chat box. Tabs do not work. (well, I've never gotten them to work, anyway).


I started searching on <announcement> last night but ... as you may guess this returned like pages and pages of replies because it matched "announcement"
Will look for your posts + that next.

Varsuuk
February 26th, 2017, 16:27
Try: "*"

Not in the <announcement> tag (guessing because as Bid says, it is not a "Formatted Text" field.)
However, thank you - you know I never knew nbsp stood for that concept. Hell, I'd forgotten about the concept of non-breaking spaces since I never did any layout work. I just "vooshed" over the "nb" part of "nbsp" and read it as "space" in html (another thing I barely ever looked at)

Having fun poking and searching threads and writing stuff into my little notebook!

Talyn
February 26th, 2017, 16:29
Try: "*"

That's the alternative for #160 and isn't an escape code, like \r is for carriage return. I'm not aware of a \h or something that will do a hard space. You can try the HTML codes and see if they'll render in a string, though. If so, cool, don't even worry about escape codes.

Moon Wizard
February 27th, 2017, 22:42
The only attributes for the announcement tag are: text, font, icon
The font and icon must be valid assets defined by the ruleset.

There is also a ttf tag which may not be fully documented yet allows defining of a ruleset font asset using a TTF file.
It supports the following attributes: file, name, size, bold/weight, italic, underline, strikethrough
The file must be a valid TTF file, the name must refer to a font defined within the TTF file, and the size is the FG font size (not point size).

Regards,
JPG