Introduction to Add-on libraries: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(added preamble to useful stuff)
(Switched content between this page and 'Creation of add-on libraries' page to make the contents a true introduction.)
Line 1: Line 1:
{{stub}}
{{Beginner}}
{{Beginner}}
[[Category:Tutorial]]
[[Category:Tutorial]]
== What Is An Add-on Library? ==
An Add-on Library is an extension to MapTool that may contain code, images or more. These were introduced in MapTool 1.11, and are intended to be a replacement for [[Library Tokens]] that are easier to work with while offering more functionality.
Add-on libraries are generally distributed as .mtlib files, which are just renamed .zip file with a specific structure.
Add-on Libraries are added to a campaign.
== Managing the Add-On Libraries for Your Campaign==
[[File:addon-dialog.png|400px|thumb|left|Add-on Library Dialog]]The dialog to manage the add-on libraries for your campaign can be reached using the {{ui location|File > Add On Libraries...}} menu option.
This dialog can be used to add or remove add-on libraries, view the details of all add-ons in the campaign and view their license/read me files.
As of MapTool 1.12, add-on libraries can be dragged and dropped onto the map from your system's file explorer. This will either add the add-on library to the campaign or replace it if it is already in the campaign.




== What Is An Add-on Library? ==
An Add-on library is an extension to Maptool that may contain code, images or more. they generally are distributed as .mtlib files, but they actually are just a zip file with a specific structure.


== First Add-on Library ==
firstly you will need a text editor there are many of them mentioned below if in doubt just use [https://code.visualstudio.com/ VS Code].
* [https://www.gnu.org/software/emacs/ Emacs]
* [https://neovim.io/ Neovim]
* [https://www.vim.org/ Vim]
* [https://code.visualstudio.com VS Code]
after choosing a text editor create a new directory to hold your Add-on. Top level files in the add-on are metadata files, they hold information about your add-on. the only file your add-on needs to be accepted by Maptool is library.json. You may have other non metadata files in a subdirectory which must be named library. for macro code you may have a mtscript directory inside library, both of those subdirectories may have a public directory which must be named public.


=== Creating library.json ===
the only required fields are
* a name string
* a authors array
* a short description string
* a namespace string
the other fields are described in [[Creation of add-on libraries #Configuration File Format: library.json | Creation of add-on libraries]] most of these are self explanatory just remember '''bad''' '''things''' will happen if you use the same namespace as someone else so try to use at least 3 words or a reversed host name.


an example of a minimal library.json could be
  {
    "name": "test",
    "authors": ["you"],
    "namespace": "test.test.test",
    "shortDescription":"test"
  }
and that is it. you made an add-on those 6 lines are enough, just zip this file and then it rename so that it ends with .mtlib and have fun.


== Macros in Add-ons ==
Return to: [[Add-On Library]]
Now that you have an addon you probably want it to do something cool

Revision as of 10:06, 15 November 2023

BEGINNER
THIS IS A BEGINNER ARTICLE

What Is An Add-on Library?

An Add-on Library is an extension to MapTool that may contain code, images or more. These were introduced in MapTool 1.11, and are intended to be a replacement for Library Tokens that are easier to work with while offering more functionality.

Add-on libraries are generally distributed as .mtlib files, which are just renamed .zip file with a specific structure.

Add-on Libraries are added to a campaign.

Managing the Add-On Libraries for Your Campaign

Add-on Library Dialog

The dialog to manage the add-on libraries for your campaign can be reached using the File > Add On Libraries... menu option.

This dialog can be used to add or remove add-on libraries, view the details of all add-ons in the campaign and view their license/read me files.

As of MapTool 1.12, add-on libraries can be dragged and dropped onto the map from your system's file explorer. This will either add the add-on library to the campaign or replace it if it is already in the campaign.








Return to: Add-On Library