Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Tutorial 4. Packages

Adrodoc55 edited this page Jun 12, 2017 · 7 revisions

As applications get bigger you might feel the need to separate loosely coupled parts of code into different files. That way it is easier to keep the code organized and easy to understand. As long as your mpl-files are in the same directory you can access them as usual. If you want to call or start an MPL process that is located in a file in a different directory you can import that file like this:

import "subdirectory/myfile.mpl"
import "../folder1"

The specified string is used as a relative file path from the directory of the current MPL file so if the file you need is above the current directory you can use ".." to go one layer up. If you import a directory, all contained mpl-files are imported. To keep the size of your command block structure under control, processes of imported files are added only if they are referenced by a call or start statement. Also install and uninstall of imported files are not used unless at least one process of that file is referenced. If you want to include all processes of a file whether they are referenced or not you can use the keyword include instead:

include "subdirectory/myfile.mpl"
include "../folder1"

Continue with Tutorial 5. Variables.