#macros-compendium

1 messages ยท Page 1 of 1 (latest)

keen blade
#

Hey

#

@median plaza

#

Do you have an idea?

median plaza
# keen blade Do you have an idea?

I can see two possible solutions. First is what mxzf suggested: #module-development message
But I might go for abandoning macros altogether, dragging all the code into the module itself and executing them from there using macros again, similar to what we do now but using the code from the module instead of from another macro.
I'm just not sure yet that I can do this with all my macros.

#

This is terrible news for code accessibility but easier to maintain.

oblique violet
#

I would encourage migrating your code into a module and exposing small api functions to execute them.

It will be far easier to maintain in the long run and easier to re-use code between operations.

median plaza
oblique violet
#

oh i fully understand that, ha, im a dnd5e resident. What I would suggest is still providing a compendium of macros set up according to core rules operations, which are just a few lines calling your module's API functions.

#

that way users can import the macros and have a good example set to build out from

#

but the macros are just calling module functions, so there are no permissions issues with macro compendiums to deal with

#

while I dont provide a sample compendium with Warp Gate, due to it being system agnostic, I do keep a wiki of example code to get started. What you are making and why warp gate was created are very similar -- managing macros is a pain.

median plaza
# oblique violet while I dont provide a sample compendium with Warp Gate, due to it being system ...

I can only do so much I'm afraid. I'm not a professional programmer and on top of everything I produce comes twice or three times that amount of research I have to do. Thus I can't really maintain a wiki and lots of customisability. If I had the time and the skill, this module would look completely different. But I don't so it's still very close to what it was when I started: A collection of macros.

oblique violet
#

Oh sure sure, the wiki was just an example of providing example code.

#

And migrating functions to a module isn't terribly difficult. I'm more than happy to help out as is all of #module-development ๐Ÿ™‚

median plaza
# oblique violet And migrating functions to a module isn't terribly difficult. I'm more than happ...

I'm currently evaluating what the best way to call the former macros would be. Putting all of them into my current class (https://github.com/SalieriC/SWADE-Immersive-Macros/blob/main/swim/scripts/swim-class.js) doesn't seem like a great idea for some macros are very long. I'd rather make a file for each former macro. But I never executed code in a file from a macro without a class. But having a class for each macro is also rather dumb. Suggestions?

oblique violet
#

I would have a single api class that serves to expose your functions from various other files

#

That way you have a single place to add new functions to your module's scope

#

I'm not at my PC at the moment but if you look at warpgate's api.js file, you will see this concept

stark socket
#

I will just be happy when I have the automation of the macros back!

median plaza
# stark socket I will just be happy when I have the automation of the macros back!

Working on it. May take a while though. Consider downgrading FVTT in the meantime. If that's not an option, you could try to use the full script macros instead of the auto update ones. It is likely that you'll need to change all the auto update macros anyway so maybe that's the best option. Currently I cannot guarantee all of these will work however.

keen blade
#

If you set this as you are doing, can it override the macro limitation to let a player change a token which he don't own?

oblique violet
#

that is a core foundry limitation

median plaza
oblique violet
#

warpgate's mutation function can modify unowned tokens, if that is a common operation that is needed ๐Ÿ™‚

median plaza
oblique violet
oblique violet
keen blade
oblique violet
#

do eeeet! It shouldnt be too difficult to adapt this to swade, warpgate does the heavy lifting

keen blade
#

fixed

#

static async macroRun(macroName, compendiumName='swademacros.macros-for-swade') {
let pack = game.packs.get(compendiumName);
const macro = ( await pack.getDocuments() ).find(i => (i.data.name==macroName) );

// Get the data from the macro in the compendium in a JS object form
let macro_data = macro.toObject();
let temp_macro = new Macro(macro_data);
temp_macro.data.permission.default = 3;
await temp_macro.execute();

}

median plaza
median plaza
# stark socket I will just be happy when I have the automation of the macros back!

Okay, made great progress yesterday and today (also drained a lot of my time XD). I can now proudly say that the modules next version will be the best it has ever been and allows a lot more things in the future. =)
There are a few things I want to do before publishing the version though, but if you need it quickly, I can share a dev version with you.

stark socket
true canyon
# median plaza I'm currently evaluating what the best way to call the former macros would be. P...

@median plaza honeybadger said you were doing something similar to me. I just made this macro that dumps an array of macros into a single class. I saw that you said you didn't want to do that, but my macros are LONG and it seems to work just fine. Line 55 is rather specific to my macros because it is how I have them call each other with Advanced Macros. That line just formats the calls to use the function names from the class instead. Feel free to adapt it as needed.

oblique violet
#

thanks for the update, @true canyon

true canyon
#

I just noticed the CONST values I set at the top are just there in foundry now. I probably won't be doing that

median plaza