TheoGeek
January 27th, 2021, 22:57
Hey all!
I'm trying to create an extension for 5E that needs to "intercept" when a user clicks on a token. I've got it working with the following snippet in my onInit() function...
onClickRelease = Token.onClickRelease;
Token.onClickRelease = onClickReleaseWrapper;
... but I'd like to "call" the original when I'm done in case some other extension overloads it too.
Basically, I want this:
user clicks token on map -> execute my "wrapper" extension -> "wrapper" extension calls original handler -> original returns -> "wrapper" returns
This outline has worked well for other extensions (I use it extensively in the ImprovedCritical one...not for token clicks but for other things), but I can't find Token.onClickRelease in the 5E or CoreRPG rulesets, and when I try to add a call to "onClickRelease" I get an error because onClickRelease ends up being set to "nil" in the init function (i.e. Token.onClickRelease is "nil" as well). I must be going mad because my wrapper executes fine when the mouse button is released on a token, so it understands "Token.onClickRelease".
Please encourage me that I'm just ignorant and not mental.
Thanks!
I'm trying to create an extension for 5E that needs to "intercept" when a user clicks on a token. I've got it working with the following snippet in my onInit() function...
onClickRelease = Token.onClickRelease;
Token.onClickRelease = onClickReleaseWrapper;
... but I'd like to "call" the original when I'm done in case some other extension overloads it too.
Basically, I want this:
user clicks token on map -> execute my "wrapper" extension -> "wrapper" extension calls original handler -> original returns -> "wrapper" returns
This outline has worked well for other extensions (I use it extensively in the ImprovedCritical one...not for token clicks but for other things), but I can't find Token.onClickRelease in the 5E or CoreRPG rulesets, and when I try to add a call to "onClickRelease" I get an error because onClickRelease ends up being set to "nil" in the init function (i.e. Token.onClickRelease is "nil" as well). I must be going mad because my wrapper executes fine when the mouse button is released on a token, so it understands "Token.onClickRelease".
Please encourage me that I'm just ignorant and not mental.
Thanks!