Skip to content
Abdyy edited this page Sep 27, 2026 · 7 revisions

MSBF, short for Message Studio Binary Flowchart is a file format used to store flowcharts. PylibMS offers several functions used for dealing with these files.

Reading

from lms.flowchart.msbfio import read_msbf_path

msbf = read_msbf_path("path/to/msbf")

Any IOBase, BytesIO, bytearray, memoryview, or bytes stream object can be passed instead when reading. Useful for msbf files embedded into archive files.

from lms.flowchart.msbfio import read_msbf

stream = b"" # Data here
msbf = read_msbf(stream) 

stream = memoryview(b"")
msbf = read_msbf(stream) 

stream = BytesIO(b"")
msbf = read_msbf(stream) 

Writing

from lms.flowchart.msbfio import write_msbf_path

write_msbt_path("path/to/msbf", msbf)

If the raw data is needed, write_msbf can be utilized

from lms.message.msbfio import write_msbf

raw_data = write_msbf(msbf)

Flowcharts

The point of MSBF files are to store flowcharts, defining the flow of actions for a specific event. These may be accessed via the flowcharts attribute, using the name of the flowchart to access.

from lms.flowchart.msbfio import read_msbf_path

msbf = read_msbf_path("path/to/msbf")

# Access flowchart 'Balloon'. Returns a LMS_Flowchart object.
balloon = msbf.flowcharts["balloon"]

Flowchart Length

The length of the flowchart may be calculated by using len on the object itself.

balloon = msbf.flowcharts["balloon"]
node_count = len(balloon)

Accessing Nodes

To access a node from the flowchart, you may do so in two ways.

# By MSBF object
node = msbf.nodes[21]

# By container flowchart
balloon = msbf.flowcharts["balloon"]

# Using id of node on the object itself
node = balloon[21]

# Using id of node on the flowchart.nodes
node = balloon.nodes[21]

Registering Nodes

In order for the MSBF file to understand a node is apart of the flowchart, it must be registered. Setting the child of a node to another one without registering will not implicitly register the node.

balloon = msbf.flowcharts["balloon"]

node = LMS_EventNode.new(LMS_NodeParameterType.STRING, "Bro", 29)

# Register without flowchart
msbf.register_node(node)

# Register with flowchart
msbf.register_node(node, balloon)

The node will obtain an id once it is registered to the flowchart.

Destroying and Deregistering Nodes

To remove a node, reference that node by the id. The flowchart will set the child of the previous node to the node after the one that is deleted.

# Destroying nodes (kills all references)
msbf.destroy_node(21)

# Deregister node from individual flowchart
balloon = msbf.flowcharts["balloon"]

balloon.deregister_node(21)

Dangling Nodes

To find if any nodes do not have a parent, you may check for it using get_dangling_nodes.

balloon = msbf.flowcharts["balloon"]

dangling_nodes: list[LMS_BaseNode] = balloon.get_dangling_nodes()

Wiki Home

Home

File Formats

LMS Objects & Enums

TitleConfig

Clone this wiki locally