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

Using API Button to provide a query/list and passing back into a script

Specifically, I am trying to modify Aura/Tint Health Colors so instead of playing a Random Sound as per the code below, it prompts the DM to select a sound upon a token reaching 0 hp from a drop down list of preloaded sound files -- preloaded with the existing comma delimited format as originally designed. Any thoughts/suggestions/links to something similar I can try to copy would be appreciated. //DEATH SOUND------------ PlayDeath = function ( trackname ) { var RandTrackName ; if ( trackname . indexOf ( "," ) > 0 ) { var tracklist = trackname . split ( "," ) ; RandTrackName = tracklist [ Math . floor ( Math . random ( ) * tracklist . length ) ] ; } else RandTrackName = trackname ; var track = findObjs ( { type : 'jukeboxtrack' , title : RandTrackName } ) [ 0 ] ; if ( track ) { track . set ( 'playing' , false ) ; track . set ( 'softstop' , false ) ; track . set ( 'volume' , 50 ) ; track . set ( 'playing' , true ) ; } else { log ( ScriptName + ": No track found named " + RandTrackName ) ; } } ,
1611381784
GiGs
Pro
Sheet Author
API Scripter
The API itself cant send forms to players or the GM, so the GM would need to pre-choose the voice line via a config setting before it happens. Aura already has a lot of configuring settings - you'd need to create another one for to set which udio to use (maybe it already has one for that?).