livemaker.lsb package

Submodules

livemaker.lsb.command module

LiveMaker LSB/LSC script command classes.

class livemaker.lsb.command.CommandType[source]

Bases: enum.IntEnum

LiveMaker script command type.

Note

In some cases, for some reason the internal LiveMaker Delphi class names differ from the string command name used in script files (ex. TComEntryHist becomes FormatHist). For these cases, use the command names from serialized script files.

If = 0
Elseif = 1
Else = 2
Label = 3
Jump = 4
Call = 5
Exit = 6
Wait = 7
BoxNew = 8
ImgNew = 9
MesNew = 10
Timer = 11
Movie = 12
Flip = 13
Calc = 14
VarNew = 15
VarDel = 16
GetProp = 17
SetProp = 18
ObjDel = 19
TextIns = 20
MovieStop = 21
ClrHist = 22
Cinema = 23
Caption = 24
Menu = 25
MenuClose = 26
Comment = 27
TextClr = 28
CallHist = 29
Button = 30
While = 31
WhileInit = 32
WhileLoop = 33
Break = 34
Continue = 35
ParticleNew = 36
FireNew = 37
GameSave = 38
GameLoad = 39
PCReset = 40
Reset = 41
Sound = 42
EditNew = 43
MemoNew = 44
Terminate = 45
DoEvent = 46
ClrRead = 47
MapImgNew = 48
WaveNew = 49
TileNew = 50
SliderNew = 51
ScrollbarNew = 52
GaugeNew = 53
CGCaption = 54
MediaPlay = 55
PrevMenuNew = 56
PropMotion = 57
FormatHist = 58
SaveCabinet = 59
LoadCabinet = 60
IFDEF = 61
IFNDEF = 62
ENDIF = 63
class livemaker.lsb.command.LabelReference(Page='', Label=0)[source]

Bases: livemaker.lsb.core.BaseSerializable

Internal use class for resolving label references.

Label lookups will be done at serialization time as needed. When serializing to an LSC format, lookup will be done if the original reference is to a label index. When serializing to LSB, lookup will be done if the original reference is to a string label name.

Note

If the original reference is in the correct format (i.e. string name for LSC to LSC or index for LSB to LSB, no lookup will be done to validate that the specified label exists)!

keys()[source]
items()[source]
lookup_name()[source]

Lookup the label name for this reference.

lookup_index()[source]

Lookup the label command index for this reference.

to_lsc()[source]

Return this label reference in text .lsc format.

to_xml()[source]

Return an XML representation of this label reference.

classmethod from_struct(struct)[source]

Instantiate an object from a construct Struct.

class livemaker.lsb.command.BaseCommand(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Base command class.

Parameters:
  • Indent – Indentation level. Indent level specifies the scope for commands like If/WhileLoop/etc.
  • Mute – True if this command can be ignored during processing (used for comments).
  • NotUpdate – Unknown.
  • Color – Unknown (always False for novels?).
  • LineNo – LineNo (line number) for this command. When a script is compiled into a binary LSB, target label name references (for jumps and calls) are replaced with a reference to the LineNo of the target label command.
type

Command type.

Type:CommandType
args

OrderedDict of this command’s arguments. If an argument is not applicable in a given LSB version, it’s value should be set to None. Any arg set to None will not be serialized. If an arg is applicable in a given version and needs to be set to an empty value, use the empty string ‘’. This should make serialization for the .lsc formats consistent with how construct handles optional (version specific) values when reading to/from binary .lsb format.

Note

The order args are initialized is important, since they will be serialized in the same order.

type = None
keys()[source]

Return a list of dictionary keys for this command.

items()[source]

Return a list of (key, value) pairs for this command.

to_lsc()[source]

Return this command in text .lsc format.

to_xml()[source]

Return an XML representation of this command.

class livemaker.lsb.command.If(Calc=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Begin an If conditional block.

Conditional block nesting is handled by the Command.Indent attribute.

Parameters:Calc (LiveParser) – Conditional expression.
type = 0
class livemaker.lsb.command.Elseif(Calc=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.If

Begin an Elseif conditional block.

type = 1
class livemaker.lsb.command.Else(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Begin an Else conditional block.

type = 2
class livemaker.lsb.command.Label(Name='', **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Insert a named label which can be used as a Jump or Call target.

Parameters:Name (str) – Label name.

Note

Original label names may not be available when decompiling a binary LSB.

type = 3
class livemaker.lsb.command.Jump(Page=<livemaker.lsb.command.LabelReference object>, Calc=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Conditionally branch to a Label or the start of a script.

Parameters:
  • Page (LabelReference) – Target label.
  • Calc (LiveParser) – Jump to target label if Calc evaluates to True.
type = 4
class livemaker.lsb.command.Call(Page=<livemaker.lsb.command.LabelReference object>, Result='', Calc=<livemaker.lsb.core.LiveParser object>, Params=<livemaker.lsb.core.LiveParserArray object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Conditionally call a Label or script with optional parameter arguments.

Parameters:
  • Page (LabelReference) – Target label.
  • Result (str) – Variable name to store call return value, if unset (empty string) the return value will not be stored.
  • Calc (LiveParser) – Call target script if Calc evaluates to True.
  • Params (LiveParserArray) – List of parameters to be passed into the called script.
type = 5
class livemaker.lsb.command.Exit(Calc=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Conditionally return from the current script.

Parameters:Calc (LiveParser) – Return if Calc evaluates to True.
type = 6
class livemaker.lsb.command.Wait(Calc=<livemaker.lsb.core.LiveParser object>, Time=<livemaker.lsb.core.LiveParser object>, StopEvent=None, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Conditionally wait for some amount of time.

Parameters:
  • Calc (LiveParser) – Wait if Calc evaluates to True.
  • Time (LiveParser) – Time to wait in milliseconds.
  • StopEvent (LiveParser) – Event processing will be stopped while waiting if StopEvent evaluates to True. Only used in LM versions 107 and later.
type = 7
class livemaker.lsb.command.BaseComponentCommand(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Base class for Component type commands.

Component commands take list of LiveParser arguments, where the number of arguments depends on which parameters are enabled for a given command (i.e. the boolean flag list of parameters from the top level LMScript).

Parameters:
  • components (iterable(LiveParser)) – Iterable containing the parameters for this command. Each parameter should correspond to an enabled PropertyType for this command.
  • command_params (list(bool)) – List containing enabled parameter flags for this command.
type = None
keys()[source]

Return a list of dictionary keys for this command.

class livemaker.lsb.command.BoxNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Draw a rectangle in the specified screen region.

type = 8
class livemaker.lsb.command.ImgNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Draw an image in the specified screen region.

type = 9
class livemaker.lsb.command.MesNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Draw a message box in the specified screen region.

type = 10
class livemaker.lsb.command.Timer(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a timer that calls a specified callback script when the timer expires.

type = 11
class livemaker.lsb.command.Movie(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Play a movie clip in the specified screen region.

type = 12
class livemaker.lsb.command.Flip(Wipe=<livemaker.lsb.core.LiveParser object>, Time=<livemaker.lsb.core.LiveParser object>, Reverse=<livemaker.lsb.core.LiveParser object>, Act=<livemaker.lsb.core.LiveParser object>, Targets=<livemaker.lsb.core.LiveParserArray object>, Delete=<livemaker.lsb.core.LiveParser object>, Source=None, DifferenceOnly=None, StopEvent=None, Param=<livemaker.lsb.core.LiveParserArray object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Apply a named flip (transition) effect to the specified object.

The specifics of how a flip is applied to an object varies depending on the flip type. See the LiveNovel docs for detailed information on flip types and parameters.

Parameters:
  • Wipe (LiveParser) – Flip effect name.
  • Time (LiveParser) – Flip duration.
  • Reverse (LiveParser) – If evaluates to True, flip direction will be reversed.
  • Act (LiveParser) – If evaluates to FL_STAY, object will remain on screen after flip (i.e. a fade-in effect), if FL_OUT, object will be removed after flip (i.e. a fade-out).
  • Targets (LiveParserArray) – List of objects to be affected by this flip.
  • Delete (LiveParser) – If evaluates to TRUE, object will be deleted after this flip.
  • Source (LiveParser) – Source for this flip. Only used in LM version > 100.
  • DifferenceOnly (LiveParser) – Unknown. Only used in LM version > 116.
  • StopEvent (LiveParser) – If evaluates to TRUE, event processing will be stopped during this flip. Only used in LM version > 106.
  • Param (LiveParserArray) – List of parameter arguments for this flip, optional optional depending on flip type.
type = 13
class livemaker.lsb.command.Calc(Calc=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Evaluate some expression.

Generally used to store the result of some calculation into a variable.

Parameters:Calc (LiveParser) – Expression to evaluate.
type = 14
class livemaker.lsb.command.VarNew(Name='', Type=0, InitVal=<livemaker.lsb.core.LiveParser object>, Scope=0, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Create a new variable and optionally initialize it.

Parameters:
  • Name (str) – Variable name.
  • Type (int or ParamType) – Data type.
  • InitVal – Initial value.
  • Scope – Variable scope (0 = global).
type = 15
class livemaker.lsb.command.VarDel(Name='', **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Delete a variable.

Parameters:Name (str) – Variable to delete.
type = 16
class livemaker.lsb.command.GetProp(ObjName=<livemaker.lsb.core.LiveParser object>, ObjProp=<livemaker.lsb.core.LiveParser object>, VarName='', **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Get the specified object property.

Parameters:
  • ObjName (LiveParser) – Object name.
  • ObjProp (LiveParser) – Property name.
  • VarName (str) – Object property will be stored in VarName.
type = 17
class livemaker.lsb.command.SetProp(ObjName=<livemaker.lsb.core.LiveParser object>, ObjProp=<livemaker.lsb.core.LiveParser object>, Value=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Set the specified object property.

Parameters:
  • ObjName (LiveParser) – Object name.
  • ObjProp (LiveParser) – Property name.
  • Value (LiveParser) – Object property will be set to Value.
type = 18
class livemaker.lsb.command.ObjDel(Name=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Delete the specified object.

Parameters:Name (LiveParser) – Name of object to delete.
type = 19
class livemaker.lsb.command.TextIns(Text=<livemaker.lsb.novel.TpWord object>, Target=<livemaker.lsb.core.LiveParser object>, Hist=<livemaker.lsb.core.LiveParser object>, Wait=<livemaker.lsb.core.LiveParser object>, StopEvent=None, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Insert a LiveNovel text block.

The text block will be in a “compiled” TpWord format, rather than in the “HTML-like” LiveNovelScript format.

Parameters:
  • Text (TpWord) – The text block to insert.
  • Target (LiveParser) – Name of the message box to display the text.
  • Hist (LiveParser) – If TRUE, add the text to history.
  • Wait (LiveParser) – If TRUE, wait until all text is read and message box is cleared before proceeding.
  • StopEvent (LiveParser) – If TRUE, stop event processing while displaying this text. If FALSE, the value of Wait will be ignored. Only used if LM version > 106.
type = 20
class livemaker.lsb.command.MovieStop(Target=<livemaker.lsb.core.LiveParser object>, Time=<livemaker.lsb.core.LiveParser object>, Wait=<livemaker.lsb.core.LiveParser object>, StopEvent=None, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Stop playback and delete the specified media clip.

Parameters:
  • Target (LiveParser) – Name of media clip to stop.
  • Time (LiveParser) – Time for playback to fade out in milliseconds (0 is immediate with no fade out).
  • Wait (LiveParser) – If TRUE, command processing will not proceed until the media clip is deleted.
  • StopEvent (LiveParser) – If TRUE, event processing will be stopped until media clip is deleted. Only used in LM version > 106
type = 21
class livemaker.lsb.command.ClrHist(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.Else

Clear text history.

type = 22
class livemaker.lsb.command.Cinema(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Play the specified cinema object.

type = 23
class livemaker.lsb.command.Caption(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Display a caption.

type = 24
class livemaker.lsb.command.Menu(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Display a menu.

type = 25
class livemaker.lsb.command.MenuClose(Target=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Close the specified menu.

Parameters:Target (LiveParser) – Menu to close.
type = 26
class livemaker.lsb.command.Comment(Name='', **kwargs)[source]

Bases: livemaker.lsb.command.Label

Create a comment.

type = 27
class livemaker.lsb.command.TextClr(Target=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Clear the specified text.

Parameters:Target (LiveParser) – Message box to clear.
type = 28
class livemaker.lsb.command.CallHist(Target=<livemaker.lsb.core.LiveParser object>, Index=<livemaker.lsb.core.LiveParser object>, Count=<livemaker.lsb.core.LiveParser object>, CutBreak=<livemaker.lsb.core.LiveParser object>, FormatName=None, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Open the text history (backlog).

Parameters:
  • Target (LiveParser) – Message box to display history.
  • Index (LiveParser) – Index of line to start showing history from.
  • Count (LiveParser) – Number of lines to show.
  • CutBreak (LiveParser) – Normally a gap is displayed separating script pages (scenario pages) in the history. If CutBreak is TRUE, this gap will be removed.
  • FormatName (LiveParser) – Name of history formatter to use. Only used in LM version > 110.
type = 29
class livemaker.lsb.command.Button(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a clickable button.

type = 30
class livemaker.lsb.command.While(Calc=<livemaker.lsb.core.LiveParser object>, End=0, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Insert while loop block conditional statement.

Parameters:
  • Calc (LiveParser) – Loop conditional expression (i.e. i < 10). If TRUE the loop will be run, otherwise execution will branch to End + 2 (Since End is followed by the closing WhileLoop command).
  • End (int) – Index of the last command contained by the loop. The command at End will be followed by the closing WhileLoop command for this loop.

Note

We do not fully support serializing loops to and from XML. In an LSB file, a loop block looks like:

TComWhileInit i = 0
TComWhile i < 10
    <Nested commands>...
TComWhileLoop i = i + 1

TComWhileInit and TComWhile will have the same index (they are treated internally by LiveMaker as a single command).

In LiveMaker’s actual XML lsc format, they store this entire pattern as a single While command, even though it gets compiled into the 3 separate WhileInit, While, WhileLoop commands (with the final WhileLoop inserted before the next command with an indentation level outside of the loop).

In pylivemaker, we just output the commands individually in the order they appear in an LSB.

type = 31
class livemaker.lsb.command.WhileInit(Calc=<class 'livemaker.lsb.core.LiveParser'>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Initialize a while loop.

Parameters:Calc (LiveParser) – Loop initialization statement (i.e. i = 0).
type = 32
class livemaker.lsb.command.WhileLoop(Start=0, **kwargs)[source]

Bases: livemaker.lsb.command.WhileInit

Close a while loop.

Parameters:Start (int) – Index of the command preceding this loop. After evaluating the statement in Calc, command processing will return to Start + 1, which should be the opening WhileInit/While commands.

Note

WhileLoop is handled a subclass of WhileInit for struct parsing purposes. Calc is an expression to be evaluated when reaching the end of the loop (i.e. i = i + 1).

type = 33
class livemaker.lsb.command.Break(End=0, **kwargs)[source]

Bases: livemaker.lsb.command.Exit

Loop break statement.

Parameters:End (int) – Index for the end of the current loop.

Note

Break is handled a subclass of Exit for struct parsing purposes. If Calc is TRUE, command processing will exit the current loop.

type = 34
class livemaker.lsb.command.Continue(Start=0, **kwargs)[source]

Bases: livemaker.lsb.command.Exit

Loop continue statement.

Parameters:Start (int) – Index for the start of the current loop.

Note

Continue is handled a subclass of Exit for struct parsing purposes. If Calc is TRUE, command processing will return to the start of the current loop.

type = 35
class livemaker.lsb.command.ParticleNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Insert a particle effect.

type = 36
class livemaker.lsb.command.FireNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Insert a flame effect.

type = 37
class livemaker.lsb.command.GameSave(No=<livemaker.lsb.core.LiveParser object>, Page='', Label=None, Caption=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Create a game save.

Parameters:
  • No (LiveParser) – Save slot number to use.
  • Page (str) – Save location is normally the command following this GameSave. If Page is specified, it will be used as the save location.
  • Label (int) – Label index in Page to load. Only used in LM version > 104.
  • Caption (LiveParser) – Caption for this save.
type = 38
class livemaker.lsb.command.GameLoad(No=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Load a game save.

Parameters:No (LiveParser) – Save slot number to load.
type = 39
class livemaker.lsb.command.PCReset(Page=<livemaker.lsb.command.LabelReference object>, AllClear=0, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Reset program counter to the specified page.

See LiveNovel documentation for details.

Parameters:
  • Page (LabelReference) – PC will be reset to Page.
  • AllClear (int) – If non-zero, all call stack information will be cleared after the reset.
type = 40
class livemaker.lsb.command.Reset(Page=<livemaker.lsb.command.LabelReference object>, AllClear=0, **kwargs)[source]

Bases: livemaker.lsb.command.PCReset

Delete all components, variables and stacks and transfer processing to the specified page.

type = 41
class livemaker.lsb.command.Sound(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Play the specified sound.

type = 42
class livemaker.lsb.command.EditNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create an edit component.

type = 43
class livemaker.lsb.command.MemoNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a memo component.

type = 44
class livemaker.lsb.command.Terminate(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.Else

Unconditionally exit the program.

type = 45
class livemaker.lsb.command.DoEvent(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.Else

Process the specified event.

type = 46
class livemaker.lsb.command.ClrRead(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.Else

Clear read text information.

type = 47
class livemaker.lsb.command.MapImgNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create an image surface component.

type = 48
class livemaker.lsb.command.WaveNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a wave surface component.

type = 49
class livemaker.lsb.command.TileNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a tiled surface component.

type = 50
class livemaker.lsb.command.SliderNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a slider.

type = 51
class livemaker.lsb.command.ScrollbarNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a scrollbar.

type = 52
class livemaker.lsb.command.GaugeNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a gauge.

type = 53
class livemaker.lsb.command.CGCaption(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

type = 54
class livemaker.lsb.command.MediaPlay(Target=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Play the specified media.

Parameters:Target (LiveParser) – Media object to play.
type = 55
class livemaker.lsb.command.PrevMenuNew(components=[], command_params=[], **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Create a preview menu component.

type = 56
class livemaker.lsb.command.PropMotion(Name=<livemaker.lsb.core.LiveParser object>, ObjName=<livemaker.lsb.core.LiveParser object>, ObjProp=<livemaker.lsb.core.LiveParser object>, Value=<livemaker.lsb.core.LiveParser object>, Time=<livemaker.lsb.core.LiveParser object>, MoveType=<livemaker.lsb.core.LiveParser object>, Paused=None, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Gradually change the specified object property to the specified value over time.

Parameters:
  • Name (LiveParser) – Name of this motion.
  • ObjName (LiveParser) – Object to modify.
  • ObjProp (LiveParser) – Property to modify.
  • Value (LiveParser) – Value to set.
  • Time (LiveParser) – Duration in milliseconds.
  • MoveType (LiveParser) – Move type, see LiveNovel docs for details.
  • Paused – (LiveParser): Unknown. Only used for LM version > 107.
type = 57
class livemaker.lsb.command.FormatHist(Name=<livemaker.lsb.core.LiveParser object>, Target=<livemaker.lsb.core.LiveParser object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseCommand

Register a history display format.

Parameters:
  • Name (LiveParser) – Name of this format.
  • Target (LiveParser) – Target message box. Only used in LM version > 110.
type = 58
class livemaker.lsb.command.SaveCabinet(Act=<livemaker.lsb.core.LiveParser object>, Targets=<livemaker.lsb.core.LiveParserArray object>, **kwargs)[source]

Bases: livemaker.lsb.command.BaseComponentCommand

Move screen components into the specified save cabinet.

See LiveNovel docs for details.

Parameters:
  • Act (LiveParser) – If FALSE the specified screen objects will be saved. If TRUE, all screen objects other than the specified ones will be saved.
  • Targets (LiveParserArray) – List of objects to save.
type = 59
class livemaker.lsb.command.LoadCabinet(Act=<livemaker.lsb.core.LiveParser object>, Targets=<livemaker.lsb.core.LiveParserArray object>, **kwargs)[source]

Bases: livemaker.lsb.command.SaveCabinet

Load screen objects from the specified cabinet.

type = 60
class livemaker.lsb.command.IFDEF(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.Else

Ifdef compiler directive, removed during LSB compilation.

type = 61
class livemaker.lsb.command.IFNDEF(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.Else

Ifndef compiler directive, removed during LSB compilation.

type = 62
class livemaker.lsb.command.ENDIF(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)[source]

Bases: livemaker.lsb.command.Else

Endif compiler directive, removed during LSB compilation.

type = 63

livemaker.lsb.core module

Core lmscript classes.

class livemaker.lsb.core.BaseSerializable(**kwargs)[source]

Bases: abc.ABC

Base class for serializable LiveMaker objects.

Note

LiveMaker uses 3 different script serialization formats:

  • LSC (old text .lsc)
  • XML (new XML .lsc)
  • LSB (compiled binary .lsb)

In pylivemaker, we currently only support serializing to and from the binary LSB format. Subclasses of BaseSerializable do support serialization to pseudo-LSC and pseudo-XML formats so that a script can be examined for patching purposes, however, these exported formats cannot currently be re-read as input by pylivemaker.

This means that pylivemaker cannot be used to compile .lsc files from a LiveMaker/LiveNovel template or project directory.

get(key, default=None)[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

classmethod from_lsc(data)[source]

Parse text .lsc data into an object.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

classmethod from_xml(root)[source]

Parse XML into an object.

classmethod from_struct(struct, **kwargs)[source]

Instantiate an object from a construct Struct.

class livemaker.lsb.core.ParamType[source]

Bases: enum.IntEnum

Param data type.

Var = 0

Variable name.

Internally, LiveMaker stores TParamVar as a Delphi Variant type which in theory supports any possible Delphi type, but LiveMaker only uses it as a variable length string.

Int = 1

Integer.

Float = 2

Floating point value.

LiveMaker TParamFloats are IEEE 80-bit precision floats, in pylivemaker we handle them as numpy longdouble. According to numpy docs, np.longdouble` is either `float96` or ``float128 depending on platform, and in both cases they are actually float80 padded with zeroes to 96 or 128 bits.

Flag = 3

1-byte Enum/Flag type.

Str = 4

CP932 encoded string.

Internally, pylivemaker handles all strings as Python unicode strings.

class livemaker.lsb.core.OpeDataType[source]

Bases: enum.IntEnum

OpeData operator type.

Operator type determines how an expression will be evaluated.

None_ = 0
To = 1

Operator = (assignment).

Plus = 2

Operator +.

Note

In LiveMaker, + can be used for both addition and string concatenation, depending on the data type of the result variable. If the result variable is a numeric type and one of the arguments is a string, the string will be coerced to number (i.e. for x = 1 + "2" and x is an Int, the final value of x will be 3).

Minus = 3

Operator -.

Mul = 4

Operator *.

Div = 5

Operator /.

Mod = 6

Operator %.

Or = 7

Operator |.

Note

In LiveMaker, | is used for both bitwise OR and logical OR, depending on the data type of the operands.

And = 8

Operator &.

Note

In LiveMaker, & is used for both bitwise AND and logical AND, depending on the data type of the operands.

Xor = 9

Operator ^ (bitwise XOR).

DimTo = 10

Operator [] (array access).

Func = 11

Operator () (function call).

Available functions are listed in OpeFuncType.

Equal = 12

Operator == (equals).

Big = 13

Operator > (greater than).

Small = 14

Operator < (less than).

EBig = 15

Operator >= (greater than or equals).

ESmall = 16

Operator <= (less than or equals).

ShiftL = 17

Operator << (bitwise shift left).

ShiftR = 18

Operator >> (bitwise shift right).

ComboStr = 19

Operator ++ (string concatenation).

NEqual = 20

Operator != (not equals).

class livemaker.lsb.core.OpeFuncType[source]

Bases: enum.IntEnum

Function type.

See LiveNovel docs for details on each available function.

IntToStr = 0
IntToHex = 1
GetProp = 2
SetProp = 3
GetArraySize = 4
Length = 5
JLength = 6
Copy = 7
JCopy = 8
Delete = 9
JDelete = 10
Insert = 11
JInsert = 12
CompareStr = 13
CompareText = 14
Pos = 15
JPos = 16
Trim = 17
JTrim = 18
Exists = 19
Not = 20
SetArray = 21
FillMem = 22
CopyMem = 23
GetCheck = 24
SetCheck = 25
Random = 26
GetSaveCaption = 27
ArrayToString = 28
StringToArray = 29
IndexOfStr = 30
SortStr = 31
ListCompo = 32
ToClientX = 33
ToClientY = 34
ToScreenX = 35
ToScreenY = 36
Int = 37
Float = 38
Sin = 39
Cos = 40
Tan = 41
ArcSin = 42
ArcCos = 43
ArcTan = 44
ArcTan2 = 45
Hypot = 46
IndexOfMenu = 47
Abs = 48
Fabs = 49
VarExists = 50
EncodeDate = 51
EncodeTime = 52
DecodeDate = 53
DecodeTime = 54
GetYear = 55
GetMonth = 56
GetDay = 57
GetHour = 58
GetMin = 59
GetSec = 60
GetWeek = 61
GetWeekStr = 62
GetWeekJStr = 63
FixStr = 64
GetDisplayMode = 65
AddArray = 66
InsertArray = 67
DeleteArray = 68
InPrimary = 69
CopyArray = 70
FileExists = 71
LoadTextFile = 72
LowerCase = 73
UpperCase = 74
ExtractFilePath = 75
ExtractFileName = 76
ExtractFileExt = 77
IsPathDelimiter = 78
AddBackSlash = 79
ChangeFileExt = 80
IsDelimiter = 81
StringOfChar = 82
StringReplace = 83
AssignTemp = 84
HanToZen = 85
ZenToHan = 86
DBCreateTable = 87
DBSetActive = 88
DBAddField = 89
DBSetRecNo = 90
DBInsert = 91
DBDelete = 92
DBGetInt = 93
DBSetInt = 94
DBGetFloat = 95
DBSetFloat = 96
DBGetBool = 97
DBSetBool = 98
DBGetStr = 99
DBSetStr = 100
DBRecordCount = 101
DBFindFirst = 102
DBFindLast = 103
DBFindNext = 104
DBFindPrior = 105
DBLocate = 106
DBLoadTsvFile = 107
DBDirectGetInt = 108
DBDirectSetInt = 109
DBDirectGetFloat = 110
DBDirectSetFloat = 111
DBDirectGetBool = 112
DBDirectSetBool = 113
DBDirectGetStr = 114
DBDirectSetStr = 115
DBCopyTable = 116
DBDeleteTable = 117
DBInsertTable = 118
DBCopy = 119
DBClearTable = 120
DBSort = 121
DBGetActive = 122
DBGetRecNo = 123
DBClearRecord = 124
SetWallPaper = 125
Min = 126
Max = 127
Fmin = 128
Fmax = 129
GetVarType = 130
GetEnabled = 131
SetEnabled = 132
AddDelimiter = 133
ListSaveCaption = 134
OpenUrl = 135
Calc = 136
SaveScreen = 137
StrToIntDef = 138
StrToFloatDef = 139
GetVisible = 140
SetVisible = 141
GetHistoryCount = 142
GetHistoryMaxCount = 143
SetHistoryMaxCount = 144
GetGroupIndex = 145
GetSelected = 146
SetSelected = 147
SelectOpenFile = 148
SelectSaveFile = 149
SelectDirectory = 150
ExtractFile = 151
Chr = 152
Ord = 153
InCabinet = 154
PushVar = 155
PopVar = 156
DeleteStack = 157
CopyFile = 158
DBGetTableCount = 159
DBGetTable = 160
CreateObject = 161
DeleteObject = 162
GetItem = 163
UniqueArray = 164
TrimArray = 165
GetImeOpened = 166
SetImeOpened = 167
Alert = 168
GetCinemaProp = 169
SetCinemaProp = 170
class livemaker.lsb.core.Param(value=None, type=None, **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Expression parameter (operand).

Internally, LiveMaker subclasses each possible TParam type, but in pylivemaker we handle them all here.

Parameters:
  • value – The value for this parameter.
  • type (ParamType) – The data type for this parameter. If type is not specified, it will be guessed based on value.

Note

If value is a variable name, Var type must be explicity specified, otherwise it will incorrectly be guessed to be Str.

If value is an integer flag, Flag type must be explicitly specified, otherwise it will be incorrectly guessed to be Int.

keys()[source]
items()[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

class livemaker.lsb.core.OpeData(type=<OpeDataType.None_: 0>, name='', func=None, operands=[], **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Expression operator class.

Internal LiveMaker TOpeData class.

Parameters:
  • type (OpeDataType) – Operator type for this expression.
  • name (str) – The name of result variable for this expression.
  • func (OpeFuncType) – Function for this expression (only applicable if type is OpeDataType.Func.
  • operands (list(Param)) – The operands for this expression.
keys()[source]
items()[source]
count

Return the number of operands in this expression.

to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

tokenize()[source]

Return a tokenized version of this expression.

Returns:List of tokens.
Return type:list(str, Param)
Raises:NotImplementedError – If an operator does not support this combination of operands.
class livemaker.lsb.core.LiveParser(entries=[], **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Parses a list of OpeData expressions into one result expression.

Parameters:entries (list(OpeData)) – List of child expressions
keys()[source]
items()[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

class livemaker.lsb.core.LiveParserArray(parsers=[], prefixed=True)[source]

Bases: livemaker.lsb.core.BaseSerializable

Internal use convenience class for handling arrays of LiveParser objects.

Parameters:
  • parsers (iterable) – Iterable containing this array’s parsers.
  • name (str) – Name for this field, used as XML tag name when serializing.
to_lsc()[source]

Return this command in text .lsc format.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

classmethod from_struct(struct, prefixed=True)[source]

Instantiate an object from a construct Struct.

class livemaker.lsb.core.PropertyType[source]

Bases: enum.IntEnum

LiveMaker object property constants.

PR_NONE = 0
PR_NAME = 1
PR_PARENT = 2
PR_SOURCE = 3
PR_LEFT = 4
PR_TOP = 5
PR_WIDTH = 6
PR_HEIGHT = 7
PR_ZOOMX = 8
PR_COLOR = 9
PR_BORDERWIDTH = 10
PR_BORDERCOLOR = 11
PR_ALPHA = 12
PR_PRIORITY = 13
PR_OFFSETX = 14
PR_OFFSETY = 15
PR_FONTNAME = 16
PR_FONTHEIGHT = 17
PR_FONTSTYLE = 18
PR_LINESPACE = 19
PR_FONTCOLOR = 20
PR_FONTLINKCOLOR = 21
PR_FONTBORDERCOLOR = 22
PR_FONTHOVERCOLOR = 23
PR_FONTHOVERSTYLE = 24
PR_HOVERCOLOR = 25
PR_ANTIALIAS = 26
PR_DELAY = 27
PR_PAUSED = 28
PR_VOLUME = 29
PR_REPEAT = 30
PR_BALANCE = 31
PR_ANGLE = 32
PR_ONPLAYING = 33
PR_ONNOTIFY = 34
PR_ONMOUSEMOVE = 35
PR_ONMOUSEOUT = 36
PR_ONLBTNDOWN = 37
PR_ONLBTNUP = 38
PR_ONRBTNDOWN = 39
PR_ONRBTNUP = 40
PR_ONWHEELDOWN = 41
PR_ONWHEELUP = 42
PR_BRIGHTNESS = 43
PR_ONPLAYEND = 44
PR_INDEX = 45
PR_COUNT = 46
PR_VISIBLE = 48
PR_COLCOUNT = 49
PR_ROWCOUNT = 50
PR_TEXT = 51
PR_MARGINX = 52
PR_MARGINY = 53
PR_HALIGN = 54
PR_BORDERSOURCETL = 55
PR_BORDERSOURCETC = 56
PR_BORDERSOURCETR = 57
PR_BORDERSOURCECL = 58
PR_BORDERSOURCECC = 59
PR_BORDERSOURCECR = 60
PR_BORDERSOURCEBL = 61
PR_BORDERSOURCEBC = 62
PR_BORDERSOURCEBR = 63
PR_BORDERHALIGNT = 64
PR_BORDERHALIGNC = 65
PR_BORDERHALIGNB = 66
PR_BORDERVALIGNL = 67
PR_BORDERVALIGNC = 68
PR_BORDERVALIGNR = 69
PR_SCROLLSOURCE = 70
PR_CHECKSOURCE = 71
PR_AUTOSCRAP = 72
PR_ONSELECT = 73
PR_RCLICKSCRAP = 74
PR_ONOPENING = 75
PR_ONOPENED = 76
PR_ONCLOSING = 77
PR_ONCLOSED = 78
PR_CARETX = 79
PR_CARETY = 80
PR_IGNOREMOUSE = 81
PR_TEXTPAUSED = 82
PR_TEXTDELAY = 83
PR_HOVERSOURCE = 84
PR_PRESSEDSOURCE = 85
PR_GROUPINDEX = 86
PR_ALLOWALLUP = 87
PR_SELECTED = 88
PR_CAPTUREMASK = 89
PR_POWER = 90
PR_ORIGWIDTH = 91
PR_ORIGHEIGHT = 92
PR_APPEARX = 93
PR_APPEARY = 94
PR_PARTMOTION = 95
PR_PARAM = 96
PR_PARAM2 = 97
PR_TOPINDEX = 98
PR_READONLY = 99
PR_CURSOR = 100
PR_POSZOOMED = 101
PR_ONPLAYSTART = 102
PR_PARAM3 = 103
PR_ONMOUSEIN = 104
PR_ONMAPIN = 105
PR_ONMAPOUT = 106
PR_MAPSOURCE = 107
PR_AMP = 108
PR_WAVELEN = 109
PR_SCROLLX = 110
PR_SCROLLY = 111
PR_FLIPH = 112
PR_FLIPV = 113
PR_ONIDLE = 114
PR_DISTANCEX = 115
PR_DISTANCEY = 116
PR_CLIPLEFT = 117
PR_CLIPTOP = 118
PR_CLIPWIDTH = 119
PR_CLIPHEIGHT = 120
PR_DURATION = 121
PR_THUMBSOURCE = 122
PR_BUTTONSOURCE = 123
PR_MIN = 124
PR_MAX = 125
PR_VALUE = 126
PR_ORIENTATION = 127
PR_SMALLCHANGE = 128
PR_LARGECHANGE = 129
PR_MAPTEXT = 130
PR_GLYPHWIDTH = 131
PR_GLYPHHEIGHT = 132
PR_ZOOMY = 133
PR_CLICKEDSOURCE = 134
PR_ANIPAUSED = 135
PR_ONHOLD = 136
PR_ONRELEASE = 137
PR_REVERSE = 138
PR_PLAYING = 139
PR_REWINDONLOAD = 140
PR_COMPOTYPE = 141
PR_FONTSHADOWCOLOR = 142
PR_FONTBORDER = 143
PR_FONTSHADOW = 144
PR_ONKEYDOWN = 145
PR_ONKEYUP = 146
PR_ONKEYREPEAT = 147
PR_HANDLEKEY = 148
PR_ONFOCUSIN = 149
PR_ONFOCUSOUT = 150
PR_OVERLAY = 151
PR_TAG = 152
PR_FONTHOVERBORDER = 154
PR_FONTHOVERBORDERCOLOR = 155
PR_FONTHOVERSHADOW = 156
PR_FONTHOVERSHADOWCOLOR = 157
PR_BARSIZE = 158
PR_MUTEONLOAD = 159
PR_PLUSX = 160
PR_PLUSY = 161
PR_CARETHEIGHT = 162
PR_REPEATPOS = 163
PR_BLURSPAN = 164
PR_BLURDELAY = 165
PR_FONTCHANGEABLED = 166
PR_IMEMODE = 167
PR_FLOATANGLE = 168
PR_FLOATZOOMX = 169
PR_FLOATZOOMY = 170
PR_CAPMASKLEVEL = 171
PR_PADDINGLEFT = 172
PR_PADDING_RIGHT = 173

livemaker.lsb.lmscript module

LiveMaker LSB/LSC script classes.

livemaker.lsb.lmscript.MIN_LSB_VERSION

Minimum supported compiled LSB version.

Type:int
livemaker.lsb.lmscript.DEFAULT_LSB_VERSION

Default compiled LSB version.

Type:int
livemaker.lsb.lmscript.MAX_LSB_VERSION

Maximum supported compiled LSB version.

Type:int
class livemaker.lsb.lmscript.LMScript(version=117, param_type=1, flags=0, call_name='', novel_params=[], command_params=[[]], commands=[], **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

LiveMaker script class.

A LiveMaker script is a collection of LiveMaker novel commands. One LiveMaker/LiveNovel “Chart” will be serialized as one script file.

Parameters:
  • version (int) – Version number. If version is not in the range [MIN_LSB_VERSION, MAX_LSB_VERSION], this LMScript cannot be compiled into a binary LSB.
  • param_type – Unknown type flag (always 1?).
  • flags (int) – Unknown (always 0?).
  • call_name (str) – String name for calling this script (only used for documentation).
  • novel_params (iterable) – Iterable containing string descriptions for parameters that this script accepts (only used for documentation).
  • command_params (iterable(iterable(bool))) – Two dimensional array of booleans specifying the command parameters are for Component type commands. (i.e. command_params[CommandType.BoxNew][PropertyType.PR_NAME] == True means that BoxNew takes a PR_NAME parameter.)
  • commands (iterable) – Iterable containing this script’s Command objects.
Raises:

BadLsbError – If the specified LMScript would be invalid or unsupported.

keys()[source]
items()[source]
command_count

Return the number of command types supported by this script.

param_stream_size

Return the length of this script’s param flag bytestream.

lm_version

Return LiveMaker app version based on an LSB version.

to_lsc()[source]

Return this script in the tex .lsc format.

classmethod from_lsc(s)[source]

Create an LMScript from the specified string.

Parameters:s – String containing text .lsc format data.
Raises:BadLsbError if the string could not be parsed.

Note

Currently only supports reading version information.

classmethod from_struct(struct)[source]

Create an LMScript from the specified struct.

to_lsb()[source]

Compile this script into binary .lsb format.

to_xml()[source]

Return this script as an .lsc format XML etree.Element.

classmethod from_xml(root)[source]

Create an LMScript from the specified XML element.

Parameters:root – The root tree element.
Raises:BadLsbError – If the XML tree could not be parsed.

Note

Currently only supports reading header information.

classmethod from_file(infile)[source]

Parse the specified file into an LMScript.

Parameters:infile – Input .lsc or .lsb file. Can be a string, path-like, or file-like object.
Raises:BadLsbError – If the input file could not be parsed.
classmethod from_lsb(data)[source]

Parse the specified compiled .lsb data into an LMScript.

Parameters:data – Input .lsb data.
Raises:BadLsbError – If the input data could not be parsed.
text_scenarios()[source]

Return a list of LiveNovel text scenarios contained in this script.

Returns:(line_num, name, scenario)
Return type:tuple(int, str, TpWord)

livemaker.lsb.novel module

LiveMaker LiveNovel LNS script classes.

class livemaker.lsb.novel.LNSTag[source]

Bases: enum.Enum

An enumeration.

a = 'A'
br = 'BR'
clr = 'CLR'
condition = 'CONDITION'
div = 'DIV'
event = 'EVENT'
histchar = 'HISTCHAR'
indent = 'INDENT'
img = 'IMG'
pg = 'PG'
ps = 'PS'
scenario = 'SCENARIO'
style = 'STYLE'
txspd = 'TXSPD'
txspf = 'TXSPF'
txspn = 'TXSPN'
txsps = 'TXSPS'
undent = 'UNDENT'
var = 'VAR'
open = <bound method LNSTag.open of <enum 'LNSTag'>>[source]
close = <bound method LNSTag.close of <enum 'LNSTag'>>[source]
class livemaker.lsb.novel.HAlignEnum[source]

Bases: enum.IntEnum

Horizontal alignment.

LEFT = 1
CENTER = 2
RIGHT = 3
class livemaker.lsb.novel.VAlignEnum[source]

Bases: enum.IntEnum

Vertical alignment.

TOP = 1
CENTER = 2
BOTTOM = 3
UNKNOWN = 4
class livemaker.lsb.novel.TWdType[source]

Bases: enum.IntEnum

LiveNovel script word (entry) type.

TWdChar = 1
TWdOpeDiv = 2
TWdOpeReturn = 3
TWdOpeIndent = 4
TWdOpeUndent = 5
TWdOpeEvent = 6
TWdOpeVar = 7
TWdImg = 9
TWdOpeHistChar = 10
class livemaker.lsb.novel.BaseTWdGlyph(condition=None, **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Base TWd Glyph type.

A TWdGlyph is a single glyph or entry in a compiled LiveNovel script. A tag from LiveNovel’s documented “HTML-like” scenario script format can generally be mapped to a TWdGlyph subclass.

Parameters:Condition (int) – Index for the condition to be applied to this glyph
type = None
keys()[source]
items()[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

classmethod lns_escape(s)[source]
class livemaker.lsb.novel.BaseTWdReal(link_name=None, link=None, text_speed=0, **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdGlyph

Base class for TWdReal types.

Parameters:
  • link_name (str) – Name of referenced link for this glyph. Used in LNScript version < 105.
  • link (int) – Index of referenced link for this glyph. Used in LNScript version >= 105.
  • text_speed (int) – Text display speed for this glyph.
type = None
class livemaker.lsb.novel.TWdChar(ch='', decorator=0, **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdReal

An individual CP932 encoded character.

All text in a LiveNovel script is compiled into runs of TWdChar glyphs.

Parameters:
  • ch (str) – The character.
  • decorator (int) – Index of the decorator (style) to be applied to this character.
type = 1
match(other)[source]

Return True if these two characters can be grouped into one text run.

class livemaker.lsb.novel.TWdOpeDiv(align=0, padleft=0, padright=0, noheight=0, **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdGlyph

Specify div (row) attributes.

Parameters:
  • align (int) – Horizontal alignment.
  • padleft (int) – Left padding.
  • padright (int) – Right padding.
  • noheight (int) – TRUE if this line has no height (the next line will be drawn at the same y-coordiante as this one).
type = 2
class livemaker.lsb.novel.TWdOpeReturn(break_type=0, **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdGlyph

Insert a line or page break.

Parameters:break_type (int) – Break type.
type = 3
class livemaker.lsb.novel.TWdOpeIndent(condition=None, **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdGlyph

Increase indent level.

type = 4
class livemaker.lsb.novel.TWdOpeUndent(condition=None, **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdGlyph

Decrease indent level.

type = 5
class livemaker.lsb.novel.TWdOpeEvent(event='', **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdGlyph

Run the specified event.

Parameters:event (str) – Event name and arguments.
type = 6
class livemaker.lsb.novel.TWdOpeVar(decorator=0, unk3=None, link_name=None, link=None, var_name_params=None, var_name=None, **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdGlyph

Insert the value of the specified variable.

Parameters:
  • decorator (int) – Index of the decorator to be applied to this text
  • unk3 – Unknown.
  • link_name – Name of the link to be applied to this glyph. Used in LN scenario script versions 100 to 104 (inclusive).
  • link – Index of the link to be applied to this glyph. Used in LN scenario script version > 104.
  • var_name_params (LiveParser) – Variable name. Used in LN scenario script version < 102.
  • var_name (str) – Variable name. Used in LN scenario script version >= 102.
type = 7
name

Return the variable name for this object.

class livemaker.lsb.novel.TWdImg(src='', align=0, hoversrc='', mgnleft=0, mgnright=0, mgntop=0, mgnbottom=0, downsrc='', **kwargs)[source]

Bases: livemaker.lsb.novel.BaseTWdReal

Display an image in the text box.

Parameters:
  • src (str) – Dispaly image.
  • align (int) – Vertical alignment.
  • hoversrc (str) – Image to display on mouse hover.
  • mgnleft (int) – Left margin in pixels.
  • mgnright (int) – Right margin in pixels.
  • mgntop (int) – Top margin in pixels.
  • mgnbottom (int) – Bottom margin in pixels.
  • downsrc (str) – Image to display on mouse click.

Note

This displays the image inline with text, and is not the same thing as displaying a CG. One use case is to insert icons for replaying sounds into the history backlog.

type = 9
class livemaker.lsb.novel.TWdOpeHistChar(decorator=0, unk3=None, link_name=None, link=None, var_name_params=None, var_name=None, **kwargs)[source]

Bases: livemaker.lsb.novel.TWdOpeVar

Display the value of a variable in history only.

type = 10
class livemaker.lsb.novel.TDecorate(count=0, unk2=0, unk3=0, unk4=0, unk5=0, unk6=0, unk7=0, unk8='', unk9='', unk10=0, unk11=0, **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Text decorator (font styling) to apply to a glyph.

Font tags from an original script are replaced with references to an entry in the font/style table for this LiveMaker game when compiling to LSB.

Parameters:count – The total number of TWd glyphs affected by this decorator.
keys()[source]
items()[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

class livemaker.lsb.novel.TWdCondition(count=0, target='', **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Text display conditions.

Display condition for a glyph determines things like whether or not it will be only displayed the history backlog.

Parameters:
  • count – The total number of TWd glyphs affected by this condition.
  • target – Target message box (i.e. history message box).
keys()[source]
items()[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

Bases: livemaker.lsb.core.BaseSerializable

Hyperlink (i.e. make a glyph clickable).

Parameters:
  • count – The total number of TWd glyphs affected by this link.
  • event – Event to run on click.
  • unk3 – Unknown.
keys()[source]
items()[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

class livemaker.lsb.novel.TpWord(version=0, decorators=[], conditions=[], links=[], body=[], **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

Compiled LiveNovel scenario script.

Parameters:
  • version (int) – LiveNovel scenario script version.
  • (list( (decorators) – class:)`TDecorate`)): List of decorators (text styles) used in this script.
  • conditions (list(TWdCondition)) – List of conditions used in this script.
  • links (list(TWdLink)) – List of links used in this script.
  • body (list(BaseTWdGlyph))) – Compiled script text body.

Note

LiveNovel scenario script version is independent of LiveMaker (command) script version.

keys()[source]
items()[source]
to_lsc()[source]

Serialize this object as pseudo-LSC data.

to_xml()[source]

Serialize an object as pseudo-LSC XML.

classmethod from_struct(struct)[source]

Instantiate an object from a construct Struct.

replace_body(body)[source]

Replace the current text block body with a new one.

Updates the appropriate character counts as needed.

Parameters:body (list(TWdGlyph)) – The new body. This should generally be a script body compiled via LNSCompiler.compile().
Raises:BadLnsError – If the new script body is invalid for this TpWord block (for example, if it references a decorator that does not exist).
class livemaker.lsb.novel.LNSDecompiler(sep='n', include_comments=True, text_only=False)[source]

Bases: object

Attempt to decompile a TpWord text block into something that resembles LiveMaker’s LiveNovel scenario script format.

Parameters:
  • sep (str) – Output line separator (defaults to os.linesep).
  • include_comments (bool) – Include comment lines in output.
  • text_only (bool) – Output text only (all tags will be removed except for variable names).
Raises:

ValueError – If tpword is not a TpWord instance.

decompile(tpword)[source]

Decompile the specified TpWord scenario script.

Parameters:tpword (TpWord) – TpWord object to decompile.
class livemaker.lsb.novel.LNSCompiler[source]

Bases: _markupbase.ParserBase

Attempt to compile a LiveNovel LNS script into a TpWord block.

Based on Python3 html.parser.HTMLParser.

Note

This is only intended to be used to compile scripts which have been decompiled by pylivemaker and then translated/edited for patching. Attempting to compile a script which was not initially generated by pylivemaker may not work as intended.

END_TAGS = ('a', 'style', 'div')
reset()[source]

Reset this instance. Loses all unprocessed data.

compile(script)[source]

Compile a [decompiled] script into a TpWord block.

Parameters:script (str) – Script data
feed(data)[source]

Feed data to the parser. Call this as often as you want, with as little or as much text as you want (may include ‘n’).

close()[source]

Handle any buffered data.

get_starttag_text()[source]

Return full source of start tag: ‘<…>’.

goahead(end)[source]
parse_starttag(i)[source]
check_for_whole_start_tag(i)[source]
parse_endtag(i)[source]
handle_eventtag(tag, attrs)[source]
handle_startendtag(tag, attrs)[source]
handle_starttag(tag, attrs)[source]
handle_endtag(tag)[source]
handle_data(data)[source]
unescape(s)[source]

Module contents

LiveMaker LSB/LSC script module.

class livemaker.lsb.LMScript(version=117, param_type=1, flags=0, call_name='', novel_params=[], command_params=[[]], commands=[], **kwargs)[source]

Bases: livemaker.lsb.core.BaseSerializable

LiveMaker script class.

A LiveMaker script is a collection of LiveMaker novel commands. One LiveMaker/LiveNovel “Chart” will be serialized as one script file.

Parameters:
  • version (int) – Version number. If version is not in the range [MIN_LSB_VERSION, MAX_LSB_VERSION], this LMScript cannot be compiled into a binary LSB.
  • param_type – Unknown type flag (always 1?).
  • flags (int) – Unknown (always 0?).
  • call_name (str) – String name for calling this script (only used for documentation).
  • novel_params (iterable) – Iterable containing string descriptions for parameters that this script accepts (only used for documentation).
  • command_params (iterable(iterable(bool))) – Two dimensional array of booleans specifying the command parameters are for Component type commands. (i.e. command_params[CommandType.BoxNew][PropertyType.PR_NAME] == True means that BoxNew takes a PR_NAME parameter.)
  • commands (iterable) – Iterable containing this script’s Command objects.
Raises:

BadLsbError – If the specified LMScript would be invalid or unsupported.

keys()[source]
items()[source]
command_count

Return the number of command types supported by this script.

param_stream_size

Return the length of this script’s param flag bytestream.

lm_version

Return LiveMaker app version based on an LSB version.

to_lsc()[source]

Return this script in the tex .lsc format.

classmethod from_lsc(s)[source]

Create an LMScript from the specified string.

Parameters:s – String containing text .lsc format data.
Raises:BadLsbError if the string could not be parsed.

Note

Currently only supports reading version information.

classmethod from_struct(struct)[source]

Create an LMScript from the specified struct.

to_lsb()[source]

Compile this script into binary .lsb format.

to_xml()[source]

Return this script as an .lsc format XML etree.Element.

classmethod from_xml(root)[source]

Create an LMScript from the specified XML element.

Parameters:root – The root tree element.
Raises:BadLsbError – If the XML tree could not be parsed.

Note

Currently only supports reading header information.

classmethod from_file(infile)[source]

Parse the specified file into an LMScript.

Parameters:infile – Input .lsc or .lsb file. Can be a string, path-like, or file-like object.
Raises:BadLsbError – If the input file could not be parsed.
classmethod from_lsb(data)[source]

Parse the specified compiled .lsb data into an LMScript.

Parameters:data – Input .lsb data.
Raises:BadLsbError – If the input data could not be parsed.
text_scenarios()[source]

Return a list of LiveNovel text scenarios contained in this script.

Returns:(line_num, name, scenario)
Return type:tuple(int, str, TpWord)
class livemaker.lsb.LNSCompiler[source]

Bases: _markupbase.ParserBase

Attempt to compile a LiveNovel LNS script into a TpWord block.

Based on Python3 html.parser.HTMLParser.

Note

This is only intended to be used to compile scripts which have been decompiled by pylivemaker and then translated/edited for patching. Attempting to compile a script which was not initially generated by pylivemaker may not work as intended.

END_TAGS = ('a', 'style', 'div')
reset()[source]

Reset this instance. Loses all unprocessed data.

compile(script)[source]

Compile a [decompiled] script into a TpWord block.

Parameters:script (str) – Script data
feed(data)[source]

Feed data to the parser. Call this as often as you want, with as little or as much text as you want (may include ‘n’).

close()[source]

Handle any buffered data.

get_starttag_text()[source]

Return full source of start tag: ‘<…>’.

goahead(end)[source]
parse_starttag(i)[source]
check_for_whole_start_tag(i)[source]
parse_endtag(i)[source]
handle_eventtag(tag, attrs)[source]
handle_startendtag(tag, attrs)[source]
handle_starttag(tag, attrs)[source]
handle_endtag(tag)[source]
handle_data(data)[source]
unescape(s)[source]
class livemaker.lsb.LNSDecompiler(sep='n', include_comments=True, text_only=False)[source]

Bases: object

Attempt to decompile a TpWord text block into something that resembles LiveMaker’s LiveNovel scenario script format.

Parameters:
  • sep (str) – Output line separator (defaults to os.linesep).
  • include_comments (bool) – Include comment lines in output.
  • text_only (bool) – Output text only (all tags will be removed except for variable names).
Raises:

ValueError – If tpword is not a TpWord instance.

decompile(tpword)[source]

Decompile the specified TpWord scenario script.

Parameters:tpword (TpWord) – TpWord object to decompile.