npdogg Posted June 24, 2019 Posted June 24, 2019 On 6/24/2019 at 5:48 PM, RichWebster said: It is listening for a startup event, and it's called from the fragment. It's probably personal preference, but I like to organise my code in how it behaves and is used. It's not an event, though. It's behaving like a function call, since that's what it is.
RichWebster Posted June 24, 2019 Posted June 24, 2019 On 6/24/2019 at 6:13 PM, npdogg said: On 6/24/2019 at 5:48 PM, RichWebster said:  It is listening for a startup event, and it's called from the fragment. It's probably personal preference, but I like to organise my code in how it behaves and is used. It's not an event, though. It's behaving like a function call, since that's what it is.And you don't think that somewhere in the source code there's a function that calls an event in Papyrus?
npdogg Posted June 24, 2019 Posted June 24, 2019 On 6/24/2019 at 6:41 PM, RichWebster said: And you don't think that somewhere in the source code there's a function that calls an event in Papyrus? At some point every function is called by another function, otherwise it's dead code. You can call all functions "events" by that definition if you want, but they still exist outside the language event model, or the event framework provided by SKSE.
RichWebster Posted June 24, 2019 Posted June 24, 2019 On 6/24/2019 at 7:36 PM, npdogg said: On 6/24/2019 at 6:41 PM, RichWebster said:  And you don't think that somewhere in the source code there's a function that calls an event in Papyrus? At some point every function is called by another function, otherwise it's dead code. You can call all functions "events" by that definition if you want, but they still exist outside the language event model, or the event framework provided by SKSE.There is no spoon.
npdogg Posted June 24, 2019 Posted June 24, 2019 On 6/24/2019 at 7:38 PM, RichWebster said: There is no spoon. So how do I register as a listener to your "Startup" event?
RichWebster Posted June 24, 2019 Posted June 24, 2019 You need SKSE to create automated listeners. Fallout 4 has this feature built in.
RichWebster Posted June 24, 2019 Posted June 24, 2019 In papyrus the only difference between creating an event and a function is semantics. I'm not sure why you've chosen this hill to die on though. Can't you just not do it?
npdogg Posted June 24, 2019 Posted June 24, 2019 (edited) On 6/24/2019 at 8:03 PM, RichWebster said: In papyrus the only difference between creating an event and a function is semantics. I'm not sure why you've chosen this hill to die on though. Can't you just not do it? I think you meant event listener, and that's true. However, your use of the Event keyword implies an event that doesn't actually exist in the Papyrus event model. I can't listen for your "Startup" event, because it isn't actually an event. And SKSE is no help because you didn't define your "event" with SKSE either. So no, the difference is not semantics. Edited June 24, 2019 by npdogg
npdogg Posted June 25, 2019 Posted June 25, 2019 On 6/25/2019 at 2:57 AM, RichWebster said: I suppose we'll have to agree to disagree. lol dude. It's very simple. Event handlers are all functions, but not all functions are event handlers. Events are called through the papyrus engine event model or from custom events defined with SKSE. Giving your function the "Event" keyword doesn't make it an event handler, semantically or otherwise. It just makes your code more confusing. I didn't tell you to adopt a bad convention. If you don't like it being criticized, you don't have to post about it on discussion forums.
Recommended Posts