Jump to content

Question to FILE_EXISTS and file paths


jastey

Recommended Posts

FILE_EXISTS ~bg1npc/tra/%s/x#viint.tra~ 

doesn't turn true.

 

The path in question is:

FILE_EXISTS ~bg1npc/tra/english/x#viint.tra~

If I put it like this, it works. The language in which the mod in question is to be installed is English.

 

Would someone point me to the obvious?

 

The whole code block:

ACTION_IF ((MOD_IS_INSTALLED ~BG1NPC/BG1NPC.TP2~ "1") AND (FILE_EXISTS 
~bg1npc/tra/%s/x#viint.tra~)) BEGIN
  PRINT ~#########   bg1npc detected ##############~
END
Link to comment
FILE_EXISTS ~bg1npc/tra/%s/x#viint.tra~ 

doesn't turn true.

 

The path in question is:

FILE_EXISTS ~bg1npc/tra/english/x#viint.tra~

If I put it like this, it works. The language in which the mod in question is to be installed is English.

 

Would someone point me to the obvious?

 

The whole code block:

ACTION_IF ((MOD_IS_INSTALLED ~BG1NPC/BG1NPC.TP2~ "1") AND (FILE_EXISTS 
~bg1npc/tra/%s/x#viint.tra~)) BEGIN
  PRINT ~#########   bg1npc detected ##############~
END

You need to specify a path that actually exists in the game for FILE_EXISTS to find it, like you did in your second example.

You can install from your own files with tra/%s/ because you define what %s can mean in your own tp2 by setting the available LANGUAGE(s). Afterwards the user selects the language in which the mod is installed (0,1,2 etc) and replaces %s by that number.

But you cannot read out backwards files in that manner.

Sorry, I am not a programmer, so I can only explain it in my own amateurish ways.

Link to comment

Only a few actions/patches/other resolve %s into the current language (a quick glance suggests it's D/DLG stuff only). For a general-purpose solution, you want the LANGUAGE variable.

 

~bg1npc/tra/%LANGUAGE%/x#viint.tra~
Link to comment

 

Only a few actions/patches/other resolve %s into the current language (a quick glance suggests it's D/DLG stuff only). For a general-purpose solution, you want the LANGUAGE variable.

~bg1npc/tra/%LANGUAGE%/x#viint.tra~

A quick note to this though--because you're checking a different mod's tra files, using %LANGUAGE% only works if their labels are consistent between mods. E.g. BG1 NPC labels the German tra file as "German" and if your mod labels it "Deutsch" then it's still not going to match.

 

 

LANGUAGE ~Deutsch (Teiluebersetzung vom Kerzenburgforum, teilweise noch in englisch)~ ~german~ ~bg1npc/tra/german/setup.tra~ // http://kerzenburg.baldurs-gate.eu/

 

%LANGUAGE% is set to the second item, in this case "german", if this is the selected language at install.

Link to comment

Just asking for the reason of your check,

The FILE_EXISTS check only answers the question *Is that mod (respectively the example file you check) present in the game directory?". Language would not matter, as the mod would have all the tra files existing for that mod. It does not tell you what language was chosen for install or if the mod was installed at all.

Link to comment

Thank you for your answers. I wanted to check whether the tra file I am using in the next instance is actually there, but I might as well switch to checking whether the bg1re folder is still present in general.

As for whether the name of %LANGUAGE% actually matches between mods - it's all just a workaround and I expect it to fail on several instances.

Link to comment

Argh, I now understand what you mean with labels. So, if in mod A the languages are in a different order than in mod B, it's not evaluated by the language name but by the number the player pressed to chose the language option? This means I would have to check for which language is chosen and go to the appropriate bg1 npc tra files by hand. Thank for the heads up!

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...