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

[API] Popups, Possible?

Does the API allow you to create a pop-up or an alert? I've been scripting a bit here and there while working, almost feels like I'm stealing cookies from the cookie jar #programmer-problems. I need to tell my strongly typed language that I'm having an affair with an interpretive coercion language (but look at that syntax!) . Anyho.. what I'm trying to achieve is to have the script possibly create an on-screen dialog, similar to handouts and such (where they are anchored to the page) so I can prompt several options. For instance, you choose the attack marco which pops up a small dialog prompting attack options: heavy mace? war hammer? crossbow? [x] flanking which would then either invoke other marcos or simply send a chat command off the bat when pressed; or perhaps if there's only one button, off checkboxs/radials what have you.
1422296658

Edited 1422296715
The Aaron
Pro
API Scripter
Not currently, but there is a suggestion: <a href="https://app.roll20.net/forum/post/1281877/api-func" rel="nofollow">https://app.roll20.net/forum/post/1281877/api-func</a>... Options you have right now in Prod are to take an argument to your script that you expect to be filled with a ?{Query|0} input. That is the only way to actually send a prompt to the user, and it doesn't come from the API. Better option in Dev right now is the API Buttons, which let you write a button to chat that the players can click. The button can execute an API command for them, in the context of their session. There's examples one of the sticky posts of the API Mentor forum.
1422306595

Edited 1422306641
I somehow expected this. the API buttons I noticed don't allow for %marcos which really is a shame though. I was aiming to produce a formatted html displaying API buttons that would run marcos from a sheet. One example is pressing a Skills marco which then outputs a list of API buttons on the chat which a user then can click. For my usecase, I have a generator so every token has statistics and attacks auto-generated for it, but it's cumbersome if you have them all as token actions or for scrolling down a list on the character page. I was aiming to reduce this clutter for example, rather than having spell-1,spell-2, etc.. you would just have spells, then that would have buttons that would call on marcos to show the sub-spell list and so forth. In all, if you wanted to cast a 3rd level spell, you'd press spells which drops a list of buttons to the chat, then you'd click the button for 3rd level spells, and you'd only get a list of links to 3rd level spells which you could then click for quick reference.
1422308335
The Aaron
Pro
API Scripter
It's possible this is a total hack, but this works: `[Dagger](! %{Kobold|Dagger} ) =D
1422309009

Edited 1422309087
doesn't seem to work I'll check later again tonight. It makes a button, but the marco itself doesn't execute `[CL](! %{drow_matron|Base-SLA-CL} )
1422309562
The Aaron
Pro
API Scripter
But this works? %{drow_matron|Base-SLA-CL}
1422310034
The Aaron
Pro
API Scripter
Ah. I see why this works, and what the issue is. So, the ! makes it execute the contents, but it also effectively comments out the first line of the macro. You probably have a single line macro on that Base-SLA-CL. If you add a single line with a ! on it to the front of the macro like this: ! /em does something. Hits for [[2d5+3]] damage! Then it will work as expected in both cases. Effectively, the API is send the command ! ! and then the other actions take effect. So, complete hack, but works if you accept those constraints.
1422311895

Edited 1422311904
Ah, that makes sense, still a hack though, since it's still baking in the oven, maybe Riley will wrap up those loose ends in time.