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 .
×
Create a free account

Stop an 'on' event listener

1523824313
Robin
API Scripter
Is there a way to stop listening to an event set with the 'on' function?
1523825736
Jakob
Sheet Author
API Scripter
Robin K. said: Is there a way to stop listening to an event set with the 'on' function? Not as far as I'm aware, but you can certainly find a workaround for whatever your use case is, e.g. setting some variable to make the callback function do nothing.
1523866256

Edited 1523866294
GiGs
Pro
Sheet Author
API Scripter
You should be able to set up a chat command to switch the listener on and off, perhaps with a boolean stored in the state. Then in the on event, have an if statement wrapping your actual process code so that it doesnt actually do anything if the boolean is false. Edit: Ninja'd by Jakob, only by 11 hours...
1523950082
Robin
API Scripter
Thank you for the replies guys! I take a look in to this.