This may be my last time to post before I leave town on holiday so I hope my answers to your questions make sense.
The code I posted for the read book option is apart from the process when the player makes the choice. It has to be so since
button == 0 will only be true for the one frame that the player clicks on that choice. readBook is set to 1 by that choice, but the code triggered by that value runs outside of the messageOn block. It might look like this:
Note that I make your Enable and Disable doOnce, constantly enabling or disabling will interfere with some script functions so it is better to not take chances with it.
Begin MH_bk_antecedantsdwemerlaw_sshort buttonshort messageOnshort readBookshort frameCountif ( GetDisabled == 0 ); make this doOnce if ( "MH_Mantriel".MH_var_bk_antecedantsdwemerlaw != 4 ) Disable endifelse; currently disabled if ( "MH_Mantriel".MH_var_bk_antecedantsdwemerlaw == 4 ) Enable endif return; for efficiency - no need to process further if disabledendifif ( readBook == 1 ) set readBook to 2 player->AddItem "bk_antecedantsdwemerlaw" 1 returnelseif ( readBook == 2 ) set readBook to 3 player->Equip "bk_antecedantsdwemerlaw" returnelseif ( readBook == 3 ) set frameCount to ( frameCount + 1 ) if ( frameCount < 5 ); wait return endif set frameCount to 0; reset for next time set readBook to 4 returnelseif ( readBook == 4 ) set readBook to 0 player->RemoveItem "bk_antecedantsdwemerlaw" 1endifif ( OnActivate == 1 ) set messageOn to 1 Messagebox "Would you like to...?" "Read the book?" "Take the book?" "Leave it"endifif ( messageOn == 1 ) set button to GetButtonPressed if ( button == -1 ); no button pressed return elseif ( button == 0 ); read book set readBook to 1 elseif ( button == 1 ); take book player->AddItem "bk_antecedantsdwemerlaw" 1 set "MH_Mantriel".MH_var_bk_antecedantsdwemerlaw to 3 PlaySound "Item Misc Up" else; cancel action endif set messageOn to 0; reset for next timeendifEnd MH_bk_antecedantsdwemerlaw_s
I neglected to mention before, but the workaround with the fake book adding and equipping a book for the player to read causes a 'menu hang' ( no mouse movement) after the book is closed. A right mouse click will resolve the matter. You will want to warn users of your mod about this known issue.
As for your previous post to this, I see now that MH_var_bk_antecedantsdwemerlaw is a local variable. You had not specified the object yesterday so it was unclear to me how it is set. You present syntax is correct. Since the NPC and the books are in the same cell, there should be no difficulty reading and writing to that local variable in the script attached to MB_Mantriel (so now you are a reference librarian?
). However, you need to appreciate there are some limitations. For instance I do not believe you can set the value of the local to a variable remotely.
It has been demonstrated that a few hundred globals (or even tens of thousands) will not slow the game, but it does glut the saved game file with additional information. Back in the early days of Morrowind modding we were reluctant to introduce new globals in a way that no longer seems necessary, but I like to err on the conservative side. In Purchasable Alchemy Lab I use seven globals to place and control the interaction of over one hundred objects and their scripts without requiring persistent references. It seemed an economical solution to the problem.
If you require closed book meshes for some of the volumes, you can create the new object using a closed book nif provided by Bethesda.
I understand how easy it would be to have a momentary confusion between Book Rotate and Book Jackets. For the record, if you needed the book rotate code you would be able to use it since the creators of that mod offer permission to modders of new books to make their books 'rotatable'. The credits are actually included in the script's code. As for Book Jackets, I am confident that you can get permission from the author to use his/her textures with your project, but you do need to seek and obtain that permission before you release your project publicly.