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

[Script] Dungeon Buddies Inspired Speech Balloons.

1417794694

Edited 1417960928
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
When I saw Alan H. 's Dungeon Buddies collection I really liked them and started to talk with Aaron about what fun things could be done with them. At some point we kicked around the idea of speech balloons. It appears if you try to set the font-family property of a text object to a font that is not in the text editing menu you will get a mono-spaced font by default (this is true for Chrome at least.) That enables a pretty good guess at the text box size (which is based on the amount/size of the text itself when created by API. Another helpful thing is "\n" will provide a new line in a text area. Using a few small PNG files, properly stack in the _zorder, sized based on the amount of text lines, center and flipped in the proper location/orientation based on the selected token... you get a pretty good speech balloon. "!makebubble " + some text .....text will be word wrapped and sized. "!makebubble Ok, before we go any further in the dungeon, what are your stats?" "!makebubble --show|" + macro stuff + "~" for space + "::" for new line ...macro text will not be word wrapped (28 characters wide by default, and height based on number of new lines.) "!makebubble --show|•STR|@{selected|Strength}~~~•AGL|@{selected|Agility}~~~•STM|@{selected|Stamina}::•PER|~@{selected|Personality}~~~•INT|~@{selected|Intelligence}" "!bustBubble" ...forces the bubble to collapse to the corner of the map on the GM layer (ahead of its auto expire.) You must select a token for this function. Example below (macro printed above was shorted for the posting here. A longer macro was used in the illustration.) Link to the PNGs: <a href="https://drive.google.com/file/d/0B7d47ZZymuXPY3d0Z" rel="nofollow">https://drive.google.com/file/d/0B7d47ZZymuXPY3d0Z</a>... Code will be posted in this thread soon! (I would have had it up already but Aaron has this notion that code should be stable and functionally working before posting. I think we should get Alan H. to make a Dungeon Buddy of Aaron...."Something Something of the JSLint clan.")
1417795214
vÍnce
Pro
Sheet Author
Found it. Looking forward to the rest. Thanks Stephen.
1417795402
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Paul S. said: How long do the speech balloons stay visible? Is a sound played when they pop up and I'm on a different tab than the chat window? Right now its has a default wait regardless of the text length. However, I think it should be based on word count (not character count) plus a little longer than normal reading (your eye has to catch the bubble first.) Aaron also came up with the brilliant idea of a transparent PNG that can be grabbed by all.... quick move drop... dismisses the bubble ahead of its wait (I added that PNG to the zip file but that feature is not included in the code as of right now. I haven't had any luck with getting the default beep reliable for anything... so no sound that I can think of.
1417803635
vÍnce
Pro
Sheet Author
Are the chat bubbles also posted to chat?
1417803956
The Aaron
Roll20 Production Team
API Scripter
Stephen S. said: I think we should get Alan H. to make a Dungeon Buddy of Aaron...."Something Something of the JSLint clan." HA! Clan is right... I haven't had any luck with getting the default beep reliable for anything... so no sound that I can think of. Dumping the output to chat would cause a beep if the player is on a different tab, I think...
This will be amazing
The Aaron said: I haven't had any luck with getting the default beep reliable for anything... so no sound that I can think of. Dumping the output to chat would cause a beep if the player is on a different tab, I think... This would be a good idea anyway, so it gets logged for later
1417881315
Paul S.
Sheet Author
API Scripter
Yep - agreed with dumping to chat for logging and the beep.
1417958808
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://gist.github.com/BaldarSilveraxe/30169b0959" rel="nofollow">https://gist.github.com/BaldarSilveraxe/30169b0959</a>...
1417958866

Edited 1417960005
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Huge thanks to Aaron for his coaching on this. I am sure it can be greatly improved. But that should work as a proof of concept.
1417974723
vÍnce
Pro
Sheet Author
I'm trying this out later after I put the x-mas lights up. Thanks Stephen (and Aaron)
1417990174
The Aaron
Roll20 Production Team
API Scripter
Cool. =D
1418000249
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Having played with this in game a bit.... If this is taken further, more than a few things should be improved. Right now it places the balloon on one of the four 45 degree azimuths from the token (whichever is closer to the middle of the map.) Shown below It should look for the nearest "object free" space without crossing DL paths.. whatever the angle or distance required. This could still use the same basic three PNG shapes and the math should be easy to get distance and the angle. Shown below. The text should be a bit smaller and wrap sooner. Could trick out the "speak as" so any thing sent "speak as" the API will look for token of the same name. This would make it more natural to use this in chat.
1418002438
vÍnce
Pro
Sheet Author
This is s neat script. Now I just need to think of some usefulness over novelty. :-)
1418004592
Wes
Pro
Sheet Author
I have been playing around with this and I have a couple players who are going to love it. The positioning and size do need to be adjusted a bit, but you are already working on that, I would love the ability to post a rollable table's output text into the Text Bubble. And Have the Bubble on the Token layer so they don't appear under the other things close to your token.
1418036750

