antstubell Posted November 17, 2019 Share Posted November 17, 2019 I have seen this done many times and am attempting my own solution to it but the way I am approaching it means it will be massively difficult to follow.So player activates a book and a message appear (first page of book). Player then can click 'Skip ahead' - only choice for page 1. Next message (section of book) has the options 'Go back' or 'Skip ahead' meaning return to previous message (page) or go to next message (page). This will continue - well I don't know - a few times at least there always being the option to go back to previous message and skip ahead to next.This is simple enough to script for 2 messages but after that I am lost. I'll attach my script but I have no idea if this is the way I should go about it.Thanks. Float Property pause AutoMessage Property MyMsg1 AutoMessage Property MyMsg2 AutoMessage Property MyMsg3 AutoSound Property MySND AutoEvent OnActivate(ObjectReference akActionRef)Int iButton = MyMsg1.show()If iButton == 0MySND.play(self)Utility.wait(pause); allow sfx to finishMyMsg2.show(); the following menus will have 0 = Go back and 1 Skip ahead.EndifEndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 18, 2019 Share Posted November 18, 2019 (edited) I think something like: Int iButton = myMsg1.Show() If iButton == 0 ;do stuff Int i2Button = myMsg2.Show() If i2Button == 0 ;go back stuff Else ; assumes only two options - use ElseIf when three or more options ;skip ahead stuff Int i3Button = myMsg3.Show() If i3Button == 0 ;go back stuff Else ;skip ahead stuff EndIf EndIf EndIf But lets leave room for other methods as menus were never something that I did much work with. PS. Indenting your script code can help make it easier to follow and track what is going on. Edited November 18, 2019 by IsharaMeradin Link to comment Share on other sites More sharing options...
maxarturo Posted November 18, 2019 Share Posted November 18, 2019 (edited) All "Message MENUS" must have 2 iButtons for this approach to work correctly. Read carefully the "Descriptions" below the "Message Property" and watch which iButton is calling which Function, otherwise you might end up in a continuous "LOOP". * And this can go on and on forever... calling "Functions" within "Functions".Example: Message Property Page01 Auto {Message + MENU 01 Buttons with EXIT page & NEXT} Message Property Page02 Auto {Message + MENU 02 Buttons with PREVIOUS page & NEXT page} Message Property Page03 Auto {Message + MENU 03 Buttons with PREVIOUS page & NEXT page} Message Property Page04 Auto {Message + MENU 04 Buttons with PREVIOUS page & EXIT} Event OnActivate(ObjectReference akActivator) if (akActivator == Game.GetPlayer()) Int iButton = Page01.Show() If iButton == 0 ; EXIT ; EXIT to be REACTIVATED ElseIf iButton == 1 ; NEXT PAGE Page02() EndIf EndIf EndEvent ; This is required (Repeating Page01) so that you don't EXIT when pressing "PREVIOUS PAGE" on "Function Page02()" Function Page01() Int iButton = Page01.Show() If iButton == 0 ; EXIT ; EXIT to be REACTIVATED ElseIf iButton == 1 ; NEXT PAGE Page02() EndIf Endfunction Function Page02() Int iButton = Page02.Show() If iButton == 0 ; PREVIOUS PAGE Page01() ElseIf iButton == 1 ; NEXT PAGE Page03() EndIf Endfunction Function Page03() Int iButton = Page03.Show() If iButton == 0 ; PREVIOUS PAGE Page02() ElseIf iButton == 1 Page04() ; NEXT PAGE EndIf Endfunction Function Page04() Int iButton = Page04.Show() If iButton == 0 ; PREVIOUS PAGE Page03() ElseIf iButton == 1 ; EXIT ; EXIT to be REACTIVATED EndIf Endfunction * Keep in mind for your book's pages that messages have a limit of 1023 characters, otherwise CTD will occur !!. Edit: Typo... Edited November 18, 2019 by maxarturo Link to comment Share on other sites More sharing options...
antstubell Posted November 18, 2019 Author Share Posted November 18, 2019 (edited) @IsharaMeradinI used the script you posted and got this error. I can't see the error.Message Property myMsg1 AutoMessage Property myMsg2 AutoMessage Property myMsg3 AutoEvent OnActivate(ObjectReference akActivator)if (akActivator == Game.GetPlayer())Int iButton = myMsg1.Show()If iButton == 0;do stuffInt i2Button = myMsg2.Show()If i2Button == 0;go back stuffElse ; assumes only two options - use ElseIf when three or more options;skip ahead stuffInt i3Button = myMsg3.Show()If i3Buttom == 0;go back stuffElse;skip ahead stuffEndIfEndIfEndIfEndifEndevent (19,7): variable i3Buttom is undefined(19,16): cannot compare a none to a int (cast missing or types unrelated) @maxarturoScript doesn't go past page 1 EDIT - More specifically maxarturo clicking 'Skip ahead' on page 1 causes exit. Edited November 18, 2019 by antstubell Link to comment Share on other sites More sharing options...
maxarturo Posted November 18, 2019 Share Posted November 18, 2019 - First of all this is just an example showing the logic behind this approach. - If you just copy/paste it, then the problem is on your side. To make this script work correctly each Message Menu must have a specific iButton order. * I checked the "Example" script and it has no issues. * I didn't test and compile it, but i've use this logic so many times and in way more complicated things that there is no doubt that this might not work. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 18, 2019 Share Posted November 18, 2019 @IsharaMeradinI used the script you posted and got this error. I can't see the error.<snip>(19,7): variable i3Buttom is undefined(19,16): cannot compare a none to a int (cast missing or types unrelated)<snip>Typo on my part in the provided example code. It has been fixed. The error message tells you exactly what line has the problem, line 19 of the code you tried to compile. Link to comment Share on other sites More sharing options...
antstubell Posted November 18, 2019 Author Share Posted November 18, 2019 @maxarturoMy bad. First page only had 1 button so it woill always close the book. Adding 'Close book' button0 and 'Skip ahead...' button1 solves this.@IsharaMeradinYes, I saw it not long after my post. Thanks guys. Link to comment Share on other sites More sharing options...
maxarturo Posted November 19, 2019 Share Posted November 19, 2019 Glad you make it work !. Just be careful if your "Book" has a lot of pages that each iButton is calling the correct Function each time (Back & Next), to avoid a continuous "LOOP", and putting the Player in a position with no other alternative to exit the book except "Ctrl - Alt - Del". Have a Happy modding !. Link to comment Share on other sites More sharing options...
Recommended Posts