League of Extraordinary FoundryVTT Developers

LOE

League of Extraordinary FoundryVTT Developers

Join the community to ask questions about League of Extraordinary FoundryVTT Developers and get answers from other members.

Join

commissions

package-development

system-development

other-topics

workgroups

development

package-ideas

package-compatibility

pixijs-canvas-shaders

progress-reports

dev-guides-and-docs

ui-ux-sheets-forms

hooks

development-basics

manifest-plus

tools-and-workflow

active-effects

wiki

dnd5e-dev

package-stewardship

swade-dev

typescript

starfinder-dev

lancer-dev

pathfinder1e-dev

foundryvtt-v10-research

coc7-dev

a5e-dev

v10-updatathon

svnsea2e-dev

package-jam-2022

blackflag-dev

api-announcements

HandlebarsApplicationMixin Usage from the foundry-vtt-types node package

I have recently started to use foundry to dm my games and as a programmer myself I have been building macros and simple module stuff for the last few weeks. I am newish to type script since I use C++ mostly for my work, so I am a bit lost here. How am I supposed to use HandlebarsApplicationMixin? Every time I try to extend my custom class with HandlebarsApplicationMixin(DocumentSheetV2), I get an error that says no base constructor has the specified number of type arguments. I know C++ knowledge...
Solution:
You can see the generic parameters for DocumentSheetV2 at its definition: ```ts declare class DocumentSheetV2< Document extends foundry.abstract.Document.Any, RenderContext extends AnyObject = EmptyObject,...

Improving / forking on existing packages

Hello ! Context : I was interested in using the existing package Tabbed-Chatlog. Seeing as it was not compatible with FoundryV12, and did not totally suit my needs, I took on myself to make this compatibility happen, and maybe posting here in #endangered-packages to see if it was still maintained or not (I thought it was not because it hasn't been updated since v9). After reviewing the code, I decided it did not suit my coding style, and started rewriting it from scratch, matching what I thought were the core features of the packages, and adding my own on it. I now end up with a working module, with additional features on Tabbed-Chatlog, and some features I did not port, because I didn't see them as being part of the core functionality. I saw in the #endangered-packages chan that the original dev of Tabbed-Chatlog has not stopped maintaining the package. I now end up with this issue : what do I do with mine? It is heavily inspired by Tabbed-Chatlog (having the same functionality of splitting the chatlog in tabs, with the same tabs types for the most part), but dropped some of its features (namely the Discord integration), and added other (notably a feature allowing the creation of dedicated whisper tabs). ...
Solution:
even if the module was still receiving regular updates, you could always create a new package for your own. but it hasn't received an update in 1 year, 7 months. as someone who made a chat editing module after DF chat enhancement (and then karakara chat enhancement) both came and went, it's fine to release a module that is similar to an existing module, even moreso if its filling a gap. just submit it for package approval, at least imo...

Development setup for testing?

Starting my Foundry development journey and documenting it as I go along. I'm setting up my development environment. Started by reviewing contents of the foundryvtt.wiki Development notes, the various pages from foundryvtt.com on package development, scanning this Discord server, and the https://foundryvttt-hub.com site. I've found a few blog posts on module development and have been reviewing code repositories for various modules. I have, so far, seen no automated testing (the Quench module implies that someone has some testing but I have yet to see any in the wild---and the irony that the quench module itself contains no test is not lost on me). So, does anyone use automated tests? If so, what and how?...

Browsing system data model

Trying to modify an existing UI module to support other systems. The data model of e.g. characters is different in another system. Is there a way to easily browse what kind of data model the system is using and what values it is offering for player characters etc.?
Solution:
PDF Pager has a Data Inspector window inherited from the old PDFoundry module. It lists all the fields on a Actor/Item for users to see which fields are available. It might be worth having a look at that window....

Sockets not emitting

Hey all, I'm losing my mind. I recently stopped using socketlib in my convenient effects rewrite, and now I can't get sockets to emit at all. My setup is basically copying how pf2e did it, so I'm a bit confused. And yes, socket: true is set in the manifest. Here's my code (again, mostly derived from pf2e): ```ts...
Solution:
Clients don't hear their own socket emissions

How to add buttons to the ProseMirror Menu?