Edited 1418038036
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Vince said: This is s neat script. Now I just need to think of some usefulness over novelty. :-) I have one word for you..... "onomatopoeia" Cuz what could be useful than that? Wes said: I would love the ability to post a rollable table's output text into the Text Bubble. And Have the Bubble on the Token layer so they don't appear under the other things close to your token. The rollable table idea is worth thinking about! As to the layer.... it should go here: <a href="https://app.roll20.net/forum/post/1241955/foregrou" rel="nofollow">https://app.roll20.net/forum/post/1241955/foregrou</a>... But the real gem here might be Aaron's queue this would work well for games or situations were all actions are declared and then processed.
There seem to be some issues with Z-order on maps with large/detailed images. Perhaps it's load related. But on those maps the bubble-border black box is placed atop all else. Also it has a tendency to place itself behind existing map objects until those objects are moved back despite the toFront() invocations you placed there. Quite puzzling really.
1418146548

Edited 1418146556
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Ken L. said: There seem to be some issues with Z-order on maps with large/detailed images. Perhaps it's load related. But on those maps the bubble-border black box is placed atop all else. Also it has a tendency to place itself behind existing map objects until those objects are moved back despite the toFront() invocations you placed there. Quite puzzling really. Yea.... I thought of forcing things that are not the bubble to the back.... but then I could break a GMs map. Its seemed to me that I noticed deleted items remain in the Z-order string... which might be part of the problem.
Hey guys this is an awesome script, me and a friend of mine were just talking about making a little pop up script to show quick info like a stat block, when i saw this on the forums when reading through what i missed while out the last month or 2. It looks good we have been playing around with and testing it a lot tonight. One thing we are thinking of that i haven't used in previous scripts so ill have to do some research on is we were thinking of using this in part for some private things so making it something only visible for the selected character, not sure if it is possible but something we are thinking about :] also we lucked out in a way to run concurrent ones but it occasionally gets a little glitchy so I'll update you guys and be back later after we work on it some more, but again thanks and nice work so far :D
Comparing stats :] Bigger Image on Imgur
1418403603
vÍnce
Pro
Sheet Author
Who needs mouseover? I like the idea of displaying some additional info/stats. Not sure about how to only show the popups to a select group of players, but I would like an option to display the popup only on the GM Layer to hide the info from players...
1418403797
The Aaron
Roll20 Production Team
API Scripter
GM Layer is totally doable. With players on the same page, it would not be possible to show only some of them. (but if you wanted to write a script to duplicate a page multiple times and synchronize things on that page, you could add things that are only visible on some of the pages to the players on those pages and create the illusion of only some players seeing a thing... =D )
1418406318
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
OK..... this way way way way out there. So impractical its stupid. Data is in a text box on the map layer. Its bordered by pathing on the walls layer.. cutting off all external light. It has internally illuminated by only a light the target listener can see (or several listeners each with their own "in the box light." This way we can trash talk about Vince, behind his back, in speech balloons.... that alone almost makes it almost worthwhile.
1418406953
vÍnce
Pro
Sheet Author
This way we can trash talk about Vince, behind his back, in speech balloons.... that alone almost makes it almost worthwhile. I can hear , see what you're saying Stephen.
1418409449
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Not for long... you just wait... once I get this ridulously complexe unworkable suggestion of mine implented... you will see... or rather wont see.
1418413825
The Aaron
Roll20 Production Team
API Scripter
AHHAHAHAA =D
The Aaron said: GM Layer is totally doable. With players on the same page, it would not be possible to show only some of them. (but if you wanted to write a script to duplicate a page multiple times and synchronize things on that page, you could add things that are only visible on some of the pages to the players on those pages and create the illusion of only some players seeing a thing... =D ) Ya the GMlayer I can see how easily do able that would be and would work for some of our purposes but not our main focus of the player being able to make their own personal quick reference. Now your next idea I like, almost as crazy as Stephen's but possible more doable ( with the added benefit of not having to spam light and walls everywhere ! XD ) . I can already think of the way to make the page duplication and assigning each player their own page basically. My issue is off the top of my head I have almost no idea how I would be able to synchronize movement and actions across them, and even if that was possible without the game/ap blowing up :P Updating 8 different pages at any time 1 of 8 players move especially for big maps with lots of lil minions about.
1418422268
The Aaron
Roll20 Production Team
API Scripter
Yeah, it could be really hard. This was a technique discussed about 8-10 months ago WRT only some players seeing invisible things. Probably the easiest thing to do is to create the main page with everything you want, then create copies of that page (use page duplicate to get the settings, then you have to manually copy and paste each of the layers over. (because the API can't create graphics that aren't in a users's library)). Then run a script that builds a map from each graphic/path on each page to the matching ones on the other pages. Then it's just a matter of watching for modification of any of the possible things on a graphic, then duplicating the change for each other related token. Avoid race conditions with movements on one page causing movements on another, causing movements on the first.. After all that's working, add things which have no mapping to things on other pages, and are ignored by updates.
1418436170
PrincessFairy
Plus
Marketplace Creator
Kevin K.(Desu) said: Comparing stats :] Bigger Image on Imgur How do I obtain this basic pop up or static box of text????
1418436925
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Did you install the script?
1418458826
vÍnce
Pro
Sheet Author
Can you use inline rolls inside !makebubble ? As a test I'm trying something like !makebubble --show|HP|@{selected|HP}::AC|[[@{selected|AC}]] and I get; HP|5 AC|$[[0]] if I don't use the inline roll I just get the formula; AC|(10 + (0 * 1) + (0 * 1) + (((((floor((10 + 0 + 0 + 0)/2)-5) + floor(0/2) - (floor(abs(0)/2)) - (floor(abs(0)/2))) + 9999) - abs(((floor((10 + 0 + 0 + 0)/2)-5) + floor(0/2) - (floor(abs(0)/2)) - (floor(abs(0)/2))) - 9999)) / 2) + 0 + 0 + 0 + 0 + 0 + 0 + 0)
1418466867

Edited 1418468032
Ravenknight
KS Backer
This is beyond cool. Thanks a lot. :D ...and since I'm a total clown at everything involving coding.. where do I put the PNGs? :)
1418468499

Edited 1418468645
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Vince said: Can you use inline rolls inside !makebubble ? As a test I'm trying something like !makebubble --show|HP|@{selected|HP}::AC|[[@{selected|AC}]] and I get; HP|5 AC|$[[0]] if I don't use the inline roll I just get the formula; AC|(10 + (0 * 1) + (0 * 1) + (((((floor((10 + 0 + 0 + 0)/2)-5) + floor(0/2) - (floor(abs(0)/2)) - (floor(abs(0)/2))) + 9999) - abs(((floor((10 + 0 + 0 + 0)/2)-5) + floor(0/2) - (floor(abs(0)/2)) - (floor(abs(0)/2))) - 9999)) / 2) + 0 + 0 + 0 + 0 + 0 + 0 + 0) It could be done.... just not as it is written. Peter Bergholtz said: This is beyond cool. Thanks a lot. :D ...and since I'm a total clown at everything involving coding.. where do I put the PNGs? :) Shouldn't need to do anything with them... code should use the ones in my library. Shared the files just "because."
Thanks for sharing Stephen. I was looking for something like this.
1418522698
PrincessFairy
Plus
Marketplace Creator
Yes I installed the script I also installed the .png but nothing loads, giving me the no character was found selected, even when one is selected. I am not sure how to fix this problem.
1418600696
PaulOoshun
Marketplace Creator
"I think we should get Alan H. to make a Dungeon Buddy of Aaron...."Something Something of the JSLint clan.")" Scriptomancer! ;) <a href="https://app.roll20.net/forum/post/1423307/dungeon-" rel="nofollow">https://app.roll20.net/forum/post/1423307/dungeon-</a>...
1418605889
The Aaron
Roll20 Production Team
API Scripter
That is awesome!!
1418606040
vÍnce
Pro
Sheet Author
You have been immortalized.
1418606363
The Aaron
Roll20 Production Team
API Scripter
It's true! I'm having one of those "I'm on TV!!" moments and emailing links off to all my friends!
1418611340
vÍnce
Pro
Sheet Author
Well deserved.
The Dragon said: Kevin K.(Desu) said: Comparing stats :] Bigger Image on Imgur How do I obtain this basic pop up or static box of text???? For that specific stat block my commands were !makebubble --show| •STR|@{selected|strength}~~~•DEX|@{selected|dexterity}~~~•CON|@{selected|constitution}::•INT|~@{selected|intelligence}~~~•WIS|@{selected|wisdom}~~~•CHA|@{selected|charisma} But that is using the attribute names for what the stats are in my game as for the crazy ideas for everyone to see things privately, me and my friend are still working on it :D not much of an update yet but getting there, will keep you guys posted, and Grats Aaron on your very own Sciptomancer !
Oh damn forgot how to do code block ill fix it in a minute
I'm loving this script! Its a great addition for non-player characters and adds a great old-gameboy-feeling for players. The only problem i encountered was the fact that the bubbles where hidden when used due to the fact it was automatic 'lower' then the rest of the map (hard to explain what is happening but i hope you get my meaning). I know that tofront is written in the script but it seems not to work proper and i have to do it manually.
1420976544
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Yeah... they likely need forced to the front with a delay. But what is really needed is this: <a href="https://app.roll20.net/forum/post/1241955/foregrou" rel="nofollow">https://app.roll20.net/forum/post/1241955/foregrou</a>... That long with the ability to delete objects.... would rock. Right now any solutions is likely too "hacky" to be anything but occasionally funny in game play.