[Script API Reference] Get a programmer instrument positoin and name

Hi, I want to make a script for FMOD Studio(2.0), get all the programmer instrument (quantities: 50+)position and name, So I can make them to trigger some timline events in game, is it possible?
Thanks a lot.

You can do this within FMOD Studio with a script such as the following

events.forEach(function(event) {
  programmerInstruments = [];
  instruments = event.timeline.modules;
  instruments.forEach(function(inst) {
    if (inst.entity === "ProgrammerSound") {
      programmerInstruments.push(inst);
    }
  })
  programmerInstruments.forEach(function(programmerInst){
    console.log(event.name + "\r\n    " + programmerInst.name + ": " + programmerInst.start);
  })
})

If this is something you are performing at runtime, you can just call Studio::EventInstance::getTimelinePosition() at the time you are setting the programmer instruments sound.

https://www.fmod.com/resources/documentation-api?version=2.1&page=studio-api-eventinstance.html#studio_eventinstance_gettimelineposition

Thx, it works!
So, how Can I know when does the instrument stop?

You will need to add (programmerInst.start + programmerInst.length) to the last forEach console output.

Thanks a lot!
Where can i get these function info?
https://www.fmod.com/resources/documentation-studio?version=2.1&page=scripting-api-reference-project.html
I didn’t find these Programmerinstrument function in the document.

The programmerInst is a variable that’s instantiated when you call the forEach() function. programmerInst is the current programmer instrument whilst looping through the programmerInstruments array.

This is more of a Javascript/coding issue than an FMOD Studio scripting API issue.