jim555511 Posted December 1, 2017 Share Posted December 1, 2017 Hi there, thanks for the help. So i have a message box, lets call it message box A. Message box A has a couple of different selections in it and when a certain selection is made a new message box appears which we'll call message box B. Now i have a back button in message box B but i'm not for sure how to script it, how can i get it so that when you select back on message box B you go back to message box A? Link to comment Share on other sites More sharing options...
DavidJCobb Posted December 1, 2017 Share Posted December 1, 2017 Given two message boxes,Box A0 = Stop1 = Show Box B2 = Do Something Else Box B0 = Back to Box A1 = Do Something Else2 = Do Something Else try this code: Function MyFunction() Bool bWorking = True Int iSelection While bWorking ; ; This loop just exists to show Box A repeatedly until bWorking is set to False. ; As such, message boxes can either loop back to Box A, or set bWorking to False ; to close the entire menu system. ; iSelection = MessageBoxA.Show() If iSelection == 0 ; ; Stop showing message boxes ; bWorking = False ElseIf iSelection == 1 ; ; Show Message Box B, and handle it ; iSelection = MessageBoxB.Show() If iSelection == 0 ; ; Don't do anything here. The loop will carry us right back to Box A. ; ElseIf iSelection == 1 ; ; Do whatever it is we need to do. If we want to stop after doing it, ; set bWorking to False. Otherwise, just leave it True, and the loop ; will carry us right back to Box A. ; ElseIf iSelection == 2 ; ; Do whatever it is we need to do. If we want to stop after doing it, ; set bWorking to False. Otherwise, just leave it True, and the loop ; will carry us right back to Box A. ; EndIf ElseIf iSelection == 2 ; ; ... do something else ... ; EndIf EndWhile EndFunction Link to comment Share on other sites More sharing options...
ikonomov Posted April 3, 2020 Share Posted April 3, 2020 DavidJCobb thank you for your example and perfect explanation! Link to comment Share on other sites More sharing options...
dylbill Posted April 3, 2020 Share Posted April 3, 2020 (edited) For Menus and Sub Menus I prefer to use functions. That way, you can specify which menu to go to and when. Example script: Message Property Message1 Auto Message Property Message2 Auto Message Property Message3 Auto Event SomeEvent() Menu1() ;open main menu EndEvent Function Menu1() Int Button = Message1.Show() If Button == 0 ;do something Elseif Button == 1 Menu2() ;open sub menu 2 Endif EndFunction Function Menu2() Int Button = Message2.Show() If Button == 0 ;do something Elseif Button == 1 Menu3() ;open sub menu 3 Elseif Button == 2 Menu1() ;go back to main menu Endif EndFunction Function Menu3() Int Button = Message3.Show() If Button == 0 ;do something Elseif Button == 1 Menu2() ;go back to sub menu 2 Elseif Button == 2 Menu1() ;go back to main menu Endif EndFunction Edited April 3, 2020 by dylbill Link to comment Share on other sites More sharing options...
Noober1 Posted January 8, 2021 Share Posted January 8, 2021 For Menus and Sub Menus I prefer to use functions. That way, you can specify which menu to go to and when. Example script: Message Property Message1 Auto Message Property Message2 Auto Message Property Message3 Auto Event SomeEvent() Menu1() ;open main menu EndEvent Function Menu1() Int Button = Message1.Show() If Button == 0 ;do something Elseif Button == 1 Menu2() ;open sub menu 2 Endif EndFunction Function Menu2() Int Button = Message2.Show() If Button == 0 ;do something Elseif Button == 1 Menu3() ;open sub menu 3 Elseif Button == 2 Menu1() ;go back to main menu Endif EndFunction Function Menu3() Int Button = Message3.Show() If Button == 0 ;do something Elseif Button == 1 Menu2() ;go back to sub menu 2 Elseif Button == 2 Menu1() ;go back to main menu Endif EndFunction This works perfectly for a mod I am working on!!! Thanks for sharing!!! Link to comment Share on other sites More sharing options...
dylbill Posted January 8, 2021 Share Posted January 8, 2021 No problem, happy modding :) Link to comment Share on other sites More sharing options...
Recommended Posts