Skip to content
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

Fix for error when executing a token macro as a player with the current map not visible #4101

Merged
merged 2 commits into from
Jun 7, 2023

Conversation

Kkrafy
Copy link
Contributor

@Kkrafy Kkrafy commented May 30, 2023

Identify the Bug or Feature request

Fixes #4100

Description of the Change

When executing a token macro as a player with the current map not visible it will return that error:
Thats because in the execution of Token macros a lot of thing needs the current zone(that is null when the map is not visible)

Possible Drawbacks

None expected

Documentation Notes

Fix for error when executing a token macro as a player with the current map is not visible

Release Notes


This change is Reviewable

@cwisniew cwisniew changed the title Fix to Issue#4100 Fix for error when executing a token macro as a player with the current map not visible Jun 2, 2023
Copy link
Member

@cwisniew cwisniew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request; it will need a little change to work correctly.

Also, it would be appreciated if you could fill out the details in the PR as that is what gets added to the release notes by github, if there is no real information about the fix in the title and the PR body it will be harder for people to find what was fixed.

AllTokenIDs.add(token.getId());
}
renderer.getSelectionModel().removeTokensFromSelection(AllTokenIDs);
MapTool.getFrame().setCurrentZoneRenderer(null);
Copy link
Member

@cwisniew cwisniew Jun 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes you made should be in the below if statement (where it is setting the current zone renderer to null) because, at the moment, it will get executed for players and GMs when any map is made invisible or visible.

You can also simplify it as
var selected = List.copyOf(renderer.getZone().getAllTokens());
render.getSelectionModel().removeTokensFromSelection(selected);

Copy link
Contributor Author

@Kkrafy Kkrafy Jun 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, i have updated the commit to put the code below the if statement, now its working.

@cwisniew cwisniew added this pull request to the merge queue Jun 7, 2023
Merged via the queue into RPTools:develop with commit 81293b8 Jun 7, 2023
@cwisniew cwisniew added the bug label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[Bug]: Token macros do not execute when the current map is not visible.
2 participants