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

Passing object argument does not work any more in v11 #70

Closed
KristjanLaane opened this issue Jun 26, 2023 · 3 comments
Closed

Passing object argument does not work any more in v11 #70

KristjanLaane opened this issue Jun 26, 2023 · 3 comments

Comments

@KristjanLaane
Copy link

KristjanLaane commented Jun 26, 2023

Calling a macro with an argument like so used to work for me in v10:
macro.execute(item5e)

Now in v11.302 I’m getting an error inside the macro on the very first line just with this:
if (!args) return

The error:

VM287868:4 Uncaught (in promise) ReferenceError: undefined. args is not defined
[Detected 3 packages: advanced-macros, lib-wrapper, rngd]
at Macro.eval (eval at #executeScript (foundry.js:22632:16), :4:13)
at #executeScript (foundry.js:22636:17)
at Macro.execute (foundry.js:22584:35)

@mclemente
Copy link
Owner

Arguments are not an Advanced Macros feature on Foundry V11, that became a core feature and the implementation is different from what Advanced Macros used to:

  • The arguments are passed as part of an object now.
    • E.g. macro.execute(item5e) -> macro.execute({item5e}).
  • The macros are to be written assuming the parameter will be passed as an individual parameter instead of part of args.
    • E.g. if (!args) return -. if (!item5e) return.

I don't intend on fixing macros broken by V11 changes, look for more help on #macro-polo channel on Foundry's discord.

@mclemente mclemente closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2023
@mclemente mclemente pinned this issue Jun 26, 2023
@KristjanLaane
Copy link
Author

Thank you very much! I got access to the item5e parameter within the macro very nicely now with your guidance.

When I set the same macro to Execute for Specific User then the macro does not run though - no console logs and no error messages or warnings for GM or player user, just nothing happens. That is a separate issue though.

@mclemente mclemente reopened this Jun 27, 2023
@mclemente
Copy link
Owner

Hm, can you open another issue and share the entire macro? Just export the macro's data and upload it to the issue.

@mclemente mclemente closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants