shatsnazzle Posted March 19, 2018 Share Posted March 19, 2018 (edited) Hey everyone, I'm fairly new to modding so forgive my noobness and I can't find the answer to this particular question on the wiki although it's probably right under my nose. Let's say I have a script with a bunch of events: Event OnEventA() Do stuffEndEvent Event OnEventB() Do stuffEndEvent Event OnEventC() Do stuffEndEvent etc When I trigger the script to run in game, does the game read once through the script top to bottom checking for each event and if none of the events occur then that's it, the script is over, the script has gotten to the bottom and those events missed their window of opportunity since they did not occur when the script ran? Or does the script sit waiting for each event to occur?If they sit waiting for the event to occur can they occur in any order? Or does it all depend on what the script is attached to?Or does it depend on the particular event? I hope the explanation of my question was clear enough. Please let me know if I need to elaborate further on what is confusing me.Thank you so much for your help guys and girls! Edited March 19, 2018 by shatsnazzle Link to comment Share on other sites More sharing options...
RichWebster Posted March 19, 2018 Share Posted March 19, 2018 (edited) Depends mate. An event can be called in a script in various ways. Attached to an object reference the OnActivate events attached to it's scripts are called. That's in the engine. You can call any event manually by calling the function name. Events/functions will usually fire in the order they are called. And functions will wait for another function to finish before it moves on with the flow. Edited March 19, 2018 by B1gBadDaddy Link to comment Share on other sites More sharing options...
shatsnazzle Posted March 19, 2018 Author Share Posted March 19, 2018 Thank you for taking the time to answer B1gBadDaddy. I'm going to keep reading more on papyrus and the CK. Link to comment Share on other sites More sharing options...
RichWebster Posted March 19, 2018 Share Posted March 19, 2018 Happy to help mate, I'm a PHP developer but started out with coding in Skyrim. Lots of knowledge to share. Link to comment Share on other sites More sharing options...
cdcooley Posted March 21, 2018 Share Posted March 21, 2018 While events can be called like functions from other scripts, the Event type exists specifically because each one corresponds to some activity (i.e. event) that can occur in the game. So when you activate an object the game calls the OnActivate event for that object (if it's defined in some script attached to the object). When you take an item from a container there are three events and the item that was moved gets OnContainerChanged, the player gets OnItemAdded, and the container gets OnItemRemoved.Technically you can have the same event defined in multiple scripts all attached to the same object and they will all be called if the action that triggers the even happens. Link to comment Share on other sites More sharing options...
Recommended Posts