Setting narration override from script

The API doesn’t seem to allow setting the narration override for the labels (1, 2, 3)?

There isn’t currently a function exposed for that.

It is a bit lower level, but you can add your own function to the Functions panel which is in the Advanced panel when you select the root node in the outline. The findNodeById function allows you to access all properties of a node. It returns the full node and a path to the node. The mcState allows changing a property of the node given a path. The property you are trying to set is either label1Audio, label2Audio or label3Audio which is the narration override content.

function setItemLabel1AudioNarration(id, content) {
  const { node, path } = mc.findNodeById(id);

  if (node) {
    mcState.set(path.concat("label1Audio"), content);
  } else {
    // arguments.callee.name gets the name of the function we are in
    mcAlert.alert(arguments.callee.name + ": I couldn't find a node by that ID.");
  }
}

You would then call from a Value Trigger like this…

try {
  setItemLabel1AudioNarration("textOrEmail", "I really should text or email my wife.")
} catch (err) {
   mcAlert.alert(err.message);  
}
1 Like

And the functions tab is in the “advanced” section of the properties of the checklist (root node) itself. Thanks.