Use FMOD Scripting to duplicate a set of global parameters

We have a collection of global parameters that we use on a regular basis to create audio logic internally to FMOD Studio. The parameter values/settings are all the same, but we need to duplicate them in order to give them different names.

Is there a duplicate parameter function inside the FMOD Studio scripting library? I’ve looked, but I’m not seeing anything off hand.

Hi,

The following code will let you duplicate a parameter on an event and give it a new name:

Duplicate Paramter
studio.menu.addMenuItem({
    name: "Duplicate parameter",
    execute: function() { DuplicateSelectedParam(); }
})

function DuplicateSelectedParam() {
    var event = studio.window.browserCurrent();
    var paramIndex = studio.system.getText("Index: ", "index");
    var proxy = event.parameters[paramIndex];
    var copy = event.addGameParameter(proxy);
    var preset = copy.preset; 
    var owner = preset.presetOwner; 
    owner.name = studio.system.getText("Duplicate Name: ", "Name");
}

It is also possible to duplicate parameters in the Preset Browser window:
image
Right-click on the desired parameter and select duplicate:


So there are a couple of ways to duplicate parameters.

Hope this helps!

Thanks Conner! We have need to do a big batch duplication with auto-renaming, so the scriptable version is our desired method! I’ll be looking into whether or not extrapolating from your script will be the best course or if we need to consider creating the parameters from scratch.

Unfortunately, the paramIndex variable is returning Undefined and causing a script error. The values I’m inputing for the “Index” getText() must be incorrect. Can you clarify what that value is meant to be?