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 Questions] Abusing handouts for a targeting UI

1432148743

Edited 1432150789
Is there any way of using <script> (unlikely) and/or <style> (for :hover) tags in handouts? I'm creating a paper doll targeting UI for GURPS using handouts like in this thread (ie using API calls to set the "notes" field - or is there an easier way?) and I want to have different body parts shaded out based on a cover value (so the legs and lower torso would be shaded out if the target is behind low cover) or highlighted when moused over, as well as labels that show what armor is worn on each location. More importantly, how do you use the API to open a handout on just one particular player's screen? The UI should pop up when the player uses the attack script, so we can't have it popping up for everyone. Ideally we wouldn't need to do this through a handout, but as of right now I don't know any other way of doing a popup interface.
The API has no access to those kinds of css or html elements.
1432149620
The Aaron
Pro
API Scripter
hmm. Good luck? I don't think you'll be able to leverage hover, but you can set up API Buttons for the locations and have the player click them. They could back end to something like !select-target torso, and have your script waiting for a !select-target command from a given player that issued an earlier !begin-attack command, or some such. You'll start running into issues updating that handout too frequently with the API (rapid updates to handouts get slowed down). As for showing on a particular player's screen, there isn't a way to do that via the API (you can't popup a handout automatically from the API at all). Have you considered printing the Paper Doll to the chat via a whisper to the player that needs to make the choice?
Instead of a paper doll, use buttons with an image of the area they're targeting. Using icons, you should be able squeeze all that info into a reasonably sized table.
1432151629

Edited 1432151836
The Aaron said: I don't think you'll be able to leverage hover, but you can set up API Buttons for the locations and have the player click them. They could back end to something like !select-target torso, and have your script waiting for a !select-target command from a given player that issued an earlier !begin-attack command, or some such. We need hover mostly to give feedback to the player about what they're targeting. It's not strictly necessary, but it's a major usability thing that helps prevent a player from accidentally picking the wrong body part. We already have the button thing down. The Aaron said: You'll start running into issues updating that handout too frequently with the API (rapid updates to handouts get slowed down). This is a dealbreaker. If it can't handle rapid updates with frequent turns, then it's as good as useless. It defeats the point of the UI, which is to speed up GURPS turns to twenty seconds or less. The Aaron said: Have you considered printing the Paper Doll to the chat via a whisper to the player that needs to make the choice? I've considered this before, but the issue that comes up is size. The chat doesn't give the necessary screen real estate. Popping out or resizing the entire chat is an ugly solution from the POV of the player. HoneyBadger said: Instead of a paper doll, use buttons with an image of the area they're targeting. Using icons, you should be able squeeze all that info into a reasonably sized table. We're desperately trying to avoid this. GURPS has a lot of hit locations, and we're hoping to include the extra fiddly ones eventually. Listing them all with pictures is impractical, and just listing them as text kind of defeats the point. It's a worst case scenario.
1432151967
The Aaron
Pro
API Scripter
You might be able to get hover feed back with the tipsy classes. Rapid updates is on the order of seconds, not 10s of seconds. You would probably be ok with making an update per turn. Where you will run into issues is if you are expecting to click a button and get an instant change in the handout. There was a script a while back that had macros (this was pre-API Button) which paged a handout through different sections of a shop as you clicked them, and move a highlight up and down. That's the sort of thing you'd have trouble with.
The Aaron said: You might be able to get hover feed back with the tipsy classes. Rapid updates is on the order of seconds, not 10s of seconds. You would probably be ok with making an update per turn. Where you will run into issues is if you are expecting to click a button and get an instant change in the handout. There was a script a while back that had macros (this was pre-API Button) which paged a handout through different sections of a shop as you clicked them, and move a highlight up and down. That's the sort of thing you'd have trouble with. That sounds doable, then. Then it's just the inability of the API to cause a handout to pop up that's holding us back.
1432157074
The Aaron
Pro
API Scripter
You can of course fake it... Whisper a link to the handout: var handout = findObjs({ /* my handout */ }), who = getObj('player',msg.playerid).get('name); sendChat('','/w '+who+' &lt;a href="<a href="http://journal.roll20.net/handout/'+handout.id+'&quot;&gt;Select" rel="nofollow">http://journal.roll20.net/handout/'+handout.id+'"&gt;Select</a> Hit Location&lt;/a&gt;'); Style as a button, if you like. They can click it and it will open the handout. As a whisper, only the player who needs to do it will need to click it and open it.
The Aaron said: You can of course fake it... Whisper a link to the handout: var handout = findObjs({ /* my handout */ }), who = getObj('player',msg.playerid).get('name); sendChat('','/w '+who+' &lt;a href="<a href="http://journal.roll20.net/handout/'+handout.id+'&quot;&gt;Select" rel="nofollow">http://journal.roll20.net/handout/'+handout.id+'"&gt;Select</a> Hit Location&lt;/a&gt;'); Style as a button, if you like. They can click it and it will open the handout. As a whisper, only the player who needs to do it will need to click it and open it. That could work in the meantime. Thanks! Ultimately we're hoping for this (vote if you're interested!), so this is just getting something working so we can get something out.
1432177407

Edited 1432177456
Helmic said: Is there any way of using &lt;script&gt; (unlikely) and/or &lt;style&gt; (for :hover) tags in handouts? You could just use the title style. &lt;a href="!command args" title="this is a thingy"&gt;&lt;img src="<a href="http://image.source.com&quot;&gt;&lt;/img&gt;&lt;/a" rel="nofollow">http://image.source.com"&gt;&lt;/img&gt;&lt;/a</a>&gt;