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] Roll20 Audio Master -- Hear the dice, Hear the action!

1529971944
vÍnce
Pro
Sheet Author
When accessing the Access Restrictions Menu;  I can see "API messages treated as: gm " should clicking on " gm " toggle to " pc "?  Seemed like an intuitive toggle, but it simply stays on "gm".  I do have a playlist and tracks imported if that matters.
1529978704
Victor B.
Pro
Sheet Author
API Scripter
I haven't done much with restrictions yet.  So it's there.  The code is still in the API, but it's really not functional yet.  How would you use it?  
1529980605
vÍnce
Pro
Sheet Author
Thanks Victor.  I assume the restrictions are there to give player's permission to control roll20AM...?  I could see how giving player's access to the script for their own macros could be beneficial, but maybe not every GM would like this level of access.  I only just started to use the script so I really don't know how best to use it yet. 
1529980672
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
API messaged commands could provide a way to bypass the player restrictions on tracks/playlists. It was essentially made to allow the gm to decide if they wanted api messages to be restricted or not.
1529980962
Victor B.
Pro
Sheet Author
API Scripter
Yes Keith gives out of few of his tracks to players for inclusion in their character sheets.  Ok so it's security to insure that a player isn't invoking commands he shouldn't.  I'll enable it again.  
1529981033
Victor B.
Pro
Sheet Author
API Scripter
BTW the version out there has debug=true.  I'm kicking out an enormous amount of logs.  Set your debug=false.  It's at the top of the script.  
1529981086
vÍnce
Pro
Sheet Author
Roger that.
1530020545

Edited 1530021478
Victor B.
Pro
Sheet Author
API Scripter
New version has been deployed.&nbsp; Fixed the following issues: - Decrease/Increase button locations swapped - Fixed an issue with edit,fade,in and edit,fade,out at the track level - Added Restriction Support:&nbsp;Players cannot do edit actions.&nbsp;Players can initiate playlists or tracks based on GM approval (access button set to unlocked at playlist or track) - Added log statement in check_install t to notify that command changes have occurred with this version - Set Debug = false as the default Features - The Tracks Menu (if you have a lot) is unworkable due to size.&nbsp; Looking into a way to tag tracks with keywords and then add a search mechanism by keyword to provide smaller, more manageable lists - When a track is initiated, considering setting all playlists that the track may be assigned to playing.&nbsp; This may show multiple playlists as playing (shows green).&nbsp; When track stops, all playlists it's assigned to will be reset to not playing.&nbsp; Could cause some tracks or playlists to show as playing when they aren't if users do other actions during that time.&nbsp;&nbsp; - Add stop all and help actions to the main menu.&nbsp;&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a>
1530128854

Edited 1530129034
Victor B.
Pro
Sheet Author
API Scripter
A new version is out in there:&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> - I broke a couple of things with the last round of fixes.&nbsp; That's been corrected. - Fade In/Fade Out volumes were causing issues when the fade volume was different than the main volume and the main volume was being increased or decreased.&nbsp; I've removed Fade In/Fade Out (for the moment) completely.&nbsp; Fade In will go to Volume Level and Fade Out will go to 0.&nbsp;&nbsp; - When starting a track that's part of a playlist, playlist volume was being used instead of track volume.&nbsp; This has been changed to use the track volume.&nbsp; If you start a playlist (not an individual track), it will use the playlist volume.&nbsp;&nbsp; - When starting a track that's part of a playlist, the playlist is set to playing also, so you can quickly see where the music is playing on the Playlists Menu.&nbsp; When the track stops, the playlist is set to stopped.&nbsp; If the track is in multiple lists, multiple playlists will be set to playing and will be stopped upon completion Currently Working On - There's no ability to get a text box into chat window, so I'm going to use RollQuery to assign up to 10 groups (Group 1 through Group 10).&nbsp; These may be assigned into tracks across play lists.&nbsp; When you go to the Track Menu, you'll see a new menu that allows you to choose a group (or not).&nbsp; If you choose a group, the track view will display that group.&nbsp; If you don't choose a group, you'll see all tracks that are in Jukebox.&nbsp; This will enable you to create dynamic playlists for specific encounters, etc... &nbsp;
1530129172
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Victor, I'll give it a test. One thing: I'm not sure if I read the code right, but the version (as written on line 11 of the code) continues to be 2.00. Should that be incrementing so that users can make sure they are replacing any code with something newer? Or is that for some internal purpose? I know the Aaron had suggested people use a version variable in their scripts, so maybe this is that?
1530129288

