Difference between revisions of "Manual:Mudlet Packages"
Line 20: | Line 20: | ||
= How to create a Mudlet package = | = How to create a Mudlet package = | ||
− | Create a zip file | + | Create a zip file that ends with either ''.mpackage'' (preferred) or ''.zip''. Include all xml's that you'd like to be installed in the top level folder of the package (that is, don't have them within a folder in the archive - just have them be upfront). |
− | If you'd like to include other folders or files in the package, you can - they will be copied into ''getMudletHomeDir().."/"..packagename'' upon installation, so your scripts can use them | + | == Naming the package == |
+ | Add a file at the top level of the package (so not inside any folders in the package) called '''config.lua''' that has the following line to name your package: | ||
+ | |||
+ | <lua> | ||
+ | mpackage = "<name of your package>" | ||
+ | </lua> | ||
+ | |||
+ | That's it. If you don't include config.lua, Mudlet will then deduce the package name from the file name. | ||
+ | |||
+ | == Including images, sounds, and other files == | ||
+ | If you'd like to include other folders or files in the package, you can - they will be copied into ''getMudletHomeDir().."/"..packagename'' upon installation, so your scripts can use them. For example, if your package is called "sipper" and you have health.png as an image in it, you can place on a label like so: | ||
<lua> | <lua> | ||
-- you don't have to worry about \ versus / for file paths - use / everywhere, Lua will make it work on Windows fine | -- you don't have to worry about \ versus / for file paths - use / everywhere, Lua will make it work on Windows fine | ||
− | setBackgroundImage("my health", getMudletHomeDir().."/sipper/health.png") | + | setBackgroundImage("my health label", getMudletHomeDir().."/sipper/health.png") |
</lua> | </lua> | ||
[[Category:Mudlet Manual]] | [[Category:Mudlet Manual]] |
Revision as of 06:04, 14 January 2013
What is a Mudlet package
It's a archive file that ends with .mpackage or .zip that contains xml files to import along with any resources a package might have (images, sounds and etc). Packages can be installed / uninstalled via a window in Mudlet.
The system is backwards-compatible and existing .xml files will also be recognized as packages.
You'll see packages represented in brown in the script editor everywhere - triggers, aliases, etc. All items of a package have to go into a package folder that they belong in - so the user can know which package do items belong to, and modify the package for their needs (if it didn't have a folder, then you wouldn't be able to 'add' anything to a package).
Mudlet Packages were introduced to Mudlet in the 2.0 release.
How to install a Mudlet package
manually
Toolbox→Package Manager will open the window where you can 'Install' to install a package.
(xmls installed via Import will be converted to packages too, but do not Import packages.)
from the MUD
Packages can also be auto-installed from the MUD server via ATCP or GMCP - see ATCP extensions or GMCP extensions for more.
How to create a Mudlet package
Create a zip file that ends with either .mpackage (preferred) or .zip. Include all xml's that you'd like to be installed in the top level folder of the package (that is, don't have them within a folder in the archive - just have them be upfront).
Naming the package
Add a file at the top level of the package (so not inside any folders in the package) called config.lua that has the following line to name your package:
<lua> mpackage = "<name of your package>" </lua>
That's it. If you don't include config.lua, Mudlet will then deduce the package name from the file name.
Including images, sounds, and other files
If you'd like to include other folders or files in the package, you can - they will be copied into getMudletHomeDir().."/"..packagename upon installation, so your scripts can use them. For example, if your package is called "sipper" and you have health.png as an image in it, you can place on a label like so:
<lua> -- you don't have to worry about \ versus / for file paths - use / everywhere, Lua will make it work on Windows fine
setBackgroundImage("my health label", getMudletHomeDir().."/sipper/health.png") </lua>