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

TokenMod scripts not working

July 30 (6 years ago)

I have a few simple macros using token-mod API to manage NPCs/monsters. They have worked fine in the past.  Today they are not working.

I tried restarting the API sandbox, which appeared to be successful but there was no change in behavior.

Here's an example of a macro (this one for rolling monster HP):

!token-mod --set bar1_value|[[@{selected|npc_hpformula}]]

When I execute the macro, nothing happens and there's no error message that I can find.

Thanks for any help!


July 30 (6 years ago)
The Aaron
Roll20 Production Team
API Scripter

This will likely get moved to API, scripts are community created and don't get support in bugs. 

If you take the ! off the front, do you get some reasonable output?

token-mod --set bar1_value|[[@{selected|npc_hpformula}]]
July 31 (6 years ago)

Thanks for the reply! I will try to post my question in the right place next time :)

I launched my game to run your check, but found the original macro works now. (I had tried relaunching previously).

So I guess it was something temporary.  Thx again!

July 31 (6 years ago)
The Aaron
Roll20 Production Team
API Scripter

My speculation is you selected a token with no npc_hpformula, or group selected and got something that wasn't a character, so the reference was empty. Taking the ! off the front of API commands can be a good way to verify they are being sent what you expect. TokenMod will silently reject bad input for the most part. I should probably add something that shows last errors or something...  I'll add that to the list! =D

Hi Arik, I've moved this to the appropriate forum.

August 01 (6 years ago)

Thanks again for the feedback.  I'm pretty sure it was simply a temporary issue of some sort, first because when it wasn't working I tried several macros that used the token-mod api command, and also since I checked same page and same token that didn't work perviously, and it worked later.

In either case, I appreciate the quick responses and I will make use of the TS tip next time!