Skip to content

A question about .tra files (and newlines in the .tra file=

shevy123456shevy123456 Member Posts: 203

So, .tra files seem to be straight text files. I am looking at
the Unofficial Item Mod right now.

This Mod has entries such as the following, for one item:

@36 = ~Butcherer of Innocents

This giant, axe-like cleaver earned its nickname while in the hands of Oswell Breck, a butcher who once serviced the Clerk's Ward of Sigil. The chant is that one day this affable and well-respected citizen suddenly went on a murderous and bloody rampage that lasted ten days and ten nights. Cleaver in hand, Oswell stalked the streets of the ward, brutally hacking down every man, woman, and child unlucky enough to cross his path until the Lady herself intervened. It is rumored that he suffered from a strange disease that slowly caused his body to waste away, and it was this disease that eroded his sanity and prompted the murder spree.

The origin of this instrument of carnage is shrouded in mystery. However, the various wizards and scholars who examined the discarded weapon after Oswell's mazing have catalogued the nature of its enchantment. The cleaver seems to feed upon its victims, sucking the very life force from them and bestowing a portion of it upon its wielder.

There are no newlines here - it is a very long sentence, or actually two sentences.

Does anyone know if newlines cripple the mod? If not then I intend to add newlines
there, to simplify reading it, but I wonder if these would appear in the item
description when installed. I will test this later tonight, in
a few hours, but I wanted to ask that beforehand, because it
seems strange to me that people write very long sentences
without any newline at all. So perhaps there is a reason for
that.

Also, if I change the @number thing, e. g. mix the items,
from @36 to @40 and vice versa, will that confuse the item
descriptions? That is if I change them, the wrong description
would be used? Does one have to run something manually
after changing .tra file or will weidu apply this automatically
upon installation time?

Comments

  • jmerryjmerry Member Posts: 3,853
    If you add newlines in the middle of a string definition, they'll also be part of the string when it's used in game. Don't do that. Stuff like string descriptions and dialogue auto-wrap, and so should the text editor you read them in. But then you go adding line breaks for a width that doesn't match what the game is using, and you've made the string ugly.
    Basically, newline is not a special character in this structure; it's allowed to be part of the strings without jumping through any hoops. Your example has a pair of newlines between the item's name and the main description block, and those are part of the description in-game.

    The numbers matter, because they'll be referenced in the mod's code. There will have a line of code like
    SAY DESC @36
    
    when editing that item.
    So if you swap the @36 and @40 in the tra file, it'll use each string where the other should go. Or if you change @36 to @36000 in the tra file, the mod will throw an error and fail to install because it can't find a string when the code asks for @36.

    Everything happens at install time; the installation process loads the tra files and uses their contents to assign meaning to the @ references in the WeiDU code. No need to run anything beforehand when you change things - just save the file.
Sign In or Register to comment.