[q] How to make a custom message box

Post » Thu Jun 21, 2012 12:29 pm

Hi,

I want a message box that will popup if I activate my stone, but I don't just want it to be 'Yes' and 'No' or 'Ok'.
I want to add my own buttons, and all button have to do something different.
One button should teleport you, and one should cast a spell on you (just an example).
I've seen this before and I know it is possible.

I don't understand these pages, maybe you can explain more better and provide an example script for a custom message box:
http://www.creationkit.com/Notification_-_Debug
http://www.creationkit.com/Show_-_Message
http://www.creationkit.com/Message_Script

Thanks in advance.
User avatar
Kevan Olson
 
Posts: 3402
Joined: Tue Oct 16, 2007 1:09 am

Post » Thu Jun 21, 2012 10:37 pm

You don't understand because what you need is this:

http://www.creationkit.com/Options_Menu

And yes it's possible, I've done such a stone.
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Fri Jun 22, 2012 12:47 am

Thank you so much!
User avatar
mike
 
Posts: 3432
Joined: Fri Jul 27, 2007 6:51 pm

Post » Thu Jun 21, 2012 3:10 pm

No prob mate.
User avatar
Lifee Mccaslin
 
Posts: 3369
Joined: Fri Jun 01, 2007 1:03 am

Post » Thu Jun 21, 2012 3:00 pm

I still have a problem, this is my code:
Scriptname _1_PassToNeylojei extends ObjectReference  int Property Attacked Auto ConditionalMessage Property OptionsMenu00MESG AutoEvent OnActivate(ObjectReference akActionRef);shows the menu dialog.	 Int iButton = OptionsMenu00MESG.Show() ; Shows your menu.     If iButton == 0 ; teleport     Debug.Notification("That is not possible!")     Elseif iButton == 1 ; honor the shrine     Debug.Notification("You honor the shrine.")     Elseif iButton == 2 ; grant me powers     Debug.Notification("You have been granted powers.")     EndIfendEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)     if akAggressor == game.getPlayer()		 if Attacked == 0        	  Debug.Notification("You have dishonored Neylojei!")			 Attacked = 1		 endif     endif EndEvent

Now when I hit E to activate, it just keeps showing me the firrst dialog 'That is not possible' over and over again.
What am I doing wrong?
User avatar
Baby K(:
 
Posts: 3395
Joined: Thu Nov 09, 2006 9:07 pm

Post » Thu Jun 21, 2012 3:20 pm

Did you create the menu in message under object group in the ck?
User avatar
My blood
 
Posts: 3455
Joined: Fri Jun 16, 2006 8:09 am

Post » Fri Jun 22, 2012 1:41 am

I did yes, and assign it.
User avatar
kiss my weasel
 
Posts: 3221
Joined: Tue Feb 20, 2007 9:08 am

Post » Thu Jun 21, 2012 3:56 pm

Mmmmm.... Strange.

Does the message look like this:

http://www.mediafire.com/i/?8be8jssjug3fm10
User avatar
M!KkI
 
Posts: 3401
Joined: Sun Jul 16, 2006 7:50 am

Post » Fri Jun 22, 2012 3:16 am

Yes like that, but only 3 buttons.
I use this code now: lets see if it works
Scriptname _1_PassToNeylojei extends ObjectReference  Message Property OptionsMenu00MESG Auto ; Assigns the menu ('properties')Event OnActivate(ObjectReference akActionRef); Show Menu	 Game.DisablePlayerControls(abMenu = True) ; Momentarily disable other menus	 Game.EnablePlayerControls(abMenu = True) ; Undo DisablePlayerControls	 Menu() ; now prompt to menu functionendEventFunction Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True)	While abMenu		If aiMessage == 0			aiButton = OptionsMenu00MESG.Show()			If aiButton == 0		   	  Debug.Notification("Pressed 1")		   	  abMenu = False			ElseIf aiButton == 1		   	  Debug.Notification("Pressed 2")	   		  abMenu = False			ElseIf aiButton == 2		   	  Debug.Notification("Pressed 3")		   	  abMenu = False					EndIf		EndIf	EndWhileEndFunction


Edit: Nope, it does the same as before, it now instantly says to me "Pressed 1".
User avatar
R.I.p MOmmy
 
Posts: 3463
Joined: Wed Sep 06, 2006 8:40 pm

Post » Thu Jun 21, 2012 11:42 pm

I think the problem is the wiki is missing code, add this:

  If (iButton != -1) ; Wait for input   If (iButton == 0)   Etc.....

Tell me what happens.

EDIT: use your first script
User avatar
Nick Swan
 
Posts: 3511
Joined: Sat Dec 01, 2007 1:34 pm

Post » Fri Jun 22, 2012 1:03 am

I now use this
Scriptname _1_PassToNeylojei extends ObjectReference  Message Property OptionsMenu00MESG Auto ; Assigns the menu ('properties')Event OnActivate(ObjectReference akActionRef); Show Menu		 Menu() ; now prompt to menu functionendEventFunction Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True)	    While abMenu			    If aiMessage == 0               		 If (iButton != -1) ; Wait for input					    aiButton = OptionsMenu00MESG.Show()					    If aiButton == 0						  Debug.Notification("Pressed 1")						  abMenu = False					    ElseIf aiButton == 1						  Debug.Notification("Pressed 2")						  abMenu = False					    ElseIf aiButton == 2						  Debug.Notification("Pressed 3")						  abMenu = False					    EndIf                        EndIf			    EndIf	    EndWhileEndFunction

It still says "Pressed 1" instantly.
User avatar
Sun of Sammy
 
Posts: 3442
Joined: Mon Oct 22, 2007 3:38 pm

Post » Fri Jun 22, 2012 2:29 am

I think the error is here:

Function Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True)

You say that the button is 0 and when it's 0 the answer is the one that shows, you can't do that I think, use first script it's simpler.
User avatar
Alan Cutler
 
Posts: 3163
Joined: Sun Jul 01, 2007 9:59 am

Post » Thu Jun 21, 2012 10:34 pm

This is strange indeed because you have this:

aiButton = OptionsMenu00MESG.Show()

This line changes the value store in aiButton, this is strange, all I can recall is the:

If (iButton != -1) ; Wait for input

This is the only difference I have in my working example and for some reason people removed it from the wiki.
User avatar
Taylah Haines
 
Posts: 3439
Joined: Tue Feb 13, 2007 3:10 am

Post » Thu Jun 21, 2012 4:56 pm

This is the code that was originally in the wiki:

  iButton = YourMenuMessage.Show() ; Shows your menu. iButton == -1 until input  If (iButton != -1) ; Wait for input   ;Game.GetPlayer().RemoveItem(MenuARMO, 1, True) ; Silently remove token   If (iButton == 0)etc....

EDIT: just noticed another thing, you have aiButton and the code I gave you is iButton, and you have to switch this order:

If (iButton != -1) ; Wait for input											aiButton = OptionsMenu00MESG.Show()

First you assign the value then you do the if's
User avatar
Jason King
 
Posts: 3382
Joined: Tue Jul 17, 2007 2:05 pm

Post » Thu Jun 21, 2012 10:37 pm

Yes like that, but only 3 buttons.

I know that you said your message looks like the example Black RL showed, but the problems you are describing sound like you forgot to check the "Message Box" flag on the message.
User avatar
Nicole Coucopoulos
 
Posts: 3484
Joined: Fri Feb 23, 2007 4:09 am

Post » Thu Jun 21, 2012 11:00 pm

I know that you said your message looks like the example Black RL showed, but the problems you are describing sound like you forgot to check the "Message Box" flag on the message.

Actually, I did not. I got it checked.
User avatar
Danial Zachery
 
Posts: 3451
Joined: Fri Aug 24, 2007 5:41 am

Post » Thu Jun 21, 2012 2:46 pm

The first script looks absolutely correct. And if it's immediately showing "That is not possible!" instead of your menu then the OptionsMenu00MESG property isn't filled correctly in the CK.

If you use Show on any un-filled or otherwise wrong message it will return a 0 immediately. And that's exactly what you are describing.

If you had forgotten to make it a proper message box (with the check box) then it would have been showing the message as a notification in the top left corner and returning a -1 instead. (I removed the line about checking -1 on the Wiki page because a message box never returns -1, it returns 0 exactly as described here when something is wrong.)

Go back to the object where you attached the script and fill the properties again.
User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Thu Jun 21, 2012 4:52 pm

I use this script now:
Scriptname _1_PassToNeylojei extends ObjectReference  Message Property OptionsMenu00MESG Auto ; Assigns the menu ('properties')Event OnActivate(ObjectReference akActionRef); Show Menu		 Menu() ; now prompt to menu functionendEventFunction Menu(Int aiMessage = 0, Int aiButton = 0, Bool abMenu = True)	    While abMenu			    If aiMessage == 0               		 If (aiButton != -1) ; Wait for input					    aiButton = OptionsMenu00MESG.Show()					    If aiButton == 0						  Debug.Notification("Pressed 1")						  abMenu = False					    ElseIf aiButton == 1						  Debug.Notification("Pressed 2")						  abMenu = False					    ElseIf aiButton == 2						  Debug.Notification("Pressed 3")						  abMenu = False					    EndIf                        EndIf			    EndIf	    EndWhileEndFunction

My messagebox is set up right, and I have set it in the properties.

It is still displaying the top left message "Pressed 1". I don't know what I'm doing wrong here.
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Thu Jun 21, 2012 8:46 pm

Are you sure you filled the properties? Take a look at http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Introduction_to_Properties#Hooking_up_the_message_boxes_to_the_properties_in_the_script or http://tesalliance.org/forums/index.php?/topic/4697-class-1-start-here-for-basics/, especially step 7. Otherwise, no idea what you're doing wrong either.

Your code should work. Maybe you'll need to upload it somewhere so we can take a look at it.
User avatar
Lindsay Dunn
 
Posts: 3247
Joined: Sun Sep 10, 2006 9:34 am


Return to V - Skyrim