The title is only part of the question, I have already added a button and dropdown to ProseMirror, that inserts text at the cursor. That works fine and all, however I'd like to be able to wrap the selected paragraph in a div that has a custom css class. (similar to the Fonts wrapping the elected text in a span with custom styling) I have inspected the foundry code, how they did it. However they use functions that aren't available from a module scope (at least not that I found them) I also couldn't find any modules that add similar functionality to the PM Editor... is that just not possible for a module?...
Solution:
try something like this ```js Hooks.on("getProseMirrorMenuDropDowns", (menu, items) => { const wrapIn = foundry.prosemirror.commands.wrapIn; if ("format" in items) {...

How to hijack the place measured template?

Not sure if this is the right place to post this. I'm working on modifying a couple of modules to make foundry on mobile phones work well (for 5e at least). I've made modifications to simplemobile by @Handyfon and enhancedcombathud by theripper93. https://github.com/Handyfon/simplemobile https://github.com/theripper93/enhancedcombathud ...
No description

Do some copy paste, follow the guide, add a new coustom dice, earn some money.

I am looking for someone who would make a minor modification (adding +1 die) in to an already existing module. I have a guide how to do it but I dont have the patience to set up github and a yaml project. If someone who already has it would do it for me i would pay for it. The guide: https://github.com/BernhardPosselt/foundryvtt-special-dice-roller/blob/master/docs/Roller.md Please PM, me if someone is interested....

change token lighting based on changing value on actor or an Effect embedded on the actor.

I'm attempting to add a feature to my system that makes the token glow when it's lightsaber/generic laser sword is ignited. I was able to make a custom token document class that can override the light settings, but that only updates the light settings on refresh or move. is there some way to trigger a redraw or is there a better place to implement this logic? maybe i should make a custom token class.
Solution:
Thanks for your response. that resembles my first attempt. what ended up working is overriding the _onUpdateDescendantDocuments method on the token document, resetting the tokenDoc, then calling updateLightSource on the token itself. i think i had to override the _onUpdateDescendantDocuments on the actor as well to make sure it picked up the changes.

GitHub Actions on release

Hi there, hope I'm at the right place. I'm actually new to actions on GitHub, trying for release- depending. I have some private (because premium module) repos, all went fine on this action (on 5 other repos with the exact same parameters), but here, it produces an error (see attended screenshot)...
No description

hook preCreateToken update token name

I'm trying to update the token name when dropping a token on a scene. I basically have something like this ``` Hooks.on("preCreateToken", async function (tokenDocument) {...
Solution:
so switching the hook to createToken and keeping everything else the same seems to get the functionality i'm looking for.

Error on package install

Error message
Error: Cannot read properties of null (reading 'protected')
Error: Cannot read properties of null (reading 'protected')
...
Solution:
Does the lang file have a different directory name? The manifest has lang, the repo has languages.
No description

Newbie question on scope

Hey there, total newbie here. I'm a complete amateur to programming. I've completed the todo tutorial for foundry development, but I believe the module I'd like to make is better suited to the game settings scope rather than the flag scope. It's for Markov chain based weather as found in Izirion's Enchiridion of the West Marches. Does that sound correct or am I starting down the wrong path? Also, do you know any good modules that write game settings like this? I think it would help to read pract...

Having trouble to get scripts loaded

Trying to make my first module and I have troubles getting anything loaded in Foundry. Here is what I have done so far: 1. Made the module using the Foundry admin UI view. 2. Added that module to one of my worlds. 3. Created a script to scripts/ folder of the module (I edit these files directly in the module folder)....
Solution:
You dont want to log out, you want to shut off the world entirely.

Newbie questions on testing.

Hi all, ive put together a simple module for PF2E that allows a user to favorite a spell, feat, item or action and add it appears at the bottom of the character sheet sidebar. This is my first module and I wondered what the procedure is for testing. Do I simply release it or is it best to get some people to test it first?
Solution:
it is always best to test it first. You should at the very least do so yourself. Either manually in foundry or through unit/integration automated tests. If you can find some people to help you test it, that is even better, since they will likely interact with it in ways you didn't think to. Always test before release 🙂...

Minimise Document using Prototype

Quick question, I've got no idea what I'm doing so please excuse my ineptitude. Say I have a document, e.g. a wall: ```json { "light": 20,...
Solution:
From a post elsewhere: foundry.utils.diffObject(WallDocument.prototype.constructor._schema.initial(),canvas.walls.placeables[0].document.toObject(), {inner: true})...

Newby accepting advice on the Foundry API and Module Development

Heya,im very new to Module development for foundry and im suuuuper rusty in the codding department but im motivated to make a tool for a custom system that i love and id welcome a bit of help (im already not super experienced and on top of that im really rusty so sorry for very dumb mistakes and questions)

Newb looking for advice on creating Compendium via code

I am new to Foundry and trying to figure out if it will be a good fit for my game. I have a fair amount of custom content that my groups uses and I want to create a content mod for it. I know I can use the in game Create Compendium and Create Item features but I have a fair amount of content and wanted to try creating it via code. I have a moderate amount of experience writing JS and JSON files and it sounds like a fun project to try out. However I haven't been able to find many resources for creating the Compendium with code. The documentation from Foundry only talks about using the in game options and looking through some of the mods that add content wasn't enlightening. I was hoping someone could point me at a guide to get me started on this, or tell me if I am completely barking up the wrong tree and this really can't be done. Thanks!...

Beginners help with doors

Hi foks. Apologies if i've posted this in the wrong place. I am totally new to working with Foundry, although not new to working with Javascript. I want to write a macro that will allow me to open an adjacent door with a key press instead of the mouse. Does anyone know if this is possible?... and a few pointers into which object I need to interact with would be so helpful. Im guessing " canvas.walls.doors[0]" or something? I suppose I just need to change the door "state" from closed to open?...

How to run code from a specific user

Hi, I have the function foo(bar) and when you run this function it opens a window with some details on...
Next