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

Use different APIs from drop down?

Hoping to get a little input here. I'm relatively new to coding macros, so I'm not entirely sure if what I'm trying to do is even possible. The end goal is to be able to place status effects on tokens via a drop down. (I find it easier to parse words than symbols in this case.) I've been trying to use TokenMod to achieve this, but I'm running into an issue. If I start a standard drop down:

?{Apply Status|Red, !token-mod --set statusmarkers|red}

The drop down will return the first "Red" as an option, and then "red" as a second option. Unfortunately, due to the syntax to use TokenMod's status markers function, the Vbar is interpreted as starting option 2 in the drop down. Is there a workaround that I just don't know or can't figure out?

I also tried !token-mod --set statusmarkers| ?{red|blue|yellow|etc...} but that was equally ineffective (the reasons being obvious now that I look back at it.

I ALSO also tried a really clunky thing where I made an individual macro for setting the Red status marker called "Status-Red" (just using the regular !token-mod --set statusmarkers|red) then making a second macro where I tried to work around my vbar problem by ?{Apply Status|Red, #Status-Red}. But it seems like can't use a # to call a macro that's actually an API function.

Those were all my clever ideas. Any help would be appreciated. The Aaron? Is this one of the many knots you've unraveled? Or is there already an API for this I've somehow missed?

Thanks!

April 08 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

Hey!  Sorry for the delay.  Give this a go:

?{Apply Status|Red, !token-mod --set statusmarkers#red|Blue, !token-mod --set statusmarkers#blue}

TokenMod accepts a # instead of a | for separating commands for exactly this reason. =D

Hmm. Doesn't seem to be working. Roll20 is definitely detecting the drop down, because when I use the macro I have the option to apply a red and a blue. But when you submit your choice, it only returns:

!token-mod --set statusmarkers#red (or ...#blue if that was my choice). 

It seems like Roll20 has trouble detecting the API command in this context with this syntax.

As for "the delay." Get outta here with that talk. I posted this and went to bed. Haha thank you for your responsiveness. You've pretty much single handedly provided dozens of "wow" moments to my players already.


April 08 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

Oh!  Yeah, I was on my way to bed too, and making small mistakes.  Take the space out in front of the ! like this:

?{Apply Status|Red,!token-mod --set statusmarkers#red|Blue,!token-mod --set statusmarkers#blue}

Hahahah. =D

Heeeey! There we go. Success! Such a simple little mistake. I tested it with the "!" switch in front of the status and now I've got a fully functional toggle in drop down. Neat-o. Thank you so much.

April 08 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

No problem! =D

April 08 (5 years ago)

Edited April 08 (5 years ago)

For anyone using TokenMod and looking for a similar macro in the future, the macro to apply status markers from a drop down menu looks like this:

?{Apply Status|
Red,!token-mod --set statusmarkers#!red|
Blue,!token-mod --set statusmarkers#!blue|
Green,!token-mod --set statusmarkers#!green|
Brown,!token-mod --set statusmarkers#!brown|
Purple,!token-mod --set statusmarkers#!purple|
Pink,!token-mod --set statusmarkers#!pink|
Yellow,!token-mod --set statusmarkers#!yellow|
X,!token-mod --set statusmarkers#!X|
Dead,!token-mod --set statusmarkers#!dead|
Skull,!token-mod --set statusmarkers#!skull|
Sleepy,!token-mod --set statusmarkers#!sleepy|
Half-heart,!token-mod --set statusmarkers#!half-heart|
Half-haze,!token-mod --set statusmarkers#!half-haze|
Interdiction,!token-mod --set statusmarkers#!interdiction|
Snail,!token-mod --set statusmarkers#!snail|
Lightning-helix,!token-mod --set statusmarkers#!lightning-helix|
Spanner,!token-mod --set statusmarkers#!spanner|
Chained-heart,!token-mod --set statusmarkers#!chained-heart|
Chemical-bolt,!token-mod --set statusmarkers#!chemical-bolt|
Death-zone,!token-mod --set statusmarkers#!death-zone|
Drink-me,!token-mod --set statusmarkers#!drink-me|
Edge-crack,!token-mod --set statusmarkers#!edge-crack|
Ninja-mask,!token-mod --set statusmarkers#!ninja-mask|
Stopwatch,!token-mod --set statusmarkers#!stopwatch|
Fishing-net,!token-mod --set statusmarkers#!fishing-net|
Overdrive,!token-mod --set statusmarkers#!overdrive|
Strong,!token-mod --set statusmarkers#!strong|
Fist,!token-mod --set statusmarkers#!fist|
Padlock,!token-mod --set statusmarkers#!padlock|
Three-leaves,!token-mod --set statusmarkers#!three-leaves|
Fluffy-wing,!token-mod --set statusmarkers#!fluffy-wing|
Pummeled,!token-mod --set statusmarkers#!pummeled|
Tread,!token-mod --set statusmarkers#!tread|
Arrowed,!token-mod --set statusmarkers#!arrowed|
Aura,!token-mod --set statusmarkers#!aura|
Back-pain,!token-mod --set statusmarkers#!back-pain|
Black-flag,!token-mod --set statusmarkers#!black-flag|
Bleeding-eye,!token-mod --set statusmarkers#!bleeding-eye|
Bolt-shield,!token-mod --set statusmarkers#!bolt-shield|
Broken-heart,!token-mod --set statusmarkers#!broken-heart|
Cobweb,!token-mod --set statusmarkers#!cobweb|
Broken-shield,!token-mod --set statusmarkers#!broken-shield|
Flying-flag,!token-mod --set statusmarkers#!flying-flag|
Radioactive,!token-mod --set statusmarkers#!radioactive|
Trophy,!token-mod --set statusmarkers#!trophy|
Broken-skull,!token-mod --set statusmarkers#!broken-skull|
Frozen-orb,!token-mod --set statusmarkers#!frozen-orb|
Rolling-Bomb,!token-mod --set statusmarkers#!rolling-bomb|
White-tower,!token-mod --set statusmarkers#!white-tower|
Grab,!token-mod --set statusmarkers#!grab|
Screaming,!token-mod --set statusmarkers#!screaming|
Grenade,!token-mod --set statusmarkers#!grenade|
Sentry-gun,!token-mod --set statusmarkers#!sentry-gun|
All-for-one,!token-mod --set statusmarkers#!all-for-one|
Angel-outfit,!token-mod --set statusmarkers#!angel-outfit|
Archery-target,!token-mod --set statusmarkers#!archery-target}

(I only spot tested this macro; please go through and double check everything works before using this during a session. There may be typos.)

The general format is:

?{Apply Status|
Name to appear in Dropdown,!token-mod --set statusmarkers#!actual name of the marker}

So, for example, if you want to use the default "cobweb" emblem to represent the "restrained' condition in you drop down, you would write:

?{Apply Status|
Restrained,!token-mod --set statusmarkers#!cobweb}

So the name in the dropdown does not have to match the name of the marker. I found this useful for customizing what each symbol meant.
I didn't do it in the above code because I was being lazy, but I would recommend organizing them alphabetically to make it easier to locate what you're looking for in the drop down. Obviously you can edit things out if they're less useful to you. The "!" in front of the actual name of the marker allows you to toggle statuses on and off with the same macro. If you're using a custom set of status markers, you can find their names by typing

!token-mod --help

And scrolling up a bit. I copied and pasted them all into a notepad so I could organize them all. Some custom status marker packs may have names like, "Arrow [Arrow::123456]." In these cases you would use "Arrow::123456" (without quotes) as the actual name of the marker. The guy who, you know, actually knows this API corrected this below:

you can actually use "Arrow" as the real name for "Arrow::123456", provided there aren't any other things beginning with "Arrow::" (and even then, it will pick the one that's first)
I'm using this for a couple reasons:
1. It's easier and faster for me to select "slow" rather than look at the symbols and decide if I want to use a the "snail" status or the "tread" status, for example.
2. I can select a group of tokens and apply the same condition to all of them, instead of going through one by one and clicking a million times.
3. I can allow my players to use this to set statuses. Delegate some of the DM responsibility to keep things moving. If a player hexes a bad guy, they can now click and select "hex" to do it. This keeps things moving a little faster. Of course, this will depend on your group. If you have a player with... impulse control issues, they could just go around putting random status markers on things. Know your players.

Thanks, The Aaron for making this awesome tool. Hopefully this little macro will help others looking for similar solutions. I went ahead and posted this here in case someone searches for a way to apply status to groups or allow players to apply statuses from a drop down. I'm not certain if there's a better place to put this.

April 08 (5 years ago)
The Aaron
Roll20 Production Team
API Scripter

Neat!  

One note, you can actually use "Arrow" as the real name for "Arrow::123456", provided there aren't any other things beginning with "Arrow::" (and even then, it will pick the one that's first).  =D

April 08 (5 years ago)

Edited April 08 (5 years ago)


The Aaron said:

Neat!  

One note, you can actually use "Arrow" as the real name for "Arrow::123456", provided there aren't any other things beginning with "Arrow::" (and even then, it will pick the one that's first).  =D


Herp derp so you can. I must have had something wrong with the macro somewhere else when I tried that. Thanks agaaaain! haha