www.ClassicTW.com
http://classictw.com/

TW word translation
http://classictw.com/viewtopic.php?f=52&t=32745
Page 3 of 3

Author:  V'Ger [ Thu Jan 19, 2012 8:53 pm ]
Post subject:  Re: TW word translation

Kaus wrote:
Using Ice9 as a example one could imagine he has a script to sweep, a script to welcome a player, a script to enforce events that can be caught by text triggers.. etc..


That is precisely how I do it. I am also lucky that I have a modded version of TWX that one of my former players wrote that allows me to launch scripts at timed intervals using the TWGS scheduler. That takes some of the load off of the server.

Author:  ElderProphet [ Thu Jan 19, 2012 10:09 pm ]
Post subject:  Re: TW word translation

Back to the word translation idea... seems like a more encompassing approach would be to enumerate all strings that TW sends, and allow an alternate string to be specified. So say there are 5000 TW strings (TWString[1] - TWString[5000]), and TWString[20] is "You have $CREDITS credits and $EMPTYHOLDS empty cargo holds." You could add a new string (TWString[5001]) with a value of "Tienes $CREDITS créditos y $EMPTYHOLDS bodegas de carga vacías.", and replace TWString[20] with a pointer to TWString[5001]. If this string were later altered, then TWString[5001] would be replaced with a pointer to its replacement.

This would probably process faster right? And would allow for complete translation of TW to other languages... though there may be easier ways to do that.

Author:  John Pritchett [ Fri Jan 20, 2012 1:06 pm ]
Post subject:  Re: TW word translation

A big part of the equation for me is level of difficulty. There are nearly 5000 strings and I can't imagine touching all lines of code where these strings are used to implement the kind of string translation system you propose. Had it been used from the start, it would be perfect.

I could automate the creation of a string table by pulling all strings out of the source code and placing them into a string table, then replacing them in source code with a constant. In fact, that's what I did way back when I did the first conversion of TWv2 to TWv3. A string like 'This is a string of text for TW2002' was pulled into a string table and associated with a numeric ID, then a constant was generated in a unit with "S_THIS_IS_A_STRING_OF_TEXT_FOR_TW2002 = ID;". Then that constant replaced the string in code and you could still get a sense in code of what the string was, but the string resided in a string file. The theory was that this file could then be used to customize strings. But that never happened, because while you could change the text for many strings without effecting the formatting of the output, there are a lot of screens where formatting is more rigid. I've dealt with this in the new system by providing a word with a bracketed field width so you know a maximum width for that word. If greater than that width, it'll get truncated. If less, it'll be padded by spaces, sometimes centered, sometimes right justified, sometimes left justified, depending on the page format in question, but the format itself won't change no matter what you choose for a translation. I can do that sort of thing for a highly selective group of words, and as I expand that set of words over time, the amount of work involved won't be too burdensome. But a more complete system of translation is just too big a hurdle for me to justify.

EDIT: I should mention that the rigidity of having replaced strings in code with constants ended up being too much of a headache, so I finally reverted back to having true strings in code. It makes it so much easier for me to work with them. So the STRTABLE.D8A and .NDX (encrypted string file and index) are now obsolete.

Page 3 of 3 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/