Edited 1530129856
Victor B.
Pro
Sheet Author
API Scripter
LOL we crossed between here and PM.&nbsp; Great minds..... Oh, I was leaving it at 2 until we are out of beta.&nbsp; You are probably right.&nbsp; I'll do 2.01.&nbsp;&nbsp; 2.01 Deployed
1530129834
Victor B.
Pro
Sheet Author
API Scripter
I'm going to implement The Aaron's esRE functions in an attempt to "escape" all of the special characters coming out of Jukebox Track Titles.&nbsp; Some of the titles are causing issues within Roll20AM.&nbsp; I'd really like to avoid forcing people to change track titles in Jukebox.&nbsp;&nbsp;
1530130185

Edited 1530130200
The Aaron
Pro
API Scripter
Are you talking about this guy? const HE = (() =&gt; { const esRE = (s) =&gt; s.replace(/(\\|\/|\[|\]|\(|\)|\{|\}|\?|\+|\*|\||\.|\^|\$)/g,'\\$1'); const e = (s) =&gt; `&amp;${s};`; const entities = { '&lt;' : e('lt'), '&gt;' : e('gt'), "'" : e('#39'), '@' : e('#64'), '{' : e('#123'), '|' : e('#124'), '}' : e('#125'), '[' : e('#91'), ']' : e('#93'), '"' : e('quot') }; const re = new RegExp(`(${Object.keys(entities).map(esRE).join('|')})`,'g'); return (s) =&gt; s.replace(re, (c) =&gt; (entities[c] || c) ); })(); for substituting HtmlEntities?
1530130884
Victor B.
Pro
Sheet Author
API Scripter
Yes that's it, I just have no idea how to implement it :)
1530131096

Edited 1530131321
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Responded to your PM with the how to Victor: HE("Here's some problem characters: &amp;@{"); // returns the string 'Here&amp;#39;s some problem characters: &amp;#125;&amp;#64;&amp;#125;'
1530207799

Edited 1530207831
Victor B.
Pro
Sheet Author
API Scripter
I'm going with encodeURIComponent and decodeURIComponent simply so I don't have to keep adding special characters coming out of Jukebox.&nbsp; If someone sees an issue with this, please let me know.&nbsp; It fixed a couple of tracks I was having headaches with.&nbsp;&nbsp; A new version (2.02) is deployed to&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> Fixes - added encoding/decoding to handle special characters in tracks.&nbsp; You shouldn't have to rename your tracks unless Scott or Aaron see an issue with the javascript functions I'm using - Found a missing menu refresh for track fade out.&nbsp; It wasn't refreshing the menu so the track would still show playing (though it was stopped)
1530208740
The Aaron
Pro
API Scripter
It seems like I've run into some issues with Unicode when passed to decodeURIComponent, but I've got no hard examples.&nbsp; If you start getting errors during the decide, try unescape() (which is deprecated, but I think handles our case better).
1530500349

