• No results found

pylivemake Documentation

N/A
N/A
Protected

Academic year: 2022

Share "pylivemake Documentation"

Copied!
134
0
0

Loading.... (view fulltext now)

Full text

(1)

Release 1.0.2

Peter Rowlands

May 03, 2021

(2)
(3)

1 pylivemaker 1

1.1 Features. . . 1

1.2 License . . . 1

1.3 Credits . . . 2

2 Installation 3 2.1 Stable release. . . 3

2.2 From sources . . . 3

3 Usage 5 3.1 API Examples . . . 5

3.2 Patching Example . . . 5

3.3 Notes for Translation Patches . . . 7

4 Command-line Tools 9 4.1 lmar. . . 9

4.2 lmgraph. . . 11

4.3 lmlpb . . . 11

4.4 lmlsb . . . 13

4.5 lmpatch . . . 18

4.6 galconvert . . . 18

4.7 lmbmp . . . 19

5 API Reference 21 5.1 livemaker package . . . 21

6 Contributing 89 6.1 Types of Contributions . . . 89

6.2 Get Started!. . . 90

6.3 Coding Style . . . 91

6.4 Pull Request Guidelines . . . 91

6.5 Tips . . . 91

6.6 Deploying . . . 91

7 Credits 93 7.1 pylivemaker dev . . . 93

7.2 irl author . . . 93

(4)

8.2 1.0.1 (2020-10-25) . . . 95

8.3 1.0.0 (2020-07-01) . . . 95

8.4 0.3.2 (2020-05-04) . . . 96

8.5 0.3.0 (2020-04-30) . . . 96

8.6 0.2.1 (2020-03-13) . . . 96

8.7 0.2.0 (2020-02-16) . . . 96

8.8 0.1.2 (2020-02-05) . . . 97

8.9 0.1.0 (2019-03-07) . . . 97

9 LiveNovel Docs (en) 99 9.1 LiveNovel Tutorial . . . 101

9.2 LiveNovel Basic Information . . . 101

9.3 LiveNovel FAQ. . . 108

10 Indices and tables 111

Python Module Index 113

Index 115

(5)

pylivemaker

Python package for manipulating LiveMaker 3 game resources. Specifically intended to work with LiveNovel VN’s, but extraction should also work for other LiveMaker games.

Based on tinfoil’sirl.

Requires Python 3 (3.6 and later).

• Free software: GNU General Public License v3

• Documentation:https://pylivemaker.readthedocs.io.

1.1 Features

• Extract files from a LiveMaker .exe or .dat file.

• Dump LSB files to human-readable text or XML (similar to LiveMaker’s XML .lsc format).

• Extract LiveNovel LNS scripts from LSB files.

• Compile (modified) LNS scripts and insert them into LSB files.

• Patch (modified) LSB files into an existing .exe or .dat file.

1.2 License

1.2.1 pylivemaker / irl

Copyright (C) 2020 Peter Rowlands

(6)

Copyright (C) 2014 tinfoil

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http:

//www.gnu.org/licenses/>.

1.2.2 Python

Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.

1.3 Credits

This package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.

(7)

Installation

2.1 Stable release

To install pylivemaker, run this command in your terminal:

$ pip install pylivemaker

This is the preferred method to install pylivemaker, as it will always install the most recent stable release.

If you don’t havepipinstalled, thisPython installation guidecan guide you through the process.

2.2 From sources

The sources for pylivemaker can be downloaded from theGithub repo.

You can either clone the public repository:

$ git clone git://github.com/pmrowla/pylivemaker Or download thetarball:

$ curl -OL https://github.com/pmrowla/pylivemaker/tarball/master Once you have a copy of the source, you can install it with:

$ python setup.py install

(8)
(9)

Usage

3.1 API Examples

Look at the livemaker.cli and livemaker.patch modules for usage examples.

3.2 Patching Example

To try and patch something:

1. Extract game files.

$ mkdir game_files

$ lmar x game.exe -o game_files

2. Dump some lsb files. I suggest starting with .lsb (gamemain.lsb), and then looking for the first user script to be called (generally 00000001.lsb) and continue from there. If you are familiar with LiveNovel, .lsb is the root game start chart node.

$ cd game_files

$ lmlsb dump .lsb > gamemain.txt

$ lmlsb dump 00000001.lsb > 00000001.lsb.txt

3. Once you’ve found an LSB with a script you want to edit, scenario text lines from an LSB can be extracted into a CSV file.

$ lmlsb extractcsv --encoding=utf-8-sig 00000001.lsb 00000001.csv

