If i want to create Event by using javascript, how can i create 3D event on action sheet?

What’s more, i want to select this event after create this event.
i wrote code like this:

var m_event = studio.project.create("Event")
m_event.name = "Test event";
var actionSheet = studio.project.create("ActionSheet");
m_event.relationships.parameters.add(actionSheet);
  1. I have no idea on how to add sound on this action sheet
  2. I want to make this event as 3d event
  3. I want to select this event after it is created.
    Thank you so much!

Hi,

With the existing var actionSheet in your code, you can do the following:

var sound = studio.project.create('SingleSound');
sound.owner = actionSheet.modules;

m_event.mixer.masterBus.effectChain.addEffect('SpatialiserEffect') will add an FMOD Spatializer to the event’s master track, thereby making it a 3D event.

studio.window.navigateTo(event) will navigate the the event and highlight it in the Event Editor.

1 Like

That would be Great help!
Thank you so much!
One more~~
Is it possibile to check an event is selected or not? any properties?
Because i want to write a filter script which can help to select event.

Can you elaborate on what exactly you mean? For example, are you trying to check whether the event currently selected in the Event Editor is the same event as another you have assigned to a variable? Or do you mean something else?

Sorry for unclear.
I just want to give an input text line to the users, they can write some text such as “NPC”, and then all events’ name contain “NPC” string will be highlight or selected in the Event Editor.

I’m not sure whether it’s exactly what you’re looking for, but studio.window.browserSelection() will return an array of the objects currently selected in the active window. The best way to compare a selected event to some other event is to compare their globally unique IDs, which you can do with event1.id === event2.id.

1 Like

All Right, i think i know what to do, thank you so much!

1 Like