185 character .tra file names

Started by EnterTheStory (aka tolworthy), Thu 15/10/2009 14:14:09

Previous topic - Next topic

EnterTheStory (aka tolworthy)

I've noticed that translation file names can be 185 characters long (189 including ".tra"), but if you try 186 they won't be used. Any idea why this is?

Gilbert

Probably because this wasn't even looked into as few people will care about naming their files that long anyway.

Any practical reasons do you have for having such a long file name?

EnterTheStory (aka tolworthy)

Quote from: Gilbet V7000a on Thu 15/10/2009 14:20:29Any practical reasons do you have for having such a long file name?

I plan to have around 80 games that can link together using RunAGSGame. You can't change translation file mid game, so each .tra file contains the text for up to 80 games. But not all games are translated. If you go from a translated game to an untranslated one, CRASH! So each translation file name includes the names of all the games it can handle, and I check them before running RunAGSGame.

Example: "German_game1_game4_game31.tra" or "Dutch_game2_game31_game32_game75.tra" etc.

Gilbert

Nah. I'll say this is not practical at all. In fact file systems of different O/Ses may also have different limits on the length of paths. For example, files in WinXP may not be accessible if it's in a nest of folders with long names until you move the files or shorten some of the folder names.  If some people install your game to a slightly long path it may not be accessible.

There can be many better ways to do this. Some ideas:
1. Use the value passed to the next game in RunAGSGame(), which depends on what translation the last game(s) was/were using. So you can check this value in the called game and "crash" it when needed.
2. When you call the new game, just write a file with some specific contents first, which can differ according to the previous translation(s) used, then read and verify this file in the next game to see whether the player can continue.

EnterTheStory (aka tolworthy)

Quote from: Gilbet V7000a on Thu 15/10/2009 15:21:01file systems of different O/S may also have different limits on the length of paths.
Ah, that would make sense. I imagine 256 characters is a common maximum, so having 185 left over sounds right. Thanks for the tip.

Quote from: Gilbet V7000a on Thu 15/10/2009 15:21:011. Use the value passed to the next game in RunAGSGame()
I don't think I could squeeze 80 game tags intoa  single int :)

Quote from: Gilbet V7000a on Thu 15/10/2009 15:21:012. When you call the new game, just write a file with some specific contents first

Yes, that would work, but I'm trying to avoid writing too many extra files (I have a great talent for creating bugs, so try to keep everything as simple as possible). I like the idea of including the contents of a file in its name - it just feels right. I think in practice I'll be unlikely to exceed 50 characters or so for most .tra files.

Pumaman

If you're using AGS 3.1 or later, you can change the translation file at runtime using the Game.ChangeTranslation command.

EnterTheStory (aka tolworthy)


SMF spam blocked by CleanTalk