Retrieve list of events from Masters.strings bank

Hello there!

So I read that you should be able to load the Masters.strings bank and can then use getEventList() or getEventCount() to get a list of all the event paths the project has. But for me it returns an empty list / 0 for the count.

I can’t find out what the problem is or how I am supposed to do it correctly. Any help is very appreciated!

Also, I use the HTML5 version!

The master strings bank is used to convert GUIDs of all events, snapshots, buses, etc. in the project into their human readable strings. The events themselves are contained in the banks they are assigned to in the FMOD Studio project. You will need to call getEventList() on the banks your events are assigned to.

Thank you for the answer.
It’s as I feared, in order for my game engine to have a list of all the events, I would need to load every bank once and retrieve the event list from there, correct?

Because I don’t think that will be feasible, I wrote an FMOD Studio script that generates a JSON of all the banks, events, parameters etc, and their paths and GUIDs!

There is a built in example script in FMOD Studio if you click Scripts > FMOD Examples > Export GUIDs Header. You might find this useful for knowing all events, buses, etc. without loading the banks in your game. Otherwise, you are correct that this is something you will need to export from the project and not at runtime.

If you are only interested in the path / guid of all Events, and none of the other details you can get this info from the On that bank call Studio:: Bank::getStringInfo, this will retrieve all the entries from the strings table, you will need to filter the output since you are only interested in the “event:/” prefixed paths but it should get what you want.

1 Like

This sounds exactly for what I was looking for!

Sadly, the function doesn’t work for me. It throws an error in this function:

function __emval_set_property(handle, key, value) {
            handle = requireHandle(handle);
            key = requireHandle(key);
            value = requireHandle(value);
            handle[key] = value

in here, handle is 1, which makes “requireHandle” return undefined, which breaks the last line of the function. I tried to comprehend with some debugging where this originates from, but it doesn’t seem to be coming from my code as far as I can tell.

Regardless, as I said I have the JSON solution right now, so this is not the most important thing right now! Just wanted to let you know!

Thanks for your answers!

Glad to hear you found a workaround. I was able to recreate your error by passing in an empty object as the id argument to getStringInfo. The HTML5 platform docs mention needing to construct structs before passing them into get calls.
As a quick example, you can enumerate the event paths of a loaded strings bank with the following code:

let id = FMOD.GUID(); // constructing GUID instead of using empty object '{}'
let path = {}, retrieved = {}, count = {};

result = masterStringBank.getStringCount(count);

for(let i =  0; i < count.val; ++i) {
    result = masterStringBank.getStringInfo(i, id, path, 100, retrieved);
    console.log({i, id, path, retrieved});

Just something to keep in mind in case you run into that error again!