Note: It is also possible to extract, translate and insert multiple LSB files using a single CSV file. For details refer to this discussion:https://github.com/pmrowla/pylivemaker/issues/58#issuecomment-626787758

(10)

4. Edit the CSV using your preferred spreadsheet tool. To translate a text block, simply add your translation in the

“Translated text” column.

Note: For text blocks spanning multiple lines, newlines in the translated text cell will be preserved in-game as line breaks.

5. Patch the translated CSV back into the lsb.

$ lmlsb insertcsv --encoding=utf-8-sig 00000001.lsb 00000001.csv

Note: The recommended way to translate scripts in pylivemaker 1.0 is via the CSV tools. extractmenu and insertmenucan be used to translate in-game text menus via CSV files as well. For more details on the CSV tools, refer to this (and related) github discussions:https://github.com/pmrowla/pylivemaker/pull/37

6. Patch the exe (for now the .lsb file must be in the same directory as the exe, since there is no command line option to set the correct archive entry path).

$ lmpatch some.exe 00000001.lsb

3.2.1 Patching with LNS scripts

LNS scripts can be extracted and edited as well, in the event that you need support for more advanced script tags which are not supported by the CSV translation API.

Example (replaces steps 3 through 5 from above):

3. Once you’ve found an lsb with a script you want to edit, extract it.

$ mkdir orig_scripts

$ lmlsb extract 00000001.lsb -o orig_scripts 4. Edit the script.

$ mkdir translated_scripts

