Deleted45243387User Posted February 14, 2019 Author Share Posted February 14, 2019 If the bool is set false by default should the line read like this? Event OnConfigClose()RegisterForSingleUpdate(0.1)EndEvent Event OnUpdate()If BooksAdded == FalseAddBooks()ElseRemoveBooks()EndIfEndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 14, 2019 Share Posted February 14, 2019 Okay, so the books are being added each time the menu is being closed. Try this. Book[] Property MyBooks Auto Bool BooksAdded = False Bool InitialSetup = False Function AddBooks() Actor aPlayer = Game.GetPlayer() int i = MyBooks.Length while (i > 0) i -= 1 aPlayer.AddItem(MyBooks[i], 1) endWhile EndFunction Function RemoveBooks() Actor aPlayer = Game.GetPlayer() int i = MyBooks.Length while (i > 0) i -= 1 aPlayer.RemoveItem(MyBooks[i], 1) endWhile EndFunction Event OnOptionSelect(int option) If (option == OIDBooks) BooksAdded = !BooksAdded SetToggleOptionValue(option, BooksAdded) EndIf EndEvent Event OnConfigClose() RegisterForSingleUpdate(0.1) EndEvent Event OnUpdate() If BooksAdded == True If InitialSetup == False InitialSetup = True AddBooks() EndIf Else RemoveBooks() InitialSetup = False EndIf EndEvent This uses a "master" bool that is toggled when the books are added and thus prevents adding the books again. It is reset when the books are removed so that the books may be added once more when the option is turned on in the MCM. Link to comment Share on other sites More sharing options...
Deleted45243387User Posted February 14, 2019 Author Share Posted February 14, 2019 I will try this in the morning! Thank you for your continued help.. I really appreciate it.. Link to comment Share on other sites More sharing options...
Recommended Posts