Introduction to Add-on libraries: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Brought 'things to be addressed' here.)
m (Added note about how setLibProperty() stores persistent data)
 
(3 intermediate revisions by 2 users not shown)
Line 7: Line 7:
Add-on libraries are generally distributed as .mtlib files, which are just renamed .zip file with a specific structure.
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.
Add-on Libraries are added to a campaign and are saved as part of the campaign file.
 
When the {{func|setLibProperty}} function is called on an add-on, the property name and value are stored in a campaign area.  That area is '''NOT''' cleared when the add-on is removed.  This allows the data to persist across add-on updates.  (Currently (as of v1.14.3), there are no corresponding functions to clear this data, so the only way to erase it is to create a new campaign.)


== Managing the Add-On Libraries for Your 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.
[[File:addon-dialog.png|400px|thumb|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.
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.
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.





Latest revision as of 23:59, 15 February 2024

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 and are saved as part of the campaign file.

When the setLibProperty() function is called on an add-on, the property name and value are stored in a campaign area. That area is NOT cleared when the add-on is removed. This allows the data to persist across add-on updates. (Currently (as of v1.14.3), there are no corresponding functions to clear this data, so the only way to erase it is to create a new 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.








Things still to be addressed

  • There is only minimal checking of data when importing add-ons so error reporting is not great.
  • Expanding the JavaScript API which will make this much more useful (part of another change set).
  • Better replacement for user defined functions.
  • Providing an equivalent to Library Tokens buttons.
  • Ability to check URL for later version and update from that (most likely GitHub to start with)
  • Link maps to required add-ons when exporting/importing.
  • Documentation / procedures for creating a GitHub release for your add-on.
  • The data store could be slightly smarter about large text blocks that remain static and attempt to cache them.


Return to: Add-On Library