Page MenuHomeFeedback Tracker

Add the ability to get subscriber count of ScriptInvokers
Feedback, NormalPublic

Description

Sometimes there is a necessity to check if ScriptInvoker event was subscribed at all, so you could do basic ""if there are still existing subscribers to event do one thing, if not do other" logic but without introducing additional variables thus increasing complexity and coupling of the scripting code.
For example, I want to implement "location clear" logic where it could be cleared by various ways (picking up an item, killing all enemies an area etc) and they all will call the same OnClear event. I want to add fallback subscriber if there are no subscribers (no enemies nor items spawned by various reasons), and this is why I need to check if there were subscribers at all. It could be achieved with using external m_iSubscribersCount, m_bIsSubscribed flags etc, but it will increase spaghettiness of code and coupling, so it would be so nice if there would be something like GetSubscribersCount() method in the API.

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
General

Event Timeline

Socrates created this task.Mar 7 2024, 9:31 PM
Socrates updated the task description. (Show Details)Mar 7 2024, 9:36 PM
Geez changed the task status from New to Awaiting internal Testing.Mar 8 2024, 11:16 AM
Geez changed the task status from Awaiting internal Testing to Feedback.