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

Is it possible to trigger a playlist to play per PC in initiative?

I don't know if the Roll20 Audio Master could handle this but I was curious if anyone had some thoughts.  I'd like to have music switch to a battle music playlist whenever we roll initiative.  Even more cool would be curated playlists for each PC that starts playing when it is their turn in combat.  Any ideas on how to do this?  A coder I am not.  The one thought I had was to include a macro to play a playlist in the Initiative macro I already have setup but that would restart each time someone clicks initiative which i guess isn't that bad.
1519655634
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
For the combat music starting with initiative, why not have it be part of your initiative macro for monsters/npcs, rather than for all the players. You could even have a query that would controll whether it sends the command or not: !?{Combat Music|No, |Yes,roll20AM} Roll20AM commands here Hooking the playlist up to who is up in the initiative tracker would require another script that would send the appropriate command depending on how the initiative tracker changes. That's an interesting idea. There's nothing for it currently though.
Ok cool, that's kinda what I was thinking to at least switch to battle music on initiative.  It's the same Initiative button for everybody -  !group-init so I could try throwing some logic in there with what you supplied here.  I'll mess around with it.  Thanks.
1519658876
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Scott C., that ! at the beginning of the macro makes sense now that I understand how it works, but I hadn't considered making it start a query. It either triggers an API command or is just ignored in the log. That's cool.
1519658919
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You could make a separate button for you as GM, that would do the Roll20AM command and then call your initiative macro.
1519658965

Edited 1519659136
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
keithcurtis said: Scott C., that ! at the beginning of the macro makes sense now that I understand how it works, but I hadn't considered making it start a query. It either triggers an API command or is just ignored in the log. That's cool. Yep, a lot easier than doing all the html replacement that would be required in the actual command group(s) :). Of note, it does still send the message as an API command, but I can't think of why a script would use ! space some command as it's triggering command, so shouldn't cause any issues. EDIT: Matt M., You could also potentially use my Customizable Roll Listener script to set it up to automatically respond to initiative rolls based on some criteria (not sure what this would be, and would depend on how you have your initiative rolls formatted).
Scott - thanks I will look into your CRL API as well.  I just think having a music cue at initiative (or various other triggers) is a cool idea and taking it a step further to have each player have their own battle songs could also be great...or really chaotic.  Next level deep would be sound effects that play when attack rolls are made or spells are cast.
1519664045
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The sound effects for attacks/abilities is actually the easiest part as that is just adding it to the macro. The actual method will depend on your sheet.
5th Ed OGL by Roll20
1519683320
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, then you would handle it by putting the following at the end of the description for your attacks/spells: }} !roll20AM and other API commands here, each on their own line ! The final exclamation mark by itself is to hide the orphan }} that will be left over from the default macro code.
Cool!  Is there a way to have it play the sound effect but not overwrite the existing playing playlist?  For example, I have a battle music playlist and I want a sword sound effect to play whenever a character uses their sword - but I don't want it to stop the playlist, just play over the top.
1519745483
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
If you use Roll20AM to control all your music, yes. See the help handout for details, but basically, if you don't use the swap keyword in the Roll20 command, anything already playing from Roll20AM will continue to play.
So i played around with it and here's what I came up with: }} !roll20AM --play|Sword| !roll20AM --stop,delay:3|Sword| ! Basically, this will play the SFX (and doesn't interrupt the music) and also stop the SFX after it is done.  I had to add the stop because if you don't, the track continues to play.  This is gonna be a great little surprise for my players on Friday!
1519745726

Edited 1519745827
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
nice, also, you can make that all one roll20AM command like so: }} !roll20AM --play|Sword --stop,delay:3|Sword| ! The continual play is a bug I'm working on tracking down, but haven't been able to replicate. EDIT: also, make sure you either mark those sounds as player accessible, or turn off player access control in the script's config menu.
And if i wanted two items to play, both with different stops? }} !roll20AM --play,|LightningBolt --stop,delay:8||LightningBolt|DevilCall --stop,delay:6|DevilCall| ! I'm getting some mixed results with this.  I also noticed that since a friend joined our session, the server has really slowed down in response playing these tracks.  Do multiple people in a session affect bandwidth/speed for sounds?
1519752562