$ cp orig_scripts/*.lns translated_scripts

<run your favorite text editor on whatever script you want to translate>

5. Patch the new script back into the lsb.

$ lmlsb insert 00000001.lsb scripts_dir/<translated_script>.lns 1234 (where 1234 is the appropriate TextIns command line number).

(11)

3.3 Notes for Translation Patches

3.3.1 Latin Character Display

By default, LiveMaker games will display text using full-width latin characters, which causes text translated into any Western language to look very bad in-game. For LiveMaker 3 based games, this behavior can be modified, but for LiveMaker 2 games, I am unaware of any solution for this issue.

To force LiveMaker 3 games to display text using half-width latin characters, the PR_FONTCHANGEABLED parameter must be set to 0 for the given message box type. This can be handled by using the lmlsb edit pylivemaker command.

The default settings for each LiveMaker message box type are set via MesNew commands, in the system .lsb (create_message_box.lsb) file. For the standard in-game text, users will want to modify the command corresponding to the (message_box) box type (box type is the first parameter to MesNew). In most cases, this should be command number 36 in .lsb.

Example:

$ lmlsb edit .lsb 36

36: MesNew "" "" 10 10 GetProp("", 5) - 10 - 10 GetProp("", 6) - 10 - 10 1100 " " 16 6 16777215 16711680 0 16776960 1 0 "\\.lsc" "\\.lsc"

"\\.lsc" "\\.lsc" "\\.lsc" 1 4 0

"\\.lsc" "\\.lsc" 0 0 0 0 1 0

Enter new value for each field (or keep existing value) Name [""]: <skipping uneditable field>

PR_PARENT [""]: <skipping uneditable field>

PR_LEFT [10]:

PR_TOP [10]:

PR_WIDTH [GetProp("", 5) - 10 - 10]: <skipping uneditable field>

PR_HEIGHT [GetProp("", 6) - 10 - 10]: <skipping uneditable field>

PR_ALPHA []: <skipping uneditable field>

PR_PRIORITY [1100]:

...

PR_TAG []: <skipping uneditable field>

PR_CAPTURELINK [1]:

PR_FONTCHANGEABLED [1]: 0

PR_PADDINGLEFT []: <skipping uneditable field>

PR_PADDING_RIGHT []: <skipping uneditable field>

Backing up original LSB.

Wrote new LSB.

In the above example, lmlsb edit is used to modify command #36 within .lsb. The existing values (shown in []brackets) are kept for every field except for PR_FONTCHANGEABLED. By changing that value to 0, the standard in-game text box should now be displayed using half-width latin characters.

For more details refer to the thread inissue #9.

Note: There are multiple possible LiveMaker message box types (including menus/history/etc), so users generating a full translation patch may need to modify multiple MesBox commands to have their translated text displayed properly everywhere in-game.

(12)

3.3.2 Translating System Menus

To translate the main LiveMaker system menus, lmlsb edit can be used to translate strings in the system menu LSB files (such as //.lsb/novel_system/system_menu/on_option_selection.lsb).

For more details refer to the thread inissue #19.

3.3.3 pylivemaker-tools

Github user @Stefan311 has provided a collection of scripts which may be useful to translators. See: https://github.

com/Stefan311/pylivemaker-tools.

In particular, extractstrings.py and insertstrings.py can be used to translate strings inside LSB com- mands which are not supported by pylivemaker’s lmlsb edit tool.

(13)

Command-line Tools

Note: The --help parameter can be used to see a list of commands available to each CLI tool. To see usage information for a specific subcommand, --help should be specified after the command.

Ex: $ lmar x --help

Note: Windows users running the pylivemaker CLI tools in CMD Prompt or PowerShell should ensure that your terminal font supports Japanese characters, otherwise the pylivemaker console output may be unreadable. The default terminal font in Windows 10 (Consolas) does not support Japanese characters, and needs to be changed to some font which includes Japanese characters (such as MS Gothic). Running pylivemaker CLI tools should not require changing your entire Windows system locale to Japanese.

4.1 lmar

Use lmar to work with LiveMaker archives and executables. When handling split VFF archives, lmar commands should be passed the path to the .ext index file (if it exists). For split archives without separate index files, the path to the first .dat file in the archive (usually game.dat) should be used.

$ lmar --help

Usage: lmar [OPTIONS] COMMAND [ARGS]...

Command-line tool for manipulating LiveMaker archives and EXEs.

Options:

--version Show the version and exit.

--help Show this message and exit.

Commands:

l List the contents of the specified archive.

(continues on next page)

(14)

(continued from previous page) strip Copy the specified LiveMaker EXE but remove the LiveMaker archive.

x Extract the specified archive.

4.1.1 l (list)

List the contents of a LiveMaker archive or executable.

$ lmar l --help

Usage: lmar l [OPTIONS] INPUT_FILE

List the contents of the specified archive.

Options:

--help Show this message and exit.

4.1.2 strip

lmar stripcopies only the Windows executable portion of a LiveMaker game .exe, and strips the game archive data from the output file. This command should generally only be used by interested in reverse engineering the LiveMaker engine/interpreter.

$ lmar strip --help

Usage: lmar strip [OPTIONS] INPUT_FILE OUTPUT_FILE

Copy the specified LiveMaker EXE but remove the LiveMaker archive.

The resulting program cannot be run, but may be useful for reverse engineering or patching reasons.

Options:

--help Show this message and exit.

4.1.3 x (extract)

Extract the contents of a LiveMaker archive or executable.

Image format modes:

gal (default) LiveMaker GAL (.gal) images will be extracted in their original format.

png Images will be converted to PNG before extraction.

both Both the original GAL image and a converted PNG version will be extracted.

Note: Refer to the documentation for galconvert for details on image conversion.

$ lmar x --help

Usage: lmar x [OPTIONS] file Extract the specified archive.

(continues on next page)

(15)

(continued from previous page) Options:

-n, --dry-run Show what would be done without extracting any files.

-i, --image-format [gal|png|both]

Format for extracted images, defaults to GAL (original) format. If set to png, images will be converted before extraction. If set to both, both the original GAL and converted PNG images will be extracted

-o, --output-dir TEXT Output directory, defaults to current working directory.

-v, --verbose

--help Show this message and exit.

4.2 lmgraph

Generate a graphviz DOT syntax graph of branches between LiveNovel script files.

The output .dot file can be used with graphviz (or online tools likehttp://viz-js.com/) to create a visual (PNG/PDF/etc) approximation of the original LiveMaker/LiveNovel scenario flowchart. The output graph will include menu choice/route branch conditions (as edge labels) if possible.

Note: The script currently uses a very naive implementation for following branch conditions, so the output labels may not always be 100% accurate. Conditions based on route flag variables may not be labeled properly, depending on the complexity of the original script logic.

$ lmgraph --help

Usage: lmgraph [OPTIONS] LSB_FILE [OUT_FILE]

Generate a DOT syntax graph for a LiveNovel game.

lsb_file should be a path to the root script node - this should always be .lsb (game_main.lsb) for LiveMaker games. If output file is not

specified, it defaults to <lsb_file>.dot

The output graph will start with game_main as the root node and follow branches to all scenario scripts, which should give a general

approximation of the original LiveMaker scenario chart.

Options:

--version Show the version and exit.

--help Show this message and exit.

4.3 lmlpb

Use lmlpb to work with LPB (LiveMaker project settings) files.

$ lmlpb --help

Usage: lmlpb [OPTIONS] COMMAND [ARGS]...

Command-line tool for manipulating LPB project settings.

(continues on next page)

(16)

(continued from previous page)

Options:

--version Show the version and exit.

--help Show this message and exit.

Commands:

edit Edit the specified LPB file.

probe Output information about the specified LPB file in human-readable...

4.3.1 probe

Output general information about an LPB file.

Usage: lmlpb probe [OPTIONS] file

Output information about the specified LPB file in human-readable form.

Options:

--help Show this message and exit.

4.3.2 edit

Edit project settings within an LPB file.

lmlpb editprovides an interactive prompt that can be used to modify project settings in an LPB file.

For users generating translation patches, this command may be useful for modifying the application name, certain message prompts, and the default text display and audio settings.

Warning: This command should only be used by advanced users. Do not edit an LPB setting unless you are absolutely sure of what that setting does. Improper use of this command may cause undefined behavior (or a complete crash) in the LiveMaker engine during runtime.

$ lmlpb edit --help

Usage: lmlpb edit [OPTIONS] LPB_FILE Edit the specified LPB file.

Only specific settings can be edited.

The original LPB file will be backed up to <lpb_file>.bak

Note: Setting empty fields to improper data types may cause undefined behavior in the LiveMaker engine. When editing a field, the data type of the new value is assumed to be the same as the original data type.

Options:

--help Show this message and exit.

(17)

4.4 lmlsb

Use lmlsb to work with LSB (compiled LiveMaker chart) files.

$ lmlsb --help

Usage: lmlsb [OPTIONS] COMMAND [ARGS]...

Command-line tool for manipulating LSB scripts.

Options:

--version Show the version and exit.

--help Show this message and exit.

Commands:

batchinsert Compile specified LNS script directory and insert it into the...

dump Dump the contents of the specified LSB file(s) to stdout in a...

edit Edit the specified command within an LSB file.

extract Extract decompiled LiveNovel scripts from the specified input...

extractcsv Extract text from the given LSB file to a CSV file.

extractmenu Extract menu choices from the given LSB file to a CSV file.

insert Compile specified LNS script and insert it into the specified...

insertcsv Apply translated text lines from the given CSV file to given...

insertmenu Apply translated menu choices from the given CSV file to...

probe Output information about the specified LSB file in...

validate Verify that the specified LSB file(s) can be processed.

4.4.1 batchinsert

Insert multiple LNS scripts into an LSB file. The SCRIPT_DIR argument should be a path to a directory generated by lmlsb extract (as batchinsert relies on the .lsbref file generated by extract).

$ lmlsb batchinsert --help

Usage: lmlsb batchinsert [OPTIONS] LSB_FILE SCRIPT_DIR

Compile specified LNS script directory and insert it into the specified LSB file according to the Reference file.

The Reference file must be inside script_dir.

script_dir should be an LNS script directory which was initially generated by lmlsb extract.

The original LSB file will be backed up to <lsb_file>.bak unless the --no- backup option is specified.

Options:

-e, --encoding [cp932|utf-8] The text encoding of script_file (defaults to

(continues on next page)

(18)

(continued from previous page) utf-8).

--no-backup Do not generate backup of original archive file(s).

--help Show this message and exit.

4.4.2 dump

Dump the contents of one or more LSB file(s) in a human-readable format.

Output format modes:

text (default) Plaintext that resembles LiveMaker’s text .lsc format (but is not a 1 to 1 match with LiveMaker’s format).

xml XML that resembles LiveMaker’s XML .lsc format (but is not a 1 to 1 match with LiveMaker’s format).

lines Only plaintext LNS script lines will be dumped. No LSB command data and no LNS script tag formatting will be included in the output. (This may be useful for generating a more traditional “script” to be used by translators.)

$ lmlsb dump --help

Usage: lmlsb dump [OPTIONS] INPUT_FILE...

Dump the contents of the specified LSB file(s) to stdout in a human- readable format.

For text mode, the full LSB will be output as human-readable text.

For xml mode, the full LSB file will be output as an XML document.

For lines mode, only text lines will be output.

Options:

-m, --mode [text|xml|lines] Output mode (defaults to text)

-e, --encoding [cp932|utf-8] Output text encoding (defaults to utf-8).

-o, --output-file FILE Output file. If unspecified, output will be dumped to stdout.

--help Show this message and exit.

4.4.3 edit

Edit a specific command within an LSB file.

lmlsb editprovides an interactive prompt that can be used to modify an LSB command. This is command is mainly only provided as a (slightly) more user-friendly way of editing specific byte fields within an LSB file.

For users generating translation patches, this command may be useful for modifying text display parameters, and for modifying in-game “choice menu” text.

For more specific usage/implementation details refer to the thread inissue #9.

Note: Only a specific subset of command types (and a specific set of parameters for each editable command type) can be modified via lmlsb edit.

(19)

Warning: This command should only be used by advanced users. Do not edit an LSB command parameter unless you are absolutely sure of what that parameter does. Improper use of this command may cause undefined behavior (or a complete crash) in the LiveMaker engine during runtime.

$ lmlsb edit --help

Usage: lmlsb edit [OPTIONS] LSB_FILE LINE_NUMBER Edit the specified command within an LSB file.

Only specific command types and specific fields can be edited.

The original LSB file will be backed up to <lsb_file>.bak

WARNING: This command should only be used by advanced users familiar with the LiveMaker engine. Improper use of this command may cause undefined behavior (or a complete crash) in the LiveMaker engine during runtime.

Note: Setting empty fields to improper data types may cause undefined behavior in the LiveMaker engine. When editing a field, the data type of the new value is assumed to be the same as the original data type.

Options:

--help Show this message and exit.

4.4.4 extract

Extract (decompiled) LiveNovel scenario scripts from an LSB file.

Note: The LNS format generated by pylivemaker is not an exact 1 to 1 match with LiveMaker’s original LiveNovel script format. When modifying a script extracted via this command, users should be aware that all of LiveMaker’s

“pseudo-HTML” LiveNovel script tags are not supported by pylivemaker. For a detailed list of supported tags and how they are used by pylivemaker, please refer to the livemaker/lsb/novel.py source code.

$ lmlsb extract --help

Usage: lmlsb extract [OPTIONS] INPUT_FILE...

Extract decompiled LiveNovel scripts from the specified input file(s).

By default, extracted scripts will be encoded as utf-8, but if you intend to patch a script back into an LSB, you will still be limited to cp932 characters only.

Output files will be named <LSB name>-<scenario name>.lns Options:

-e, --encoding [cp932|utf-8] Output text encoding (defaults to utf-8).

-o, --output-dir DIRECTORY Output directory. Defaults to the current working directory if not specified. If directory does not exist it will be created.

--help Show this message and exit.

(20)

4.4.5 insert

Insert a single LNS script into an LSB file.

Users generating translation patches may be more interested in batchinsert.

lmlsb insert --help

Usage: lmlsb insert [OPTIONS] LSB_FILE SCRIPT_FILE LINE_NUMBER

Compile specified LNS script and insert it into the specified LSB file.

The LSB command at line_number must be a TextIns command. The existing text block of the specified TextIns command will be replaced with the new one from script_file.

script_file should be an LNS script which was initially generated by lmlsb extract.

The original LSB file will be backed up to <lsb_file>.bak unless the --no- backup option is specified.

Options:

-e, --encoding [cp932|utf-8] The text encoding of script_file (defaults to utf-8).

--no-backup Do not generate backup of original archive

file(s).

--help Show this message and exit.

4.4.6 extractcsv

Extract LiveNovel scenario text lines from an LSB file to a CSV file.

Note: Only text lines are extracted, so some formatting information may be lost. For translating games which make heavy use of formatting tags, you may need to consider using lmlsb extract and lmlsb insert to translate fully decompiled scripts instead of using the CSV commands.

lmlsb extractcsv --help

Usage: lmlsb extractcsv [OPTIONS] LSB_FILE CSV_FILE

Extract text lines from the given LSB file to a CSV file.

You can open this csv file for translation in most table calc programs (Excel, open/libre office calc, ...). Just remember to choose comma as delimiter and " as quotechar.

You can use the --append option to add the text data from this lsb file to a existing csv. With the --overwrite option an existing csv will be

overwritten without warning.

NOTE: Formatting tags will be lost when using this command in conjunction with insertcsv. For translating games which use formatting tags, you may need to work directly with LNS scripts using the extract and

insert/batchinsert commands.

(continues on next page)

(21)

(continued from previous page) Options:

--overwrite Overwrite existing csv file.

--append Append text data to existing csv file.

--help Show this message and exit.

4.4.7 insertcsv

Insert (translated) LiveNovel scenario text lines from a CSV file into an LSB file.

lmlsb insertcsv --help

Usage: lmlsb insertcsv [OPTIONS] LSB_FILE CSV_FILE

Apply translated text lines from the given CSV file to given LSB file.

CSV_FILE should be a file previously created by the extractcsv command, with added translations. The original LSB file will be backed up to

<lsb_file>.bak unless the --no-backup option is specified.

Options:

--no-backup Do not generate backup of original lsb file.

--help Show this message and exit.

4.4.8 probe

Output general information about an LSB file.

Most of the information generated by lmlsb probe is only useful to developers, but users generating translation patches may be interested in the script character/line counts.

lmlsb probe --help

Usage: lmlsb probe [OPTIONS] file

Output information about the specified LSB file in human-readable form.

Novel script scenario character and line count are estimates. Depending on how a script was originally created, actual char/line counts may vary.

Options:

--help Show this message and exit.

4.4.9 validate

Validate that LSB file(s) can be processed by pylivemaker.

This command is probably only useful for pylivemaker developers.

$ lmlsb validate --help

Usage: lmlsb validate [OPTIONS] file

Verify that the specified LSB file(s) can be processed.

Validation is done by disassembling an input file, reassembling it, and

(continues on next page)

(22)

(continued from previous page) then comparing the SHA256 digests of the original and reassembled versions

of the file.

If a file contains text scenarios, a test will also be done to verify that the scenarios can be decompiled, recompiled, and then reinserted into the lsb file.

Options:

--help Show this message and exit.

4.5 lmpatch

Use lmpatch to replace individual LSB files in an existing LiveMaker archive or executable.

$ lmpatch --help

Usage: lmpatch [OPTIONS] EXE_FILE PATCHED_LSB Patch a LiveMaker game.

Any existing version of patched_lsb will be replaced in the specified LiveMaker executable. If a file with the same name as patched_lsb does not already exist, this will do nothing.

A backup copy of the old exe will also be created.

Options:

--help Show this message and exit.

4.6 galconvert

galconvertcan be used to convert from LiveMaker’s Gale/GaleX (GAL) image format into any format supported by PIL/Pillow.

Note: It is recommended to convert to image formats which support transparency (alpha channel) such as PNG. If a GAL image contains multiple frames, only the first frame will be used when converting to a format which does not support multiple frames.

Direct conversion to GAL format is not currently supported. If you need to generate GAL images, it is recommended to use LiveMaker’s BmpToGale program in conjunction with lmbmp.

galconvert --help

Usage: galconvert [OPTIONS] INPUT_FILE OUTPUT_FILE Convert the image to another format.

GAL(X) images can only be read (for conversion to JPEG/PNG/etc) at this time.

Output format will be determined based on file extension.

(continues on next page)

(23)

(continued from previous page) Options:

-f, --force Overwrite output file if it exists.

--help Show this message and exit.

4.7 lmbmp

lmbmpcan be used to convert an image to a set of bitmap files which can then be used with LiveMaker’s BmpToGale tool.

$ lmbmp --help

Usage: lmbmp [OPTIONS] INPUT_FILE

Convert image to BMP(s) which can be used with bmp2gale.

If the input file contains an alpha layer, a mask bitmap will be generated. Output files will be named <input_name>.bmp and

<input_name>-m.bmp.

Options:

--version Show the version and exit.

-f, --force Overwrite output file if it exists.

--help Show this message and exit.

(24)
(25)

API Reference

5.1 livemaker package

5.1.1 Subpackages

livemaker.lsb package Submodules

livemaker.lsb.command module

LiveMaker LSB/LSC script command classes.

class livemaker.lsb.command.CommandType Bases: enum.IntEnum

LiveMaker script command type.

Note: In some cases, for some reason the internal LiveMaker Delphi class names differ from the string com- mand 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

(26)

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

(27)

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) 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() items()

lookup_name()

Lookup the label name for this reference.

lookup_index()

Lookup the label command index for this reference.

(28)

to_lsc()

Return this label reference in text .lsc format.

to_xml()

Return an XML representation of this label reference.

classmethod from_struct(struct) Instantiate an object from a construct Struct.

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

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()

Return a list of dictionary keys for this command.

items()

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

to_lsc()

Return this command in text .lsc format.

to_xml()

Return an XML representation of this command.

class livemaker.lsb.command.If(Calc=<livemaker.lsb.core.LiveParser object>, **kwargs) Bases:livemaker.lsb.command.BaseCommand

Begin an If conditional block.

(29)

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) 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)

Bases:livemaker.lsb.command.BaseCommand Begin an Else conditional block.

type = 2

class livemaker.lsb.command.Label(Name=”, **kwargs) 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) Bases:livemaker.lsb.command.BaseCommand

Conditionally branch to aLabelor 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) Bases:livemaker.lsb.command.BaseCommand

Conditionally call aLabelor 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

(30)

class livemaker.lsb.command.Exit(Calc=<livemaker.lsb.core.LiveParser object>, **kwargs) 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)

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 StopEventevaluates to True. Only used in LM versions 107 and later.

type = 7

class livemaker.lsb.command.BaseComponentCommand(components=[], com- mand_params=[], **kwargs) 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 pa- rameters 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 com- mand. 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()

Return a list of dictionary keys for this command.

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

Draw a rectangle in the specified screen region.

type = 8

class livemaker.lsb.command.ImgNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Draw an image in the specified screen region.

type = 9

class livemaker.lsb.command.MesNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Draw a message box in the specified screen region.

(31)

type = 10

class livemaker.lsb.command.Timer(components=[], command_params=[], **kwargs) 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) 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>, Re- verse=<livemaker.lsb.core.LiveParser object>, Act=<livemaker.lsb.core.LiveParser object>, Tar- gets=<livemaker.lsb.core.LiveParserArray object>, Delete=<livemaker.lsb.core.LiveParser object>, Source=None, DifferenceOnly=None, StopEvent=None, Param=<livemaker.lsb.core.LiveParserArray object>,

**kwargs) 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 op- tional depending on flip type.

type = 13

class livemaker.lsb.command.Calc(Calc=<livemaker.lsb.core.LiveParser object>, **kwargs) 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.

(32)

type = 14

class livemaker.lsb.command.VarNew(Name=”, Type=0, InitVal=<livemaker.lsb.core.LiveParser object>, Scope=0, **kwargs)

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) 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)

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) 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) Bases:livemaker.lsb.command.BaseCommand Delete the specified object.

(33)

Parameters Name (LiveParser) – Name of object to delete.

type = 19

class livemaker.lsb.command.TextIns(Text=<livemaker.lsb.novel.TpWord object>, Tar- get=<livemaker.lsb.core.LiveParser object>, Hist=<livemaker.lsb.core.LiveParser object>, Wait=<livemaker.lsb.core.LiveParser object>, StopEvent=None, **kwargs)

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)

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)

Bases:livemaker.lsb.command.Else Clear text history.

type = 22

class livemaker.lsb.command.Cinema(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Play the specified cinema object.

(34)

type = 23

class livemaker.lsb.command.Caption(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Display a caption.

type = 24

class livemaker.lsb.command.Menu(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Display a menu.

type = 25

class livemaker.lsb.command.MenuClose(Target=<livemaker.lsb.core.LiveParser object>,

**kwargs) Bases:livemaker.lsb.command.BaseCommand Close the specified menu.

Parameters Target (LiveParser) – Menu to close.

type = 26

class livemaker.lsb.command.Comment(Name=”, **kwargs) Bases:livemaker.lsb.command.Label

Create a comment.

type = 27

class livemaker.lsb.command.TextClr(Target=<livemaker.lsb.core.LiveParser object>,

**kwargs) 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)

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 (sce- nario 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

(35)

class livemaker.lsb.command.Button(components=[], command_params=[], **kwargs) 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) 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 WhileLoopcommand).

• 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) 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) 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.

(36)

Note: WhileLoop is handled a subclass ofWhileInitfor 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) 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 ofExitfor struct parsing purposes. If Calc is TRUE, command processing will exit the current loop.

type = 34

class livemaker.lsb.command.Continue(Start=0, **kwargs) 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) Bases:livemaker.lsb.command.BaseComponentCommand

Insert a particle effect.

type = 36

class livemaker.lsb.command.FireNew(components=[], command_params=[], **kwargs) 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)

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.

(37)

type = 38

class livemaker.lsb.command.GameLoad(No=<livemaker.lsb.core.LiveParser object>,

**kwargs) 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)

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)

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) Bases:livemaker.lsb.command.BaseComponentCommand

Play the specified sound.

type = 42

class livemaker.lsb.command.EditNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Create an edit component.

type = 43

class livemaker.lsb.command.MemoNew(components=[], command_params=[], **kwargs) 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)

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)

Bases:livemaker.lsb.command.Else

(38)

Process the specified event.

type = 46

class livemaker.lsb.command.ClrRead(Indent=0, Mute=False, NotUpdate=False, Color=0, LineNo=0, **kwargs)

Bases:livemaker.lsb.command.Else Clear read text information.

type = 47

class livemaker.lsb.command.MapImgNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Create an image surface component.

type = 48

class livemaker.lsb.command.WaveNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Create a wave surface component.

type = 49

class livemaker.lsb.command.TileNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Create a tiled surface component.

type = 50

class livemaker.lsb.command.SliderNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Create a slider.

type = 51

class livemaker.lsb.command.ScrollbarNew(components=[], command_params=[],

**kwargs) Bases:livemaker.lsb.command.BaseComponentCommand Create a scrollbar.

type = 52

class livemaker.lsb.command.GaugeNew(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

Create a gauge.

type = 53

class livemaker.lsb.command.CGCaption(components=[], command_params=[], **kwargs) Bases:livemaker.lsb.command.BaseComponentCommand

type = 54

class livemaker.lsb.command.MediaPlay(Target=<livemaker.lsb.core.LiveParser object>,

**kwargs) Bases:livemaker.lsb.command.BaseCommand Play the specified media.

Parameters Target (LiveParser) – Media object to play.

(39)

type = 55

class livemaker.lsb.command.PrevMenuNew(components=[], command_params=[], **kwargs) 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)

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) 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)

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.

(40)

• 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)

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)

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)

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)

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) 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 BaseSe- rializabledo 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)

(41)

to_lsc()

Serialize this object as pseudo-LSC data.

classmethod from_lsc(data) Parse text .lsc data into an object.

to_xml()

Serialize an object as pseudo-LSC XML.

classmethod from_xml(root) Parse XML into an object.

classmethod from_struct(struct, **kwargs) Instantiate an object from a construct Struct.

class livemaker.lsb.core.ParamType Bases: enum.IntEnum

Paramdata 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

``float128depending 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 Bases: enum.IntEnum

OpeDataoperator 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

(42)

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 inOpeFuncType.

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).

(43)

ComboStr = 19

Operator ++ (string concatenation).

NEqual = 20

Operator != (not equals).

class livemaker.lsb.core.OpeFuncType 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

(44)

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

(45)

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

(46)

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

(47)

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

(48)

class livemaker.lsb.core.Param(value=None, type=None, **kwargs) 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() items() to_lsc()

Serialize this object as pseudo-LSC data.

to_xml()

Serialize an object as pseudo-LSC XML.

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

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 Ope- DataType.Func.

• operands (list(Param)) – The operands for this expression.

keys() items() count

Return the number of operands in this expression.

to_lsc()

Serialize this object as pseudo-LSC data.

to_xml()

Serialize an object as pseudo-LSC XML.

tokenize()

Return a tokenized version of this expression.

(49)

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) Bases:livemaker.lsb.core.BaseSerializable

Parses a list of OpeData expressions into one result expression.

Parameters entries (list(OpeData)) – List of child expressions keys()

items() to_lsc()

Serialize this object as pseudo-LSC data.

to_xml()

Serialize an object as pseudo-LSC XML.

class livemaker.lsb.core.LiveParserArray(parsers=[], prefixed=True) Bases:livemaker.lsb.core.BaseSerializable

Internal use convenience class for handling arrays ofLiveParserobjects.

Parameters

• parsers (iterable) – Iterable containing this array’s parsers.

• name (str) – Name for this field, used as XML tag name when serializing.

to_lsc()

Return this command in text .lsc format.

to_xml()

Serialize an object as pseudo-LSC XML.

classmethod from_struct(struct, prefixed=True) Instantiate an object from a construct Struct.

class livemaker.lsb.core.PropertyType 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

References

Related documents

This is, to our knowledge, the first mixed-methods study of culturally competent clinical psychology practice in the Netherlands using the theory of MCC. Study 1 and 2

Succession Planning Guidelines – July ‘13 Page 4 To develop the employees needed for your succession plan, use such practices as lateral moves; assignment to special projects;

With different network scenarios, EPAR is dominating in terms of Residual Battery Power, Power Consumption, Network lifetime and Throughput with respect to time and routed

The findings suggest a conceptual model of early childhood care and development programs as a hook for mobilizing community involvement in supporting young children and families and

Print devices on the local subnet that match the search criteria specified in the Probe message will respond with a unicast WS-Discovery Probe Match message (sent using

International travel destination Wellness Holiday benefits Satisfaction Modal split Facts Accommodation capacities Region Locational factors Image World tourism City

Enforcement Certification Requirements Form), which have been incorporated, when accepted by the Contractor either in writing or by the shipment of any article or

3v third ventricle, aBDNF treated with immunoneutralizing antibody against BDNF, BDNF brain-derived neurotrophic factor, CTR control fed chow, GFAP glial fibrillary acidic