Jump to content

Multiple Messages in one Script


eleglas

Recommended Posts

Can you use Multiple Messages with multiple buttons in each one in one script without it going haywire? I tried using a variable to separate each section, but no luck, all the buttons seemed to mash together.

 

Any help?

Link to comment
Share on other sites

Everybody has their favorite ways of doing it. Here's one of mine, using a token. It's important to keep the GetButtonPressed command isolated so it captures a button just once. Then the ShowMessage block and the button processing blocks are isolated too.

 

scn RHKMYMenuExampleScript



short iAwaitingInput
short iButtonPressed
short iMessageToShow
short iMessageShown

;---------- This script is launched from an armor token when added to an NPC, for example

BEGIN ONADD

set iMessageToShow to 1

END

BEGIN GameMode

	if (iMessageShown)
	else
		if (iMessageToShow == 1)
			ShowMessage RHKMyMessageTop
			set iMessageShown to 1
			set iAwaitingInput to 1
		elseif (iMessageToShow == 2)
			ShowMessage RHKMyMessageSub1
			set iMessageShown to 2
			set iAwaitingInput to 1
		elseif (iMessageToShow == 3)
			ShowMessage RHKMyMessageSub2
			set iMessageShown to 3
			set iAwaitingInput to 1
		endif
	endif
	
	
	if (iAwaitingInput)
		set iButtonPressed to GetButtonPressed
		if (iButtonPressed > -1)
      			set iAwaitingInput to 0

			if (iMessageShown == 1)
				if (iButtonPressed == 0)	;Sub 1
					set iMessageShown to 0
					set iMessageToShow to 2					
				elseif (iButtonPressed == 1)	;Sub 2
					set iMessageShown to 0
					set iMessageToShow to 3	
				elseif (iButtonPressed == 2)	;Done
					removeme	
				endif
			elseif (iMessageShown == 2)
				if (iButtonPressed == 0)
						;Do stuff
				elseif (iButtonPressed == 1)
						;Do Stuff
				elseif (iButtonPressed == 2)
						;Do Stuff
				elseif (iButtonPressed == 3)	;Back
					set iMessageShown to 0
					set iMessageToShow to 1
				elseif (iButtonPressed == 4)	;Done
					removeme	
				endif
			elseif (iMessageShown == 3)	
				if (iButtonPressed == 0)
						;Do stuff
				elseif (iButtonPressed == 1)
						;Do Stuff
				elseif (iButtonPressed == 2)
						;Do Stuff
				elseif (iButtonPressed == 3)	;Back
					set iMessageShown to 0
					set iMessageToShow to 1
				elseif (iButtonPressed == 4)	;Done
					removeme	
				endif
			endif
		endif
	endif
	
END

Link to comment
Share on other sites

Just Highlight it to see it.

 

I'm still having problems with it; the main message doesn't go anywhere when I want it to, this is my code:

 

SCN 000VoiceBoxX


short iAwaitingInput
short iButtonPressed
short iMessageToShow
short iMessageShown

;---------- This script is launched from an armor token when added to an NPC, for example

BEGIN OnEquip

       set iMessageToShow to 1

END

BEGIN GameMode
		If (iMessageShown)
		Else
                       if (iMessageToShow == 1)
                               ShowMessage 000VoiceMainMessage
                               set iMessageShown to 1
                               set iAwaitingInput to 1
                       elseif (iMessageToShow == 2)
                               ShowMessage 000VoiceTaunt01Message
                               set iMessageShown to 2
                               set iAwaitingInput to 1
                       elseif (iMessageToShow == 3)
                               ShowMessage 000VoiceBattleMessage
                               set iMessageShown to 3
                               set iAwaitingInput to 1
                       elseif (iMessageToShow == 4)
                               ShowMessage 000VoiceTaunt02Message
                               set iMessageShown to 4
                               set iAwaitingInput to 1
                       endif
               Endif
               
               if (iAwaitingInput)
                       set iButtonPressed to GetButtonPressed
                       if (iButtonPressed > -1)
                       set iAwaitingInput to 0

                               if (iMessageShown == 1)
                                       if (iButtonPressed == 0)        ;Sub 1
					                  set iMessageShown to 0
                                               set iMessageToShow to 2                                 
                                       elseif (iButtonPressed == 1)    ;Sub 2
                                               set iMessageShown to 0
                                               set iMessageToShow to 3 
                                       elseif (iButtonPressed == 2)    ;Done
                                               
                                       endif
                               elseif (iMessageShown == 2)
                                       if (iButtonPressed == 0)
										;Do stuff
										PlaySound 000VoiceTaunt01
                                       elseif (iButtonPressed == 1)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt02
                                       elseif (iButtonPressed == 2)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt03
                                       elseif (iButtonPressed == 3)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt04
                                       elseif (iButtonPressed == 4)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt05
                                       elseif (iButtonPressed == 5)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt06
                                       elseif (iButtonPressed == 6)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt07
                                       elseif (iButtonPressed == 7)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt08
                                       elseif (iButtonPressed == 8)    ;Next
                                               set iMessageShown to 0
                                               set iMessageToShow to 4
                                       elseif (iButtonPressed == 9)    ;Done

                                       endif

                               elseif (iMessageShown == 4)
                                       if (iButtonPressed == 0)
										;Do stuff
										PlaySound 000VoiceTaunt09
                                       elseif (iButtonPressed == 1)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt10
                                       elseif (iButtonPressed == 2)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt11
                                       elseif (iButtonPressed == 3)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt12
                                       elseif (iButtonPressed == 4)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt13
                                       elseif (iButtonPressed == 5)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt14
                                       elseif (iButtonPressed == 6)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt15
                                       elseif (iButtonPressed == 7)
                                                       ;Do Stuff
										PlaySound 000VoiceTaunt16
                                       elseif (iButtonPressed == 8)    ;Back
                                               set iMessageShown to 0
                                               set iMessageToShow to 2
                                       elseif (iButtonPressed == 9)    ;Done

                                       endif

                               elseif (iMessageShown == 3)     
                                       if (iButtonPressed == 0)
                                                       ;Do stuff
										PlaySound 000VoiceBC01
                                       elseif (iButtonPressed == 1)
                                                       ;Do Stuff
										PlaySound 000VoiceBC02
                                       elseif (iButtonPressed == 2)
                                                       ;Do Stuff
										PlaySound 000VoiceBC03
                                       elseif (iButtonPressed == 3)
                                                       ;Do Stuff
										PlaySound 000VoiceBC04
                                       elseif (iButtonPressed == 4)    ;Done
  
                                       endif
                               endif
                       endif
               endif
            Player.UnEquipitem 000SpyVoiceBox   
END

 

For clarity I'm trying to make a voice box with multiple voices put into two categories, Taunts and Battle Cries, there are 2 pages of Taunts because their are 16 taunts, but only 4 battle cries. Because their are so many taunts, I need 2 messages to display them all, as you know you can only have 10 buttons on a single message, two on each page are Next/Back and Exit buttons.

 

Can you help me fix this?

Link to comment
Share on other sites

You probably want to put this line : Player.UnEquipitem 000SpyVoiceBox under the buttons where the player hit's 'Done'. Otherwise, the first message will be shown, then the voicebox will be unequipped

 

Also, every time a button is processed, you have to set iMessageShown to 0, then set iMessageToShow to X <---the same message number or a different number, in order to stay in the message system.

 

elseif (iMessageShown == 2)

if (iButtonPressed == 0)

set iMessageShown to 0

set iMessageToShow to 2

PlaySound 000VoiceTaunt01

 

elseif (iButtonPressed == 1)

;Do Stuff

Link to comment
Share on other sites

  • Recently Browsing   0 members

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