SandMouseAnarchy Posted February 28, 2019 Author Share Posted February 28, 2019 (edited) Ah fair enough, I did atleast test on a clean save before the mod was loaded each time ^.^ Haha Yeh please do let me know mate :) if I stumble on an answer to it I'll let you know too :) Edited February 28, 2019 by SandMouseAnarchy Link to comment Share on other sites More sharing options...
DieFeM Posted February 28, 2019 Share Posted February 28, 2019 I think I got it, it checks for the quest stage and it checks for the power armor, everything seems to work: Scriptname SM_Equip extends ObjectReference Message Property TutorialPipboyMessage_SM_Style Auto Mandatory Const ObjectMod[] Property ModIndex Auto Mandatory Const Quest Property MQ101 Auto Mandatory Bool CurrentlyAttachingMod = False Bool NewGameStarted = True Event OnEquipped(Actor akActor) If NewGameStarted If MQ101.GetStage() > 20 NewGameStarted = False EndIf EndIf If !NewGameStarted && !CurrentlyAttachingMod && akActor == Game.GetPlayer() && !akActor.IsInPowerArmor() CurrentlyAttachingMod = True Int iButton = TutorialPipboyMessage_SM_Style.Show() ; Shows your menu. If iButton < 4 ;0 open, 1 closed, 2 unziped, 3 tied AttachMod(ModIndex[iButton]) Debug.Notification("Mod Index " + iButton + " equipped") Else Debug.Notification("Style unchanged (Index " + iButton + ")") ;4 cancel EndIf CurrentlyAttachingMod = False EndIf EndEvent Remember to set the script properties, "Auto-Fill All" will do the job for two of them, but you'll need to fill the Object mods manually, add them in the same order than the buttons of the message (0 open, 1 closed, 2 unziped, 3 tied). Link to comment Share on other sites More sharing options...
SandMouseAnarchy Posted March 1, 2019 Author Share Posted March 1, 2019 YEEEES!!!! Thats the one DieFeM mate :) total legend! that new script works perfectly! I had no idea you could write the "iButton" part like that either, thats very sleek :) Thankyou again mate :) Link to comment Share on other sites More sharing options...
SandMouseAnarchy Posted March 1, 2019 Author Share Posted March 1, 2019 (edited) So the script still works perfectly :)And in an attempt to understand the script better I thought I would brainstorm a little. So, in the beginning it says - "bool CurrentlyAttachingMod = false"((meaning - no options menu is showing?)) And then in the beginning of OnEquipped() Event it says - "&& !CurrentlyAttachingMod"((meaning - CurrentlyAttachingMod = not false?)) And then "CurrentlyAttachingMod" is set to True ((I think because CurrentlyAttachingMod is set to false again at the end of OnEquipped Event - this is like a state? Where the options menu can only show when CurrentlyAttachingMod is set to true?)) This is the bit that confuses me ->At the beginning on OnEquipped Event "&& !CurrentlyAttachingMod" is required to go further, but "not(!) CurrentlyAttachingMod" means "not false"? - so that means that it's true? And if it is true at the beginning of OnEquipped wouldn't the menu keep popping up infinitely when an option is selected?And then why does "CurrentlyAttachingMod = true" need to be written before showing the menu if it was already true at the beginning of OnEquipped event? Edited March 1, 2019 by SandMouseAnarchy Link to comment Share on other sites More sharing options...
DieFeM Posted March 1, 2019 Share Posted March 1, 2019 (edited) So the script still works perfectly :smile:And in an attempt to understand the script better I thought I would brainstorm a little. So, in the beginning it says - "bool CurrentlyAttachingMod = false"((meaning - no options menu is showing?)) It creates a new variable which can store true or false, a boolean value, that I use in the condition later. And then in the beginning of OnEquipped() Event it says - "&& !CurrentlyAttachingMod"((meaning - CurrentlyAttachingMod = not false?))And then "CurrentlyAttachingMod" is set to True ((I think because CurrentlyAttachingMod is set to false again at the end of OnEquipped Event - this is like a state? Where the options menu can only show when CurrentlyAttachingMod is set to true?))This is the bit that confuses me ->At the beginning on OnEquipped Event "&& !CurrentlyAttachingMod" is required to go further, but "not(!) CurrentlyAttachingMod" means "not false"? - so that means that it's true? And if it is true at the beginning of OnEquipped wouldn't the menu keep popping up infinitely when an option is selected?And then why does "CurrentlyAttachingMod = true" need to be written before showing the menu if it was already true at the beginning of OnEquipped event? A conditional (if) will run the code after it until the end of the block (endif) only when all the conditions evaluate as true so if CurrentlyAttachingMod contains False it would evaluate "NOT False", this evaluates as true, but if it contains True it would evaluate "NOT True", this evaluates as False. When you want to evaluate something, if this something must be false you use ! :!CurrentlyAttachingMod is the same than CurrentlyAttachingMod == False But if what you want to evaluate that something is true :CurrentlyAttachingMod is the same than CurrentlyAttachingMod == True. Let's say that at a given moment those are the values NewGameStarted is FalseCurrentlyAttachingMod is FalseakActor == Game.GetPlayer() is TrueakActor.IsInPowerArmor() is False If !NewGameStarted && !CurrentlyAttachingMod && akActor == Game.GetPlayer() && !akActor.IsInPowerArmor()becomesIf (Not False and Not False and True and Not False)this evaluatesIf (True and True and True and True)which evaluates asIf True If only one of these conditions evaluates differently it would evaluate as false. So, when the block of code starts, before attachMod(), it changes to CurrentlyAttachingMod = True, so when you call attachMod() and OnEquipped fires again this conditional evaluates as false, and the block of code is ignored.Then, when attachMod() has finished, CurrentlyAttachingMod is set to back to False, so the next time you equip it the conditional evaluates as true. Edited March 1, 2019 by DieFeM Link to comment Share on other sites More sharing options...
SandMouseAnarchy Posted March 1, 2019 Author Share Posted March 1, 2019 "A conditional (if) will run the code after it until the end of the block (endif) only when all the conditions evaluate as true" Ooooooh! I thought that the conditions just had to be accurate, not necessarily equating to true. No wonder half my logic in scripts seems to fail... (I've been writing some of those conditions to = false in order to run to the end of the block not knowing that it would fail and stop running when it hit the false condition. Thanks for explaining DieFeM, your coding genius know no bounds good sir ^.^ thank-you again! Link to comment Share on other sites More sharing options...
Recommended Posts