Edited 1530501094
Victor B.
Pro
Sheet Author
API Scripter
New version deployed.&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> - Delay added to process.&nbsp; Add any delay: &nbsp;&lt;number of seconds&gt; to any audio command to delay action on it &nbsp; &nbsp; -- audio,play,delay:5| &nbsp;&lt;comma delimited list of tracks or playlists&gt; - Added nomenu so menu's are displayed for macro users.&nbsp; When fade out occurs and the end of the fade out, the menu is refreshed in the chat window to show the track as stopped.&nbsp; For macro users, this isn't wanted.&nbsp;&nbsp; &nbsp; &nbsp; -- audio,fade,out,nomenu|&lt;comma delimited list of tracks or playlists&gt; To Do: - Adding 4 tags that can be used to dynamically create up to 4 playlists.&nbsp; These are "extra" playlists that aren't defined in Jukebox.&nbsp; So you can quickly form up a "tag" of tracks you want for whatever reason.&nbsp; You'll have playlist level functionality over these 4 tags or open them to view/play the individual tracks assigned to them.&nbsp;&nbsp; When this is done, I'll update help on the WIKI and I'll deploy to GitHub.&nbsp; Once it's deployed you'll need to either 1) get prior version to avoid making changes to your commands or 2) update your commands &nbsp; &nbsp;&nbsp;
1530577983
Victor B.
Pro
Sheet Author
API Scripter
Ok, this is final version before pushing it to Github.&nbsp;&nbsp; - audio,stop| will stop all tracks - Tags have been added.&nbsp; You'll be able to assign tracks into any of the Tag Lists.&nbsp; You can play a Tag List just like a Play list.&nbsp; You can open a Tag List and view the tracks, remove them or add more.&nbsp; Tag Lists are dynamic playlists so you don't need to go back to Jukebox and modify the play lists there, nor will you need to import them into Roll20AM
1530581292
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Sweet!
1530588064

Edited 1530589972
vÍnce
Pro
Sheet Author
1. Changing "Master Volume" from the config menu doesn't seem to have any noticeable effect for me.&nbsp; Is the "Master Volume" supposed to sync with the sidebar settings, "Master music volume level" ?&nbsp; 2. How so I play a group of similarly tagged tracks?&nbsp; Maybe this is done by macro only?&nbsp; Example? 2a. As a test, I tagged each of my tracks as tag1, yet when I choose Tags from the menu, each track has a title "Tag1", "Tag2", "Tag3", and "Tag4".&nbsp; I was expecting all to have the title "Tag1" since I had marked them all tag1.&nbsp; I'm obviously a little confused on how tags should work.&nbsp; See image. I'm using v2.04.&nbsp; Thanks
1530591624

Edited 1530591884
Victor B.
Pro
Sheet Author
API Scripter
Ok, first I found a bug in the menu generation, so if you click on a playlist activity it's bringing up tracks, so I'm working on that.&nbsp;&nbsp; To your questions 1) Master volume doesn't change existing tracks that are playing.&nbsp; It is a simple way to set the default volume for ALL playlists and tracks.&nbsp; If you want to adjust volume of the track while it is playing use the increase or decrease.&nbsp; You can do that at the playlist level and it will adjust the track that is playing or you can go down to the tracks and adjust it there.&nbsp; You can do the same for Tags.&nbsp; Increase/Decrease the volume and/or click on Tag 1 (or Tag 2, Tag 3, Tag 4) and view the tracks you've assigned to the Tag.&nbsp;&nbsp; 2) Whether looking at playlist tracks (click on playlist name and it shows assigned tracks) or ALL tracks (clicks on Tracks on main menu), you start clicking 1, 2, 3 or 4.&nbsp; Go back to main menu and click on Tags.&nbsp; You'll see Tag 1 through Tag 4.&nbsp; Click on one of the names (Tag 1 for example) and you'll see the tracks you just assigned.&nbsp; If you click the check mark for that track again, it will unassigned the track from that Tag.&nbsp;&nbsp; 3) Tag 1 through Tag 4 are grouping of tracks.&nbsp; For every track you have click 1 for, they will be in the Tag 1.&nbsp; Tag 1 allows you to set the mode (in order, random, together, shuffled, single track) so you can fire off the tracks in that Tag right there or click on the Tag 1 name and you'll see the tracks associated with it and you can manage individual tracks within that tag. There's two levels within this:&nbsp; Playlists/Tags which enable you to start a play list, choose a mode (keep clicking on Mode until you get the one you want) and manage your music there OR you can view tracks assigned to the playlist, tracks assigned to the Tag or ALL tracks and manage your music at the track level.&nbsp; &nbsp; Hover your mouse over everything.&nbsp; There's a lot of functionality on these panels.&nbsp;&nbsp;
1530593123
vÍnce
Pro
Sheet Author
Thanks for the help Victor.
1530593468

