Introduction to Add-on libraries: Difference between revisions
m (added beginner banner) |
(added preamble to useful stuff) |
||
Line 21: | Line 21: | ||
* a short description string | * a short description string | ||
* a namespace string | * a namespace string | ||
the other fields are described in [[Creation of add-on libraries #Configuration File Format: library.json]] 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. | 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 | an example of a minimal library.json could be | ||
Line 32: | Line 32: | ||
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. | 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 == | ||
Now that you have an addon you probably want it to do something cool |
Revision as of 21:51, 19 September 2023
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
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. 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 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 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
Now that you have an addon you probably want it to do something cool