Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences here.
×
×
Cookie Preferences
We use Cookies to help personalize and improve Roll20. For more information on our use of non-essential Cookies, visit our Privacy Policy here.
Play Now
Join a Game
Characters
Shop
Tools
Compendium
Community
Sign In
[Help] Trying to remove a callback function from an event.
Does anybody know how to remove a callback function from an event? I
want to issue a command in the chat to deactivate said callback
function. I have been looking through the documentation and cannot seem to find anything on it.
I don't know that there is a way to unregister the callback without restarting the sandbox. However, you can have the callback check some variable (probably in state) and possibly return immediately based on its value.
Manveti is right. There isn't a documented way of unregistering for events you have subscribed for via the on() function. Checking a variable is the correct approach to avoiding future responses. You can see an example of this in my isGM script. Follow the active variable through the code at lines 10 (initializing it), 30 (checking if it needs to be on), 41 (checking it to avoid work) and 53 (turning it off when work is done).