While not exactly an installable, DIY-system, The Boilerplate System by@unique crane has been a long-running project that has spawned numerous game system implementations that we've approved for listing on our package repository. It seems only fitting that it have a channel of its own for discussions related to its updates and workflows.
#Boilerplate System
1 messages · Page 1 of 1 (latest)
🎉
The boilerplate system has been invaluable in letting me make the system im working on now, whenever i wonder how to do something, i pull up the gitlab page and dive into the source.
Very cool stuff
New Release: Boilerplate 2.0.1
Release Notes: https://gitlab.com/asacolips-projects/foundry-mods/boilerplate/-/releases/2.0.1
Fixes
Small bug fix for the npm run generate command when executed on Windows. The script that copied data model files was not compatible with Windows file paths.
Credits
Thanks go out to @ocean tapir for reporting the bug and helping me debug it!
@unique crane
On 01. Getting Started I changed line 22 from generator to generate since generator produced this error on my machine
npm ERR!
npm ERR! Did you mean this?
npm ERR! npm run generate # run the "generate" package script
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in: %localappdata%\npm-cache\_logs\2024-03-29T16_04_46_459Z-debug-0.log```
Foundry VTT Community Wiki
Good catch! I renamed that during development and used the wrong one for the tutorial 
I also think there's a few references to the old foundry-generator npm package I created back in the day that I need to remove. I'm pretty sure I caught them all in the wiki, but the Gitlab page itself needs an update from my end.
Yes, that's one of those things that only really ever pop up again if a 'not knowing person' like me tries to really follow a tutorial step by step ^^
Plus I edited 07. Extending the ActorSheet class first sentence to include the file that you are explaining in that section just like in the other sections.
Foundry VTT Community Wiki
@unique crane I have one question that is not yet explained in the guide. You do give the option to create the actor and item structures inside the new System Model Data.
And since I chose the glamorous way to headaches I chose to do so.
Do I still need all the lines in the template.json or does the config.mjs do the job now?
I tried to compare it to the way the DND5E System was set up and do find some similarities. But man... Right now I absolutely don't know jack 😅
as of v11, you still need template.json to define the valid system-provided document subtypes
The DataModel approach and template.json approach require different structures. By default the system uses template.json. If you use the generate command and enable data models, it will replace the relevant files (template.json, document classes, etc.) with versions using DataModel.
You can see the alternative files for data models in the src/datamodels/ directory. Those are what will replace the matching files in the normal directories if you use the generate command.
oh look at that... I thought I ran the generate command with the choice of using the data model version but I see that the template.json did not get replaced... I'll run the command again and see if I did something wrong
Yeah, if it worked template.json will only be a few lines
alright, seems like that does not work
> boilerplate@2.0.0 generate
> node src/generate-boilerplate-system.mjs
? Enter the package name of your system, such as "my-system" (alphanumeric characters and hyphens only): fabula-ultima
? Enter the formatted name of your system, such as "My System": Fabula Ultima TTJRPG
? Enter the name of your system for usage in JS classes, such as "MySystem" (alphanumeric characters only): FabUlt
? Enter the name of your system for usage in constants, such as "MY_SYSTEM" (alphanumeric characters and underscores only): FABULT
? Use DataModel instead of template.json? Yes
Success! Your system has been written to the fabula-ultima/ directory.
PS %localappdata%\FoundryVTT\Data\systems\boilerplate> ```
template.json still looks like this
Hmm, I would double check that you’ve got the latest version of Boilerplate. I put out a release earlier this week that fixes a bug with the generate command on Windows.
used the master.zip from march 26th
alright, you changed that 1 day after 😄
got myself a new zip file. worked now
It looks like some of the example DataModels have label properties defined in schemas. That should probably be cleaned up, as it's a better practice to localize and associate labels in memory instead of saving them to the database
Especially now that you can define the label as part of the field itself, in prep for v12
Good catch, I missed that in the code review for them. Feel free to submit an MR, or I can take a pass at it later this weekend.
@wheat plume mind giving this MR to fix the data model labels a quick look? https://gitlab.com/asacolips-projects/foundry-mods/boilerplate/-/merge_requests/10
Yeah
honestly it might be worth asking if you really want to assign the label in prepareDerivedData or in getData
but otherwise looks good. You'd need to rewrite how you're setting up the context so that way you've got the objectified-system rather than the actual pointer
Good point. I was going for a lift and shift, but that’s render logic IMO and should be moved.
iirc the appeal of the existing actorData.system is that you're already pulling from the upstream toObject(false) call
Any specific advice on this? When doing this.document.system.toObject(), I lost the derived attributes since they were computed in the model’s prepareDerivedData.
mmm yeah that's the main downside of toObject
as of v10 they removed derived data from toObject and only iterate through the keys present in the schema
one option is to for stuff like abilities to just get their own piece of the context pie
Hmm, I’d rather avoid that if possible. It feels like duplicate work and more places for devs to accidentally miss when doing version upgrades X months down the line.
I’ll piddle with it and see what I can come up with. Haven’t tried cloning the object yet or anything else to simplify the object aside from toObject()
One more advanced option would be to override one or more toObject implementations
toObject(source=true) {
if (source) return super.toObject(source)
const data = super.toObject(source)
// figure out a way to functionalize prepareDerivedData calls and re-use them?
return data;
}
@unique crane what if you used the {{lookup}} helper
What dnd5e does for spell schools is it stashes CONFIG.DND5E inside of context then uses lookup to turn the @key into the label and icon
Is that a core helper? I couldn’t find it on the API docs.
Oh, nice. I’ll have to play around with that.
I've been piddling around with this and overriding it is super finicky because of how SchemaField works. I think I'm just going to implement an additional toPlainObject() method in the document class that looks something like this:
toPlainObject() {
const result = {...this};
// Simplify system data.
result.system = this.system.toPlainObject();
// Add items.
result.items = this.items?.size > 0 ? this.items.contents : [];
// Add effects.
result.effects = this.effects?.size > 0 ? this.effects.contents : [];
return result;
}
Also probably need to implement that in the data model as well in case someone does document.system.toPlainObject()
so some version of
BoilerplateDataModel extends foundry.abstract.TypeDataModel {
toPlainObject() {}
}
// everything then extends BoilerplateDataModel
Yeah, something like that. I had it in the actor base model and item base model, but it could go in a parent class instead to reduce duplication.
Also putting it on the document class itself so that you could do either document.toPlainObject() or document.system.toPlainObject()
The data model version would just be return {...this}; since there's not items or effects to worry about.
Alrighty, MR has been updated: https://gitlab.com/asacolips-projects/foundry-mods/boilerplate/-/merge_requests/10
kept forgetting to do this, it looks good now
I think I'm going to make one more pass at this before merging it, following the discussion the other day where Mana pointed out that the spread operator wouldn't be able to handle nested instances. Given that toObject(false) is considered a legacy path now, I doubt I'll keep the toPlainObject() around.
I'm looking forward to see the actualized version.
Following your system I learn a lot about system development. But some things feel too advanced for me to come up with that on my own ^^
@unique crane did some digging tonight in how Foundry's data model works - something to deal with in toPlainObject is that any instance of an EmbeddedDataField, e.g. prototypeToken, is going to be a class instance
Is this.actor.items.get inside a actor sheet async?
I'm getting ReferenceError: undefined. Cannot access 'item' before initialization when calling it. But logging it to console returns the object as expected the line before the error.
in a document sheet? No. But you might be trying to call it too early
Foundry VTT Community Wiki
The core Game instance which encapsulates the data, settings, and states relevant for managing the game experience. The singleton instance of the Game class is available as the global variable game.
I'll check it. But I don't understand how can it be early. This is a edit button in a actor sheet, just want to open the item sheet. It's working everywhere else, even in the same sheet, but not on one particular item type.
Could you provide more context in #system-development? This isn't really about Boilerplate specifics
Oh man, I thought I was there 🤦♂️
Hey folks. Posting this now in the correct thread.
In character.mjs's defineSchema, the example places Level in schema.attributes and your D&D stats in schema.abilities. I was wondering if there are any guidelines or rules about what kind of data goes in which - I don't know enough yet to know if the division between the two is load bearing, or if mod developers would have expectations as to how things are categorized.
In the system I'm working on, the equivalent of D&D stats are called attributes, so I'm guessing I'm going to need to rearrange things anyway to keep my own sanity while developing.
There are no hard rules on what to name the properties in your data model, so you just need to go with what makes sense for your system and feels consistent. Those were included in Boilerplate as examples of how you could structure them, but you should plan to remove them and replace them with something better.
My original generator back in the Foundry v9 and before times actually had an option to leave those out altogether, but I haven’t reimplemented that in the new generator script yet.
Roger that. Thanks!
Are you anticipating any major changes for Fonudry v12? I'm deciding whether I want to use boilerplate to spin up a system soon or wait for v12 updates.
The current version will work fine on v12, but there's a lot of update opportunities going into v12
App V2 is an obvious one
But you've also got the abolition of template.json for the data model version of the system
I read the documentation on data model, and I understand that it's closer to Fonudry's core functionality. But I'm not understanding how that benefits me as a developer. It seems a little harder to use than template.json. Is it something I should be more excited about? 😅
Two main reasons to like data models
- Stronger client side data validation
- Proper polymorphism via the
systemfield
There's some field specific benefits — better handling for arrays and I like how smoothly ForeignDocumentField works — but those are fairly ancillary to the above two
Nice. If you were in my shoes, would you start using boilerplate now? Or would you wait until some of the v12 changes were implemented first? Maybe migrating to the new v12 features won't be too bad?
I figure once Test 1 comes out I'll file a MR for the v12 updates
The reality of how Foundry does development is a lot of really key details don't get filled in until very close to release, so you either scramble to match their Test1/Test2/Stable or just let it ride a bit
Basic example: ActorSheetV2 and ItemSheetV2 aren't available yet, so those key building blocks of a functional AppV2 based sheet class aren't ready yet
That's really helpful context, thank you. The main reason I'm looking to switch to boilerplate is that there's serious html/css tech debt in my current project (a fork of an abandonware system). I'll probably hammer away at some of the stuff I want to do that isn't related to the character and item sheets. And I'll switch once the App V2 updates are in.
Yeah, the Document classes aren't meaningfully changing
The only v12 data architecture change is moving the last bits of data from template.json into system.json for the Data Model version
Another piece of Boilerplate that we'll need to work through is I'm sure @unique crane wants to add support for non-hbs rendering engines, but those packages are still being written
Tbh the more I look at App V2 the more it's clear we won't see the full benefits for a few months until all the devs can properly build on top of it and work through stuff
Cool. Maybe I'll give it a shot soon and target v11.
Other rendering engines would need to be optional variants like the current data model option of the generator script. With that said, I think the non-hbs rendering will likely be high level overview stuff initially, along with links to specific implementations as they’re created. The non-hbs setups are also more opinionated, as they’ll get into things like a compile step to compile the components used by Vue with something like vite.
I'm curious, is there a list of systems that started with this boilerplate template? I know they're out there, but it would be great to see a few examples.
I don’t have a list myself, but it’s a pretty common starting point for systems started after 2020-ish. Because of the MIT license, they should have an attribution to note it somewhere in their repository or Foundry package, but I don’t monitor or enforce that.
One of the easy to spot signs is if they take advantage of the grid CSS classes I ship with the system, like grid-2col for layout. The actor sheet’s getData() structure is also pretty particular and a good indicator of it.
For systems started prior to 2020, we typically either started from dnd5e or worldbuilding, though it was possible to start from scratch but not really documented.
So, up from the dev mines: It's likely that ActorSheetV2 will be much more bare bones than ActorSheet, in the name of more flexibility for systems to define their own behavior. I think that means Boilerplate should step up to provide some sensible defaults.
Making good progress on v12 updates!
I want to override and customize the Active Effect's Config sheet, but I can't.
What am I doing wrong?
The code is as follows.
mysystem.mjs
import { MYSYSTEMActiveEffectConfig } from "./sheets/active-effect-config.mjs";
~
Hooks.once("init", function () {
~
CONFIG.ActiveEffect.sheetClass = MYSYSTEMActiveEffectConfig;
console.log(MYSYSTEMActiveEffectConfig.defaultOptions);
active-effect-config.mjs
export class MYSYSTEMActiveEffectConfig extends ActiveEffectConfig {
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
template: "systems/mysystem/templates/effect/active-effect-config.hbs",
});
}
}
In the console result from console.log(MYSYSTEMActiveEffectConfig.defaultOptions);, template returns the correct path, but calls the core html file when opening the Active Effect's Config screen.
Help me.
This is a machine translation, so sorry if it's a weird sentence.
Resolved.
#system-development message
Implementing my own DragDrop in the Actor and Item sheets because core software isn't doing that
Hey folks, I am just now dipping my toes into Foundry because some of our players have asked for Foundry integration for our game. I'd like to create a character sheet and tokens, but I am having trouble figuring out just how to make a character sheet. When I click "Create Actor" as many tutorials suggest to start on the character sheet, I get a message suggesting I chose a template, but there are clearly no templates for a new game. So how do I create a template and where do I put it? Can I upload a fillable PDF, etc?
did you actually download and startup Boilerplate?
If the game system you installed and created this world with was Simple Worldbuilding, you’ll want to ask this in the #1037073983335563457 thread.
no. I was sent here from another thread. Is there a tutorial about how to install/customize Boilerplate?
If Boilerplate doesn't seem to be the best fit, that is my next stop for sure.
Do you want to code the system?
I'm not opposed to it, that is, having someone on my team take a look, but I need to be able to hand them the information/tutorials they need to make it as easy as possible. So far, Foundry seems not immediately intuitive, so I'm trying to do as much legwork as I can on their behalf.
GitHub
Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/S...
Foundry VTT Community Wiki
Thanks!
Okay, a little rant here (and maybe someone to lend a helping hand.) Two days ago I tried to code Exalted 2nd edition into Foundry because using Discord and dice bots does not seems to vibe well with the group. So, since I am the player with the most time on his hands. I volunteered.
I have a basic grasp of HTML, CSS and a newborn in java. I checked the tutorials on the wiki and, well, I am at a loss.
Where should I actually start? Making a character sheet? Make data for skills and dice rolls?
Having someone to share their workflow would be goodsend at this point.
Java or JavaScript?
Foundry uses JavaScript
javaScript
And then just to check, were you using this guide? There's unfortunately a lot of other, older and out of date guides elsewhere on the wiki
Yes, that's the one I am using at the moment, but I find it glosses over a lot of things. I also know it's probably my lack of knowledge, too.
I check the files of there system also to how they do things, but that just confused me more. 😛
If you could elaborate where you're getting stuck that would be helpful
@somber portal I also know some people have found this guide helpful
Foundry VTT Community Wiki
Tracking the permutation of data from the server database to a document sheet rendering.
Well, I think I had a confusion about what kind of things I was working with. I am using the DataModel option, so I was probably following the wrong guide all along by trying to modify the Template.json to no avail.
Ah yeah the data model almost entirely replaced template.json
Yeah, I was wondering how to input skills and stuff, but I need to create Schema for them before putting them in the character sheet, which was the problem I was having for the past two days.
I'll be honest the data model option is by far the more complicated version
Probably, but by boucing off idea with you, I figured it out a little, thank you! 🙂
Big feature upgrade coming in the v12 branch: Full utilization of the new ActiveEffect sort field
including handling for the mixed case of "Active Effects on both the original actor as well as items"
nothing in Boilerplate broke in v12
nice
currently have a PR to upgrade its sheets to AppV2
what's a pr?
Pull request
GitHub
Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/S...
Ah.. okay. Yes. Didn't think of git
everything is git all the time
now that v12 is out I try to start freshly from boilerplate.
when I fired up foundry with the my newly generated system, I got the following message for the boilerplate system, and my system
The system "boilerplate" is using "gridUnits" which is deprecated in favor of "grid.units".```
I found these inside `system.json` and changed them to the version with the dot inbetween.
But now i get
`The "Fabula Ultima TTJRPG" system's manifest contained the following unknown keys: "grid.distance", "grid.units"`
The dot notation is talking about a nested object
grid: {
distance
units
}
oh, I see
Is there a good way to attach items to other items in this system?
I'm looking at some systems that have done it before, and I'm thinking about trying to copy over some of that, but if I'm just missing a function or something I'd love to hear about it
It's basically all done at a rendering level
You're running into a core Foundry data architecture limitation
Dnd5e does it by having a container property that points to another item in the same collection
Avatar Legends seems to have an attachment system that works the way I'd like it to. But it's obvious whoever wrote it is leagues ahead of me so I'm not sure I'll be able to reverse engineer it
Figured I'd throw out a line on if there was some basic function, looks like I'm mostly SOL lol
In theory the rendering logic isn't that hard
I've read your rendering doc a few times, it still escapes me on how to utilize the knowledge to it's full potential
I'm sure after a few more weeks/months something'll click
You just wrap your item display in {{#unless item.system.container}}
There's also the drag and drop functionality to put in place too, but I think I see what you're saying here
You also want the link doubled up on the container so that you can display there
Contained item has a property pointing to its container. Contained also keeps a list of items it contains.
You'll need to sync your updates to maintain those together
Hmm, alright
Thanks for the help! Seems like I'll need to research this from the ground up and walk before I run
It's complicated
That does make me feel better about it haha
Following up this post (#system-development message) from @trim hatch in #system-development:
Hello everyone, i am sort of new in the comunity. I was very interested in making my own system and was looking to start from https://github.com/asacolips-projects/boilerplate. my question here is, when i run "npm run generate" i ask for the version with data model but the folder src dont contain the data model folder... so did i do something wrong or am i just a little dumb dumb and i dont understand the concept at all?
This first thing I would try is cloning down a fresh copy of the Boilerplate repo and making sure you're on the main branch. Looking at it directly on Github, looks like the files are still present in src/datamodels/: https://github.com/asacolips-projects/boilerplate/tree/main/src/datamodels/module/data
Aside from that, if you can post a copy of your error message here, that will help me identify what's going on and debug it.
I downloaded the latest main version from GitHub, but my "problem" comes from using "npm run generate." I use it to change the filenames, but when I take the files generated in the build folder, I don't have the dataModel folder in src. It doesn't send any error, and since I'm new to using data models, I don't know if this is normal or not. In the worst case, I can just use the raw files and rename everything by hand.
Check the top level module folder
My understanding is with the generator it pulls stuff down
your right, now i file like an idiot, but on i'm also happy :). well thanks for your help!
Yeah, if you choose the data models option during the generate command, it will copy the files from src/datamodels/* into build/[my-system-name]/*. So you won't have a datamodels folder specifically, but they should be included where needed.
I believe the src/ folder itself will still be brought along, but only for the scss files in case you want to use those for your CSS rather than just writing CSS directly.
yes the src and scss are stil here. It just changed the mjs file's location.
once again thank you and have a nice day, you are amazing!
You too, good luck and happy coding!
For those following along with my PR - @dense lake that's you - I just changed out the {{editor helper on the description and biography with the new <prose-mirror custom element
Cool I'll take a look at it today ❤️
export default class BoilerplateItem extends BoilerplateItemBase
should be now called XxGear with the other changes you made (nothing is currently breaking due to it being default and renamed in _module, but still. 🙂
export default class BoilerplateGear extends BoilerplateItemBase
Thanks
I'm refactoring the actor-sheet and item-sheet so "basic behavior" like drag and drop is moved into a base-sheet. (refactoring helps me better understand the code & I think its cleaner)
Any specific reason you added ActiveEffect to Features but not to Gear? And is it correct that the shown "Source" isn't fully working yet?
I believe it’s just that we picked Features as the example, as there’s no technical reason why other item types would have problems with it.
Can you expand on the source thing? That sounds like a potential bug.
The source column should work
But yeah the reason for features is purely arbitrary
v12 branch:
The effectData object in item-sheet _createEffect doesn't contain an origin parameter
target.dataset logs a DOMStringMap object, which doesn't contain the origin
btw, you also try to use target.dataset.type, which is undefined
Aha! I see the rootcause
Feel free to file an issue or PR
templates/item/effects.hbs is missing data-origin="{{@root.item.uuid}}" after line 22.
🙂
I'm blind - I dont see a way to raise an issue to https://github.com/JPMeehan/boilerplate/tree/v12
You should be able to make an issue against the main repo. That's ChaosOS' fork in your link. https://github.com/asacolips-projects/boilerplate/issues
I'm somewhat new to making systems and can't find where the variables are stored. I remember they used to be stored in the template.json, but I cant find them with the new data model.
If you're using the data model version, they're defined in the data models
Specifically by static defineSchema
Foundry VTT Community Wiki
The abstract base class which defines the data schema contained within a Document.
I found the ability vars being generated in the actor-character.mjs not sure where the others are, but now i know what im looking for. thanks
Hello all, I've been pecking away at trying to make a simple system for a friend but I've hit a bit of a roadblock. I know I can give a line on a sheet the rollable class to make it a button that rolls, and I've modified the attributes to fit how they want it to work, but I can't figure out how to make something roll a script macro on click.
So, ultimately click listeners are registered in activateListeners
Does it need to be an arbitrary script macro?
Or is it just an existing function?
Either or. I have it as a script macro right now but I could presumably turn it into a function pretty easily, yeah?
It's generally best practice to implement methods everyone is going to need directly into the code
Is it a long function or a short one?
The basic idea is in activateListeners on the sheet you use html.on('click', 'selector', callback)
Pretty long. The macro makes a window where they enter a few numbers and then it does some math with it.
Selector is a valid css selector — the existing Boilerplate uses .rollable for example
Okay so you probably want to make the callback a separate function for readability reasons
MyActorSheet extends ActorSheet {
activateListeners(html) {
html.on('click', 'selector', this._callback.bind(this)
}
_callback(event) {
// Do stuff
}
}
The bind(this) is a JavaScript thing to make sure the context for the function remains the actor sheet rather than the event
I'll give that a shot.
And I can replace selector and callback with whatever I want, right?
If I add the bind the sheet doesn't load right anymore.
activateListeners(html) {
super.activateListeners(html);
// Render the item sheet for viewing/editing prior to the editable check.
html.on('click', '.item-edit', (ev) => {
const li = $(ev.currentTarget).parents('.item');
const item = this.actor.items.get(li.data('itemId'));
item.sheet.render(true);
});
// -------------------------------------------------------------
// Everything below here is only needed if the sheet is editable
if (!this.isEditable) return;
// Add Inventory Item
html.on('click', '.item-create', this._onItemCreate.bind(this));
// Delete Inventory Item
html.on('click', '.item-delete', (ev) => {
const li = $(ev.currentTarget).parents('.item');
const item = this.actor.items.get(li.data('itemId'));
item.delete();
li.slideUp(200, () => this.render(false));
});
// Active Effect management
html.on('click', '.effect-control', (ev) => {
const row = ev.currentTarget.closest('li');
const document =
row.dataset.parentId === this.actor.id
? this.actor
: this.actor.items.get(row.dataset.parentId);
onManageActiveEffect(ev, document);
});
// Rollable abilities.
html.on('click', '.rollable', this._onRoll.bind(this));
// Drag events for macros.
if (this.actor.isOwner) {
let handler = (ev) => this._onDragStart(ev);
html.find('li.item').each((i, li) => {
if (li.classList.contains('inventory-header')) return;
li.setAttribute('draggable', true);
li.addEventListener('dragstart', handler, false);
});
}
// Click event for Actor sheet's button.
html.on('click', '.actorroll', this._pcskill.bind(this);
}```
The short answer is there's a syntax error
Go to the top of the console, click on beforeDOMContentLoaded, and you'll see the error
Should I have put it at the top instead of at the bottom in the inventory stuff?
You're missing a closing parentheses
What kind of IDE are you using?
Kate. Basically notepad++
Found the missing parenthesis. The text doesn't highlight but that's a very minor issue by comparison.
What tag did you wrap your text in?
Usually using an a tag provides better default styling for click listeners
It includes hover highlighting
Upgrading to something heavier duty like vscode might be better, it will catch stuff like the missing parens
Since I was just trying to make things work period rather than well it was just <div class='actorroll'>Sample Text</div> to see if the activator worked.
Yeah, replace div with a
Perfect. Thank you so much!
Np
I see in your branch @Chaos that your context adds
editable: this.isEditable,```
is there a reason this isn't isEditable: in the context?
Because I wanted to replace as little as possible in the templates and that's what AppV1 used
It's arbitrary, feel free to name it what you want
my v1 used isEditable, so I guess if that was working I should leave it alone.
Final merges have been made to Boilerplate v12, it's now fully usable; however, wiki updates still need to be written
To use the v12 and AppV2 version of Boilerplate, you can run the following to clone it and check out the v12 branch.
git clone https://github.com/asacolips-projects/boilerplate.git
cd boilerplate
git checkout v12
Wiki updates will likely be written as a new guide altogether that reorganizes the same content from the previous guide along with more material on the front half to ease getting started with Foundry. If there's anything in particular that tripped you up when you got started with the tutorial, let us know and we'll try to account for it in the new one!
@wheat plume I have a system I generated from v12 to get access to the AppV2 implementation. I'm trying to convert an application I already have, can I just change:
dragDrop: [{ dragSelector: '[data-drag]', dropSelector: null }],
the dragSelector to something else?
Ta
btw were there (code/css) changes from your fork of June 14 since the new merge with asacolips?
in ActorSheet.DEFAULT_OPTIONS are you still overriding handler
12.328 added some more controls in DocumentSheetV2 that I implemented
yea handler: this._onSubmitActorForm,
okay reworked that stuff so it's just a simple _processSubmitData override: https://github.com/asacolips-projects/boilerplate/blob/v12/module/sheets/actor-sheet.mjs#L734
GitHub
Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/S...
I see I'm missing a lot more changes 😄
Yeah, there were a few merged PRs, so I would just spot check those. Off the top of my head, the other things I tweaked this weekend were getting avatar changes on the sheet to work and some small tweaks to the CSS related to headlines.
I’ve also made some changes on a system I’m building with Boilerplate that I haven’t backported into it yet, like fixing scroll behavior if the description on an item is super long.
yea I'll go through the git commit log manually
Ok, I think I'm fully in sync again 😄 Nothing broke after manual edits hehe
If you'd like to follow along with the system I'm building off of Boilerplate as another reference point, you can find it here: https://github.com/asacolips-projects/grimwild
It's still pretty experimental since this is my first time using data models and AppV2 in an actual system, but it may be helpful just as a comparison. One significant difference is that I'm using an src/ directory and a build script, like with most of my other projects.
Btw
What is the purpose of ActorSheet._processSubmitData ? I don't really see where this.actor.overrides is set and why it the submitData needs to be transformed.
@wheat plume has more background on why that's in our AppV2 implementation specifically, but IIRC it's missing from AppV2's version of the document sheet and handled for us here. Sheet form submits include all named inputs, so that's stripping out any fields that are currently using active effects to prevent accidentally modifying them while they're overridden.
As for where overrides are set, I believe that happens earlier in the document process when effects are being applied.
this.actor.overrides is part of Actor#applyActiveEffects
Ah I see now
the foundry Actor class has a overrides property
Hmm, if I debug a little bit, I don't think we really need to perform the for (let k of Object.keys(overrides)) delete submitData[k]?
See:
If I disable the effect:
Then the health.max is included as normal:
Ah I think that DocumentSheetV2._prepareSubmitData already does the necessary cleaning:
Set up an active effect that alters a number field on the sheet, then edit a different field
Hmm I wonder if it's because there's also the field disabling
That's a new addition by me not in ActorSheet
Ah yes you're right
If I comment out, then the health.max gets send in the submitData
I think it's correct for Boilerplate to include both in this case
Sure, but I added a comment in my own code to make me remember 🙂
in case I change #disableOverrides in the future
I got a little problem, it's strange but not the end of the world, but if I do Like picture 1, I get the message in picture 2.
If I change to the appelation in picture 2 and open FoundryVTT it warns me that the names "gird.distance" and "grid.units" are not recognized by the system.
The v12 branch of Boilerplate has all of these adjustments made
GitHub
Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/S...
in this case, the new format is
"grid": {
"type": 1,
"distance": 5,
"units": "ft",
"diagonals": 0
},
Oh, I guess I didn't download the right version! And I hd so much trouble setting everything up with GitHub 😛
I guess I can change the stuff in picture 1 to what you just suggested?
Or am I going to get other surprises?
Did you just get started?
The v12 branch totally reworks the Actor and Item sheets, and the reason it's not merged into main is the guide hasn't been updated to the reworked sheets
Basicaly, I did nothing except minor changes to the system.json (like version and suff.)
ah yeah just download the v12 version
Ah, I used the guide version, that's why P
the v11 versions still works in v12
I managed to change everythin without issue. Thanks for the info ! 🙂
Anyone as a good exemple of a system that use BoierPlate, I would lik to see an exemple. If anyone is willing to share 🙂
there's been quite a few people who have started with Boilerplate, I know @dense lake has been working on something. Do you have a more specific question on how to do certain things?
The point of Boilerplate is it's a starting point that can be molded based on the RPG system you're adapting
No, not rally specific, I am mostly looking for exemple to know where to start. I amtrying to port Exated 2e to Foundry. I know there is a module for 3rd edtion, but it is not made with Boilerplate as far as I can see.
So I wanted to check out what somene else did to give a good direction to start with.
projects that start with boilerplate quickly diverge as people write their own stuff, plus we've updated a number of the internal stuff.
Usually, a good place to start is figuring out what types of actors and items you need
and then defining their data models/template.json entries
I see! Just this bit of information gave me a lot to consider! 😛 Thanks!
Something important to realize: Boilerplate is a fully functional example system. 🙂
Best place to start for an MVP:
- Download boilerplate
- Use the npm generator to create your own system. It will be a copy of boilerplate with your own system name.
- Change the Actor/Item attributes so it has your own systems attribute schema. (important: keep it a simple attribute structure at first. Look at the simplest pdf character sheet of your system and recreate it.)
- Change the template html and css to prettify the actor and item templates.
- Change the initiative formula
Tadaaa 🙂
Important to read fully:
- Creating your own system via boilerplate tutorial (step by step) https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD01-Getting-started
- Getting an understanding of how Foundry load things step by step (warning: its a bit complex so only read this once you're comfortable and run into an issue that needs this understanding) https://foundryvtt.wiki/en/development/guides/from-load-to-render
- If you use DataModel in step 4 of the tutorial: https://foundryvtt.wiki/en/development/api/DataModel
Thanks, but I already did the installation according to instructions. 🙂
I'll check out the links, but the first one seems familiar.
Just a double check, but if I look at the class structure, any Document/DataModel prepareXxxData() should always call super.prepareXxxData() correct? Shouldn't we add that to boilerplate as well, in case e.g. someone adds stuff to both actor-character.mjs and base.actor.mjs?
Documents sometimes do stuff in prepareData, but TypeDataModel is intentionally blank
currently Actors and Items don't do anything in super.prepareData which is why it's left out
yea I mean we use inheritence within the datamodel classes BoilerplateCharacter extends BoilerplateActorBase
but we don't call super.prepareDerivedData() within BoilerplateCharacter.prepareDerivedData()
oh yeah definitely should do that there
yes, true. Just thought it would be handy to add to make it more js class newbie proof
yeah, good suggestions
I need to put my //TODO refresh git memory at a higher priority 😅
Question on Handlebars as it's used in Boilerplate. In some of the hbs templates, #each is used in a format like this: {{#each system.abilities as |ability key|}} The Handlebars docs reference using @key, but don't explain using as. Is that a Handlebars thing that isn't documented, or something else?
I mostly got curious because the format has it as |value key|, and I would have expected it the other way around.
Somewhat related but different questions:
In actor-character-sheet.hbs, it loops through the default defined abilities to display on the sheet. The way it's doing it doesn't match the way explained in the Localizing Arrays of Labels section of https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD13-Localization - it's instead using a lookup: {{localize (lookup @root.config.abilities key)}}.
I grok lookup. My questions are, can you explain what is going on with the @root usage and why we're going there instead of the system.abilities info we're iterating through?
Foundry VTT Community Wiki
I’m fairly certain it’s a built-in thing, but my Google searches are failing me. At any rate, that’s the order of arguments and I’ll blame Handlebars weirdness for it.
Lookup was a recent addition to this template. @root lets us access the top-level variables in the template (so context returned by getData() ) which is where the config variable we’re looking it up from is at.
Both the older approach in the tutorial and the lookup approach in the current version of Boilerplate will work, so it’s more of a preference thing than anything.
Ah! Gotcha. And you need to go to root because we're pulling the name of the localized string location, which isn't in that attributes object we're iterating on.
Yeah. We made some recent adjustments to better accomodate the data model version of the system
A lot of the old code leaned on toObject to get a clone of the system field, but with data models that doesn't work too good
@unique crane would you consider the V12 boilerplate branch with AppV2 stuff in a good enough state to use? (thinking of switching my side project over to that to to learn how it App V2 works)
yeah it's largely functional. There's a few minor bugs which you can see in the Issues but I've been using it as a template for other stuff I've been up to
cool ty.
Yeah, the main thing you may run into are other parts of AppV2 that are missing and haven’t been noticed yet. One example was that actor avatars weren’t handled by default, but we pushed out an update last week to fix that. If you notice something while using it @hollow cave, feel free to submit an issue or PR.
The main reason it hasn’t been merged is that the accompanying tutorial needs an overhaul to make it useful, as it’s significantly different than the setup the tutorial explains.
Makes sense
So I seem to be doing something wrong with custom status effects. Specifically ones using icons outside of Foundry's base set, as far as a few quick and dirty tests seem to show.
I can't paste the whole config.mjs but I'll paste a sample.
{
id: "charmed",
label: "Charmed",
icon: "systems/dungeonpunk/icons/status/charm.svg",
description: ""
},
They appear fine as the host, but I can't join if I use a browser unless I remove all of the ones that are using icons from the system folder.
Or rather I can join but it just gets stuck at about 80%
Is that browser Firefox?
You need an explicit height and width
So instead of style="height:512px;" you want height="512"
Oh I see you asked in #system-development
Please only ask in one spot or if you ask in multiple mention you got your problem solved
Is V12 branch usable or there is still some stuff planned?
Fully usable just missing an updated guide
Maybe I missed something in the chat or the wiki, but https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD06-Extending-the-Actor-class refers to /module/documents/actor.js, while previous pages in the guide refer to actor.mjs.
Not really confusing when I dig through Boilerplate’s files (find . -type f -name actor.js ; grep -r 'actor\.js' * returns nothing) and determine actor.mjs is the correct reference.
Let me know if I missed something or if this is just something to correct in the wiki.
Foundry VTT Community Wiki
Yep, that’s just a typo as the system switched to the convention of using .mjs for JS files that are ES modules. Good catch!
The wiki is only 11 confirmed, so I think I understand the inconsistency.
I was warned… 😉
Yeah we're about to do a big update of the guide for v12
Excellent. https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD08-Creating-HTML-templates-for-your-actor-sheets seems to reference a lot of no-longer-applicable things.
Foundry VTT Community Wiki
I’ve been informed some of the language about development options are not options; npm is required.
npm is technically still optional, as you can clone the system and do the replacements manually as suggested in option 2. It would be correct to say that npm is recommended though, as the generator eliminates a lot of false positives and gives you a good head start. I'll make a note of that for clarification when we get to the v12 update 👍
Over in #system-development, I learned I’m hitting the brick wall at SD08 because I’m working with npm input scripts and not the actual built system.
So it’s technically still optional, but the wiki directions cannot be followed if it’s not used.
Well, I misstate that, so let me clarify. npm seems to allow for building either DataModel or template.json, but the statement “you cannot forego that” with regard to installing npm and running npm install and npm run generate is 100% accurate.
? Use DataModel instead of template.json? (y/N)
That's a fair point and something we'll consider on the rewrite. With that said, the use DataModel step of the generate script pulls equivalent copies of files (ex: module/sheets/actor-sheet.mjs) and replaces the ones in the main directory with them. The tutorial doesn't make that clear however.
To be clear, this is helpful feedback and something I would like to update in the guide, so thanks for catching this!
Just to clarify where this is all coming from:
- Gamer. Want to build a system to help friends run a game.
- Software engineer. I should not be allowed to write public-facing code documentation, because I will make assumptions based on the months I’ve spent learning and re-learning what I’ve written.
I'm not sure asacolips actually wrote the tutorial, that might have been ChaosOS
Happy to be corrected either way
If you want to use data models without using the npm run generate script, you can do this process:
- Clone the version of Boilerplate from Github: git@github.com:asacolips-projects/boilerplate.git
- Copy the folders from
src/datamodels/to the top-level of the directory and replace the original files. Thesrc/datamodels/directory is an exact copy of the relevant files and folders from the main repo, but using DataModel instead. - Do the manual find and replace to rename "Boilerplate" per the guide.
The original work is asa, I've just done updates
I did write it originally, way back in 2020. ChaosOS made a ton of improvements to it this year however (along with throughout the wiki as a whole!)
Hi. I'm new with foundry and with the boilerplate system. Is there any reason why it doesn't use form input or form group helpers? I'm starting to use them in my bootstrapped system and they seem quite useful
because those helpers only work with the Data Model version
and right now the templates are for both the template.json and data model implementations
if you're using data models feel free to use the helpers, they're quite nice
Thanks. Makes sense
Hello, I'm new to the boilerplate system. I have when I do npm install I have 2 high severity vulnerabilities that are displayed is this normal and I can override or I did a bad intallation. I precise I have cloned the version github.
Screenshot?
I'm not sure if @unique crane has dependabot configured
You can run npm audit fix safely
Let us know if it does, but I suspect this is just because Boilerplate doesn't have dependabot to update stuff
Ah, yeah, I need to get dependabot in there. @slate grove I just spot checked it on my local and there's no problems with either the generator or the scss build command after updating, so you're good to update it.
okay thanks
Whats the difference between this and Custom System Builder?
This system requires coding
CSB lets you build a character sheet within Foundry’s UI using the building blocks it provides, while Boilerplate is a starting point to build a system from scratch with JavaScript, HTML, and CSS.
Gotcha
I know a bit a JS but not HTML or CSS, I have hit some walls with CSB so wanted to see what else was available before I started fighting through them
Html and css are easier than JS the boilerplate has every basic thing you need to kick off a system and learn from it
Ok
Foundry VTT Community Wiki
There is there tutorial for the system. I'm pretty new and have been following it and looking at how systems do things
Thanks Void! I will go through this a bit before I decide but thinking that maybe a good way to do it. I game we run biweekly within the system to remove bug, introduce features but I am only 1 person, if this gives me a bit more flexiblity, I think it would be worth moving over.
Well that's certainly an opinion. 🙂 Personally, I find the html and css much more difficult, but then I'm a programmer, not a front end guy.
The #system-development channel is friendly and helpful, don't be afraid to ask questions.
It's worth noting that Boilerplate includes a bunch of grid CSS classes to try and make it a bit easier to do sheet layouts. I actually wrote them to help more quickly prototype layouts on my own systems and included it in Boilerplate in case they were helpful.
A basic example for using a 3 column layout to have two nested divs, one that's 1 col wide and the other that's 2 cols wide:
<section class="grid grid-3col">
<aside class="grid-start-1">Sidebar, one column wide</aside>
<article class="grid-start-2 grid-span-2">Main content, two columns wide</article>
</section>
Getting things positioned where you want them to go is one of the trickier parts of CSS, so my hope for that feature was to help ease the process a bit.
When running the generate script is asks Use DataModel instead of template.json? I am not sure what DataModel is and all the guides I've seen so far use template.json . What is the difference and will template.json be depreciated?
additional question is there anywhere I can read or watch to understand DataModel
I see this has already been answered: but any tutorial on DataModel would be appreciated.
Yeah there's definitely a need to write a proper tutorial but neither asacolips nor I have had time
In the meanwhile
Foundry VTT Community Wiki
The abstract base class which defines the data schema contained within a Document.
Is boilerplate verified for v12? Thinking about to start from here.
It has a v12 branch that takes advantage of ApplicationV2, but the tutorial hasn’t been updated for it yet. However, the main branch that was written for v11 is still compatible with v12 if you would like to follow along the tutorial.
why files are .mjs? how to use usual javacript?
They’re still plain JavaScript. The .mjs extension is just a convention that they’re ES modules that can/should use import and export statements.
Warnings will bother me = (
I just cleared Year Zero Roller from warnings and created pull request. Feels Good.
But without tutorial it will be impossible to do something I think? You said that v12 branch rewrited Actors/Items, will it be hard to move after you will update the tutorial?
from Foundry's POV the actual CommonJS vs ECMAScript is decided by whether you use scripts or esmodules to link your root file in module.json
I don't think the v11 branch even throws warnings
AppV1 isn't gone yet
Now I think about moving back to v11. Cause your tutorial is for v11 and World Explorer module doesn't fully work for v12. Is it even a good idea?
Either is fine and just depends on your comfort level. The v12 branch will be tougher to learn since the sheets are fairly different, but that’s what this channel and the #system-development channel can help with. The v11 version is also good to use, but will require more effort to upgrade to ApplicationV2 if you ever want/need to do that. It’s for sure doable though.
Ok, I installed boilerplate through npm generation. It launched fine. I added my roller as I did in Simple Worldbuilding. And... it is not working. And doesn't throw any errors in console.
It is Year Zero systems roller. It creates dice roll chat message with "Push" button. Message is created, but "push" button do nothing.
So there is 'roll.hbs' with:
<div class="dice-buttons">
<button class="dice-button push" data-action="push">{{localize "YZUR.CHAT.ROLL.Push"}}</button>
</div>
And class with 'push' method:
class YearZeroDie extends Die {
push() { }
I don't even know where to start to debug it. console.log in push() didn't work out.
I made correct imports - as I did in Simple Worldbuilding:
import { YearZeroRollManager } from '../lib/yzur.js';
import { YearZeroRoll } from '../lib/yzur.js';
hook init has:
YearZeroRollManager.register('num', {
'Roll.chatTemplate': 'systems/numenera-yze/templates/dice/roll.hbs',
'Roll.tooltipTemplate': 'systems/numenera-yze/templates/dice/tooltip.hbs',
'Roll.infosTemplate': 'systems/numenera-yze/templates/dice/infos.hbs',
});
game.numenerayze.roller = YearZeroRoll;
So the problem is somewhere in boilerplate system.
Solved. I needed to add event listener for a button.
init hook has these lines:
Actors.registerSheet('boilerplate', BOILERPLATEActorSheet, {
makeDefault: true,
label: 'BOILERPLATE.SheetLabels.Actor',
});
but api doc doesn't follow these parameters:
https://foundryvtt.com/api/classes/client.DocumentSheetConfig.html#registerSheet
how do I need to understand docs? Or it's v12 changes?
Why is there 'actor' and 'system'? Isn't it the same entity? It is so confusing with all of re-re-re-assignments.
It’s a bit of an older convention, but the document’s system property is aliased to system for the sheet template for convenience. You could also do actor.system.health.max and so forth if preferred.
The reason for the context.system = actor.system is so the value path matches the name
Note that Actors.registerSheet is equivalent to DocumentSheetConfig.registerSheet(Actor
the value path matches the name
I read it a few times, but I still didn't get what you mean. Comment also says about "easier access". If not do it then we will need to access properties byactor.systeminstead of justsystem, right?
Yeah actor.system is totally valid. My point was though see how on that input there's both a name and value attribute?
Broadly speaking your only going to use the root actor properties like, twice — name and img. Everything else is going to be under system
But nobody is forcing you to remove the leading actor
Yeah, I see it now. But name can be actor.system. too, right?
The name value is for Foundry's form handling and is ultimately fed into an actor.update call
So it should always be properties of the relevant document
Hi Nath could we update the pinned link? https://github.com/asacolips-projects/boilerplate
GitHub
Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/S...
Hello! I'm a beginner in this type of system creation, I come from Sandbox, but I believe that Boilerplate is even better, more customizable and with the latest version.
Is the Boilerplate documentation here? Can I follow the guide for creating a sheet here?
https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD03-systemjson
Foundry VTT Community Wiki
Yeah, did you figure out the clone the repository + use the generator part?
other question - do you have prior programming experience
I have a lot of experience with Frontend, but not much with Backend, so my JS is not very good.
I have already cloned and created the repository on my github, it is already linked there too. I am at the system.json part.
OK, it looks like you didn't use the generator
the main Boilerplate repository has a bunch of extra tooling that isn't relevant to your system
Revert changes and run npm run generate to build a copy of the system
that will go into the build folder
I strongly recommend this method
Ok, i'll be back then
(screenshot from the README)
another thing to consider is if you want to use the v12 branch
it's fully functional but it doesn't have a walkthrough
So is version 12 working now? Well, I'll go one step at a time. 😂
I've already done this, lol
the generated copy was put in the build folder
you need to grab that and move it to its own folder in data/systems
now you can edit. However, I will note that if you want to use the v12 branch of boilerplate you will have to re-run the generation
also, system-cardigan isn't a good ID primarily because of course it's a system
you can just do cardigan
Do you recommend starting with v12 instead of v11? Is it more work later to move to v12?
Definitely do not start on v11.
the v11 version of Boilerplate works on v12 but it hasn't implemented any of the v12 upgrades like AppV2
unfortunately there hasn't been the time & energy to overhaul the guide to walk through appv2
So I'll start with v12, just do the same process but do a git pull of the v12 branch from the repository?
yeah normal git stuff
ok
I don't know if this question is wrong, but would there be any system that has already used this base and could show me how it ended up? Mainly the Front, HTML and CSS part.
Quite a few
But honestly a lot of the HTML and CSS stuff is just general front end principles
I would like to see a system that was made here with HTML and CSS. I made this form here in the Sandbox system, but I saw that when it comes to creating macros that connect with skills and abilities on the form, there is no way. That's why I migrated to this system construction that seems to be much superior to the one in Sandbox.
Yeah
yeah if you can pull that off in Sandbox you can pull it off with Boilerplate
the existing ActorSheet gives you a general structure
Okay! Got it, thanks a lot!
I need help 😦
I have been trying to start design a system using the boilerplate repo, but I can't get past this error when I try to install the system
It seems like no matter what I do, the ID field of system.json isn't being seen (id is undefined in requestData). It has the manifest correct though
Image
I've been over and over system.json trying to figure out what the problem is, and I can't see any part of it that's configured incorrectly. I even stripped it down to the bare essentials + manifest and it still didn't read id
I put everything together using the manual method and my experience modifying other systems so far, so I've compared each file to two other systems (MTA and MM3) to make sure things are configured correctly
weirdly enough it's successfully downloading the files from the git repo too
but it won't register the system
hi, new to coding in general. can someone help me figure out....
when an item is created and added to the inventory, what exactly happens when {{localize "DOCUMENT.Create" type='Item'}} / {{localize "DOCUMENT.New" type='Item'}} runs? specifically, how is system.formula and system.roll... set initially?
what happens when {{localize "DOCUMENT.Update" type='Item'}} runs?
i assume that localize is some handlebar helper somewhere, but i can't find it
So there's two separate things happening
- The actual creation is handled by a click listener
- What you've found is just the localize helper for the label
Foundry VTT Community Wiki
A helper class which assists with localization (i18n) and string translation
I assume you started with the current main branch?
should be, i think
i've been reading through https://foundryvtt.wiki/en/development/guides/SD-tutorial but my knowledge isn't deep enough for me to understand enough of it
Anyways the actual interactivity is in the ActorSheet subclass
Specifically it's attached in activateListeners
The v12 branch implements AppV2 which I think is actually more straightforward but unfortunately neither I nor asacolips have had time to write a proper guide to it
hmmm. i don't know if i have v12
i have whatever is here https://github.com/asacolips-projects/boilerplate
GitHub
Boilerplate system for FoundryVTT to use as a starting point for your own system's development. Follow along with the [accompanying tutorial](https://foundryvtt.wiki/en/development/guides/S...
which looks to me like v11?
Yeah, so on GitHub in the top left of the page you can switch branches
gotcha
still learning github
have learned enough to get in trouble, but not out of it 😬
Yeah there's a lot. Unfortunately, system dev is still very reliant on community contributions and I've been busy elsewhere
do you suggest swapping to v12?
I think the v12 branch is a better framework since appV1 will be officially deprecated in v13
ok. i'll swap over later and see if i can figure things out
thanks for the quick reply though
Hey all! I'm just getting started with programming in general and building a system in Foundry in particular. Does anyone here have an example of adding skills in addition to stats (abilities) for Boilerplate?
Skills vary wildly in implementation across systems you'll need to be more specific
Oh, yeah.
The same mechanic as abilities (have a value and a mod with formulas), but in another css field
Then it's just a question of defining some base value and then calculating things in prepareDerivedData
Yeah i tried this, I use the same code with another variables and and the character sheets just stopped opening.
Open the console and read the errors
Foundry VTT Community Wiki
Tracking the permutation of data from the server database to a document sheet rendering.
I didn't know foundry had a console, my bad
f12?
yeah it's just an electron browser
I would strongly recommend just doing all your testing in Chrome though
the error reporting is better
thk a lot
Ok. Am i right, what render error is error with css or html, not with js?
Screenshot?
Nope wrong spot
Would be in the handlebar template
Vscode search can also be helpful
I tried to found myrpgActorSheet class, bc i have the same class in the code.
Or this isnt a name of class?
I don't have a file with that name and that's what confuses me the most.'
Should be the name of the class, but the error it's pointing to is in a file that ends in .hbs
How did you understand this?
{{!-- is the syntax for a comment in handlebars
The kind of error it has is saying that it's not parsing as a comment
And so instead is just reading as invalid
ok i was thinked its a part of error description
For better or for worse a good chunk of understanding Foundry will require understanding handlebars
yeah
i found the error fixed and it works well
thanks very much 🙂
i opened it in visual studio, not in the visual code
Ah yeah vscode every day for Foundry dev
I'm working on an implementation of Cities Without Number and am trying to implement CWN's concept of Edges. These are features that can, among other things, modify character data (like abilities or other computed data on the actor).
For example, characters have a 'Base Attack' that is calculated based on character level. An edge can override that calculation with a different formula still using the level.
I have initially implemented Edges as items with effects, but it doesn't look like I can use formulas in the 'Effect Value' of an active effect on an item.
Is there a better approach to implement something like this? Edges are similar to Feats in D&D and while I'm trying to read through the dnd5e system, its very dense.
It is possible to make effects take roll data – several systems do this – but you have to implement that yourself
You also need to then ensure you're happy with the order of operations that is possible
Gotcha, thank you.
How far along is the development of the boilerplate for v12? Is it a good starting point in it's current state?
Perfect, then it's time for crafting!
Guides are for chumps who can ready anyways... /jk
Okay I'm going to need a few pointers if anyone is willing to give them to me
I have worked on an old system that was very bloated and not super well maintained as it was created in v9 and supported all the way to v11 so bear with me please.
- There are 2 system.json, one in the root folder and one in src/datamodels/ do I need both? Why are there 2? Which one should I keep
- I want to create a system, so can I drop the content of the modules/ directory or for what should I use it?
- I will probably have more questions later on 😅
You should use the generate command to build the system which will be placed into the build folder
Have you worked with node before?
Yeah I have, I also did that and wasn't sure which one I should work on in the end because their structure differed a bit (like a dataModel directory being missing)
Basically the way this works is you download Boilerplate into any old place, install node dependencies with npm ci, then use npm run generate to build the system. You then copy the generated files from build into your Data/systems folder and work on them there
So I basically just work directly on the System the way it would be in foundry, gotcha
Last time I had build process where I wasn't sure what was happening exactly
But what about the template.json lying around even though I wanted to use dataModel?
One of the kinks in the v12 branch is we never implemented a step to delete template.json
You can just do that
My latest system has mutated quite a bit at this point but I did start with the v12 Boilerplate branch
I will check it out, running systems like that helped me a lot in the past, thanks!
Note there's no release yet, still building stuff out
I just need to see how some things are done and seeing something working helps me more than most tutorials
Yeah it's got a lot implemented
Any v13 boilerplate update plans? (I should continue with my own system later this month.. It's been on a half year break. 🙈)
Dev2 is a little early to do that but honestly a v13 update is mostly going to be the delete button
Playing around with this a bit on the early end. Trying to add additional actor/item types and running into this.system.toPlainObject is not a function. They get created, but attempting to open the sheet throws the error.
I have tried adding copied versions of item-item-sheet.hbs and actor-character-sheet.hbs with a renamed middle name (e.g. item-reaction-sheet.hbs) for the get template() and cant quite figure out where the wall is now.
Is there some other reference I'm missing?
You created new (for items)
- TypeDataModel?
- and add them to
CONFIG.Item.dataModels = {inHooks.once("init", function ()
I would suggest switching to the v12 branch
at this point the lack of appv2 docs is going to be less of a hindrance than all of the pecularities of appv1
Main is still v11? also trying to follow along on the walkthrough, is there an updated version of that as well? (just checking my understanding)
The lack of walkthrough is why main hasn't been updated
gotcha
Main still works on v12
But there's a lot of stuff in main that really is no longer best practices, and I wouldn't advise spending a bunch of time learning how AppV1 works since it will begin its deprecation process in v13
right that's where i was starting at, i had only adjusted the templates and not registered anything different in init hook
I will check out the v12 and see if that takes me to a different wall 🙂
But yeah toPlainObject is one of those hacky things I got rid of when I worked on the v12 branch
handy shibboleth
It seems like dropping an item onto an actor sheet creates the item regardless of type, but only renders it if it's appropriate to that section. There is not a failover check built in to see if the item type is valid for the actor, is that correct (or did i break the check somehow)?
if you want to block item creation by actor type you'll need separate logic
ok cool just making sure i wasnt breaking something i wasnt seeing anyway 🙂
it's super doable, but it happens on a separate layer from the sheet
this page might still be a bit foreign since you're so early
Foundry VTT Community Wiki
Tracking the permutation of data from the server database to a document sheet rendering.
but it's a good reference guide for how data gets translated from the database to what you see on screen
this process is super helpful, by the way. thank you
So with v12 schema definitions, what if anything should go in template.json? Should it all be reduplicated or is templates formatting just superfluous/backcompat?
Backwards compatibile, if you've got data models then all of the information you actually need to provide to the server can just go in system.json
I've been building Draw Steel from the v12 branch
sweet thanks
Im trying to understand a little better making the sheet rollable.
i dont actually have derived modifiers, do i need to just register the stats values in the same way?
I tried to look at SR5/6 for comparison to another pool system but they are beyond my current comprehension 🙂
is getRollData() within actor-character.mjs just defining a method for copying the abilities data to a new object so that object can be used, because data within the sheet is otherwise just used for rendering?
so Actor#getRollData() is a core function that foundry calls when you do a basic /r chat command
if you do nothing, getRollData returns the actor's system property (what you've been defining)
ok so if nothing is derived then it shoud be fine to omit?
The reason it's important is because the constructor for Roll takes a data object as its second parameter, which it interprets to parse @ values
It's worth noting that if you do nothing, it actually passes system by reference
the trick is when you want any other abbreviations that aren't simple data paths on your roll data
OK so it's giving a mapping for the shorter @str etc
Yeah if you want to include anything like that, you should do that in getRollData
so then a mechanically simple dice system with top-level direct attributes should be safe to drop that and prepareDerivedData() yeah?
yep
awesome, thanks for walking through it with me
by contrast you've got people working on systems like 3.5 who are adding even more layers of data calculation
Thankfully that's not my need at the moment 🙂
I forget if I've already shown this/you saw this explained on the wiki
but the client side source is available in your foundry install folder
i've mostly been leaning on the API site so i dont have to find what file things are nested into if you're saying what i think you are
still plenty of comprehension to be had though
yeah unfortunately the API site is incomplete in a few ways
- it doesn't show mixin internals (Foundry has... a lot of mixins)
- it only shows function signatures, but as a system dev you often care about internals
- there are outright errors in various places
the js i can bang my head against for long enough and usually come up with at least a new problem, the CSS might kill me eventually lol
that is good to know
very yes
ClientDocumentMixin adds a lot of important functions to documents
yeah im still a little shaky on documents yet, we paused our main campaign back in v9 and ive had a lot to pick up now that we're restarting
thankfully most of the negatives have just been "oh thats in a different place" compared to the positives
to register another sheet is it best to just call another instance of .registerSheeet()?
yep
Is following this guide: https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD01-Getting-started still a good idea? On the one hand it was updated under half a year ago, on the other it is at least one and soon two foundry versions behind and I have no idea what changed in the versions
Foundry VTT Community Wiki
So, theres a v12 branch that totally overhauls the apps
The advice about ActorSheet and ItemSheet is now outdated but the rest is good
Unfortunately v12 is an awkward transition version in terms of sheets, it's definitely possible to make it work (I have) but there's some really nice qol improvements coming in v13
So it would be better to wait for 13 if I don't urgently need it?
You could use the guide and the v11 version of Boilerplate in v12 now if you want to get started ASAP, but you’ll either need to do a lot of reworking when v13 is stable (probably in the next month or two if I had to guess since it’s in the testing phase now), or you’ll need to do a larger amount of asking around here and in #system-development while referencing v12-based systems like Draw Steel by @wheat plume .
An example of one of the pain points if you used the v12 branch of Boilerplate is that in addition to the guide not explaining it yet, we have a bunch of methods implemented in its sheets that will be obsolete and provided by Foundry core in v12.
That sounds like a lot of unnecessary work when I can just continue using r20 and return for v13. Thank you and I guess I will see you in a month or two 💜
For what it's worth I don't think v13 is going to be a hugely breaking update but the polish is noticeable
Chaos has been building Draw Steel on v12 similarly to what we’re doing in Boilerplate and my Grimwild system is outright using Boilerplate v12 as its baseline. I’d like to revisit rewriting the guide once v13 is out, as both of us have had direct experience in building a v12+ system from scratch this year.
I did use Boilerplate it's just mutated a bunch 😂
Ah, repo structure was pretty different and I didn’t spot the MIT attribution so I figured it was custom. I’m not policing that (nor do I have any desire to), but it’s usually what I spot check to see when neat new stuff was based on it
Another example to look at, though its pretty rough, cause I was learning as I built (will need to do some clean up when I fix things for v13). But this is based on the v12 branch of Boilerplate too (I looked at Draw Steel a lot).
https://github.com/philote/eat-the-reich
Speaking of v13, is anyone working on a guide for conversion?
because it's mostly core UI overhauls, it's super context dependent
some systems won't need any adjustments at all
furthermore, because we're still in Testing, lots of stuff is changing
Generally speaking the in-app warnings and errors are where you should start
Perfect
Hi! Anyone knows, how can I make two fields edit the same variable?
I have two character sheet tabs and both have the "flow" stat value. I need them to be synchronized - that is, so that editing one value will automatically edit the second value in the adjacent tab of the character sheet. I've already tried 3 methods and nothing worked.
What do you have now? Just having the the name and value attributes matching should be sufficient
In this case, everything was synchronized only in one direction. In another, when changing the value on the 2nd tab, the value on the first did not change. I got discouraged and decided not to do this, I will leave editing only in the main tab.
Hello guys, I just found out this section exists. I have question regarding boilerplate v12
I am trying to use activate listener but it just does not work for me
So this is my actor-sheet.mjs part
activateListeners(html) {
super.activateListeners(html);
html.find('.my-button').on('click', this._onButtonClick.bind(this));
}
_onButtonClick(event) {
event.preventDefault();
console.log('Button clicked!');
}
and this is my .hbs part in the actor sheet
<button class="my-button">Click Me</button>
But for some reason the console log does not do anything.
I wanted to make sure it has nothing to do with my edits, so I tested this on the unedited version of boilerplate (V12) but I still have no idea how to make it work
Does anyone have experience here how it should be done? Maybe I need to put the activate listener in some specific place. I spent a whole day trying to figure this out but at this point I just ran out of all of my sanity 😄
ActorSheetV2 does not use activateListeners
Foundry VTT Community Wiki
The Application class is responsible for rendering an HTMLElement into the Foundry Virtual Tabletop user interface.
it also doesn't use jquery
Thank you for quick answer 😄 ahhh this is quite embarassing
so basically I should have put this kind of interaction with button into
_onRender(context, options) {
this.#dragDrop.forEach((d) => d.bind(this.element));
this.#disableOverrides();
// You may want to add other special handling here
// Foundry comes with a large number of utility classes, e.g. SearchFilter
// That you may want to implement yourself.
}
Well, if it's a basic click listener, use actions
Foundry VTT Community Wiki
The Application class is responsible for rendering an HTMLElement into the Foundry Virtual Tabletop user interface.
Thank you, you have given me hope! I will go through this and see how I can make use of it
Everything works perfectly now! thanks again
https://github.com/MetaMorphic-Digital/draw-steel if you need any examples I wrote the v12 boilerplate and then started on this system
Wow super! I will use this for referrence for sure
It does use some more advanced concepts and tricks, feel free to ask questions
Hello people, its me again.
I was rubbing my forehead about this part
// Handle item rolls.
switch (dataset.rollType) {
case "item":
const item = this._getEmbeddedDocument(target);
if (item) return item.roll();
}
Is there any way I can catch the roll.total of this item.roll ? I did not change the basic formula that was there
Whatever you want to do I would do in that roll method
Aha so if in item.mjs inside if (this.system.roll) {
there is defined formula, I can also explicitly put things like roll.tomessage and roll.total at the end of that method ?
Yep, freeform space to work and redo things
Thanks 🎉
Hello everyone, I hope you are doing well. Is there anyone that can tell me if the Boilerplate tutorial is compatible with Foundry V12? It tells me v11 Compatible, but what I mean by this is mostly: Does it use any v12 stuff?
The tutorial is written for v11, but it will run in v12 just fine. We do have a v12 branch of the Boilerplate system that uses newer APIs (data model, AppV2), but the tutorial hasn’t been updated yet to explain that branch in detail.
@unique crane is there any plans to update it to v13?
Right now the issue is v13 keeps getting changes
Frankly though it's not going to be a big shift from the v12 branch
Main change is removing the drag drop extras from the actor sheet
Yeah, the v12 branch should need minimal changes for v13. Once v13 is out, I’ll start work on a rewrite of the tutorial for it.
If you need help, I would be happy to
The wiki is open to edits and Boilerplate is open to PRs
I’ll likely put together an issue in the repo with an outline of the v13 structure for the tutorial, as I imagine it will end up a bit differently organized given how long it’s been since I originally put it together. That’ll be a good place to weigh in on it in addition to the more targeted edits.
I posted this message in system-development before the pinned post led me here:
I am trying to use npm run generate to create a new system and get the following error:
*file:///home/greville/Documents/Roleplaying/Utilities/Foundry%20VTT/In%20Dev/boilerplate-main/src/generate-boilerplate-system.mjs:23
this.dataModel = answers.dataModel ?? false;
^
SyntaxError: Unexpected token '?'*
I am running Pop!_OS 22.04 LTS with fresh installs of nodejs v12.22.9 and npm v8.5.1 . It didn't ask me any of the questions from the script, just failed with the error straight away. I've tried the standard download, using git clone, the v12 branch, and I get the same error every time.
That node version is waaaay out of date, so I would start there. Boilerplate uses node v20, but later versions should also work.
If you have trouble updating your system version of node or can’t update it due to other projects, I would recommend using a node version manager like nvm (https://github.com/nvm-sh/nvm) to install additional versions. Once you have it, you can run nvm install to install inside the Boilerplate directory to install node 20.
That worked for updating node to 20.11, thank you. Unfortunately I'm still getting an error:
`boilerplate@2.0.0 generate
node src/generate-boilerplate-system.mjs
node:internal/modules/esm/resolve:853
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'inquirer' imported from /home/greville/Downloads/boilerplate-2.0.1/src/generate-boilerplate-system.mjs`
I re-downloaded the source file and tried it several times, but to no avail.
I'm pretty sure this is something unique to my system and not an issue with the boilerplate files.
I ran npm run generate on my old macbook and it worked fine
Hmm. And there were no errors in your npm install command?
All fixed now, I had to run npm audit fix, and now it is all good. Thank you so much for your help.
I don't know if someone is doing this, but I just forked and I will try to check some of the warnings/deprecations for v13
Make sure you’re starting from the v12 branch rather than main, as that’s the one that would be our baseline for any v13 work.
Yeap, from v12 branch 🙂
@unique crane do you have the permission to copy the latest Wiki Tutorial? I wanna to start to update it with the things I am doing here.
I will not be able to clean/document everything because I need to start to work on the system. But I want to help a little at least! 🙂
I will probably spend today and tomorrow on that.
The wiki is open, so anyone can edit any page. I’ve been debating with myself on whether I want to rewrite the existing articles or write it as a new section since it’s going to be so different.
Do you have any preference?
I can’t recall what the wiki has in terms of draft states/workflows. My main worry with editing the existing one is getting it into an unusable state for X period of time while the revisions are being made. So that has me leaning towards throwing it in a new section.
However, it might also work to do something like putting a clear indicator (horizontal rule, warning info bubble, etc) at the bottom of the original article(s) and then throw the new content below those warnings.
I was planning to duplicate the current content and start to modify the things with what I am doing. Of course that there is a "strange period" that the wiki would not be up-to-date until we merge that
I wanted to at least create/update the docs while I am doing the changes. If I left to do later, I will forget to do that 😅
Gotcha. The plan from my side has been to just start from scratch after v13 stable since the tutorial’s whole structure is still based on what made sense to me back in 2020 or whenever. There will be a lot of copy paste as a ton of the text is still relevant, but it’s the overall structure that I want to revisit.
That’s obviously going to take longer to do though, so it’ll be a bit before I can get to it. If you’re tackling them more piecemeal, that should help a lot in the interim for sure.
In that case, I will move forward with the changes and try to add descriptive commit messages that can give you an idea of what I was planning to do. And we can check these things during the PR review 🙂
Does it make sense?
Sounds good to me. Thanks a ton for this!
Easy fixes (that should probably get ticketed)
- adjust the DragDrop implementation to match core (remove most of it from ActorSheet, adjust both selector to use
.draggableinstead of[data-drag]
- adjust the prose-mirror to use
data-documenf-uuidinstead ofdata-document-u-u-i-d. This change technically could've happened in v12, it just got fixed after I made my updates (it was like 12.328 or something)
@unique crane what do you think about maybe moving to pure css
The v13 electron client now supports normal css nesting
That works for me 👍
I think it would simplify a lot. The only hitch is I've struggled a bit with hot reload
Hi! I accidentally started development of a custom system in V11, but with datamodels. Are most of the V12 changes in actor-sheet.mjs and item-sheet.mjs? Trying to figure out if it's worth trying to rework what I have, or start from scratch in V12 fully.
Yeah like 95% are to those, but I did do other cleanup
For example, AppV2 has a better basis for context prep, which means I got rid of the silly toPlainObject method
The handlebars templates are also different for the AppV2 version since it can use parts
Oh, cool. I'll poke around then and see if I can switch over. Thanks for all your work - boilerplate has been a lifesaver for me in terms of learning foundry tools!
Hello folks. Just wandering in and trying to get started with the current version of Foundry development.
On Boilerplate's "Getting Started" page, the instructions say to search for "boilerplate" (case sensitive) and "Boilerplate" (case sensitive), but not "BOILERPLATE". I found twenty-some of those.
Was that intentional?
Nope, that was a mistake. The intent there is that there are a lot of references to the word boilerplate in various contexts, and you should replace that with the equivalent for your system name.
So BoilerplateActor might become FabulaUltimaActor and BOILERPLATE might become FABULA_ULTIMA on a system like Fabula Ultima for example.
Ideally there won’t be any references to Boilerplate in any capital casing once you’ve caught them all.
I think I've caught them all. There's something especially weird about gridDistance and gridUnits, though, or next, depending. As it's Saturday, this doesn't seem like a good time for a documentation review.
Those shouldn't be in system.json any more
They moved to a nested structure in v12
I've observed from the warnings on many other systems, but when I change them...:
The "Stewpot" system's manifest contained the following unknown keys: "grid.distance", "grid.units"
Will keep hammering at it.
Yeah, so it wants a nested object
"grid": {
"type": 1,
"distance": 1,
"units": "sq",
"diagonals": 0
},
Separately, I almost got there. And with some minor changes to versioning, it loads up in Foundry 12 with no errors. It's all downhill from here.
For what it's worth, https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD03-systemjson still has it the old, non-nested way.
Foundry VTT Community Wiki
And now I'm not sure if I'm supposed to rewrite template.json or do something in the "System Data Model."
It's kind of scary that I'm not actually up to the programming part yet.
Use system data models, not template.json
Okay, found that page, and the documentTypes get defined in the pile with the system.json stuff?
Yes, you need to define the document types in system.json and then provide the data model classes for your documents in the init hook
And again, sorry to stink up with the place with n00b questions.
Literally what this channel is here for 🙂
Thanks, but I still feel like I'm abusing the privilege.
No joke go to therapy if you feel that way
"I am using a resource therefore that's abusing the resource" is the kind of maladaptive thinking that therapy can help with
Question, do we want to maintain compatibility with the non-data model actor sheet?
I am just thinking if it worth to have to handle two actor sheets
The tutorial never got updated which is why the v12 branch didn't get merged to main
Oof.
I'm increasingly thinking it's time to ditch template.json
It would simplify the repository a lot
yeap, I was getting quite confused here beacuse of the two actor sheets 😄
If people have nothing against, I can do that on my current fork for the v13 and send that together no the PR
Do you have an example of how this should be? I tried to remove some things and it stopped to work.
Check Draw Steel
I was looking to that one. Ok, it seems that it is so many things that I thought I was missing some connection 😄
So... this looks like a decent start on the thing I'm doing:
"documentTypes": { "Actor": { "character": { "arrayFields": ["adventurerJob", "townJob"], "stringFields": ["name", "weapon", "armor", "quirk"], "filePathFields": ["portrait"] }, "tavern": { "arrayFields": ["locationDetails", "advancementDetails"], "stringFields": ["look", "name"], "numberFields": ["cuisine", "atmosphere", "service"], "filePathFields": ["landscape"] }, "minigame": {} } }
system.json is only for htmlFields & filepathFields
the reason is those need server-side cleaning
the rest of those aren't going to do anything
also, do you really need system.portrait/system.landscape as additional image fields?
Actors already have a native image field
Fair enough. Pulling stuff out...
And now...
"documentTypes": { "Actor": { "character": {}, "tavern": {}, "minigame": {} } }
...looks a little sparse.
That's not unusual if you don't have any html fields
usually you want some kind of description/biography field
// also triple tick (`) lets you do a code block
Question: given that we cannot have items inside items, does it make sense to have a drag-drop on item sheet?
Previous versions of the Boilerplate had that, but did basically nothing.
And checking here, the foundry implementation, it does not create the dragDrop handles for the item sheet
so, if we want to have that, it will require the full implementation for it
Active effects
Maybe those aren't worth it since they can't go in the sidebar and you leave it out entirely
let me check it here 🙂
It would lose the reorder of active effects.
I don't remember if the ordering of them makes some difference, but just thinking, if they are applied via the order, it could
which means that having this on the document could be interesting
Even if it doesn’t affect the application order, I would still keep it so that users can order them however makes sense to them.
Ok. Let me work on that.
it's visual only. The AE itself has a sortpriority for drag n drop while each individual change has a priority property for application order
So, if I understood correct, we would need the DragDrop implementation, but we can leave it only for the AE. Can I remove the Actor, Folder, Item? Because they are just polluting the code, as they don't do nothing today.
I mean, part of the function of Boilerplate is it's going to have no-op functions that end users can leverage if they need them
Yeah, I would lean towards expanding the comments on them with context about how they’re not used by default but could potentially be used.
This is also what Core does for the ActorSheet functions
Ok. I will leave them in this case and add some comments.
adjust the prose-mirror to use data-documenf-uuid instead of data-document-u-u-i-d. This change technically could've happened in v12, it just got fixed after I made my updates (it was like 12.328 or something)
@wheat plume does just need the replacement? I did that and everything is working. Just wanna confirm if there is something more
yeah basically what happened is foundry was checking dataset.documentUUID and forgot that meant the html would have all those hyphens
now it also supports dataset.documentUuid which looks much better in the html
[also hopefully you didn't copy over my typo]
I didn't 😄
Ok, I will open a PR to the branch v12, but I believe that it should probably create a v13 branch (or maybe consider going back to main).
My idea is to get some review on the code to see if there is any problem.
To make the scrollable work, I set the max-height on the tab, and start to use the scrollable class on the tabs. I am open to suggestion, although this works for a base project.
I think that makes sense to me
Here we are! 🙂
As this is right now working on the v13, I will probably start on the new system, but I am open to hear feedback and put more time on it to make it better for the community 🙂
If you're going to add symlink support should also have jsconfig.json
Getting back to it after a period of nothingness... in which file do I put the DataModel definitions?
modules/data
note that ultimately folder structure is about convention, what matters is the imports & exports
So in my case that'd be data/system/stewpot/module/stewpot.mjs?
Sure, although naming a data model after your system isn't usually all that helpeufl
also, just set your system's folder as your root for vscode
<-- Toldja I was new.
Hi again! Trying to define a button to Take A Rest. Previously, I did this with activateListeners. Now, I'm trying to use data-action and wondering if I missed a step.
- In my sheet template, I have
<button type="button" data-action="takeRest">Take a Rest</button> - In
actor-sheet.mjs, I have a functionasync _takeRest(event, target) - In
actor-sheet.mjsI have addedtakeRest: this._takeRestto the set of options.
But it's not correctly calling the function (testing with console.log(...)). Is there anything else I need to get the button to register correctly?
Is your function static async?
It wasn't, but that fixes it! Thank you! Why does it need to be static? I learned java back in high school, so I'm pretty rusty
I think it is because how Foundry handles this execution. But maybe somebody else can bring more light to this
Foundry does some funny things with actions. So, you define them in static DEFAULT_OPTIONS, which means they can't be instance methods; static methods is certainly the easiest, but you could define an action externally and assign it.
Then, when you actually click the element, foundry uses call and specifically provides the instance for this
If you want this to work in intellisense, make sure you annotate @this. The existing Boilerplate actions should be examples there
One issue I found yesterday (and I remember that someone was having a similar issue): during the generate, we are transforming the boilerplate to my-system. However, there is a globalThis.boilerplate being converted to globalThis.my-system which causes an issue Invalid left-hand side in assignment.
I will try to check if I can fix that inside my v13 branch.
PR updated with the fix for this case (it was simpler because there was already something similar there)
Interesting! I wondered all the time, why I can access the instance in static methods for the action handlers 😅
Yeah this is the type of thing that an updated Boilerplate guide should address
As maybe some people will be getting here from the recent talks in the #system-development ...
There is a v13 PR that I opened, but I am still finding some issues as I am developing a system and using that.
But I will need to check that on the source when I get things done for that.
There are not so much differences from v12 to tell the truth, so it could still be used with the current tutorial.
Of course that there are things that are not in the tutorial, but it can be worked out.
Hiya! I noticed there were some styles in the css sheet referencing "tox", but unsure what that is. It doesn't seem to show up anywhere in my HTML classes, does anyone know? E.g:
.boilerplate .tox .tox-editor-container
What does all this stuff in the v12 actor-sheet.mjs do? Some of these tab cases have that context.tabs[] call, and some don't, and I'm not really sure which to apply to my own tabs.
I would check the API, but the _preparePartContext section just gives me an error 404 page. Most of the site does, actually.
what url are you checking?
Using the search bar at the top brought me to this URL: https://foundryvtt.com/api/classes/undefined/classes/foundry.applications.sheets.RegionConfig.html#_preparePartContext
OK, going to recommend you get comfortable reading the source
Uh, what's your background on Inheritance and Object Oriented Programming?
I have no clue what that means, so I'm gonna go with 'none'?
OK, so basically whenever you see ClassA extends ClassB, that means ClassA "inherits" all of the properties from ClassB
the classic example is something like "Dog extends Mammal"
we might define a Mammal with properties like "hasFur: true" or methods like "warmBlood()"
Even with just an empty class definition, class Dog extends Mammal {}, Dog would have all of that
The slightly more advanced idea is "multiple inheritance", where you inherit the properties of multiple parents
Some languages support multiple inheritance out of the box, but javascript is not one of them
That's where Mixins enter the picture
in this case, HandlebarsApplicationMixin
unfortunately the current typedoc generation that Foundry uses does not support mixins
which is why HandlebarsApplicationMixin is covered on the wiki https://foundryvtt.wiki/en/development/api/applicationv2#_preparepartcontext
Foundry VTT Community Wiki
The Application class is responsible for rendering an HTMLElement into the Foundry Virtual Tabletop user interface.
Now, you can read all this source code for yourself
If you have an electron based install, go into resources/app, otherwise this is the root folder
clientandcommonare the primary code of Foundry broken up into a general 1 file == 1 class setup.clientis code that's only for end users, such as applications and the canvas. It was fully migrated to use ESM in version 13.338. The actual root file that imports everything isclient/client.mjs, where stuff is assigned to a spot in thefoundrynamespace.commonis code that's shared with the server, and is also available under thefoundrynamespace.
distandnode_modulesare for the server and shouldn't be touchedpublicis the actual files that are served up to clients. All of the stuff that's inclientandcommongets rolled up intoscripts/foundry.mjs. There's also a ton of other stuff here, like the core icons and css. I'll also call outlang/en.jsonas particularly useful.templatesis all the hbs templates used by core.
Oh, jeez, that's complicated. So, just to make sure I understand - _preparePartContext was being used there to override the properties of each tab individually, instead of their entire class?
I'll keep that in mind, but how useful could reading source code be for someone that doesn't understand what the code is doing (i.e., me)?
Well, for one you can look at the Foundry-defined sheets to see what they're doing
like, SceneConfig isn't fundamentally that different
yeah, although v13 has introduced fresh new ways of handling tabs
Oh? That could definitely be useful, since I was hoping to get things working on v13. Where would I find out more about that?
by looking at one of the foundry-defined apps with tabs, like SceneConfig
basically you define static TABS
I would also take a look at this interface
Documentation for Foundry Virtual Tabletop - API Documentation - Version 13
also implemented in Draw Steel https://github.com/MetaMorphic-Digital/draw-steel/blob/develop/src/module/applications/sheets/actor-sheet.mjs
Huh... unfortunate that tabs don't seem to simplify anything. Thank you for the help though, I'm just gonna need a lot of time to read through all this and try to figure it out ('~`;)
I noticed that this doesn't have _getTabs(parts). Is that not needed in v13?
Yeah, one of the big changes from v12 to v13 is the tabs handling; for Draw Steel it's inherited from the super._prepareContext call
Good to know! 🙏
I'm struggling to figure out what could be causing this error. It says that preloadHandlebarsTemplates() is undefined, but where was it meant to be defined in the first place? I can't find anything except this return in module/boilerplate.mjs 🤔
I think there was an imported method that would load the templates. After some foundry refactors that's less necessary
Basically in AppV1 you have to preload every partial you use in any app
But AppV2 solves that with the templates array for each part
So, I can just remove that line...?
Yeah
is there a quicker way to create a build rather than npm run generate all the variables are already in place so i don't always want to mention them again
Well, you should only use the build once
Then copy the build into a fresh repo
And directly edit that
Ohhh I see. My bad used to have some kind of src and distribution folder when working on systems and modules
can someone tell me how to pass a value from config to hbs template to iterate over it?
got it. It's predefined in config = CONFIG.<yoursystem>
So I managed to add different groups in the hbs template for each feature subtype:
In my case:
- Physical
- Knowledge
- Social
I also added the subtype in my config and added groups for each in my hbs file.
How can I filter the items in order that they are only shown in those categories?
my feature has system.set = phy
And I want to allocate those items to the coloumn of phyiscal features see screen
actor.itemTypes returns an array for each document subtype
you'll then need to sort it by the item's sort value
The itemtype is feature and each feature has system.set which stores it's group (phy, kno. or soc)
the itemTypes array does list all items. (features, spells, items)
Then you'll just need to do your own sort/group. I suggest the reduce helper that's native to JS, or Object.groupBy
Ok i got it working but still a minor bug:
I used the following in actor-sheet.mjs
const skillSets = Object
.entries(context.config.skillSets)
.map(([key, rr]) => ({
...rr,
key,
skills: skills.filter(i => i.system.set === key) // Filter skills by set
}));
// Assign and return
context.skillSets = skillSets;
This works as key and skills are part of the Object
However somehow each key also contains each letter of the value for each key
Like
0
:
{0: 'H', 1: 'T', 2: 'B', 3: 'A', 4: 'H', 5: '.', 6: 'S', 7: 'k', 8: 'i', 9: 'l', 10: 'l', 11: 'S', 12: 'e', 13: 't', 14: '.', 15: 'P', 16: 'h', 17: 'y', 18: '.', 19: 'l', 20: 'a', 21: 'b', 22: 'e', 23: 'l', key: 'phy', skills: Array(1)}
1
:
{0: 'H', 1: 'T', 2: 'B', 3: 'A', 4: 'H', 5: '.', 6: 'S', 7: 'k', 8: 'i', 9: 'l', 10: 'l', 11: 'S', 12: 'e', 13: 't', 14: '.', 15: 'K', 16: 'n', 17: 'o', 18: '.', 19: 'l', 20: 'a', 21: 'b', 22: 'e', 23: 'l', key: 'kno', skills: Array(0)}
2
:
{0: 'H', 1: 'T', 2: 'B', 3: 'A', 4: 'H', 5: '.', 6: 'S', 7: 'k', 8: 'i', 9: 'l', 10: 'l', 11: 'S', 12: 'e', 13: 't', 14: '.', 15: 'S', 16: 'o', 17: 'c', 18: '.', 19: 'l', 20: 'a', 21: 'b', 22: 'e', 23: 'l', key: 'soc', skills: Array(0)}
length
:
3
[[Prototype]]
:
Array(0)
This is my config object
HTBAH.skillSets = {
phy: 'HTBAH.SkillSet.Phy.label',
kno: 'HTBAH.SkillSet.Kno.label',
soc: 'HTBAH.SkillSet.Soc.label',
};
fixed it. ...rr was incorrect
Making good progress but facing another problem
I fetch the items per skill set and want to update the item directly from actor sheet and not inside the item itself
I managed to retrieve the correct ranks of skills. but am unable to update them. I presume i have an incorrect path in the "name" attribut of the input form.
Yeah so the name attribute actually needs to be left out entirely
Because you explicitly don't want the default change handling
but how can foundry write back the updated value in that case?
You need to add your own change listener in _onRender
Foundry VTT Community Wiki
The Application class is responsible for rendering an HTMLElement into the Foundry Virtual Tabletop user interface.
I'm not yet on appv2 tried today but struggle was real xD
If you're this early in sheet design I would just switch now
the guide didn't help me much, still to many open questions
Is there an example of an already transitions boilerplate system? i can use as a reference?
The v12 branch
I'm trying to customize the img of a new type of item. I don't want the default "bag" when I click "New Occupation" on top of the list container. Can anyone point me to where I might find the file/line for that?
Extend Item.getDefaultArtwork
Transition worked pretty good I'd say thank you for the advice.
I only got one problem:
- I renamed the
featureitem type toskilland replaced all occurences accordingly (case sensitive) - on my actor, I can add
skillsusing item-controls in hbs. - deleting and editing however don't work. and raise the following error:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'dataset')
at HtbahActorSheet._getEmbeddedDocument (actor-sheet.mjs:450:16)
at HtbahActorSheet._deleteDoc (actor-sheet.mjs:358:22)
at #onClickAction (foundry-esm.js:45095:58)
at #onClick (foundry-esm.js:45056:53)
Note: all other item types work in terms of create, update, delete. (e.g. spells and gear)
This is my hbs. item-controls
<div class='item-controls'>
<a
class='item-control item-edit'
title='{{localize "DOCUMENT.Update" type='skill'}}'
data-action='viewDoc'
>
<i class='fas fa-edit'></i>
</a>
{{#if @root.editable}}
<a
class='item-control item-delete'
title='{{localize "DOCUMENT.Delete" type='skill'}}'
data-action='deleteDoc'
>
<i class='fas fa-trash'></i>
</a>
{{/if}}
</div>
See screen attached for my layout on actor.
Ignore the bad formats.
Abore this div, you have to have a tag with the document id on the dataset
the error Cannot read properties of null (reading 'dataset') says it is trying to get the dataset from a null object, which means that somewhere around the actor-sheet.mjs:450:16 you are trying to get the tag that contains the dataset, but it is returning null
How is the HBS for each item you have?
{{#each this.skills as |item id|}}
<li class='item flexrow' data-item-id='{{item._id}}'>
<div class='item-name skill-name'>
<h4>{{item.name}}</h4>
</div>
<div class="flexrow skill-modifiers">
<input
class="skill-ranks"
type="number"
value="{{system.ranks}}"
/>
/<span class="skill-dc rollable" data-roll="d100" data-label="{{item.name}}">{{system.total}}</span>
</div>
<div class='item-controls'>
<a
class='item-control item-edit'
title='{{localize "DOCUMENT.Update" type='skill'}}'
data-action='viewDoc'
>
<i class='fas fa-edit'></i>
</a>
{{#if @root.editable}}
<a
class='item-control item-delete'
title='{{localize "DOCUMENT.Delete" type='skill'}}'
data-action='deleteDoc'
>
<i class='fas fa-trash'></i>
</a>
{{/if}}
</div>
</li>
{{/each}}
And how is the code for the delete and the getEmbeddedDocument?
/** Helper Functions */
/**
* Fetches the embedded document representing the containing HTML element
*
* @param {HTMLElement} target The element subject to search
* @returns {Item | ActiveEffect} The embedded Item or ActiveEffect
*/
_getEmbeddedDocument(target) {
const docRow = target.closest('li[data-document-class]');
if (docRow.dataset.documentClass === 'Item') {
return this.actor.items.get(docRow.dataset.itemId);
} else if (docRow.dataset.documentClass === 'ActiveEffect') {
const parent =
docRow.dataset.parentId === this.actor.id
? this.actor
: this.actor.items.get(docRow?.dataset.parentId);
return parent.effects.get(docRow?.dataset.effectId);
} else return console.warn('Could not find document class');
}
static async _deleteDoc(event, target) {
const doc = this._getEmbeddedDocument(target);
await doc.delete();
}```
So, this line:
const docRow = target.closest('li[data-document-class]');
It is trying to get an li tag with the data-document-class.
But your HBS only has the data-item-id:
Change it to something like this and it should work:
<li class='item flexrow' data-document-class="Item" data-item-id='{{item._id}}'>
will try thank you
okay that that solved it for deletition. Let's see if I can find something similar for update. Thanks
Okay strange. It seems like that the items can only be edited, when I drag them around on the sheet once...
Could this be some kind of missing initialisiation or something, that at least 1 action needs to happen?
The _getEmbeddedDoc function is called correctly and the ID is passed to the doc.sheet.render() function in _viewDoc
and i can only use the edit button once xD
after that it stops functioning again
Sorry, I don't understand what you are trying to achieve and what is the issue. Can you share more information?
Or maybe share the repo to look a little bit more
- I transitioned the appv1 to appv2 in that branch
- create a new actor and open the
skillstab - the item controls (create, edit, delete) buttons worked before
- create and delete are already fixed and work again thanks to you help
- However the edit item (skill) does not work still.
- I tried debugging, an the
_getEmbeddedDocumentfromactor-sheet.mjsworks - Problem seems to occur somewhere in
static async _viewDoc(event, target) {(line 346) - The corresponding hbs is
templates\actor\skills.hbs
you can recreate the error by creating a new actor and using one of the + icons to create a new skill and after that try to edit it via provided item-control button
is there any error on the console when you try to do the operation?
I don't know the system, so sorry if I am saying something wrong... but should the skills be items? Most games have a predefined set of skills, which mean that they are not items, but fixed set of data on the actor.
Besides it, I believe that maybe you are facing issues not exactly related to the boilerplate itself, but for general system development. Based on that, I would recommend you move this question to #system-development as you get more help from there too.
This channel is more about the state/improvement of the Boilerplate itself than implementations that used that
yeah the system is very low rules and people just write down the skills they want
so they are items
like fishing, Running, Diplomacy
In it's current state it's still 95% Boilderplate I'd say 😄
thank you anyway
item-sheet.mjs:104 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'fields')
at HtbahItemSheet._prepareContext (item-sheet.mjs:104:49)
at #render (foundry-esm.js:44317:34)
at Semaphore._try (foundry-esm.js:6645:25)
at foundry-esm.js:6617:21
at new Promise (<anonymous>)
at Semaphore.add (foundry-esm.js:6615:14)
at HtbahItemSheet.render (foundry-esm.js:44289:30)
at HtbahActorSheet._viewDoc (actor-sheet.mjs:346:15)
at #onClickAction (foundry-esm.js:45095:58)
at #onClick (foundry-esm.js:45056:53)
Does your skill follows the new data model style?
Because the line it is complaining, it is trying to get the fields from the schema, but schema is undefined
systemFields: this.document.system.schema.fields,
when i create a skill from items tab i can open it just fine
import HtbahItemBase from './base-item.mjs';
export default class HtbahSkill extends HtbahItemBase {
static LOCALIZATION_PREFIXES = [
'HTBAH.Item.base',
'HTBAH.Item.Skill',
];
static defineSchema() {
const fields = foundry.data.fields;
const schema = {
set: new fields.StringField({ initial: "phy"}),
ranks: new fields.NumberField({ initial: 0 })
}
return schema;
}
}
``` this is the datamodell
I don't think that what I will say now is the problem.. but you should probably check
If your "skill" is inheriting the HtbahItemBase, your define schema probably should call the super.defineSchema.
Again, this is not the reason for the issue, but is a programming point that you should check.
I am not seeing any issue that would explain what you are seeing.
Let me try to install your system to see if I can see something when running
Is this for which Foundry version? 12 or 13?
12
ok
did not checkc 13 yet
Question: did you create a new actor after all those changes?
because I tested here and I am not able to reproduce the issue you are saying
I can edit the skill all the times I click the edit button
yes i recreated the actor just now.
So you add the skill on the actor and than edit it just fine?
Yeap
I am on 12.331 (didn't get the latest version yet)
browser (chrome)
new world
will try
Chrome with new world on 12.343 does not work either.
But comparing gear item type and skill item type.
Gear has this.document.system.schema defined while skill has not...
updated skill model to
import HtbahItemBase from './base-item.mjs';
export default class HtbahSkill extends HtbahItemBase {
static LOCALIZATION_PREFIXES = [
'HTBAH.Item.base',
'HTBAH.Item.Skill',
];
static defineSchema() {
const fields = foundry.data.fields;
const requiredInteger = { required: true, nullable: false, integer: true };
const schema = super.defineSchema();
schema.set = new fields.StringField({ initial: "phy"}),
schema.ranks = new fields.NumberField({ ...requiredInteger, initial: 0 })
return schema;
}
}
will change to system dev channel once this is solved
This is the skills content in document.system at runtime
while this is gear
For some reason, your item seems to be created correctly, as it is coming as an object... 🤔
Friend of mine also could reproduce the error on 12.331. Did you use the v2 branch when testing? I guess so right?
Oh my... there is a big chance I was on main.. let me test it again with the right branch
Found the issue:
for (const skill of filteredSkills) {
const ranks = skill.system.ranks || 0;
skill.system = {
...skill.system,
total: ranks + mod
};
}
You are replacing the system property from HtbahSkill to a simple object. This is causing the issue
You should probably do something like this:
for (const skill of filteredSkills) {
const ranks = skill.system.ranks || 0;
skill.system.total = ranks + mod;
}
That worked - thank you very much ❤️
believe it or not I suspected that to be the culprit just 5 mins before I saw that you answered here
that worked beautifull as well thank you
And once again, the curse of the casual developer kicks in: I return to trying to shoehorn a system into Foundry, only to forget what I was doing before and need directions to find my way back to Square forking One.
I don't even remember if I'm set up to do this development in v13.
There is a PR opened for the v13
PR? I don't come in here nearly often enough, and I felt guilty doing so, like I was wasting everyone's time.
Is this a bad time to try to develop a system?
My only recommendation is that if you are starting now, I would recommend developing that pointing to v13 directly
As I do intend to use v13 fully (once it's got enough games running in it), that's what I'm going to do.
Wait. Is the version fo Boilerplate I have in here for the new system even up to date?
Or with the pull request in should I reload from scratch (won't lose much work, I'll say that much.)
So, the PR is not merged yet on the Boilerplate repository. So, if you want to use that, I would recommend getting the repo/branch from the PR and running the commands again
It sounds like my time would be better spent getting to know the game I intend to implement a little better. The setting has a more involve character sheet than the characters do. And there are some recipes in the back.
@sharp belfry turns out someone else was already implementing the system i tried to set up using the boilerplate as well. And now I can help by contributing my insights to the system from here. 2 devs is better than 1 I guess
My checkboxes are taking three clicks to check and only 1 box can be checked at a time. What am I doing wrong?
I am not sure your checked condition is correct. It is trying to get a "key" inside traits, not the value of the variable key
Is there a way I can pass the "key" variable within the "checked" helper?
changing the condition to "trait.toRoll" fixed it. Thanks for you help!
rollingLabel += game.i18n.localize("PIONEERS.trait." + String(trait)) + ' '
This localize function is failing and returning the input string and I've checked that the stringID is correct. I can get handlebars localize to work but not js.
structurally this looks like you should be using the game.i18n.format helper?
I tried that one too same problem.
if you do a console.log(String(trait)), what is the value?
"fin" or "hrd" or "sft". The proper value to finish the localize function. I'm iterating through several traits.
Can you share/confirm that this key is on the en.json file?
"PIONEERS": {
"Trait": {
"Cha": { "long": "Charisma", "abbr": "cha" },
"Dat": { "long": "Data Collection", "abbr": "dat" },
"Hrd": { "long": "Hard Science", "abbr": "hrd" },
"Sft": { "long": "Soft Science", "abbr": "sft" },
"Fin": { "long": "Finesse", "abbr": "fin" },
"Con": { "long": "Constitution", "abbr": "con" },
"Bra": { "long": "Brawn", "abbr": "bra" }
},
It's the capital "T" in traits, isn't it?
it is
it is case sensitive
not only in the T, but if your values are fin, it will not find as the file has it as Fin
That wasn't it. My en.json has them capitalized but the config.mjs doesn't.
I tried capitalize both the "Trait" and "Fin" and that didn't work.
I tried hard coding: rollingLabel += game.i18n.localize("PIONEERS.trait.fin") + ' '
Still didn't work.
do you want to open a quick call so I can try to help you?
Sure. Thanks!
Sent you a PM
It's working perfectly now! Thank you! Thank you! Thank you!
I've got another one. Sorry. I'm trying to adjust the rollMode on this toMessage(). When rolled the message is always as set on my chat ui.
the rollMode is part of the second parameter
roll.toMessage({
speaker: ChatMessage.getSpeaker({actor: this.actor}),
flavor: label
}, {rollMode: CONST.DICE_ROLL_MODES.SELF});
You are the best!
Where is the current documentation on getting started with Boilerplate?
The git with the boilerplate in question should have starter steps in the readme (which should be visible on the git page)
I'm trying to track the carrying load of actors. I've got a value in the template but not sure how to change the value as I add items to a character sheet. I'm thinking it is best done by Active Effects but I not sure how to setup a default effect that takes the item sheet input "weight" and adds it to the character sheet's "currentLoad". Any suggestions?
Do this calculation in the prepareDerivedData
Because current load is a derived value based on the items' weight
I tried that but had trouble accessing the items' stats. I'll give it another shot.
Yeah, so in my "actor.mjs" file I have this: actorData = this
But actorData isn't giving me a way to the actors owned items.
Is that valid for all actors or just some type of actors?
Depending you should be doing that in a different file.
But you should be able to access all items via this.items
Which method are you doing that?
I am doing it just for "character" types, right now.
I was able to find the weight stat through "_source" in actorData. I hadn't looked there before because I don't know what it is. Is there any problem with accessing the data that way?
I don't think that's the proper way. I can take a look later today. Can you share your repo?
Sorry, I'm not sure what that means.
Can you share your repository for the system code?
I apologize if i sound dumb but i am new to developing a system. I seem to be stuck in a loop trying to update my system to version 12 of foundry.
Well, usually a good place to start is working through error messages
What do you have?
I keep getting a bunch of TypeErrors over and over.
Screenshots?
give me a little while to finish up with work and then ill Dm the SC to you
Post to #system-development
Not to my DMs
That way if I'm busy someone else can help
Sounds good!
Is this compatible with Version 13 or has it not been updated for it?
We have a v13 PR that was not merged. But you can get from the PR branch
Does it have a tutorial, or is the Version 11 tutorial still accurate?
There are some things that are changed in the code, but not in the tutorial. If this is your first time coding, it can be complicated that the tutorial is not up to date. But it should not be totally off.
The main difference is that the v13 branch uses the data model approach, and some other small changes for the new Foundry API. But I believe that it can still work quite similar with the tutorial
Thank you. This isn't my first time coding, but they made Foundry so damn weird and arcane that I absolutely cannot wrap my head around it, so I'm trying to simplify the process for myself as much as I can XD
I still think that you can spot the differences and use that. And if you have any issue, I am sure that the people in the #system-development channel are open to talk. And if you would be kind to create a list of what is "missing" or changed in the tutorial, I can try to check that later to update it too
Hello everyone. I have issues understanding how setting an initiative works.
I have reached a point where just formula declaration is not enough for my system and I want to implement some conditionals there:
this is my current initiative
CONFIG.Combat.initiative = {
formula:
"1d12 + @secondaryAttributes.ini.total + @secondaryAttributes.spd.total",
decimals: 0,
};
But in my ruleset, the player can get a feat that will give them advantage on the D12 roll.
Also NPCs in my system shouldnt use spd.total for their initiative roll so I wanted them to have a different formula.
Problem is I have no idea how to implement it inside the Hooks.once("init", function () {
Any idea what would be the correct way to implement these ?
You're going to want to extend the Combat & Combatant classes where all this is used
Thanks for the fast reply!. Do I extend these in system.mjs ? Or should I create a new document for extension and then just import it in system.mjs
Similar situation as Actor and Item, these deserve their own files
Also, for this kind of stuff, I recommend #system-development
Extending these classes is not covered in Boilerplate specifically because it's a more advanced topic
Hey folks, is there any boilerplate v13 branch that includes anything on customizing a dark/light theme?
Fortunately that's basically just a bunch of css
@chrome stirrup heres what we use in Draw Steel
:root, .application.draw-steel.themed.theme-light {
--draw-steel-c-dark: #191813;
--draw-steel-c-faint: #c9c7b8;
--draw-steel-c-beige: #b5b3a4;
--draw-steel-c-tan: #444444;
--draw-steel-c-white: #ffffff;
--draw-steel-c-black: #000000;
--draw-steel-c-groove: #eeede0;
--draw-steel-c-success: green;
--draw-steel-c-failure: red;
--draw-steel-c-item-header-bg: #bebbab;
--draw-steel-c-item-alternating-bg: rgba(0, 0, 0, .05);
}
.theme-dark, .application.draw-steel.themed.theme-dark {
--draw-steel-c-dark: #c9c7b8;
--draw-steel-c-faint: #191813;
--draw-steel-c-beige: #444444;
--draw-steel-c-tan: #b5b3a4;
--draw-steel-c-white: #000000;
--draw-steel-c-black: #ffffff;
--draw-steel-c-groove: #11121f;
--draw-steel-c-item-header-bg: #28232f;
--draw-steel-c-item-alternating-bg: rgba(255, 255, 255, .05);
}
We have a V13 PR opened, and it has some small customisation regarding themes, if I recall correctly
The basic idea is you set your css variables based on the theme then just use var for the themes
thank you folks, this should get me started!
Hi, I'm not sure if this is the right channel to ask this question, but how do I create a compendium with folders and items within them?
In this case, I created a compendium, but I'm not able to divide the items into folders; in fact, it doesn't even look like folders. I created it directly from the code of the system I'm using, but I'm not sure if I'm doing it right. I need help just figuring out how to create the JSON structure (if applicable) to place the items within the folders.
Did you define the compendium in your system.json or did you use the in-world create compendium button
But this is something that can be covered by #system-development
I defined the compendium in my system.json because I wanted to do it like the D&D or Old Dragon 2e system (which are the two I'm trying to base this on), where when you open the board or create a board and then open the compendiums, they're already downloaded, without needing to be created.
Do you think it's better if I post my question in this channel then https://discord.com/channels/170995199584108546/670336275496042502 ?
Your question is not meaningfully related to Boilerplate in specific rather than a general system dev question
This channel is much more for stuff like "how does the generate function work"
I'm using the boilerplate system to port to foundry. However I am encountering a slight snag. I've looked through a few files and the walkthrough. And I can't seem to find where I would define the value for character attributes in terms of the modifier applied to rolls.
by default, an actor's roll data is just system
e.g. if you've got system.foo.bar, then 2d6 + @foo.bar will reference that stat
so that would be in the mjs file?
Yes, code is going to be in .mjs files
Do I need to plug in my my own config for that? Like how they have CONFIG.Combat.initiative
We can go to #system-development because someone there just had a similar question
I'm attempting to learn foundry development using boilerplate. I'm trying to start simple by just adding a field called 'test' to my character sheet. The field appears in the sheet, but when I enter data into it, it doesn't save to the sheet. The other existing fields still save appropriately. What am I missing?
actor-character.mjs snippet
schema.test = new fields.StringField({required: true, blank: true});
actor-character-sheet.hbs snippet
<div class="resource flex-group-center">
<label for="system.test.value" class="resource-label">Test</label>
<div class="resource-content flexrow flex-center flex-between">
<input type="text" name="system.test.value" value="{{system.test.value}}" data-dtype="String"/>
</div>
</div>
- the
forthere isn't going to do anything, thefor - Put in a
{{log system}}near that hbs snippet, it's the easy way to do logging - Is this ActorSheetV2-based?
I've removed the for. Is the for a foundry or handlebars thing?
I added the {{log system}}. It was helpful as it revealedtest is coming through as test: "[object Object]" instead of a string, which I'm guessing is the root of my issue
I'm guessing it is v1. This is using the latest release of boilerplate (2.0.1). All references to ActorSheet in the code don't mention ActorSheetV2.
for is a core HTML attribute
oh that's a good point, are you looking for test.value or test
there's a v12 branch that did a bunch of v2 upgrades
Ah, should have figured it was just HTML. Been a long while since I've done any input forms.
That was my problem! I was using test.value. I had wrongly assumed the string was an object and not a plain string. Thanks for assisting in uncovering that!
Should I look into that or would it be better to use that v13 branch I've seen kicked around?