You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A campaign with an add-on embedded will generate an error on the add-on's onInit, if the event requires campaign resources, like switching to a lobby map, reading images from a table etc.
According to Skullman3194 (on the Discord), it appears that MT attempts to execute the add-on code before it has actually load the campaign resources.
If I defer the onInit code that requires these resources, i.e. use the execLink(link, 1, "self") function, my initialization code works.
To Reproduce
Create a campaign.
Create a second map.
Create an add-on which attempts to switch to second map in onInit.
Save campaign.
Restart MapTool and load campaign.
Observe failure.
Expected Behaviour
I expect the add-on to be able to load campaign resources in the initialization code, just like a library token.
Without having to resort to deferring code.
Screenshots
No response
MapTool Info
1.15.2 - clean install
Desktop
Windows 11
Additional Context
I will ASAP construct an example campaign to demonstrate the issue.
The text was updated successfully, but these errors were encountered:
This is because the last message in the handshake includes the addons, and the message handler fetches and initializes the addons, and onInit is run during initialization, but the Campaign is sent to the player as the first message of the session so the onInit is run before the campaign is loaded.
I have created a very simple campaign with two maps. The default "Grasslands" and new one "Desert".
The add-on, already added to the campaign attempts to switch to the "Desert" map in onInit.js.
But fails, as per the description above.
Interesting! It's not just on connect that it doesn't work, but also on file load.
Your test campaign having two add-ons, one that changed to desert and one that changed to grasslands, so I was left confused by why it didn't appear to change.
Describe the Bug
A campaign with an add-on embedded will generate an error on the add-on's
onInit
, if the event requires campaign resources, like switching to a lobby map, reading images from a table etc.According to Skullman3194 (on the Discord), it appears that MT attempts to execute the add-on code before it has actually load the campaign resources.
If I defer the
onInit
code that requires these resources, i.e. use theexecLink(link, 1, "self")
function, my initialization code works.To Reproduce
onInit
.Expected Behaviour
I expect the add-on to be able to load campaign resources in the initialization code, just like a library token.
Without having to resort to deferring code.
Screenshots
No response
MapTool Info
1.15.2 - clean install
Desktop
Windows 11
Additional Context
I will ASAP construct an example campaign to demonstrate the issue.
The text was updated successfully, but these errors were encountered: