antstubell Posted March 19, 2021 Share Posted March 19, 2021 Rusty at scripting and I've forgot how to do this. Make the script below show the notification once using a bool property. I know I can use global variables but this seems wasteful for just one instance and I don't want a load of variables just for this purpose.Thank you. Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)if akOldContainer && !akNewContainerDebug.Notification("I’ve have been dropped and will disappear.")Self.Delete()EndIfEndEvent Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 19, 2021 Share Posted March 19, 2021 This uses a local bool variable rather than a property, but can be changed to a property if needed. Bool DoOnce = false Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If (DoOnce == false) && (akOldContainer && !akNewContainer) Debug.Notification("I’ve have been dropped and will disappear.") Self.Delete() DoOnce = true EndIf EndEvent If this were a more often ran event, you could use the state approach and change states such that nothing will be done when the event is triggered. Link to comment Share on other sites More sharing options...
antstubell Posted March 19, 2021 Author Share Posted March 19, 2021 (edited) Thanks. I need the dropped item to be deleted every time but see the massage once. I'm guessing swapping the lines DoOnce = true and Self.Delete() will achieve this? Edited March 19, 2021 by antstubell Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 19, 2021 Share Posted March 19, 2021 Helps to know intent... This should do what you want Bool DoOnce = false Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If (akOldContainer && !akNewContainer) If (DoOnce == false) Debug.Notification("I’ve have been dropped and will disappear.") DoOnce = true EndIf Self.Delete() EndIf EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts