-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Addons - Inconsistent onInit Functionality #3334
Comments
Campaign file + addon for debugging |
Update for the 1.12.0 alpha:
|
This should also be the case when you update via the UI if you don't remove first, or at least that is what is intended please let me know if you have had issues with that. |
I was previously foolishly unaware that you could update via the UI (hence my thinking it was a new scenario). This is working as intended, no issues. |
@Pmofmalasia please confirm that this issue has been resolved with beta 3. Thanks. |
This issue is mostly resolved for me. In all instances, my functions are defined correctly (which is my main issue with this bug in the first place). The one thing that is still happening is that when loading a campaign from Grasslands, the The main issue is resolved from my end, but I believe some frameworks use outputs to chat in OCL/onInit for user instructions, showing if versions are up to date, etc. |
@cwisniew thoughts? |
@Pmofmalasia I tried with just the simplest case possible, one lib:token with a onCampaignLoad that has just a The broadcast appears
What other types of things are you doing in your onCampaignLoad macro? Maybe there is some odd interaction happening. |
@cwisniew this isn't in reference onCampaignLoad macros on Lib:tokens, just onInit for an addon. I only brought up OCL in my previous comment to mention that it had been used that way in the past, and people might want to do so going forward in addons. My onInit macro declares functions, calls out to another short macro, and has a broadcast at the end, though. |
@Pmofmalasia tried the same tests with a simple add-on, and get broadcast in all tests. |
@cwisniew The broadcast does output to chat if moved before calling the other macro - in case it makes a difference, that macro is called with the |
I should note if it helps, the called macro also has a broadcast in it which does not display in chat either. |
In this test add-on it has broadcast They all work, so I wonder whats different. What is the macro you are calling doing, it seems that something in that macro may be failing which is why the broadcasts are not happening |
@cwisniew Just did some additional testing - it was something in the macro that was failing. That macro gathers a bunch of information from a bunch of library tokens on the map. It appears that using |
So are you saying that |
Yes, but notably if opened while a campaign file where those |
okay. Good info. |
Describe the Bug
I am having a few issues with the onInit macro/event. It seems to operate differently depending on the situation:
When I first load in the addon, it works as expected.
When opening MapTool and loading it as the very first campaign from the default grasslands, it does not appear to run at all - I have a
broadcast()
function that does not output anything to chat in this instance.When another campaign has been opened in the same instance of MapTool (or the same campaign, just any campaign file), the
broadcast()
function outputs to chat but none of the functions are defined. Thebroadcast()
function occurs after the functions are defined, so the macro was not aborted early.When run manually by entering
[h,MACRO("onInit@Lib:pm.a5e.Core"):""]
into the chat, it works as expected.For troubleshooting purposes, my events file is below:
{ "events": [{"name": "onInit","mts": "onInit"}, {"name": "onFirstInit","mts": "onFirstInit"}] }
To Reproduce
isFunctionDefined()
will return0
for the function.Expected Behaviour
Expect the functions to be defined upon loading the campaign in instances 2 and 3.
Screenshots
No response
MapTool Info
1.11.4
Desktop
Windows 10
Additional Context
The UDFs declared in my onInit macro are standard UDFs, not js.UDFs.
The text was updated successfully, but these errors were encountered: