I’m trying to set up an event with a parameter, and am using the details from the docs at
https://www.fmod.com/docs/2.02/studio/scripting-api-reference-project.html#parameterdefinition
setting the parameter definition like this:
var trackname = "Track1";
var datetime = new Date().toJSON().slice(0,19).toString().replace(":", "");
var newEvent = studio.project.create( "Event" );
newEvent.name = trackname + " " + datetime;
newEvent.folder = studio.project.workspace.masterEventFolder;
studio.window.navigateTo(newEvent);
var _min = 0;
var _max = 6; //this is a calculated value in my actual script
console.log("Setting " + trackname + "Vol" + " min:" + _min + ", max: " + _max);
//add in a parameter to drive volume
var volParam = newEvent.addGameParameter({
name: trackname + "Vol",
type: studio.project.parameterType.UserDiscrete,
min: _min,
max: _max
});
this ends up with a parameter with it’s min and max both set to 0. I’m unable to set the min and max values.
If I edit the preset child I seem to get the right outcome,
volParam.preset.minimum = _min;
volParam.preset.maximum = _max;
volParam.preset.initialValue = 1;
Which feels like its not the right way to go about this, from how the docs are showing the objects.
thanks for any help