Jump to content

Combining messages and variables


Recommended Posts

Hi,

I'd like to combine the text of a message with a variable like so:

String msg = (dz_outfits_msg03 As String)
    debug.notification(teammate_name+msg)

but this doesn't work (although it compiles), the only way to display the text of the message is to do:

dz_outfits_msg03.Show()

but I can't see that I can then add a variable(teammate_name) to that displayed text.

Is what I want to do not possible?

 

diziet

Link to comment
Share on other sites

Unfortunately no:(

All attempts that compile result in the notification:

Serana[Message

If using a messagebox in the script, I get the form id of the message added after.

I have tried also setting the messagebox checkbox on and off in the message itself, but that makes no difference.

It seems odd that both these compile:

Message msg = dz_outfits_msg03
    debug.notification(teammate_name+""+msg)

and:

String msg = dz_outfits_msg03
    debug.notification(teammate_name+""+msg)

without any casting, but that's just an oddity. Sadly I can't think of any other way to store a text string in the esp other than a message.

 

diziet

 

Link to comment
Share on other sites

This dialogue is from my MCM script, in the past I have tried such as:

String msg = "$testing"
    debug.notification(teammate_name+""+msg)

with the appropriate entry in dz_auto_outfits_ENGLISH.txt file i.e

$testing has been added to Diziet's Outfits

but that doesn't work (just checked again).
Using a function:

String Function dz_testing()
String msg = "$testing"
    Return msg
EndFunction

works until anything is added to the $testing e.g.

String Function dz_testing(String name)
String msg = name + "$testing"
    Return msg
EndFunction

or:

String Function dz_testing(String name)
String msg = "$testing"
    msg = name + msg
    Return msg
EndFunction

using the function to just replace the $testing and adding the name via:

debug.notification(teammate_name+dz_testing())

also doesn't work, whereas:

debug.notification(dz_testing())

does the substitution, but of course there is no variable added.

 

It's good to know that I can do substitutions for text that is displayed outside of the MCM menu using this method, I've just been converting a whole load of notification and messageboxes to messages in the CK, putting aside the variable issue, is there an advantage to one method or the other (speed etc.)?

 

diziet

 

 

 

Link to comment
Share on other sites

I've read that before, and it works for dialogue/text when the MCM menu is open or for text in the menu itself, so e.g. AddHeaderOption or Showmessage.

 

However I've just been spending my evening looking at UILib and UiLib.ShowNotification which I've got working as this allows the nested translations mentioned in your link but in notifications in the game. I'm having to edit the UILIB_1_notificationarea.swf file to get the size of the notifications back down to my SkyHud size, but that's just for me, although the edit is just one parameter in the swf file so it might be safe to offer as an alternative in my FOMOD, have to check the permissions.

 

diziet

 

edit: ah, permissions forbid modifications. Well that's tricky, uilib gives me what I need, but conficts with SkyHud and I imagine a few people use that.

Link to comment
Share on other sites

So you can't get the text of a Message form through papyrus like you're trying to do. You can store an actual String Property in your script and do it that way.




String Property dz_outfits_msg03String Auto

debug.notification(teammate_name + dz_outfits_msg03String)



Another way is to use a reference alias in a quest and a dummy item to display different text in your message.

So in your message form you would put:


<Alias=MsgAliasA> <Alias=MsgAliasB>


Then in the script do this:




ReferenceAlias Property MsgAliasA Auto
ReferenceAlias Property MsgAliasB Auto


ObjectReference Property dz_outfits_msg03Ref Auto ;ref's name is the string you want to display
ObjectReference Property teammate_nameRef Auto ;ref's name is the string you want to display


Message Property dz_outfits_msg03 Auto


Event SomeEvent()
MsgAliasA.forceRefTo(teammate_nameRef) ;display teammate_nameRef's name in the dz_outfits_msg03 message.
MsgAliasB.forceRefTo(dz_outfits_msg03Ref)
dz_outfits_msg03.Show()
EndEvent



Make sure your message's owning quest is the same as the ReferenceAlias's are on.

Link to comment
Share on other sites

Thankyou for your reply dylbill,

Method 1:

What in the CK do I set the dz_outfits_msg03String property to? I looked for a string type object but couldn't find one, hence attempting to use messages:)

 

Method 2:

I've not worked with referencealiases before, so I'm not sure I follow this; what is the dz_outfits_msg03Ref property set to? also the teammate_nameref? The actor referred to in my MCM script by 'teammate_name' in my code posted above is the name of one of the MCM pages i.e. pages = teammate_name, so it changes:)

I get that the <Alias=MsgAliasA> <Alias=MsgAliasB> in the message are tokens for text replacement, but not how MsgAliasA.forceRefTo(teammate_nameRef) works.

Also would I only need one alias if the second part of the desired string never changed?

 

diziet

Link to comment
Share on other sites

For this situation, I would use the 1st method. Using a string property you don't need to make a new form in the CK. You just type the text you want when setting the property in the ck, similar to setting your modname property for MCMs.

The second method is more involved. Check out my message menu tutorial for more info: https://www.nexusmods.com/skyrimspecialedition/mods/46410

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...