GithubHelp home page GithubHelp logo

foundry-vtt-community / macros Goto Github PK

View Code? Open in Web Editor NEW
206.0 11.0 166.0 1.52 MB

FVTT Community Macros - ๐Ÿ“ Contribute macros or download them as a module! ๐Ÿ“

License: Creative Commons Attribution Share Alike 4.0 International

JavaScript 100.00%
macros foundry-vtt module vtt-macros

macros's Introduction

Foundry VTT Macros Repository

Latest Version Forge Installs Foundry Hub Endorsements

Foundry community-contributed macros are noted here and merged into the Foundry Community Macros module for ease of use.

Macros may cause unintended side effects, such as issues with performance. Please read the comments in each macro to understand how it works before running!

Installation

Usage as a Module

You can now install this module automatically by specifying the following public module URL :

https://raw.githubusercontent.com/foundry-vtt-community/macros/main/module.json

As GM go to the Manage Modules options menu in your World Settings tab then enable the Foundry Community Macros module.

This module adds all of the community macros as a Compendium Packs called FVTT Community Macros.

You can open these packs, right click and click on import the macros you want. You can then add these macros to the Macro Toolbar at the bottom of the screen.

Usage without the Module:

  1. Download the .js file to your machine
  2. Create a new macro in Foundry VTT
  3. Give it a name and set the Type to "Script"
  4. Use a text editor, such as Notepad or vscode, to open the download .js file and copy the contents
  5. Paste the contents into the Command section of the new macro
  6. Click "Save Macro"
  7. Celebrate ๐ŸŽ‰

Development/Contributing

To clone this repository, along with every macro in it, use the following command:

git clone https://github.com/foundry-vtt-community/macros.git

You can make pull requests to add or update macros here: https://github.com/foundry-vtt-community/macros/pulls

  1. Navigate to the directory where you wish to add your file
  2. Click on add file at the top
  3. Name your file with a .js ending and paste your content and save (add details in the description field of your .js file)
  4. Save the file and then open a pull request (GitHub should walk you through these steps)

macros's People

Contributors

aka-beer-buddy avatar anthonyvadala avatar chummer5a avatar dixonmyles avatar drunemeton avatar eclarke12 avatar erithtotl avatar espositos avatar freeze021 avatar kaelad02 avatar kavaliro avatar lel-15 avatar mainframe97 avatar merudo avatar naokotani avatar nathonius avatar noggin01 avatar norc avatar nulmas avatar penguin-0949 avatar reaver01 avatar schlosrat avatar shawndibble avatar sneat avatar vvddries avatar websterguy avatar xtechnocatx avatar yoman987 avatar zeroxnoxus avatar zeteticl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

macros's Issues

Divine Smite Macro: add valid actor and spell slot verification

The Divine Smite macro does not currently verifies if there is a selected actor or if the selected actor can use smite. There should be some verification to prevent the script for throwing an error.

Additionally, the prompt for missing spell slots doesn't show until the end of the script. The prompt should come earlier, at the slot selection stage.

k is not defined

When checking for updates ini Foundry VTT core 0.75, I get a popup saying "k is not defined".

image

Unable to install because requires beta version

Issue: Users will be unable to install this module or update it because it requires a version that is currently beta. Users should not be required to install a beta version of FoundryVTT to install or update this plugin.

Solution: Move development of the plugin to a branch and change the manifest file's update source to point at the branch's manifest. Then when the new version of FoundryVTT is released, update the manifest file's source to point at the master branch again, and merge the updated plugin into master.

This will allow installs on current stable versions of FoundryVTT while still allowing for development on the beta track.

A workaround is available: Users can point their install path to the tagged older version that corresponds to their installed FoundryVTT version, which will let it install. Since the manifest at that version still points to master, when they click update they will get an error about requiring the beta version, but it will stay installed without updating. Then when they install a beta (or new release) of FoundryVTT, it will update normally.

However, again, users should not have to use this workaround or be subjected to beta software to use the plugin.

Divine Smite doesn't work on 7.5

Divine smite are throwing following error There was an error in your macro syntax. See the console (F12) for details

SyntaxError: Illegal return statement
    at Macro.execute (foundry.js:32357)
    at Hotbar._onClickMacro (foundry.js:20282)
    at HTMLLIElement.dispatch (jquery.min.js:2)
    at HTMLLIElement.v.handle (jquery.min.js:2)

Foundry VTT 7.5
Macros versions 0.27

Checking, why the macro doesn't work.

Macros with roll table have invalid reference

Noticed this while playing with some of the bard macros like random mockeries and random inspiration. The refrences in the macro are looking for tables named "mockeries" and "inspirations" but the tables by default in the community tables are named "Mockeries" and "Inspirations" the references appear to be case sensitive.

PF2e Treat Wounds macro hangs

When executing the macro on the latest stable release ( Foundry 0.7.8 / pf2e 1.10.15.22) The treat wounds macro hangs and does not execute both from the players and the GM side. Attempts to close the macro then fail resulting in needing to resize the window to small to get it out of the way. No error messages are presented server side or client side.

Guidance adding 1d4 twice to Skill checks (5e)

Foundry Version: 0.7.9
Module Version: 0.33

When using the "Guidance" macro on an actor, it correctly responds the chat message and correctly adds the +1d4 on Ability checks. However, on Skill checks, it adds +1d4 twice.

Thinking it may be an issue with other modules, I deactivated all modules except this one. Issue persists. I reviewed the code and I can't see where it's going wrong...
bug

Label system specific macros as such

I think it would be helpful for things like "Rage" to instead be called "Rage (5e)" so games with similar concepts wouldn't have name collisions.

Removal of PF2e macros

Please remove the PF2e macros from this module.

At present, they have not been maintained and either have been replaced by core functionality in the PF2e system or are incompatible with documents as introduced in Foundry 0.8 requiring JSON actor editing.

Roll token HP macro needs update

macros/roll/token_hp.js

Lines 23 to 26 in 121ddf9

actor.data.data.attributes.hp.value = hp;
actor.data.data.attributes.hp.max = hp;
printMessage('<h2>' + actor.data.name + '</h2><strong>HP:</strong> ' + actor.data.data.attributes.hp.value + '/' + actor.data.data.attributes.hp.max + '<span style="float:right"><em>(' + token.data._id + ')</em></span>');

Those lines of code do only assign the values, but do not actually update the token, so the newly rolled HP isn't applied.
This could be fixed by changing Line 23 and 24 into actor.update({"data.attributes.hp.value": hp, "data.attributes.hp.max": hp}); with await for the printMessage function to not fire before the changes apply.

Feature request: option to use macros without expending resources

Running a macro without expending resources is sometimes necessary, for example for do-overs or when the cost has already been manually taken. It also simplifies debugging.

It would be nice to add the option to not consume resources on macro activation, for example not consuming spell slots when using Divine Smite, or not consuming charges when using Lay on Hands.

In the D&D 5e system, casting a spell gives a checkbox letting the spell consume a slot or not. I suggest the same checkbox be added to community macros.

image

Mass Roll Check throws "Illegal Return Statement" error

When attempting to use the Mass Roll Check macro, in version 0.6.4 of foundryvtt, the console returns:
foundry.js:27687 SyntaxError: Illegal return statement
at Macro.execute (foundry.js:27684)
at Hotbar._onClickMacro (foundry.js:21559)
at HTMLLIElement.dispatch (jquery.min.js:2)
at HTMLLIElement.v.handle (jquery.min.js:2)

all_tokens_passive_perception fails when a vehicle token is in the scene

Place a 5e Vehicle token on the scene and execute the macro and you'll get a "There was an error in your macro syntax" alert, and the following error in the console log:

foundry.js:27987 TypeError: Cannot read property 'prc' of undefined
at eval (eval at execute (foundry.js:27984), :20:51)
at Macro.execute (foundry.js:27984)
at Hotbar._onClickMacro (foundry.js:21674)
at HTMLLIElement.dispatch (jquery.min.js:2)
at HTMLLIElement.v.handle (jquery.min.js:2)

This is caused by some actors not having a 'skills' property.

The macro "Close All Doors" doesn't work anymore

Foundry version: 0.8.7
Community macros version: 0.42.0

The doors do not close anymore. It doesn't seem to have any effect. I have tried on a fresh world with no active module and I had the same result.

I've tried to fix the deprecation reported in the logs, but I didn't get more success. Here is what I tried:

canvas.scene.updateEmbeddedDocuments("Wall", canvas.scene.data.walls.map(w => {
  return {_id: w.id, ds: w.ds === 1 ? 0 : w.ds};
})); 

Hunter's Mark CUB

Hi

Hunter's Mark macros was not properly applying the CUB condition.
It seems that them problem in line 12 in GMConditions

game.cub.applyCondition(condition, target, {warn: true}); <- Syxtax error

game.cub.addCondition(condition, target, {warn: true}); <- worked here

roll table from compendium

There is a lovely macro to import a folder to a roll table, I wonder if it would be possible to convert that to import a compendium to a roll table?

Random Mockeries doesn't work

Running this macro (with a selected token, a targeted token & the "Mockeries" table imported to a world will not execute and show this error in Console:

Macros.js:224 TypeError: Cannot read property '0' of undefined
at viciousMockeries (eval at callScriptMacroFunction (Macros.js:176), :24:41)
at Macro.eval (eval at callScriptMacroFunction (Macros.js:176), :82:1)
at Macro.callScriptMacroFunction [as callScriptFunction] (Macros.js:179)
at Macro.renderMacro [as renderContent] (Macros.js:197)
at Macro.executeMacro (Macros.js:221)
at MacroConfig._onExecute (foundry.js:18174)

Frustratingly, I cannot figure out where "property '0' of undefined" is not getting set.

isPC has been deprecated, but some scripts appear to still use it

foundry_community_macros/module-specific/resolve_surprise.js:135: .filter((pc) => pc.actor.isPC && pc.actor.data.type === "character")

foundry_community_macros/module-specific/resolve_surprise.js:144: .filter((pc) => pc.actor.isPC && pc.actor.data.type === "character")

foundry_community_macros/module-specific/resolve_surprise.js:151: .filter((ec) => ec.actor.isPC === false && ec.data.disposition === -1)

foundry_community_macros/module-specific/resolve_surprise.js:160: .filter((ec) => ec.actor.isPC === false && ec.data.disposition === -1)

foundry_community_macros/misc/award_party_xp.js:5: let actors = game.actors.entities.filter(e => e.data.type === 'character' && e.isPC);

Token Vision Configuration macro is blinding when using Light (Cantrip)

I suspect this is because there is no alpha, so foundry is drawing 100% white light around the token, but it's blinding.

image

I fixed it by changing Light to the following:

case "light": dimLight = 40; brightLight = 20; lightAnimation = {type: "none"}; lightColor = colorWhite; lightAlpha = 0.15 break;

Shield Equip Unequip Macro Broken

I am on Foundry 0.8.6 and D&D 1.3.3 and when I use the Shield Equip Unequip macro it kicks up a lot of errors, both unequip and equip. It seems to work fine, until you refresh after using this macro and the token it was used on becomes un selectable and you need to delete the token and pull a new one out from the sidebar.

The error in question was...
jquery.min.js:2 Uncaught (in promise) Error: Syntax error, unrecognized expression: Ranunculus equips their Shield
at Function.se.error (jquery.min.js:2)
at se.tokenize (jquery.min.js:2)
at se.select (jquery.min.js:2)
at Function.se [as find] (jquery.min.js:2)
at S.fn.init.find (jquery.min.js:2)
at new S.fn.init (jquery.min.js:2)
at S (jquery.min.js:2)
at new Dnd5Handler (dnd5-handler.js:3)
at specialCaseAnimations (autoAnimations.js:453)
at autoAnimations.js:280

Help with wall resizing macro in 0.8.x

Can anyone help me update this macro to work in 0.8.x? Perhaps @mainframe97 since they helped with a similar issue a few months ago involving doors? I am running Curse of Strahd, and am having to resize a lot of maps and then redraw all the walls.

let scale = 2;
canvas.scene.update({
walls: duplicate(canvas.scene.data.walls.map(w => {
w.c = w.c.map(x => x * scale);
return w;
}))
});

Accurate Module/Core Version

While many of the macros within this module are technically compatible with 0.8, a suspect a significant portion are only compatible by virtue of the deprecation paths built into the software - i.e. they're not really compatible, they're just shimmed. In fact, there are some seemingly simple macros, e.g. "Close All Doors" written by Atropos himself, that do not function at all in 0.8.

I think its disingenuous to indicate compatibility when the individual macros within the module have not be verified and updated to use 0.8 functions. This module has gone from a source of examples for how Foundry does things to a collection of examples of how Foundry used to do things.

I'm not certain of the right path forward. My only horse in the race is that of a user, not a developer or contributor. My preference would be for this module's 0.7.10-compatible state to be forked (for archive purposes), then any macro not using the full 0.8 API to be removed until it it does use 0.8 functions.

random_cutting_words.js is not working with 0.8.8

random_cutting_words.js is not working with Foundry 0.8.8, it is throwing:

Macros.js:221 TypeError: Cannot read property '0' of undefined
at bardicInspiration (eval at callScriptMacroFunction (Macros.js:176), :40:32)
at Macro.eval (eval at callScriptMacroFunction (Macros.js:176), :88:1)
at Macro.callScriptMacroFunction [as callScriptFunction] (Macros.js:179)
at Macro.renderMacro [as renderContent] (Macros.js:197)
at Macro.executeMacro (Macros.js:218)
at Hotbar._onClickMacro (foundry.js:28059)
at HTMLLIElement.dispatch (jquery.min.js:2)
at HTMLLIElement.v.handle (jquery.min.js:2)
executeMacro @ Macros.js:221
fou

Create Merchant Stock - Not working (might be me though)

I cannot get the Macro 'Create Merchant Stock' working.

I get the error:

VM2229:105 Uncaught (in promise) TypeError: Cannot read property 'data' of undefined
at generateMagicItemsStock (eval at _executeScript (foundry.js:14665), :105:14)
at addToActor (eval at _executeScript (foundry.js:14665), :131:9)

I've tried multiple Compendiums and Actors. None generate any Inventory into any character.

Thanks in advance for any help

SneakAttack macro makes undefined check instead of null check

Hey there,

when the sneak attack macro checks if the actor is a rogue it wrongly checks for undefined. But the result of the name check can be null.

//check to ensure token is a rogue
if (errorReason == '' && macroActor.items.find(i => i.name == `${rogueClassName}`) !== undefined) {
	rogue = macroActor.items.find(i => i.name == `${rogueClassName}`);
} else {
	errorReason = `${errorSelectRogue}`;
}

Instead it should read:

//check to ensure token is a rogue
if (errorReason == '' && macroActor.items.find(i => i.name == `${rogueClassName}`) !== null) {
	rogue = macroActor.items.find(i => i.name == `${rogueClassName}`);
} else {
	errorReason = `${errorSelectRogue}`;
}

Suggestion: make this into a compendium

I think having this repo be a 'community macros' module with all the macros importable from a compendium would make it much more approachable for people.
Don't know if you agree, but that's my suggestion.

Rage macro resistances

The 5e rage macro can now have just [Physical] resistance instead of bludgeoning/slashing/piercing

FVTT 0.8.7 - "Create Chat Message" macro missing vital line

As it exists in FVTT Community Macros v.0.42.0, the "Create Chat Message" macro does not work without the addition of this line at the top of the macro:

let controlledToken = canvas.tokens.controlled[0];

Running in FVTT 0.8.7 (node.,js install)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.