Freelancer Community Network
Reminder: Internet Explorer 6 or below are NOT supported.
HomeHome
ForumForum
WikiWiki
DownloadsDownloads
ForgeForge
Multiplayer Connection Tutorial
Collapse/Expand Random Image
Collapse/Expand Login
Username:

Password:

Remember me



Lost Password?

Register now!
Collapse/Expand Chat
Collapse/Expand Who's Online
35 user(s) are online (18 user(s) are browsing Forum)

Members: 0
Guests: 35

more...
Collapse/Expand Donations
Monthly costs: -30€
Income (ads): +5€
Donations (last month): +10€

Current balance: -70€
(last updated 08/2019)

Please make a donation if you want to help keeping The-Starport online:

Bitcoin address:
Thanks!
Collapse/Expand Links
Collapse/Expand Advertisement
There are currently 35 users playing Freelancer on 31 servers.
August. 19, 2019

Browsing this Thread:   1 Anonymous Users



 Bottom   Previous Topic   Next Topic  Register To Post

(1) 2 »


Infocard XML coding
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3518
Offline
I've been having a go at FL's XML scripting since a few days and I stumbled upon a very odd issue.

I need to understand how the TRA tag works.

Basically, the TRA tags has three parameters: data, mask and ref. I have found out the syntax of data inside FLHook's manual, but the rest puzzles me. I've tried to find patterns within the different values, and I'm starting to believe either mask or ref "cancel" out the style defined by an earlier TRA tag. However, I haven't found a way to make them work.

Here's a little compilation of TRA tags.

<TRA data="96" mask="-32" def="-1"/>
<TRA data="24" mask="24" def="-25"/>
<TRA data="65280" mask="-32" def="31"/> //Red
<TRA data="65281" mask="-31" def="30"/> //Bold Red
<TRA data="2" mask="2" def="-3"/> //Italic
<TRA data="0" mask="2" def="-1"/> //Normal
<TRA data="1" mask="1" def="-2"/> //Bold
<TRA data="5" mask="5" def="-6"/> //Bold underline
<TRA data="3" mask="3" def="-4"/> //Bold italic

I don't know what the first two do. And here's the same tags written as hex:

<TRA data="0x00000060" mask="0xFFFFFFE0" def="0xFFFFFFFF"/>
<TRA data="0x00000018" mask="0x00000018" def="0xFFFFFFE7"/>
<TRA data="0x0000FF00" mask="0xFFFFFFE0" def="0x0000001F"/> //Red
<TRA data="0x0000FF01" mask="0xFFFFFFE1" def="0x0000001E"/> //Bold Red
<TRA data="0x00000002" mask="0x00000002" def="0xFFFFFFFD"/> //Italic
<TRA data="0x00000000" mask="0x00000002" def="0xFFFFFFFF"/> //Normal
<TRA data="0x00000001" mask="0x00000001" def="0xFFFFFFFE"/> //Bold
<TRA data="0x00000005" mask="0x00000005" def="0xFFFFFFFA"/> //Bold underline
<TRA data="0x00000003" mask="0x00000003" def="0xFFFFFFFC"/> //Bold italic

Anybody has any further info on the matter?

Posted on: 2008/7/11 18:35
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: Infocard XML coding
Starport Admin
Joined:
2009/2/21 21:42
Group:
Webmasters
Registered Users
Posts: 3518
Offline
*Cough* Bump?.... ???

Posted on: 2008/7/13 3:14
"Cynicism is not realistic and tough. It's unrealistic and kind of cowardly because it means you don't have to try."
-Peggy Noonan
Top
Re: Infocard XML coding
Home away from home
Joined:
2008/2/10 22:00
Group:
Registered Users
FLServer Admins
Senior Members
Posts: 1281
Offline
Not a clue how it works. I do know that each of the ID_Info's define a different section of what you see, some are for what you see in the ship dealer and one of them is for the what other players see when they scan your ship.

You might want to go through the following information in the link below for the MSXML format

http://msdn.microsoft.com/en-us/library/ms256177(VS.85).aspx

Posted on: 2008/7/13 15:34
Galaxy Empire
Youtube Videos
Facebook
Top
Re: Infocard XML coding
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1908
Offline
I would have thought there'd be more info on XML/RDL, but a search for "underline" (since "tra" and "rdl" are too small) only seemed to yield this topic. Since I've just gone through it again for my patch, here's a complete description of the TRA tag.

