I have some macro logic working now. In a specific case, the macro was calling the powercards API. I tried launching it as is via CM and it didn't substitute the @{character_name}, @{character_id} @(token_id) parameters when sending to chat. I double checked my code vs. older CT code and I have the exact same code between the two. I started searching and found this from The Aaron The API can load the list of chat commands from either a macro or a character ability, and issue them to the chat with the sendChat() command. HOWEVER, there are a few caveats to getting it to work: In the case of a character ability, you would need to parse all the @{} references and replace them with fully qualified versions including the character's name since you won't be executing them in the context of the character. That looks something like this: let text = ability.get('action').replace(/@\{([^|]*?|[^|]*?\|max|[^|]*?\|current)\}/g, '@{'+(character.get('name'))+'|$1}');
In both cases, @{selected} and @{target} won't work. You'll either have to make sure those aren't used, or provide some sort of intermediate query to the executing player where by they click a button and are prompted for those things. @Ken, if you are still watching this thread, you said that CT_TURN launches that !power command and it worked. I don't see how. But I added substitutions in CM for @{character_name}, @{character_id} @(token_id) into CM and ran it and it worked. So I'm really confused as to how the !power command even did anything, especially if you read the above from TheAaron and it didn't work for me at all. This also means that for APIs you want to launch either via abilities or via macros (with substitutions), launching these things will be dependent upon how the API was coded. For example, with the PowerCards API, it's way too reliant upon macro syntax (@{whatever}. Selected tokens are already passed into the API. From the token, you get the character sheet from the character sheet you get the attributes, so you don't need @{character_name}, @{character_id} @(token_id) @{selected}. Additionally, a --ids parameter should accept specific token ids and then the API could easily be called by other APIs. I'm guessing though that you can't get completely away from @{something} due to abilities calling APIs. However, I would highly suggest sending in @{token_id} only along with the --ids parameter. The API is then callable from other APIs as well as support abilities or even a macro (with selected tokens). Then the focus becomes formatting the output and the attributes you want, and/or updating attributes which it seems to do also, all of which can remain as -- parameters or comma delimited list. Even better, allow the users to define the attributes by name and dynamically process them, kicking out errors if the attribute(s) doesn't exist, making PowerCards usable by any game, not just D&D focused.