-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Describe the bug
Macros with leading or trailing spaces cause an error for Lib:Overlay when their containing token is selected. Since the BoT contains such a macro, several users have been running into this problem.
This seems to only happen in newer versions of MapTool,
To Reproduce
Steps to reproduce the behavior:
- Make any token in the framework, ensuring that Lib:Overlay is activated.
- Add the macro with the label " Starts with a Space" (or "Ends with a Space "), excluding the quotes.
- Click on the token.
- See error:
Argument number 1 "" to function "getMacroProps" must be an integer.
Error trace : selectedToken@Lib:Overlay <<< OverlaySelected@Lib:Overlay <<< macroLink
Expected behavior
No error should occur.
Workaround
I have found that processing macro names as JSON fixes this issue. This is how I recommended on Discord to fix this issue:
- Select Lib:Overlay and right click and edit the selectedToken macro.
- REPLACE Lines 128-138 with the following code (it is a bit shorter than the existing code, so you can expect that it will take fewer lines):
[h:macros=getMacros("json")]
[h:json=macros]
[h,count(json.length(macros)),code:{
[h:currentMacro=json.get(macros, roll.count)]
[h:index=listget(getMacroIndexes(currentMacro), 0)]
[h:props=getMacroProps(index)]
[h:json=json.set(json,roll.count,json.fromStrProp(props))]
}]
I'll note that if you follow that thread, at least one person had other errors after my fix (though I suspect those are unrelated to this, except that they are likely new issues due to recent macro performance changes)
Metadata
Metadata
Assignees
Labels
No labels