<TRA
data="0xBGRA|<number>"
mask="0xBGRA|<number>"
def="0xBGRA|<number>"
color="default|gray|blue|green|aqua|red|fuchsia|yellow|white|#RGB|<number>|0x<hexnumber>"
font="default|<number>"
bold="default|true|false"
italic="default|true|false"
underline="default|true|false"
/>

RGB is, of course, the red/green/blue component of the color, as a two-digit hex number. A is the attribute, storing the font and bold/italic/underline settings: 1 = bold, 2 = italic, 4 = underline, remaining bits are the font number (see DATA\FONTS\rich_fonts.ini; the number used by FONT is one more than this). DATA contains the new value; MASK contains the bits that should be set from DATA; DEF contains the bits that should be made default. So if we take your "bold/red" example:

data="65281" (0x0000FF01) -> red + bold
mask="-31" (0xFFFFFFE1) -> all color bits and the bold bit are relevant, don't change anything else
def="30" (0x0000001E) -> use default font/italic/underline

For my patch, I've replaced all these with the smaller strings: <TRA color="#FF0000" bold="true"/>...<TRA color="default" bold="false"/>

The RGBs for the color names:

gray = #808080
blue = #4848E0
green = #3BBF1D
aqua = #87C3E0
red = #BF1D1D
fuchsia = #8800C2
yellow = #F5EA52
white = #FFFFFF

If you choose to use a number for the color, one is subtracted from it, for some reason.

BTW, the complete text of all the resource files (687k; .rc files; before I made use of COLOR and FONT) can be found on my site.

Posted on: 2009/8/20 15:28
Top
Re: Infocard XML coding
Just popping in
Joined:
2010/4/6 16:55
From New York
Group:
Registered Users
Posts: 9
Offline
Very nice description, and makes almost complete sense to me.


I do have two questions regarding the color specification:

When you say <number>, is that the numeric equivalent of the hex value used in #RGB, or is it the number that would be the color component of the data="0xBGRA" field? (I'm assuming the second, but want to verify)

Similarly, when it is '0x<hexnumber>', I'm assuming that's the same thing that would be in the data field, except ignoring the last (attribute) pair?

Also,
Quote:
If you choose to use a number for the color, one is subtracted from it, for some reason.

You mean from each color individually, or from the whole number?

I ask this instead of trying it myself because I'm working on an XML to HTML converter that verifies the syntax and shows what it would look like ingame in the browser, and those two are the only remaining unknowns in the script.

Posted on: 2010/5/18 2:37
Top
Re: Infocard XML coding
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1908
Offline
Quote:
When you say <number>, is that the numeric equivalent of the hex value used in #RGB, or is it the number that would be the color component of the data="0xBGRA" field? (I'm assuming the second, but want to verify)

Similarly, when it is '0x<hexnumber>', I'm assuming that's the same thing that would be in the data field, except ignoring the last (attribute) pair?

In both cases, <number> is just a straight decimal number, equivalent to the 0x number, so it does include the attribute. e.g. #010203 == 0x03020100 == 50462976. (I think, anyway.)

Quote:
Quote:
If you choose to use a number for the color, one is subtracted from it, for some reason.

You mean from each color individually, or from the whole number?

