maptool icon indicating copy to clipboard operation
maptool copied to clipboard

[Bug]: Change to add on library onFirstInit between v1.17.1 and 1.18.6

Open icarean opened this issue 1 month ago • 0 comments

Describe the Bug

onFirstInit failing to load in Matool 1.18.6, using an add on library where onFirstInit successfully loaded in v1.17.1 and other earlier versions.

Sometimes it seems to quietly fail to load that script, even though a pop-up window says the library was imported. Sometimes an "An unexpected error occurred" window also pops up with some output that includes "Caused by: net.rptools.parser.ParserException: Unknown macro "public/onFirstInit"."

To Reproduce

onFirstInit.mts script file is located in library/mtscript/public/ in the add on library. In events.json , this library had a line: { "name": "onFirstInit", "mts": "public/onFirstInit" } Up to v1.17.1, onFirstInit would execute with the above line. In v1.18.6 onFirstInit is not executed (I haven't tried other 1.18.x versions). onFirstInit is executed as intended by v1.18.6 if I remove the public/ part in events.json, so that line just reads: { "name": "onFirstInit", "mts": "onFirstInit" } The above still works in v1.17.1 (adding the library via either method). So it seems previously the public/ pathname was optional but in v1.18.6 it must be omitted.

The error window seems to always (?) come up if the library with "File -> Add On Libraries -> Add" but only about half the time (?) if dragging the library file onto the map.

Expected Behaviour

It sounds like the library should never have worked with the events.json line: { "name": "onFirstInit", "mts": "public/onFirstInit" } and that the events.json line should always have been: { "name": "onFirstInit", "mts": "onFirstInit" }

Since it did used to work, I recon expected behaviour should be one of the following:

  • A clear communication that this is a change from v1.18.x; and also an error that pops up which is much clearer than the current full screen of traceback which points the library user in the right direction (i.e., something like: "events.json line 3: Unable to find mts file onFirstInit. If this library worked in previous MapTool versions, see this wiki page for more information of add on library functionality changes between versions."). Note this option would mean add on libraries might be unuseable until they were maintained. or
  • Backward compatibility implemented.

Screenshots

No response

MapTool Info

1.18.6

Desktop

Linux 25.10

Additional Context

No response

icarean avatar Nov 19 '25 02:11 icarean