Closed A1exanderWebb closed 2 years ago
Hey thanks for the request! Good news - there's already a feature built in that can let users accomplish the same thing, with just a little more getting their hands dirty.
Stuff like this is what you'd use the Macro progression type for on an activity (and is exactly why it exists). The only difference to what you're proposing is that the macro you use here would also include the logic for "rolling" and updating the downtime activity, and a check for completion afterwards. Basically - you tell the module what to do to increase progress, update the progress value, check to see if it's done, and then conditionally do your "on complete" actions. If you've got the know-how to create a macro to run on completion in the first place, you should have the tools you need to do the extra steps too.
Here's an example of a Medicine Skill Check with a DC 15, that does whatever you specify once it completes:
// ======= CONFIG ========
let actorName = `Example Actor`; //The name of the actor who owns the activity to update.
let itemName = `Crafting Example`; // The name of the activity to update.
let checkDc = 15; // The DC of the check
let skillToRoll = `med`; // The abbreviation of the skill to roll.
// ==========================
// Get our actor and item
let item = CrashTNT.getActivity(actorName, itemName);
let actor = game.actors.getName(actorName);
// Make necessary rolls
let skillRoll = await actor.rollSkill(skillToRoll);
let total = skillRoll.total;
// If total is high enough, increase progress by 1
if(total >= checkDc){
let newProgress = item.progress + 1;
CrashTNT.updateActivityProgress(actorName, itemName, newProgress);
// Check for completion
if(newProgress >= item.completionAt){
// Do your things here
}
}
There are more example macros in the repo wiki, but I'm always happy to help with something specific if you need it.
Thank you for your response, it totally slipped my mind that the macro called for progress rolls could also just check to see if the activity has been completed. Follow up question, does the macro field accept inputs to be passed to the macro?
It does not, no. I'd imagine pretty much anything you'd need you should be able to get programmatically from inside the macro, though. Depends on what you're trying to do, I suppose.
Hello, I think an option to call a macro upon completion would open this module up to automating a lot of the results of training, crafting, and other long term activities.
With a macro call (ideally one that accepts inputs) the sky is the limit, obviously I have no idea if it’s even possible but I thought I’d throw it out there as an idea for a future feature.