Describe the Bug
Specifying a return value causes that value to output in the chat. This can be avoided if you use the roll option h when you call the macro itself, but it cannot be avoided by putting the return function inside a code block that uses the h roll option. So, for example, [h,if(1), code: {[return(0, someData)]}] (or, alternatively, [h:return(0,SomeData)] )will output whatever someData is into the chat. There is certainly no reason I can tell from the documentation why the h roll option would work if and only if used when calling the macro, but not anywhere inside the macro.
To Reproduce
For problem 1:
Create two macros on a library token, let's call it Lib:Test. The first macro is called test, the second called test_return.
Then, inside test, type:
[macro("test_return@Lib:Test"):""]
Inside test_return, type:
[h,if(1), code: {
[returnData=json.set("{}",
"one", 1,
"two", 2,
"msg", "test complete"
)]
[macro.return=returnData]
[return(0,macro.return)]
}]
You will see {"one":1,"two":2,"msg":"test complete"} output in the chat.
Expected Behaviour
I would not expect the return value specified in argument 2 of return() to output in the chat, since the documentation does not mention this. And even so, I would expect the h roll option used on the code block would silence the output. Rather, I would expect it to do the same thing as if I replaced the function with [h:macro.return = "whatever"], which doesn't output even if the macro is not called with the h roll option.
Screenshots
No response
MapTool Info
1.18.6
Desktop
Windows
Additional Context
The only function I know of that isn't silenced by h, is assert(), but assert() isn't even silenced if the calling macro is prefaced by the h roll option. Given the lack of a continue keyword/function, it doesn't seem to me like our only early return function should do this.
Describe the Bug
Specifying a return value causes that value to output in the chat. This can be avoided if you use the roll option h when you call the macro itself, but it cannot be avoided by putting the return function inside a code block that uses the h roll option. So, for example, [h,if(1), code: {[return(0, someData)]}] (or, alternatively, [h:return(0,SomeData)] )will output whatever someData is into the chat. There is certainly no reason I can tell from the documentation why the h roll option would work if and only if used when calling the macro, but not anywhere inside the macro.
To Reproduce
For problem 1:
Create two macros on a library token, let's call it Lib:Test. The first macro is called test, the second called test_return.
Then, inside test, type:
[macro("test_return@Lib:Test"):""]Inside test_return, type:
You will see
{"one":1,"two":2,"msg":"test complete"}output in the chat.Expected Behaviour
I would not expect the return value specified in argument 2 of return() to output in the chat, since the documentation does not mention this. And even so, I would expect the h roll option used on the code block would silence the output. Rather, I would expect it to do the same thing as if I replaced the function with
[h:macro.return = "whatever"], which doesn't output even if the macro is not called with the h roll option.Screenshots
No response
MapTool Info
1.18.6
Desktop
Windows
Additional Context
The only function I know of that isn't silenced by h, is assert(), but assert() isn't even silenced if the calling macro is prefaced by the h roll option. Given the lack of a continue keyword/function, it doesn't seem to me like our only early return function should do this.