feat: Initial release of SwapTokenPositions script#2206
Merged
Alicekb merged 3 commits intoRoll20:masterfrom Apr 30, 2026
Merged
feat: Initial release of SwapTokenPositions script#2206Alicekb merged 3 commits intoRoll20:masterfrom
Alicekb merged 3 commits intoRoll20:masterfrom
Conversation
Contributor
steverobertsuk
commented
Apr 22, 2026
- Added core functionality to swap positions of two selected tokens on Roll20.
- Implemented customizable animation effects and persistent settings for GMs.
- Created a user-friendly help command and macro installation feature.
- Documented features and usage in README and CHANGELOG files.
- Added core functionality to swap positions of two selected tokens on Roll20. - Implemented customizable animation effects and persistent settings for GMs. - Created a user-friendly help command and macro installation feature. - Documented features and usage in README and CHANGELOG files. Signed-off-by: Steve Roberts <[email protected]>
shdwjk
reviewed
Apr 24, 2026
| * The main functionality is triggered by the `!swap-tokens` command in chat. | ||
| */ | ||
| // === Script version and last updated date === | ||
| const SWAP_TOKEN_POSITIONS_VERSION = "1.0.0"; |
Contributor
There was a problem hiding this comment.
Since all Roll20 Mod Scripts are concatenated together before being run on the sandbox, it's best practice to wrap your code in a closure. Usually something like:
on('ready',()=>{
<... your code ...>
});This prevents name collisions and general pollution of the global scope.
Contributor
Author
There was a problem hiding this comment.
I've applied a patch to wrap the code in a named scope to prevent collisions and general pollution of the global scope.
shdwjk
reviewed
Apr 24, 2026
| * | ||
| * @returns {void} | ||
| */ | ||
| on("ready", () => { |
Contributor
There was a problem hiding this comment.
You can just move this line up to above line 17, and that will solve the global scope issue.
Contributor
Author
There was a problem hiding this comment.
I've kept the on ready slim as I've wrapped the script in a named scope
…e script scope Signed-off-by: Steve Roberts <[email protected]> Co-authored-by: Copilot <[email protected]>
…onsMod for clarity Signed-off-by: Steve Roberts <[email protected]>
shdwjk
approved these changes
Apr 24, 2026
Alicekb
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.