Jump to content

[LE] Papyrus access to Message "Title" and "Button Text" ?


ashpcatup

Recommended Posts

Is it possible to access the "Title" and or "Button Text" and use it in Papyrus?

 

Here's the sort of guesses I made that of course failed:

mystring = mymessage.title

mystring = mymessage.buttontext()

 

 

It's a mystery to me how this "assignment" displays a message...

ibutton = mymessage.show()

...and then on the very next line you can use it to access the integer index value of the choice made by the user on the screen.

if ibutton = 0 ...

 

 

Where does someone learn this stuff? I can't find anything going into the details of using messages or anything else on the creation kit site or anywhere really.

Link to comment
Share on other sites

In your example, mymessage should be a property variable pointing to a message created in the Creaiton Kit (https://www.creationkit.com/index.php?title=Message). Show() is a function on the stock message script which tells the game to display the message stored within the mymessage property and to return the value of the user selected 'button'. Thus ibutton contains the stored value of the user's selection which is then compared to specific values to perform various tasks as determined by the mod author.

 

If you need more information than that, I hope someone with more knowledge regarding messages and message boxes will come along to assist you.

Link to comment
Share on other sites

Is it possible to access the "Title" and or "Button Text" and use it in Papyrus?

 

Here's the sort of guesses I made that of course failed:

mystring = mymessage.title

mystring = mymessage.buttontext()

 

 

It's a mystery to me how this "assignment" displays a message...

ibutton = mymessage.show()

...and then on the very next line you can use it to access the integer index value of the choice made by the user on the screen.

if ibutton = 0 ...

 

 

Where does someone learn this stuff? I can't find anything going into the details of using messages or anything else on the creation kit site or anywhere really.

 

From this post I'm still a bit unclear as to what exactly you're trying to accomplish. If you want to actually get the string value of the message title or button text in papyrus, that's not possible. If however you are trying to display a designed message which has menu options, and then act on that, it's very simple. Just like your confusion example suggests. So here goes an explanation about that.

 

For the wiki page specific to using Messages in papyrus see https://www.creationkit.com/index.php?title=Show_-_Message

 

The Message(s) must be defined as a property to the script so you can use it in some way. This allows you to interact with the Message object. I'll use the wiki example here:

 

Message Property HelloWorld Auto
Message Property YouGotGold Auto
Message Property YetAnotherMessage Auto

 

Then further in the script inside some function where you want to use the message you would interact with the object using the Show() member function. In other programming parlance it may be called a method. In any case you're contacting a function called Show on the object message. If you pass arguments (aka parameters) they will be used as replacement values for replaceable text in the message content. The first 2 examples are to just display a message with no menu. The third displays a menu with options. While technically both notifications and message box types will return a value only the types that are message boxes with menu options are usually relevant.

 

; Display a simple message to the user
; The message text would be something like: "Hello World!"
HelloWorld.Show()
 
; Display a message, replacing the first number with a 10
; The message text would be something like: "You got %.0f gold."
YouGotGold.Show(10.0)
 
;/ Display a message, replacing the second number with a 10, the third number with a 20 (leaving first 0), and getting
the button the user hit /;
; The message text could be something like: "The first number is %.0f The second number is %.0f The third number is %.0f."
int ibutton = YetAnotherMessage.Show(0.0, 10.0, 20.0)

Edit: It cut off half my original message :sad:

 

To use the messagebox with a menu selection you need the 3rd type. The message will return a value of the index of the menu option chosen. The value will be the same as that which is found on the message form in the Creation Kit. So keep in mind that rearranging the menu in CK will require you to also change your papyrus to handle the new order of options. Also keep in mind that since Skyrim displays a horizontal list of the menu options the users screen resolution and ratio will affect what they may see. So keep from using really long menus with large text.

 

To use the return value you would use an if tree like this

if ibutton == 0 
  ; the first option
elseif ibutton ==1
  ; the second option
elseif ibutton == 2
  ; ... repeat for other options
endif

In case I didn't already cover to clarity your confusion about

It's a mystery to me how this "assignment" displays a message...

ibutton = mymessage.show()

You're calling mymessage.show() which is telling papyrus to ask the message object to show the menu. Then when it returns to your script it returns a value which is then assigned to the ibutton integer.

Edited by BigAndFlabby
Link to comment
Share on other sites

Sorry I should have given you a little background. Thanks for such detailed answers! But I'm using messages in the usual way with no problem. If papyrus could read the button text or title though, I could do a lot more. I'm creating a fairly generic multi-level menu system that doesn't rely on a million if-then statements that only work in one specific situation. What I've done so far is working fine, but it'd be a lot simpler, flexible, and concise if I could flag whether each button opens another menu or makes the final choice.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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