Locomotion Text Formatting Control Characters

Discuss, get help with, or post new modifications, graphics or related tools for Locomotion in this forum.

Moderator: Locomotion Moderators

Post Reply
Posts: 14
Joined: 01 Feb 2017 09:57

Locomotion Text Formatting Control Characters

Post by crchinoy »

I can't imagine anyone is left here to care about this discovery, but just for the sake of getting information out there, I thought I'd post this. It's a neat little glimpse into the workings of Locomotion.

Accidental discovery: Locomotion can parse out hex codes for ASCII control characters in text strings. Apparently Chris Sawyer used these to call text formatting when writing the game.
What that means is you can toss the following control characters at the beginning of an object name, etc. when editing the XML of an object, and they actually do interesting things as follows:

> \05 offsets the text 1 full character height down (i.e., the top of the text aligns with the bottom of normal text)
> \06 offsets the text 1/2 height down (i.e., the center of the text aligns with the bottom of normal text)
> \07 produces teeny-tiny text
> \08 produces the great big serif-font text used in newspaper headlines
> \0A produces the regular text font, un-bolded--this does not normally appear anywhere in the game!
> \0D produces greyed-out text
> \0E and \0F appear to force text to remain white even where the game normally displays it in black

> \02 changes the color of the text, and is controlled by an additional prefix character as follows:
>> \020 and \021 produce red text, as used for negative dollar amounts
>> \022 produces a medium-grey text with light grey drop shadow--i.e., shadow text.
>> \023 produces a light pink text I don't recognize
>> \024 also produces medium-grey text, but with the drop shadow pixels the same shade of grey--not useful.
>> \025 and \026 produce black text, with the drop shadow pixels also filled in black--very ugly and useless.
>> \027, \028 and \029 all produce dark maroon text
>> \02A, \02B and \02C all produce dark blue text
>> \02D, \02E, \02F, \02G and beyond all produce brown text, matching the brown background of Scenario Editor

> \03, \04, \0B and \0C don't appear to do anything, but aren't printed (i.e., the game interprets them as control characters, not part of the text--they just aren't assigned to any formatting)

> \00 wipes out the text completely, \01 indents the text about half an inch and eats the first character of the string as if it's a third digit of control character, but it doesn't seem to affect the amount of indent. I have no idea what these are used for. A string beginning with a backslash followed by any other two characters either has no effect, or causes the text not to display at all.

Insert these control characters directly at the start of strings, without following spaces. A control character inserted partway through a string will specify the formatting for all text that follows it; it can be preceded by plain text or by text formatted with another control character. However, I didn't find an escape character to end a section of formatted text and return to normal text in the middle of a string.

These control characters (even those that don't change the appearance of the text) DO alphabetize, meaning that names that begin with them appear in the menu above 0-9 and A-Z. The non-printing, non-formatting control characters could be used to solve the problem people once complained about, that there needed to be a better way than annoying name prefixes to organize different mod packs in the vehicle list.

I actually stumbled on this years ago by copy and pasting the wrong thing in the xml while editing an object, and never went back to figure out what happened to make the un-bolded text it was showing me. I was cleaning some old files today and found that very same file in a folder marked "weird bug save for later"... I had to take another look, and further exhaustive experimentation yielded the above results.

User avatar
Posts: 3900
Joined: 15 Mar 2012 02:48
Location: USA but hiding it

Re: Locomotion Text Formatting Control Characters

Post by Zakos »

That's pretty neat actually. No idea if I'll ever use it.

Post Reply

Return to “Locomotion Graphics, Modifications & Tools”

Who is online

Users browsing this forum: No registered users and 6 guests