'.set' for 'jukeboxtrack' Type Objects

1505161833

Edited 1505161896
I've been trying to re-engineer  this particular ammo script (by Aaron C. M.) in order to automatically play a sound effect when ammo is used or ammo is depleted. The concept is simple. With the use of one macro for an already existing script, be able to fire a weapon if it has ammo and play the appropriate sound effect. If it is out of ammo, deny the user the ability to deplete ammo below zero and play the 'out of ammo' sound effect. Both sound effects are determined by the command's parameters !ammo @{selected|token_id} weapon1Ammunition -1 __m9_1 ammo_out "__m9_1" is the name of the sound for the gun firing "ammo_out" is the name of the sound for, well... you know. The Problem I've gone back and forth trying to recreate the way the Audio Master and SFX scripts do it, but it doesn't seem to be recognizing the 'jukeboxtrack' object. The log outputs "[object Object]" as the music object that's trying to get played. ultimately, I want to turn a string, into a music object, that gets played once. https://www.dropbox.com/s/k3v1rd6kbi9iini/ammo.js?dl=0 These are the errors I'm getting in the current iteration. https://pastebin.com/9aE2f1uW
1505164540
The Aaron
Pro
API Scripter
The "Play function, song is [object Object] " Is just because of the way output is encoded, try replacing your log call with this:         log('Play function, song is '+song.get('title')+' '); or log('Play function, song is '+JSON.stringify(song)+' '); As to that other issue, it's because you're passing the song object to itself:             song.set({  playing: true, softstop: false, title:song }); Which makes for a problem.  Just don't do that.  It's probably a typo anyway:             song.set({  playing: true, softstop: false}); Hope that helps!
Did the trick, thanks! Now I just need to work out a little bug with where the boolean flags are and I'll post the solution.