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

Send no value via a roll query

August 31 (8 years ago)
So I am trying to create a macro that will call an API script with multiple options, but one particular option is not applicable in all cases.  I can create two different macros, but trying to see if I can condense it down to one.

!apiscript --option1 --option2 ?{Do you want to include option3?|yes, --option3|no,}

Basically I want "no" to pass a blank value, allowing the apiscript to be run with option1 and option2 only.  The problem, I can't seem to find a way to pass a null or blank value.  I have tried several combinations including spaces, multiple spaces, and double quotes, but all of them do not pass a null value back.  Is this even possible?
August 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
try putting * * in. It will read it as an italicized space which counts as an actual character as opposed to just a bunch of actual spaces which it parses as nothing. This might or might not work with the script, but based on the syntax you have up there it looks like it splits by "--", which Aaron uses a lot. He also tends to put in trimming of extraneous spaces, so it should work.
August 31 (8 years ago)
That is a great idea, unfortunately the script is very structured, so it still reads that character as appended to the previous option.  This is for the shaped-companion script, so I understand it isn't really a script issue, was just hoping there might be a simple way to add an option via a roll query, but I am suspecting it's not possible.

August 31 (8 years ago)
The Aaron
Pro
API Scripter
Could also try:    (which is a regular space).
August 31 (8 years ago)

Edited August 31 (8 years ago)
The Aaron
Pro
API Scripter
could also do:

!apiscript --option1 ?{Do you want to include option3?|yes,--option2 --option3|no,--option2}
August 31 (8 years ago)

Edited August 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Kevin said:

That is a great idea, unfortunately the script is very structured, so it still reads that character as appended to the previous option.  This is for the shaped-companion script, so I understand it isn't really a script issue, was just hoping there might be a simple way to add an option via a roll query, but I am suspecting it's not possible.


just wondering, it looks like you have a space between option 2 and the roll query, so it is maybe setup to only accept a single space between arguments. You could move the roll query to be right after option 2, and then add a space into the start of option 3 (probably via my * * or Aaron's html entity way) so that it parsed correctly.

EDIT: Ha, or what Aaron put in his second post.
August 31 (8 years ago)
As Scott says, whitespace is as close as a dropdown Roll Query can get to outputting a null value. However, a non-dropdown Roll Query can output a null value, so if you really need one, you can use nested Roll Queries:
[[ 1?{Value|

Whitespace, | 

Null,?{Press Enter}

}1 ]]

If, in your case, you are not able to use whitespace, you might use a macro like this:
?{Options|

2,!apiscript --option1 --option2|

3,!apiscript --option1 --option2 --option3

}
August 31 (8 years ago)

The Aaron said:

Could also try:  (which is a regular space).

This works!  Saw some strange behavior when I had it at the end of the macro, but adding it before "--attacks" worked. 

!shaped-abilities --DELETE --advantageTracker --initiative --savesQuery --abilityChecksQuery ?{Spellbook?|yes, --spells|no, &#32} --attacks
August 31 (8 years ago)
The Aaron
Pro
API Scripter
cool. =D