Edited 1530594203
Victor B.
Pro
Sheet Author
API Scripter
No worries.&nbsp; I personally like random as a playlist mode.&nbsp; For battle music, I'll set my Battle playlist to random and fire it off. Easy.&nbsp; When battle is done, I'll fade out at the playlist.&nbsp; Easy again. For weather, I might click on the weather playlist to view the weather related tracks and then start launching one or more of them at the same time.&nbsp; Another option is to set the Weather playlist mode to Together and fire it off.&nbsp; If will play everything at once for some serious weather.&nbsp;&nbsp; Also keep in mind that at the track level, the mode is single (plays once and stops) or loop (keeps playing).&nbsp; So just like Jukebox, I might set a few tracks at loop, but then go up to the playlist level and play them together.&nbsp; So some will stop (like thunder) and other may continue on (like rain).&nbsp; There's many ways to play with this.&nbsp;&nbsp; And soon I'll get the commands up on Wiki if you love macros.&nbsp; Everything is macro friendly
1530621852

Edited 1530621864
Victor B.
Pro
Sheet Author
API Scripter
v2.05 is deployed - fixed bug where doing something at the playlist level took you incorrectly to the playlist tracks - fixed bug where delayed was showing the word button instead of the value 0 <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a>
Getting this error when i try to use it with roll listener
1530633565
Victor B.
Pro
Sheet Author
API Scripter
Have you imported Jukebox?&nbsp; If so, please recreate this error and copy and paste the log.&nbsp; To do that, keep a page open showing the API.&nbsp; The log is below it.&nbsp; Please PM the log to me.&nbsp; This could be the unicode issue that The Aaron mentioned.&nbsp;&nbsp;
1530828365
Victor B.
Pro
Sheet Author
API Scripter
2.06 Deployed -&nbsp;<a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> - Fixed a bug where launching the track assigned to the playlist stopped the track but not the playlist - Condensed Tag Toggles onto same lines Audio Controls - Updating Help Wiki
1530836564

Edited 1530836736
vÍnce
Pro
Sheet Author
Thanks for the update Victor. The tag icons look a little "off" for me. (chrome&nbsp; 68.0.3440.42 &nbsp; ) If I stretch the chat window a little, all is well.&nbsp; I'm at 100% browser zoom.
1530838159
Victor B.
Pro
Sheet Author
API Scripter
Hmmm I built this for 1920/1080 resolution.&nbsp; I'm going to guess yours is less.&nbsp; What's your resolution and I'll need to work with that.&nbsp;&nbsp;
1530842262
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Should be able to do it regardless of resolution. The line height and width of characters doesn't change when your resolution does. It just takes up more of the screen. But regardless of your screenresolution, the chat pane will always be X pixels wide.
1530843862
Victor B.
Pro
Sheet Author
API Scripter
That doesn't seem to be the case.&nbsp; His tag icons aren't fitting in the main line and bumping up above, which is really strange.&nbsp; I would have expected them to display below.&nbsp; I'll check for any hard coded heights &amp; widths, but I don't think there are any.&nbsp;&nbsp;
1530844326
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Actually, looks like they are getting knocked down a bit. Are you perhaps using two different divs for the play controls and the tags and floating the tags to the right?
1530848166
Victor B.
Pro
Sheet Author
API Scripter
yep, floats always cause me issues.&nbsp;&nbsp;
1530857491

Edited 1530857583
vÍnce
Pro
Sheet Author
Victor B. said: Hmmm I built this for 1920/1080 resolution.&nbsp; I'm going to guess yours is less.&nbsp; What's your resolution and I'll need to work with that.&nbsp;&nbsp; 1920x1080px is what I'm using.&nbsp; Seems the content of the div is being forced to wrap due to the width of it's content.&nbsp;&nbsp; I made a quick temp fix by adding font-size:80% &nbsp;to the div containing the pictos audio control images.
1530878120

