Repository navigation
MSBT
Abdyy edited this page Jun 8, 2025
·
59 revisions
MSBT, short for Message Studio Binary Text is a file format used to store messages linked to labels. PylibMS offers several function used for dealing with these files. Currently, the LBL1, ATR1 and TXT2, and TSY1 blocks are the main ones supported.
from LMS.Message.MSBTStream import read_msbt
# Create the MSBT object
with open("Drama.msbt", "rb+") as f:
msbt = read_msbt(f)from LMS.Message.MSBTStream import write_msbt
with open("Out.msbt", "wb") as f:
write_msbt(f, msbt)Accessing relevant data is done through the MSBTEntry class.
# By index
entry = msbt.entries[4]
entry.name
# >>> Entry04# By name
entry = msbt.get_entry("Entry04")
Text is accessed through a LMS_MessageText object. This class gives extra tag manipulation functionality.
message = entry.message
message.text
# >>> "Hi"Additonally, the list of control tags can be retrieved from the current message.
message.tags
# >>> [<LMS.Message.Tag.LMS_Tag.LMS_EncodedTag object at 0x00>, <LMS.Message.Tag.LMS_Tag.LMS_DecodedTag object at 0x1>]For more info on tags, see Control Tags.
The index of styles in a MSBP object is located in the MSBTEntry object through the .style_index property, and the style object can be accessed through a MSBP object.
index = entry.style_index
style = msbp.styles[index]
# >>> LMS.Project.Definitions.Style.LMS_Style object at 0x00