Introduction to Add-on libraries

From RPTools Wiki
Revision as of 21:51, 19 September 2023 by Eldritch cookie (talk | contribs) (added preamble to useful stuff)
Jump to navigation Jump to search

 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