dizietemblesssma Posted August 7, 2020 Share Posted August 7, 2020 I'm having a problem with one part of my mcm menu not substituting the tokens:I have all 9 files in data/interface/translations Event OnKeyMapChangeST(int keyCode, string conflictControl, string conflictName) Bool continue = True If (conflictControl != "") string msg If (conflictName != "") ;msg = "$This_key_is_already_mapped_to"+"\n" + conflictControl + "\n (" + conflictName + ")\n \n" +"$Are_you_sure_you_want_to_continue?" msg = "$This_key_is_already_mapped_to"+"\n"+conflictControl Else msg = "$This_key_is_already_mapped_to"+ "\n" + conflictControl + "\n\n"+"$Are_you_sure_you_want_to_continue" EndIf continue = ShowMessage(msg, True, "$Yes_text", "$No_text") EndIf If (continue) hotkey = keyCode SetKeyMapOptionValueST(keyCode) EndIf RegisterForKey(keyCode) EndEvent the line:msg = "$This_key_is_already_mapped_to"+"\n"+conflictControldoes not substitute the token, but the following does:msg = "$This_key_is_already_mapped_to" so far my experiments have not been able to get the token to substitute if there is anything following the token, even tbough the following compile:msg = "$This_key_is_already_mapped_to\n"+conflictControlmsg = "$This_key_is_already_mapped_to"+"\n"+conflictControlmsg = "$This_key_is_already_mapped_to"+"\n"msg = "$This_key_is_already_mapped_to"+"\n" + conflictControl + "\n (" + conflictName + ")\n \n" +"$Are_you_sure_you_want_to_continue?" this is based on the example from https://github.com/schlangster/skyui/wiki/MCM-Advanced-Features#Keymapwith the text tokenised is token substitution not possible in this string? diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 7, 2020 Share Posted August 7, 2020 I've never used \n within script before. Its always been in the translation file itself. So try the following: In the script:msg = "$This_Key_is_already_mapped_to"+conflictControl+"$LeftPuddle"+conflictName+"$RightPuddle"+$Are_you_sure_you_want_to_continue?" In the translation file:$This_Key_is_already_mapped_to This Key is already mapped to\n$LeftPuddle \n($RightPuddle )\n\n$Are_you_sure_you_want_to_continue? Are you sure you want to continue? Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 7, 2020 Author Share Posted August 7, 2020 I've never used \n within script before. Its always been in the translation file itself. So try the following: In the script:msg = "$This_Key_is_already_mapped_to"+conflictControl+"$LeftPuddle"+conflictName+"$RightPuddle"+$Are_you_sure_you_want_to_continue?" In the translation file:$This_Key_is_already_mapped_to This Key is already mapped to\n$LeftPuddle \n($RightPuddle )\n\n$Are_you_sure_you_want_to_continue? Are you sure you want to continue?I tried your example, and I just had a resultant text in which the tokens $LeftPuddle and $RightPuddle appear. It just seems odd that that the MCM documentation gives an example:msg = "This key is already mapped to:\n\"" + conflictControl + "\"\n(" + conflictName + ")\n\nAre you sure you want to continue?"that seems unable to be tokenised.The example comes immediately after the section on the same page about how to localise a menu! :smile: I should also point out that I have the function block: string Function GetCustomControl(int keyCode) If (keyCode == hotkey) Return "$hotkey_name" Else Return "" EndIf EndFunction as recommended in the documenatation, the "$hotkey_name" token is also not substituted although the translation file has:$hotkey_name Hotkey for adding NPCs diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 7, 2020 Share Posted August 7, 2020 Maybe it is your use of underscores. In one of my mods I have the following as the text label$Minimum strikes per oreand the following as the end resultMinimum strike sets per ore \n Strike Set = 3 attack hits or 3 animation swings Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 8, 2020 Author Share Posted August 8, 2020 Well, I seem to have found the answer, from the skyui github page no less!This post:https://github.com/schlangster/skyui/issues/78#issuecomment-427883582 suggests the following: English translation key:$KeyMapConflict{}{} This key is already mapped to:\n{}\n({})\n\nAre you sure you want to continue?Papyrus scriptmsg = "$KeyMapConflict{" + a_conflictControl + "}{" + a_conflictName + "}" and so far, that's working!Why I don't know, but that's another day - if ever. :smile: diziet Link to comment Share on other sites More sharing options...
Recommended Posts