Jump to content

Modding Question: Message.Show()


Recommended Posts

Posted

In my Oldrim mod, I had made frequent usage of debug.notification to show messages in the upper left is the option was turned on in the MCM.  Worked great, no problems.

 

Except, those can't be localized like dialogs in your .esp for translation.  I've read the better way is to create a Message and then use .show() to display these in a similar manner.

 

Okay, sounds simple and straight forward enough.  I even found some samples, and tried to duplicate these.  Only problem is I haven't been able to get a single proof of concept one to work.

 

This is what I have in the script for testing the concept:

Message Property _SLSubmitMSGShout Auto

<snippet>
Else
	_SLSubmitShout.Cast(playerRef)
EndIf
_SLSubmitMSGShout.Show()
PlayerRef.SetVoiceRecoveryTime(_SLConfig.ShoutCooldown)
<snippet>

This is the message itself:

image.png

No message box, nothing fancy, just the little blurb in upper left when it's triggered with the .Show()

 

The shout effect plays, the shout cooldown triggers, yet no message.

 

I have even deleted the previous .pex to make it absolutely was creating a new one, and it did.

 

Since I am at a complete loss, I figured I'd ask if any active modders on here make use of Message.Show() and if they had similar experiences, or if I'm just doing something wrong and/or missing step(s).

 

Posted

It's one thing to declare the Message property, but have you filled in the property pointing to the actual Message form in the script properties window?

Posted

Did you actually assign the message property?
And if yes, did you start a new save so it would actually register the changed property?

Posted (edited)

Ahh, no, I didn't do that.  I figured it had to have been something stupidly simple I was overlooking.

Been out of the Skyrim modding game for over a decade until a few weeks ago, forgot so many of the basic things.  lol

 

[Edit]

Okay, this part was driving me crazy yesterday, and is factoring into setting the properties.  I can't seem to open the properties window with errors because it keeps telling me:

Spoiler

[SCRIPTS] Cannot open store for class "ski_configbase", missing file?
[SCRIPTS] Error: Unable to link "ski_configbase" - the parent of "_SLSubmitConfig".
[SCRIPTS] Error: Unable to link type of variable "::_SLConfig_var" on object "_SLSubmitQuest"
[SCRIPTS] Error: Unable to link type of property "_SLConfig" on object "_SLSubmitQuest"
[SCRIPTS] Error: Unable to link type of variable "::_SLConfig_var" on object "_SLSubmitTargetSelect"
[SCRIPTS] Error: Unable to link type of variable "::_SLQuest_var" on object "_SLSubmitTargetSelect"
[SCRIPTS] Error: Unable to link type of property "_SLQuest" on object "_SLSubmitTargetSelect"
[SCRIPTS] Error: Unable to link type of property "_SLConfig" on object "_SLSubmitTargetSelect"
[SCRIPTS] Error: Unable to link type of variable "::_SLQuest_var" on object "_SLSubmitFunctions"
[SCRIPTS] Error: Unable to link type of variable "::_SLConfig_var" on object "_SLSubmitFunctions"
[SCRIPTS] Error: Unable to link type of property "_SLQuest" on object "_SLSubmitFunctions"
[SCRIPTS] Error: Unable to link type of property "_SLConfig" on object "_SLSubmitFunctions"
[SCRIPTS] ERROR: Failed to find variable ::Pages_var used in sslConfigMenu.OnPageSelected()
[SCRIPTS] ERROR: Failed to find variable ::CurrentVersion_var used in sslConfigMenu.OnGameReload()
[SCRIPTS] ERROR: Failed to find variable ::CurrentVersion_var used in sslConfigMenu.OnVersionUpdate()
[SCRIPTS] ERROR: Failed to find variable ::Pages_var used in sslConfigMenu.OnConfigOpen()
[SCRIPTS] Error: Unable to link type of variable "::_SLFunctions_var" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of variable "::_SLQuest_var" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of variable "::TargetSelect_var" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of variable "::_SLConfig_var" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of property "_SLQuest" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of property "_SLFunctions" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of property "_SLConfig" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of property "TargetSelect" on object "_SLSubmitScene"
[SCRIPTS] Error: Unable to link type of variable "::_SLQuest_var" on object "_SLSubmitConfig"
[SCRIPTS] Error: Unable to link type of property "_SLQuest" on object "_SLSubmitConfig"

