I'm always asking for advice, but now I just feel like chatting. Share your tips.
How do YOU handle eventing? Specifically, when you have multiple events in a project that need to be turned off after triggering or multiple events when you only want one to fire at a time?
My current solution has been arrays. I export a variable from my object and then check if that variable is in a global/autoload array. If it's there, the trigger fires and if not, it doesn't.
The global (easy, though you'd likely want multiple arrays for different types of objects)
var _eventArray = ['default']
And then in the object:
export var _eventKey = 'default'
I also have a 'default' tag in the array so if it's an event that triggers multiple times (like an NPC text event), you can just keep 'default' and not even have to edit it. (Sure, I could use ' ' - a space - but I like my stuff to be legible.)
It's also great for standard "switches" in games.
Switch On function
Global._eventArray.append('switch1')
And then back off:
Global._eventArray.remove('switch1')
It's been working great and is giving me a lot of complexity with very little code. I am sure I will need spreadsheets before long but - hey! It works!
How do you event and do you foresee any problems with this method?