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

[LookingFor] Script playing song when ...

1468330364

Edited 1468330381
Hey folks, I'm looking for a script triggering "X" track when a dice is rolling and then playing a random track from the playlist "success" if "result<10" or from the playlist "fail" if "result>90". I think you got the idea, is there something like this already existing or could someone please take a little bit of his own time to do it ? (We could set a payment/reward if you want to) Thanks,
I use SFX. I believe it can be found here:  SFX Post You can then set up calls play or stop music from a macro. And being a macro you can add dice rolls, FX, etc. Here is one of my basic calls as an ability on a character: !sfx volume:75 song:Horse action:play Hope this helps.
1468350216

Edited 1468350466
Lyrad said: I'm looking for a script triggering "X" track when a dice is rolling If I'm understanding correcting, you want all dice rolls have an accompanying sound effect? One way to accomplish this is to roll such dice through a macro that includes a command line to activate this sound effect. For example, using the SFX script above: /r ?{Dice Roller|1d20} !sfx song:Dice action:play Lyrad said: and then playing a random track from the playlist "success" if "result<10" or from the playlist "fail" if "result>90". Here's one possible way to accomplish this (untested): Rename the playlist "fail" to "Result-0". Rename the playlist "success" to "Result-2". Ensure both playlists are set to Shuffle . Use a macro similar to the following: /em rolls a d100! !sfx list:Result-[[ 1d100<90f>10 + 1 ]] action:play One issue is that you won't be able to see the exact result of the roll; only hear a track play / get a message from the API Script.
1468350488

Edited 1468350718
Thank you guys ! - How is the macro working, do i have to start the macro to each map ? Each game ? Each roll ? - How is the SFX working ? Should i install it as a script and then start the macro in game ? A friend of mine did this when i exposed him the thing : var badPlaylist = "Bad"; var goodPlaylist = "Good"; var goodLimit = 90; var badLimit = 10 function randomMusic (playlist) { var number = _.random(0, playlist.i.length-1); var track = getObj("jukeboxtrack", playlist.i[number]); //launch new music track.set("playing", true); } on("chat:message", function (obj) { if (!obj.origRoll || obj.origRoll.indexOf("d100") == -1 ) return; var playlists = JSON.parse(Campaign().get("_jukeboxfolder")), bad = null, good = null; _.each(playlists, function (playlist, i) { if (playlist.n == badPlaylist) bad = playlist; if (playlist.n == goodPlaylist) good = playlist; }); var content = JSON.parse(obj.content); if (content.total < badLimit ) randomMusic(bad); if (content.total > goodLimit) randomMusic(good); }) I don't get a shit of this and still have to ask him how this would work.
1468351043

Edited 1468351061
Lyrad said: - How is the macro working, do i have to start the macro to each map ? Each game ? Each roll ? If you're referring to this one /r ?{Dice Roller|1d20} !sfx song:Dice action:play Yeah, you'd have to make all rolls through that. A better alternative might be to write an API Script that either Listens for certain dice rolls and then plays a Jukebox track after that roll occurs (able to use 3D Dice with this option), or Functions as a dice roller that can play the Jukebox track at the same time that the roll occurs (unable to use 3D dice with this option). You would use a chat command to activate this Script, could be as simple as typing "!roll 1d20" into the Text Chat. Lyrad said: - How is the SFX working ? Should i install it as a script and then start the macro in game ? Yes; you would copy/paste/save the contents of the code block within the SFX thread's original post as a New Script.