Edited 1530879946
Victor B.
Pro
Sheet Author
API Scripter
I'll make same change.&nbsp; Cross browser support is always a challenge.&nbsp; Go figure.&nbsp; We have same resolution, same browser (chrome) and your version decides to bump those down and mine is fine.&nbsp; &nbsp;
1530887109
Victor B.
Pro
Sheet Author
API Scripter
2.07 Deployed -&nbsp;&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> Fixes - Changed the format of the Tag Toggles per Vince (thanks!) - Fixed a bug where if you moved all the tracks out of a playlist in Jukebox, but left the playlist there and then imported into Roll20AM so that playlist was empty om Roll20AM, it would cause java failures.&nbsp;&nbsp; - Fixed a bug where if you removed an empty playlist from Roll20AM, there would be a java failure - Add a variable at top of script to Display Tracks.&nbsp; Currently set to false.&nbsp; This will add a "Now Playing: &lt;track title&gt;" to everyone in chat.&nbsp; Keep it off it you don't want it.&nbsp; If you do want it, it's at top of script and set to true.&nbsp; My groups like seriously hard rock during battles.&nbsp;&nbsp;
1530975671

Edited 1530975697
Victor B.
Pro
Sheet Author
API Scripter
2.08 deployed -&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> I messed up Scott's interoperability between roll20AM and other scripts.&nbsp; Scott has shown me the light (thanks Scott!).&nbsp; This is fixed now, so !CRL or anything else should work fine with roll20AM.&nbsp;&nbsp; NOTE: for anyone calling roll20AM from templates or per other scripts, add nomenu to your command.&nbsp; By default, roll20AM sends menus to the chat window to reflect changes in a track (it stopped or started) or some type of action done against a playlist or track.&nbsp; nomenu suppresses menus out of roll20AM Example !roll20AM --audio,play,nomenu|Fireball Spell
1530980661
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Victor. Tonight is game night, but I'll give it a spin tomorrow.
1531072355
Victor B.
Pro
Sheet Author
API Scripter
The Audio Master Help Wiki has been updated.&nbsp; I'm ready to deploy this.&nbsp; There's a process involved and an approval.&nbsp; Sometime tomorrow, the API will become 2.0.&nbsp;&nbsp; Again, you'll need to change your commands.&nbsp; Go to help wiki to figure out how or contact me.&nbsp;&nbsp;
1531240141
Victor B.
Pro
Sheet Author
API Scripter
New version is deployed to Github.&nbsp; If you have issues PM me or post in this thread.&nbsp;&nbsp;
1531257114
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks, Victor B!
1531264210

Edited 1531264464
I'm having some trouble here. I've put in "!roll20AM --audio,play|City" but nothing is working. It's not playing my track named "City". I've also tried "!roll20AM --audio,stop|" but it's not stopping any of the currently playing tracks. I've got the latest version installed, and when I try the older commands like "!roll20AM --stop" it gives me an error that says that command isn't valid. Edit: Nevermind, I'm dumb. I didn't realize I had to "import" my tracks first.
1531264294
Victor B.
Pro
Sheet Author
API Scripter
Are you getting any errors in the output console?&nbsp;&nbsp;
1531264892
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Malachi, I made the same mistake, and still occasionally forget. You need to import first, and re-import if you add any tracks to the Jukebox.
Okay, had to update my macros which led me to have this question. Is there any way to take a command line like this: !roll20AM --audio,play|Broadside And make it so that if the line is entered while that particular track is playing it will stop ONLY that track and play it again from the beginning?
1531313329
Victor B.
Pro
Sheet Author
API Scripter
yes, go into config menu !roll2)AM --config.&nbsp; From within the menu, click on tracks to view all tracks, find the track you want and set the mode to loop .&nbsp; Then run !roll20am audio,play|track and it will keep playing that track continuously until you stop it.&nbsp; In lieu of using the menus,you can issue this !roll20AM --edit,mode,loop|track
1531313534

Edited 1531314538
Victor B.
Pro
Sheet Author
API Scripter
roll20am went through a major upgrade.&nbsp; The commands have changed.&nbsp; Go to here to view the new commands.&nbsp; <a href="https://wiki.roll20.net/Script:Roll20_Audio_Master" rel="nofollow">https://wiki.roll20.net/Script:Roll20_Audio_Master</a> What you'll need to do is get into config menu !roll20AM --config.&nbsp; Click remove all (to clear out roll20AM) and click import jukebox (to import everything back into Roll20AM).&nbsp; Then you'll need to modify your commands accordingly Alternatively you can go to github and get the prior version and you won't need to make any changes.&nbsp;&nbsp; EDIT: I was responding to a post that disappeared