The first line is a Sky_UI .psc which is is in both the MO folder, as well as directly into the /data/source/scripts folder, just to be sure.

And all of the rest are Framework functions, which obviously are there, because I can compile, and they work in game.

But the CK64 keeps throwing up errors like it can't find them.

 

 

 

 

 

Edited by dkatryl
Posted (edited)
39 minutes ago, Pamatronic said:

Did you actually assign the message property?
And if yes, did you start a new save so it would actually register the changed property?

I'm using the LAL mod to rapidly create new characters specifically to test this.

But yes, I'm having issues setting the message property due to the "can't find Framework functions" errors

Edited by dkatryl
Posted (edited)

Ahh, there we go.  Dumped all of the Sky_UI & Framework scripts/sources into my mod's folders in its MO directory, and now I don't get those stupid errors.  Now I can finally set the properties.

 

Since all of my scripts start with "_SLSubmit", keeping them separate from the others when it's time to package it all up will be easy.

 

Man, so much time struggling with this stupid thing yesterday, trying to do similar things, but the actual solution was the simplest.  🤪

 

Thanks again, you two!

[Edit]

And there we go, proof of concept worked.

I've never been so happy to see a silly message like "Shout go RAWR!".

Now I can start digging through all of my scripts to remove the debugs and replace with messages. 🙂

Edited by dkatryl
Posted (edited)

Now that I have the messages working, followup question on them regarding dynamic text.

 

Some of the debug.notifications had numbers, and that proved to be quite easy to convert to message.show() by using %.#f format.  For instance:

%.2f%% success chance, %.2f%% rolled.  Target submits!

 

However, I also had some debug.notifications for if you succeeded in stealing your opponent's weapon(s), it would display their name and the name of the weapon(s).

Debug.Notification("You have disarmed " + Target.GetLeveledActorBase().GetName() + " and taken their " + Target.getEquippedWeapon().GetName() + "!")

This was easy because debug.notifications can directly handle strings.

 

But message.show isn't as flexible, and from my reading, it requires using an alias.

The actor was easy enough, as you can use Alias.ForceRefTo(Target), but the weapons that 'Target' is wielding have proven more difficult to get into an reference alias.  You can't use ForceRefTo with a weapon, for instance.

 

Is this another one where the answer is obvious and I'm being blind?

 

(For now my workaround is to just rephrase this one to generic terms to avoid the need for dynamic text in the message, but I would like to know what could have been done)

Edited by dkatryl
Posted

I seem to be struggling over something with text replacements in Messages.

Numerical replacements are easy.  However, Strings are proving more difficult, as it doesn't seem you can directly use Strings like debug.notifications, and have to rely on Aliases.

I've defined the Alias, ActorVictim,

ActorVictim.ForceRefTo(Target)

 

and filled in the Property in the MagicEffect.

 

In the Message, I put this:

You have disarmed <Alias=ActorVictim> and taken their primary weapon!

 

But all that plays is "You have disarmed"

Leaving me wondering if that is the correct syntax? Or am I leaving out some other step?

Posted
16 hours ago, Tlam99 said:

"you have disarmed" + < alias=actorvictim> + "and......"

 

That's basically how you do it in debug.notification, absolutely.

 

The original was:

Debug.Notification("You have disarmed " + Target.GetLeveledActorBase().GetName() + " and taken their " + TargetWeapon1.GetName() + "!")

and that worked perfectly.  Except you can't localize debug.notifications, as they are baked into the compiled scripts.  Hence moving to Messages.

For numerical text replacement, you enter it like this in the script:

_SLSubmitAmbushEffect1.Show(SuccessChance.GetValue(), SuccessRoll.GetValue())

 

Then make the Message say:

%.2f%% success chance >= %.2f%% rolled.  Target submits!

 

And it works perfectly.  It's only the ones relying on an Alias that I'm struggling with, because I guess Messages can't directly handle Strings because that would be too easy.  🙄

 

I tried it the way you suggested:

image.png

 

It only returned: "You have disarmed " +

 

Posted

Figured it out.

 

Forgot to set the Owner Quest:

image.png

 

The original way I had it was correct, just forgot to link to the Quest that contained the Alias.

 

Duh.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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