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] Buttons in locations other than chat?

March 13 (10 years ago)

Edited March 13 (10 years ago)
Is it possible to have buttons in locations other than chat? I had this nutty idea of having buttons on a pop-out journal.

The difference from ability rolls, which you can already easily store a button command; is that you could customize it further.

For my usecase, I'm using journals as inventories, and it lists a nice html catelog of items with formatting and images. Now some items are say 'usable' such that they spit out the effects of their use, then remove themselves from the inventory, or decrement their quantity. Here I'd like to have this journal with image buttons where I could click the image, thus executing the command (perhaps a cure light wounds potion), and the API rider would repopulate the bio field with either a reduced quantity or removing it entirely from their inventory. Even better, if you pop-out the journal, you'd have a side-by-side view with your inventory which can dynamically update as you pickup things and use them.
March 13 (10 years ago)
I just realized you can with a quick test.. things are going to be amazing.
March 13 (10 years ago)
The Aaron
Pro
API Scripter
oooh? This sounds intriguing!
March 13 (10 years ago)
Gen Kitty
Forum Champion
PLEASE keep us updated!
March 15 (10 years ago)
Hey Ken. Can you elaborate a little bit? My friend's trying to do the same thing, and we want to know if this is actually possible and if there are any restrictions.
March 15 (10 years ago)
You should prolly run this by Riley and see if it's intended behavior. He might not want it to work.
March 15 (10 years ago)
Yes it works, the only thing that doesn't is pressing the button while the journal is popped out. But that's pop outs in general as the devs are still working on API buttons in the pop-out window which don't work currently.

If the journal is simply open in the tabletop, it will work.
March 15 (10 years ago)

HoneyBadger said:

You should prolly run this by Riley and see if it's intended behavior. He might not want it to work.

If not, he should make a more nice replacement 'cause this is exactly what we needed.
March 15 (10 years ago)
Hi Ken,

Could you elaborate with a brief code sample (markup or script, whatever you're using) - something that can be pasted into either a template or into Campaign Scripts? I'm not sure what tools you're putting together or how they're being used.

For context, I'm looking into how to create a "paper doll" for targeting body parts, and I want buttons on a handout such that I can click a button and it provokes an API event. It sounds like you're doing a similar thing - like you, it'd be best if I could use provided images for the buttons.

I don't need anything fancy, just a quick pointer. I can probably come back and contribute what I make whenever I get around to implementing it.
March 15 (10 years ago)
Either way, this is a mentor level feature so for goodies like this you'd have to support the cause :)
March 15 (10 years ago)
Hi Ken,

I'm aware. Were you planning to elaborate?
March 15 (10 years ago)

Ken L. said:

Either way, this is a mentor level feature so for goodies like this you'd have to support the cause :)

We're planning. We're wanting to write to get the GURPS combat API script working well enough before testing it with Mentorship, but we want to know if it's even possible. This would probably make playing GURPS on Roll20 MUCH more feasible, as it'd cut down on the needed clicks and user input quite a bit. Click your weapon attack macro, click a target, click a target location on the paper doll, and have everything else calculated for you - aiming bonuses, range penalties, armor, enemy dodge bonuses, the works. So something like what you're describing would overcome a pretty big hurdle towards that goal.
March 16 (10 years ago)

Edited March 16 (10 years ago)

rowtuh said:

Hi Ken,

I'm aware. Were you planning to elaborate?

you'd simply add
<a href="!apicommand"><img src="http://somesite.com/image-link-here.ext"></img></a>

to the journal entry either in the 'bio' or 'gmnotes' field, there's nothing really complicated about it. There's a number of topics discussing how to reach and access the 'bio' and 'gmnotes' fields, you can check the wiki for more information. Just be aware the button will not work when the window is popped out.
March 16 (10 years ago)

GenKitty said:

PLEASE keep us updated!

Had some time around break, but it's working swimmingly. Still need to implement the store functionality and whatnot. Some HTML is interpreted, differently on handouts and pop-outs in general, but devs are working on it from what I hear as it's similar to popouts.


cheers,
March 16 (10 years ago)
The Aaron
Pro
API Scripter
So, the icon is the button? Pushing it triggers dumping those to the chat?
March 16 (10 years ago)

Edited March 16 (10 years ago)
Anything in the <a> field becomes the trigger basically, it's not terribly difficult to test. As far as the example, I was just assumed genkitty just wanted to know about the inventory idea so that's offtopic.

As far as the API buttons are concerned, yes they work, but the markup will clearly not so no pink buttons, but the links embedded within still perform the same actions.
ok, having read this, I'm behind it 100%. anything to make a GURPS game easier to swallow is just fantastic. But its a hell of a script to write, I wish you nothing but the best of luck and patience.
Need and testing done, let me know, I love the system and would like to see combat made manageable.
March 21 (10 years ago)

Michael H. said:

ok, having read this, I'm behind it 100%. anything to make a GURPS game easier to swallow is just fantastic. But its a hell of a script to write, I wish you nothing but the best of luck and patience.
Need and testing done, let me know, I love the system and would like to see combat made manageable.

We're actually making pretty good progress. We'll be getting started on the paper dolls on Sunday, then I expect sometime next week I'll have some artwork done to go with them. We have most of the ranged attack stuff done, then once we have that working well enough we'll start on melee attacks. After that, powers and such shouldn't require any new API functions, players can probably just type out the macros and call the API functions themselves. We'll put out two versions of the sheet, one for free users and subscribers and another for mentors that comes with API scripts.

First version will be fairly bare bones, but as time allows we'll try to sneak more stuff in. My goal is for quick-resolving GURPS combat, something that can be played almost like XCOM: EU, but still rewarding players for thinking of all the little things like whether it's more appropriate to use armor piercing or hollow point ammo.