Jump to content

Problesm to resolve "RESOLVE_STR_REF" for mod in other language


jastey

Recommended Posts

I want to get the dlg state number of a line added by another mod. For USING it works if the other mod is installed in another language than the mod that searches for the state number.

But for WITH_TRA this doesn't seem to work.

I'm using

WITH_TRA ~c#sodtweaks/translations/autotra/%s/DIALOGUE_CHOICES.TRA~ BEGIN
  OUTER_SET strref1 = RESOLVE_STR_REF(@54)
END

and it only works if both mods are installed in the same language. If it is different languages, there is an error message:

Quote

ERROR: No translation provided for @54
Stopping installation because of error.

Switching it to

WITH_TRA ~c#sodtweaks/translations/autotra/%LANGUAGE%/DIALOGUE_CHOICES.TRA~ BEGIN
  OUTER_SET strref1 = RESOLVE_STR_REF(@54)
END

gives the same error message.

How would I solve this?

Link to comment

 

What do you think about this workaround ?

 

/* tagg new reply options from Jastey's SoD Tweakpack with variables */

ACTION_IF MOD_IS_INSTALLED ~c#sodtweaks.tp2~ ~5~ THEN BEGIN
PRINT @100024

ACTION_IF FILE_EXISTS ~c#sodtweaks/translations/autotra/english/DIALOGUE_CHOICES.TRA~ THEN BEGIN
PRINT ~c#sodtweaks in english~

WITH_TRA ~c#sodtweaks/translations/autotra/english/DIALOGUE_CHOICES.TRA~ BEGIN
  OUTER_SET strref1 = RESOLVE_STR_REF(@54)
END

END ELSE ACTION_IF FILE_EXISTS ~c#sodtweaks/translations/autotra/german/DIALOGUE_CHOICES.TRA~ THEN BEGIN
PRINT ~c#sodtweaks in german~

WITH_TRA ~c#sodtweaks/translations/autotra/german/DIALOGUE_CHOICES.TRA~ BEGIN
  OUTER_SET strref1 = RESOLVE_STR_REF(@54)
END

END ELSE ACTION_IF FILE_EXISTS ~c#sodtweaks/translations/autotra/russian/DIALOGUE_CHOICES.TRA~ THEN BEGIN
PRINT ~c#sodtweaks in russian~

WITH_TRA ~c#sodtweaks/translations/autotra/russian/DIALOGUE_CHOICES.TRA~ BEGIN
  OUTER_SET strref1 = RESOLVE_STR_REF(@54)
END

END ELSE ACTION_IF FILE_EXISTS ~c#sodtweaks/translations/autotra/french/DIALOGUE_CHOICES.TRA~ THEN BEGIN
PRINT ~c#sodtweaks in french~

WITH_TRA ~c#sodtweaks/translations/autotra/french/DIALOGUE_CHOICES.TRA~ BEGIN
  OUTER_SET strref1 = RESOLVE_STR_REF(@54)
END

END ELSE ACTION_IF FILE_EXISTS ~c#sodtweaks/translations/autotra/polish/DIALOGUE_CHOICES.TRA~ THEN BEGIN
PRINT ~c#sodtweaks in polish~

WITH_TRA ~c#sodtweaks/translations/autotra/polish/DIALOGUE_CHOICES.TRA~ BEGIN
  OUTER_SET strref1 = RESOLVE_STR_REF(@54)
END

END

 

It's not pretty, but the mod seem to installs without error...

 

Jastey's Tweakpack "More Dialogue Choices & Prevent Dead Ends" detected.

c#sodtweaks in french
[c#sodtweaks/translations/autotra/french/DIALOGUE_CHOICES.TRA] has 34 translation strings
Copying and patching 1 file ...
[./override/bdcaelar.dlg] loaded, 17624 bytes
Compiling 1 dialogue file ...
Processing 1 dialogues/scripts ...
[./override/BDCAELAR.DLG] loaded, 17624 bytes
[BDCAELAR.DLG] loaded
[BDCAELAR.DLG] saved	94 states, 173 trans, 12 strig, 43 ttrig, 81 actions

 


Edited by JohnBob
Link to comment

The scripting can be shortened a bit if you fetch the mod language directly from the WeiDU.log.

This script should do the trick:

// Language folder names listed in the order of LANGUAGE definitions in the mod.
ACTION_DEFINE_ARRAY languages BEGIN
  "english" "german" "russian" "french" "polish"
END

// Fetching language index from the WeiDU.log
OUTER_SET language_number = "-1"
COPY "WeiDU.log" "WeiDU.log"
  REPLACE_EVALUATE CASE_INSENSITIVE
    "^~.*c#sodtweaks\.tp2~ #\([0-9]+\) #5\b"
    BEGIN
      PATCH_IF (IS_AN_INT "MATCH1") BEGIN
        SET language_number = MATCH1
      END
    END
    "%MATCH0%"
BUT_ONLY IF_EXISTS

ACTION_IF (language_number >= 0) BEGIN
  OUTER_SPRINT mod_language $languages("%language_number%")
  WITH_TRA "c#sodtweaks/translations/autotra/%mod_language%/DIALOGUE_CHOICES.TRA" BEGIN
    OUTER_SET strref1 = RESOLVE_STR_REF(@54)
  END
END

 

Link to comment

Great! It's prettier this way.

I tried to figure out how to retrieve the language from the weidu.log, but it was too complicated for me to understand.

I'm quite certain that I'll ever be able to do something like that, but perhaps I could reuse your example in other instances.

Edited by JohnBob
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...