Edited 1519752614
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Would be: }} !roll20AM --play|LightningBolt|DevilCall --stop,delay:8|LightningBolt --stop,delay:6|DevilCall| ! I'm not sure on the multiple people. It does have to send the sound to each person, but I'm not sure if it is played locally or server side.
Gotcha, thank you for the syntax help! Is there a way to trigger sounds based off of a roll value?  I'm being greedy now but for example - a 20 or a 1 being rolled would cause a sound effect.
1519753899
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
That is pretty much what I made the Customizable Roll Listener script for. It started out as a module of Roll20AM, but was easier to do as a separate script.
Oh sweet!  I will have to play around with that one.  Thanks for your help!
1519754125
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
NP, happy to help.
Ok so I got my Crit SFX up and running and working on my Fumble.  It appears to have crashed.  : Crit was not parseable. You may want to remove/update this ability via the config menu." " > CRL ERROR ||| Ability: Fumble was not parseable. You may want to remove/update this ability via the config menu." Here is the script I used: !crl \\create,name=Fumble,text=##,roll=fumble \\!roll20AM --play|Trombone|Boo --stop,delay:8|Trombone --stop,delay:8|Boo| ! Here is the profile for the fumble: This Roll Listener will look for this text: ## In these templates: No Template Filtering With these roll results: fumble And will execute these commands: !roll20AM --play|Trombone|Boo --stop,delay:8|Trombone --stop,delay:8|Boo|
Not sure, but don't you have to tell it to look for the attack template so that it will check for the 1 in that template?  I'm lost as well as I don't know the syntax for templates and for result filtering.
Hm, I am not sure.  I read as much as I could but wasn't able to determine if the Template was necessary.  My undestanding was using the ## would essentially open the listener up to any inline rolls.  Which, if I am being honest, I am not 100% sure what constitutes an 'inline' roll.
1519846284

Edited 1519846739
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Sorry for the delay getting back to you Matt. That command should work just fine, although as Omegaman noted you could make it more specific by adding a template to search and/or additional texts to search for. Also, make sure that you have roll20AM set up to accept commands from API scripts correctly, see the config menu for this. EDIT, also when doing this via the CRL, you don't need the extra API command !.
Scott, no worries and thank you for the help so far.  Could you verify for me what a command to CRL would be to play roll20AM when a 20 or a 1 are rolled from 5th Ed OGL by Roll20?
1519848775
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It would need several different commands: !crl \\create,name=Fumble,text=r1=##,roll=fumble \\!roll20AM --play|Trombone|Boo --stop,delay:8|Trombone|Boo <-- fumble in r1 !crl \\create,name=Fumble,text=r2=##,roll=fumble \\!roll20AM --play|Trombone|Boo --stop,delay:8|Trombone|Boo <-- fumble in r2 !crl \\create,name=Fumble,text=r1=##,roll=crit\\!roll20AM --play|Trombone|Boo --stop,delay:8|Trombone|Boo <-- crit in r1 !crl \\create,name=Fumble,text=r2=##,roll=fumble \\!roll20AM --play|Trombone|Boo --stop,delay:8|Trombone|Boo <-- crit in r2
Hm, I don't think it likes the name being the same.  I tried creating unique instances for each of the scenarios you mention.  I assume R1 and R2 refer to if you have advantage enabled?  Wasn't familiar with that term. !crl \\create,name=Fumble1,text=r1=##,roll=fumble \\!roll20AM --play|Trombone|Boo --stop,delay:8|Trombone|Boo !crl \\create,name=Fumble2,text=r2=##,roll=fumble \\!roll20AM --play|Trombone|Boo --stop,delay:8|Trombone|Boo !crl \\create,name=Crit1,text=r1=##,roll=crit \\!roll20AM --play|Crit --stop,delay:8|Crit !crl \\create,name=Crit2,text=r2=##,roll=crit \\!roll20AM --play|Crit --stop,delay:8|Crit So i created these and clicked a bunch till i got a crit and a fail, no sound played.  I also get these: " > CRL ERROR ||| Ability: Fumble1 was not parseable. You may want to remove/update this ability via the config menu." " > CRL ERROR ||| Ability: Fumble2 was not parseable. You may want to remove/update this ability via the config menu." I don't get them for the two Crit ones I made.
1519851516
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, weird, I'm not getting that error on my end. Would you be willing to PM me an invite to your game and let me jump in your game as a gm some time this week, probably around Friday?
By all means, message sent.  Thanks!
1519892292

Edited 1519892815
erm, heya, Im very new to API, Id like to play a bolter sound at in a macro, I tried inserting following. The Bolter sound is in jukebox }} !roll20AM --play|Bolter| !roll20AM --stop,delay:3|bolter| ! EDIT:  Ok made it work by installing roll20 autio master, however theres "quite a delay on playing of sound" and it leaves }} in the chat.. any way to clean that up? This is a GREAT funktion!  -now I only need to make the macro apply dammage to the Healthbar too
1519909811
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hi rune, the }} was a way to hack the roll template of the ogl sheet. If you are using a custom macro, you don't need that line. As for the delay, I'll be working on streamlining the code with my next pass, but part of the issue is that the API runs server side, and so a scripts responsiveness is heavily affected by how busy the site is.
Cool so removed }} hehe, thank you :) its very cool feature