The number as a whole. e.g. 50462976 -> 50462975 == 0x030200FF. (Again, I think. It's just as easy for you to experiment, as for me.)

Posted on: 2010/5/18 7:09
Top
Re: Infocard XML coding
Just popping in
Joined:
2010/4/6 16:55
From New York
Group:
Registered Users
Posts: 9
Offline
After a week or two of work on a web-based infocard development 'application' for the Discovery dev team, I have a part of that code that I want to release to the dev community at large, and I hope that it is useful to someone.

A php class that facilitates working with XML infocards:
http://cshake.homeip.net/disco/class.FreelancerXML.phps

Features:

  • Input and output XML card strings, user-specified encoding

  • Input and output bbcode-style format

  • Validates input XML infocards, giving details on any errors

  • Outputs valid XHTML that shows exactly what the infocards will look like in-game (when given the blue background)

  • Input and output HTML for use in, and generated by, browser-based rich-text editors (compatibility issues with adding new paragraphs or linebreaks in IE8, no support for text justification in IE or Opera, everything else works fine in those, everything works in Firefox 3.6)

  • Fully usable in both 32- and 64-bit environments



The BBCode translator works for all possible XML tags, and will produce functionally identical infocard markup when converted back and forth an unlimited number of times.
The supported 'bbcode' tags are:
Code:
[b] [i] [u] [align=(left|right|center)] [font=(default|0-7)] [color=(#rrggbb|default|named colors)]


The XML writer will use the 'pretty' human-readable color="red", bold="true" style TRA tags by default, but will also output the 'raw' data/mask/def style tags if desired. In the case of reading in a 'pretty' style infocard, the output will be identical (even if converted to bbcode and back). When reading in a 'raw' style infocard, the output will be identical if not converted to bbcode, but if it is converted the mask and default values may be slightly different, but will function identically in-game. This comes from me always masking all the color bits when a color is specified, and always masking 0xF8 when a font is specified, while 0x38 (font numbers 0-7) is usually used in the vanilla cards.

The code is (I believe) fully commented and readable. Except for the use of variable-type arrays it should be easy enough to port to C/C++ if the FLDev people want to improve their 'bbcode' editor.

Thank you very much to adoxa for the <TRA> explanation here!

[edit]6/10/10 - did some fixes, changed the link to the latest version instead of a specific one.[/edit]

Posted on: 2010/5/24 18:14
Top
Re: Infocard XML coding
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1908
Offline
No worries. I did miss one thing, though: TRA is Text Render Attributes, not transform (and RDL is Render Display List).

Posted on: 2010/5/25 7:53
Top
Re: Infocard XML coding
Just popping in
Joined:
2010/8/17 9:45
Group:
Registered Users
Posts: 2
Offline
Here's a question, how can you change info cards? Can someone explain how to change them from A to Z?

Posted on: 2010/9/26 10:16
Top
Re: Infocard XML coding
Just can't stay away
Joined:
2010/2/2 13:57
Group:
Registered Users
$$$ Supporters $$$
Posts: 351
Offline
Use Freelancer Developer or FLEd-ids, both are self-explaining I think...

Posted on: 2010/9/26 20:08
Top
Re: Infocard XML coding
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1908
Offline

Posted on: 2010/9/27 5:51
Top
Re: Infocard XML coding
Just popping in
Joined:
2010/8/17 9:45
Group:
Registered Users
Posts: 2
Offline
Tried FRC, I can't get my head around it and yes I have ran it from command line since you used that programming method.

Having a go at FLEd.

Thanks for the info guys

Posted on: 2010/10/2 8:12
Top
Re: Infocard XML coding
Home away from home
Joined:
2009/8/16 2:58
From Qld, Aus.
Group:
Registered Users
FLServer Admins
Trusted Speciality Developers
Senior Members
Posts: 1908
Offline
I was so pleased with FRC, yet no one seems to use it. I thought it was so simple, but perhaps not.

Code:
E:\contrib\games\Freelancer\frc>type test.frc
S 1 name
H 2 infocard

E:\contrib\games\Freelancer\frc>frc test

E:\contrib\games\Freelancer\frc>..\res2rc test.dll

E:\contrib\games\Freelancer\frc>type test.rc
STRINGTABLE
{
1,      "name"
}


2 23
{
L"<RDL><PUSH/>\
<TEXT>infocard</TEXT><PARA/>\
<POP/></RDL>"
}

What's so hard about that?

Posted on: 2010/10/2 16:29
Top
Re: Infocard XML coding
Not too shy to talk
Joined:
2008/3/15 16:10
From Slovenia
Group:
Registered Users
Posts: 75
Offline
I love your FRC adoxa its a lot easier to edit/add text then using old FLEdids.

Posted on: 2010/10/2 17:01
Top
Re: Infocard XML coding
Starport Admin
Joined:
2008/2/26 20:36
From Germany
Group:
Webmasters
Registered Users
Posts: 1771
Offline
adoxa, could you submit your various tools to our download section? I think they fit there better than in forum posts as attachments.

Posted on: 2010/10/2 18:21
Top
(1) 2 »