#Custom System Builder
1 messages · Page 28 of 1
i use status icon counter so checking status per round is very important for my use case
yours may be different
Hooks.on('combatRound', async (combat, update, options) => {
if (options.direction !== 1) return; // Kill hook function if combat round doesn't increment forward.
const equipmentTemplateIds = game.items
.filter(item => item.type === '_equippableItemTemplate' && item.name.startsWith('Equipment'))
.map(item => item.id);
canvas.tokens.placeables.filter(token => token.inCombat).forEach(token => {
const statusTable = token.actor.items
.filter(item => equipmentTemplateIds.includes(item.system.template))
.filter(item => item.system.props.status_table)
.map(item => item.system.props.status_table);
Object.values(statusTable)
.filter(row => !row.deleted)
.forEach(row => {
/* ----- INSERT YOUR CODE TO ADD STATUS PROGRAMMATICALLY BELOW ----- */
});
});
});
Thanks for the help, still cant intuitively use .map in my head instantly 🥲
It's pretty useful if you only need a property of an array of objects (like an id)
Completely unrelated:
I don't believe there is a way to sort items in an item list, but would anyone know if it's on the todo list for a future update or anything? I currently have a different item list for every rank of spells, 1-20, and I want to know if I'm wasting my time lol.
It's already in in the beta
Oh cool, thanks! I appreciate it!
I'm probably going to have to wait for the patch release, unfortunately, since I have an ongoing game, but I'm curious how you decided to do it. Is it a normal "Sort by item.level, ascending" kind of thing, or can you do a more specific "Sort by item.Slot, in order of Head, Arms, Chest, Legs, Feet".
I think the first covers 99% of use cases, I'm just wondering haha.
You can do both, because you can specify multiple predicates. Predicates are able to do sort by asc/desc and exact-matches
Great, thanks! Can't wait for the release!
Hello I have 2 question !
1- Is there any known wat to reload all the items, event those that are already in a sheet?
2- Is it normal that when I use 'Delay entity saving' I cannot save the content of any Rich Text Area?
In the console or in a macro:
game.actors.forEach(actor => actor.items.forEach(item => item.templateSystem.reloadTemplate()));
Just be warned that this can take quite some time (it can go into several minutes)
About the second question: This bug is unknown, I'll need to look at it
I'm looking to put an image box inside an item to have it hold user-selected images (like the portrait box, but in the body of the sheet). Anyone figure this out already?
Think I got a way to do it. Just figuring out how to emulate the image search popup that Foundry uses
I'm using a dynamic table to create custom skills
The button "USAR" means "USE", and it sends to chat the rich text area message, but it's considering all my formulas only text. Can you help me? I want the formulas to be active when I press "USE" and send to chat, not just the text
It worked!!! thanks!!
Inside the same example,
I have a number field named "uses" in my dynamic table. Im trying to update the same row of the table "uses" for a skill to "uses - 1" when the player press the button to call the macro and send the rich text area to chat, but this is not working
I'm writing the code to update the uses value Inside the rich text area, which is the camp I also write the formulas to roll dice. How can I update the same row value since it's using an macro and the macro can not understand?
There are 2 ways:
How would one change the width of a specific column in a dynamic table?
Also, how would one format a table created by a dynamic table?
Is there a way to select the last in a dynamic table?
Players will add class to a list of classes they take. The last on the list will be the current class.. and will display as the current class as a lable.
${partitionSelect(fetchFromDynamicTable('titles', 'Title'), '0', compareText)}$```
My thought is to change the 0 above to totallevel -1 but that doesnt work. I thought also about adding another column but I cant figure out how to get it to add+1 if a row is added.. IE
Fleet Acadamey would be 1.
Schumuck would be 2.. so on..
IDK if that is possible...
Can we reference predefinedIdx in a lable?
If so that would also work
You can do that, yeah.
educate me lol
${partitionSelect(fetchFromDynamicTable('titles', 'Title'), '0', compareText)}$ <--- this populates a value but the 0 <-- which I thought was the placement, doesnt match either the dropdown referenced nor the table, so I am at a lose...
${first(fetchFromDynamicTable('titles', 'Title')}$ works for the first value but I need the last value
%{
return Object.values(entity.system.props.titles)
.filter(row => !row.deleted)
.slice(0, -1)
.map(row => row.Title)
}%
"titles": {
"0": {
"deleted": false,
"predefinedIdx": null,
"Title": "SCHMUCK",
"skillPointGained": "0",
"hpGained": "0",
"str": "0",
"dex": "0",
"con": "0",
"vit": "0",
"awa": "0",
"will": "0",
"int": "0",
"cha": "0",
"luck": "0",
"speed": "0"
},
"1": {
"deleted": false,
"predefinedIdx": null,
"Title": "Truenamer",
"skillPointGained": "0",
"hpGained": "0",
"str": "0",
"dex": "0",
"con": "0",
"vit": "0",
"awa": "0",
"will": "0",
"int": "0",
"cha": "0",
"luck": "0",
"speed": "0"
},
"2": {
"deleted": false,
"predefinedIdx": null,
"Title": "Fleet Academy Graduate",
"skillPointGained": "0",
"hpGained": "0",
"str": "0",
"dex": "0",
"con": "0",
"vit": "0",
"awa": "0",
"will": "0",
"int": "0",
"cha": "0",
"luck": "0",
"speed": "0"```
Each column-Component can either have auto or fixed-width. This is the control to change it:
How do I referece the "0", 1, 2 ,3 etct
Looks like there isnt a pid for it ..
referencing null..
maybe thats why
${titles.0.Title}$ e.g. would work if you have a fixed size
It might
Othwerwise check the Script I've posted
Trying to think here... if I count the number of fields created -1 that should give me the number I need to reference
inserting that into ${titles.0.Title}$ would adjust correct
IE if there are 5, levels ${titles.4.Title}$ would return last in the list
Thanks Martin, let me see if I can get it to populate
can switchCase() be used to check booleans? For example, if I had a checkbox that was checked, and had something like this: switchCase(checkbox, 1, 'This is true', 'This is not true') would the switchCase return 'This is true'?
(I'm currently having no luck trying to set up this behavior, and am wondering if it is user error or if it just can't do that)
switchCase() performs a strict comparison instead of a loose one. It's worth to investigate how == and === differ in Javascript.
gotcha. I'll stick with a ternary check for that then.
I still haven't been able to figure this bit out. It's the last part I need for completing a player sheet
I have issues understanding the question. Do you have a Table inside a Dynamic Table and you want to fill that or what are you trying to achieve?
Exactly. I have a dynamic table with tables as its entries
The tables should have text and number fields, but there's no way to adjust the table before it's generated that I can see
Specifically I'm trying to create multiple instances of this table
Well, Tables inside Dynamic Tables are simply not supported
Ah... any other way to accomplish something similar?
I think the next best thing would be items, but those work quite different
Alright, I'll see if I can make those work. Thanks
It worked, thanks!
this code is healing my character with the value rolled on a potion
${#setPropertyInEntity('self', 'hpvalue', "hpvalue + hphealed")}$
but if the max health is 20, whenever this code is used, the healed amount bypasses the max health
then I need to click on the health field to update to max again, I also receive an error "warning, the max health is..."
is there a way to use the code but to not heal more than the max health?
I've managed to set it up as an item container. I'm not fond of the aesthetics of it, but we'll try to adjust that later.
On a simpler aesthetic front though, is there any documentation relating to valid HTML/CSS for panels?
I want to adjust the padding of the grid and some other minor things
You can use min(20,<your_value>) for that.
Thanks! Can you please send my code with this inside? I don't know where to put it
This should work:
${#setPropertyInEntity('self', 'hpvalue', "min(20,hpvalue + hphealed)")}$
Nice, thanks! ❤️
And I can change "20" to a formula, right?
If so, I need to put the formula inside () or other things?
Yes, you can and no need for brackets if you don't need them for other purposes.
And in other case... When the field is "MANA" and I want to reduce mana, but not below 0
it's min(0,mana + manaused) or other thing like max(0,mana + manaused)?
You need max().
No docs for HTML/CSS, you have to get all needed info from the browsers inspection tools.
Gotcha, I'll delve into that tomorrow. Thanks!
Hello everyone, is there any way to override the system giving error if there is a duplicate key? It either gives an error or cahnges the name of the key. I know it might not be the best but the way I am using it I need a duplicate.
I want to be able to show a hidden variable for players to see but not edit, so i create a number that is a duplicate of the hidden attribute, this way the players can see the hidden attribute and if they change it it reverts back automatically.
Just create a Label and reference the Key, no need for duplicate keys
Oh, I was having toruble understanding since it showed like the formula and not the result. But on the actor's sheet it shows correctly. Thank you!
OK, another conundrum. Admittedly advanced and I may be barking up the wrong tree. I'm trying to update an Item, using the results from a File Picker.
The item has a text field called "imgSrc" which I use to hold the path to the image used elsewhere.
I have put this script into the label that holds the image and am getting the error below. Am I calling the update function incorrectly on the entity? What am I missing?
const path = "/uploads/artwork/IRIS";
const props = entity.system.props;
let pickedImage = await new FilePicker({
type: "image",
callback: (path) => {
console.log(path);
console.log(props['imgSrc']);
props['imgSrc'] = '/' & path;
entity.update({'system.props' : props });
}
});
return pickedImage.browse();
}%```
Is it linkedentity.update or my memory is failing me as usual?
I'm calling it from the item itself, not within an item container....will linkedEntity work?
got a different error using linkedEntity
I pulled from the code Martin put up in the Formula System guide for that entity.update()
I believe you're right, I was thinking about Item Containers.
Looks like it's reading update as a function, isn't it?
But that null makes me think that linkedentity is not right.
I'm at a loss...
entity is instance of TemplateSystem while entity.entity is instance of CustomItem. update() is only part of CustomItem
so is there a CustomItem and does it have an .update method?
Sorry, my mistake. In your case it would be CustomItem
so change the entity.update to entity.entity.update?
yup
that works...just making a minor error somewhere with constructing the new value
but if I get this working, I have figured out how to use images in labels that can be updated realtime with the build in filepicker
Got it!
I know this has come up before, but I made a script for anyone who needs it. This will reload all of the items attached to your characters, in case you had to update the templates and don't want to go around manually hitting the refresh on all of the items.
I'll add an option for a progress bar later on 😄
How is it that active effects work?
I am not sure if I got it wrong, shoudn't HP be 0?
Modifiers can only affect Labels
Ooh, let me try that
And you want to remove the Group if you don't have additional conditions
Yup, it works, thanks!
Im sorry to bother so much. I have been trying all day to set a label for the HP in such a way that the player rolls a dice and then the rolled number is added to that HP. I was able to get it done as a number. But if i try to use a label instead, It fails. Is there any way to get it done?
The main issue is that i have no way to create a label with a number that can be modified, can set a label as 0 but then it is a constant and changes back to 0. So if I add the roll then it goes back to 0. And i cannot find a way to make it roll itself and add that to itself.
Nvm i got it
Is there an easy way to add a different sound to the dice rolling buttons? For example, I have an item that is a pistol, and I would like to add the sound of a gunshot when the player presses to roll the dice
I am having issue referencing the selected value from a dropdown list. How would I write a formula that returns true if the selected value in this example is "Minstrel" (key minstrel) from this dropdown list? (for example to determine the conditional visibility of another item)
equalText(class1,'minstrel') would return true if minstrel is selected.
Thanks a lot!
So, a bit new at this entire thing. I'm trying to set up a d100 system using CSB. Wondering how I would go about doing derived statistics that poll from other areas? And also how to set up buttons to do rolls that will evaluate whether or not something falls into a category of being a variable degree of success. I'm impelementing the Laundry system in Foundry if that helps.
There's a Readme online which covers basic questions like this: https://gitlab.com/custom-system-builder/custom-system-builder
Roll-Buttons are being made with Labels containing a Label Roll Message.
It's also worth to take a look at the Wiki-page, which covers more details: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/home
So... this was the intitial way I went about setting up base stats, and then derived stats. I apparently am messing up whatever formula would grab the key value for the number fields holding the default values. Would any people have suggestions of easier ways to go about getting the value I am looking to multiple by 5 for a derived stat?
IE, would a single table with more columns make it easier to reference?
Create a Label for your derived stat and use something like ${STR * 5}$ as Formula.
You can also take a look at the Example-Sheet from CSB, which covers similar cases: https://gitlab.com/custom-system-builder/custom-system-builder/-/tree/develop/sheet-library/Example?ref_type=heads
Hi everyone, I recently started configuring a custom system and I'm trying to use item modifier as specified in the instructions but apparently if the key belongs to a label I can't make it work. While if I associate the key with a hidden value everything works perfectly.
I only use the key value, while value formula is a fixed number.
Am I doing something wrong in the syntax of the key?
NAME_KEY => works only with hidden value
${NAME_KEY}$ =>doesn't work
Or do I have to write some formula in the label text?
It should be NAME_KEY without any delimiters. If you're not using the set-operator, the Label has to contain a number, it cannot be empty.
ok, setting the label text with a number now works! Thank you!
Alright, so I was very sleep deprived when I wrote this, so it's a bit mad, but is there a function to just list the names instead of posting them to the console?
%{return game.actors.filter(actor=>actor.name=='${name}$')[0].items.filter(name=>name).forEach((element)=>console.log(element.name));}%
JavaScript's not my preferred language if that was at all unclear, so scripts and macros are fun to figure out
Uhhhhh, which names exactly? Actor names? If so it's just %{return game.actors.map(actor => actor.name);}%
Item names. All the first part is just because I couldn't figure out how to correctly call this.actor or whatever the correct syntax would be
CSB provides entity, so you can just use that: %{return entity.items.map(item => item.name);}%
...that is certainly way simpler. Nice!
Minor follow-up: Is there a way to get rid of the comma from map?
It's not the map() causing this 😅 . How about using Array.prototype.join()?
How do you execute a macro from the compendium rather than from the Macro Bar with a script?
I got everything functioning with a button to create items, but it only works as long as the macro is in the bar, and doesn't work when it's only in the compendium
Much obliged!
Alright, got a question for people. Anyone have a good idea of how to either A) grab variable roll result levels of success from the Call of Cthulhu 7 setup? Or what is used in Laundry? Or B) how to implement that for button rolls for skills etc? Would that be more of a script thing called from a compendium entry? Or is it something you can put in a button and call a stat to compare?
Basically what I am trying to figure out how to execute is a comparison of a d100 roll to the skill %, and then a comparison to this chart for degree of success or failure. Special success being if the roll is in the bottom 20% of the skill %.
value:=skill
specialsuccess:=value/20
fumble=ceil((100-value)/20)
Dice:=[1d100]
Dice<=specialsuccess?'special Success':Dice>=fumble'Fumble': ....
Greetings. I've made an unofficial Ker Nathalas module using Custom System Builder and I've run into a small problem that I'm not sure how to resolve. When setting up a new world for the module, the templates are imported, but my equipable containers do not preserve the filter items templates selection. I have to go back afterwards and manually set those. Has anyone else experienced this and/or know of a way to prevent that from happening. Thanks!
This is a known problem, no workaround till now.
Will maybe fixed with next update.
Thanks for the info.
I've just found a workaround, go figure. If you make your own module and keep the templates in a compendium, you can import the templates with "Keep Document IDs" checked and it will restore the selected templates.
Question: Someone is trying to load in a single character sheet template into the CSB game, and is getting the error message maximum object depth expansion exceeded. Any idea what that's about?
I tested it in my own system and the same JSON works fine
They do seem to be on Foundry 11 build 305, that's the only thing I can think that's breaking stuff
Try to update the version. I think it was really related to that one
Gotcha, thanks
As a continuation to my descent into madness, is there a function to open an equippableItem from the sheet?
Y'know, as opposed to just clicking it
Actually, new question. Is there a way to execute a script when a text field is changed?
Script: item.sheet.render(true). Be aware that you need the context of the Item
WorldScript is the only solution if you need to handle events like on-change.
Nice. Follow-up question: How do you do a self-reference on a button?
Which reference exactly? The actor? Or the Label Component?
The label component
Well... there's none
I managed to do so since it's in a table simply by using sameRow and specifying the label's own column. Now my only problem is it posting an unwanted chat message whenever I click it.
Suppressing it will be possible with the next patch. Until then you can throw an error at the end to intercept message creation
Ah, will do. Thanks!
So I've been running into an issue since yesterday, that I initially brushed off, but it's becoming increasingly difficult to ignore. Referencing a macro from the compendium fails unless the macro has been recently opened.
game.packs.get('world.macros') returns CompendiumCollection(0), but when the macro has been opened (not even executed) it suddenly returns CompendiumCollection(1) for like 10 minutes, then returns to CompendiumCollection(0). What the fuck is going on?
I have to figure it out at this point because it's stopping me from troubleshooting other problems
Oh, and on an unrelated front: Is there a way to refresh or repaint a sheet?
Ah, just found "templateSystem.reloadTemplate()". So that one's solved
Can anyone help me sum up a column of values from dynamic table. I tried using the sum command but it won't even work with an inputted matrix. I attacked 2 pics to show what I am trying to do
Remove the []
wow, that was a simple fix, thank you
Np 🙂
How do I redo this so it only rolls the selected option?
What does the console say
${#dices:= Picked_Drive + Picked_Skill + Bonus_Dice + Picked_Chain + (Add_Triumph == 1 ? Max_Triumph : 0)}$
${#exploding:= Add_Triumph == 1 ? 'x6' : ''}$
${[:dices:d6:exploding:cs>4]}$
so im a bit lost, how do i update CSB to use the beta version? i already have a game that im looking to change the version of CSB for
That's new to me, idk what goes wrong there. Never had this case
The package manager from Foundry will create a new system for the beta (which is intended). If you want to override the current version with the beta, you'd need to manually pull from the repository via git.
Ah so the former, I'd have to make a new game; but for the latter, I can probably keep my entire game just with an upped CSB version?
When do you expect to push the beta into production?
Or you change which system the world should load (I've never tried this, so unexpected behavior might occur)
Yup
hmmmmm ill keep a backup for everything then
even a whole snapshot
in case things go horribly wrong
Estimations are really hard 😅
Lol completely get it. You need a PM with Agile experience hehe
It's not even a lack of a PM or PO, it's just that the work times (and thus the velocity) for CSB are unpredictable
ive worked on a startup and man estimations are horrible to make on your own
we got no managers, no system, no structure
we all just have to estimate how much we can do in a week or so
and that leads to a super messy roadmap and schedule which is all chaotic
and we didnt even realize how far or close we are to the finishing line
I completely get it Nao, I am a Scrum Master so it's what I do day in and day out.
the worst part is i still dont know how scrum and actual agile experience pans

the only thing i know is "estimate ur workload, finish on a reasonable timespan"
minuses of working on a startup i guess
and you know its startup
things move like crazy
and unreasonable deadlines left and right
Yep, startups were our main clientele but I can help if you need
good money though
so im not complaining too much about unreasonable deadlines
its horrible but it pays well
Indeed
Agile is the mindset, Scum, Scumban, Kanbane, are ways to develop. Basically, its all about the values of developing the product you want. You have 3 basic roles, Product Owner (or Stakeholder), Project Manager( Scrum Master), Developers. Each have their own basic job but the PO delivers the vision, the PM takes that vision and breaks to down into small chunks, the Developers will estimate the work in short durations,
Scum deals with Sprints (short durations, over a set course of time, normally 2 weeks but could be up to 4). There is more to this, but generally speaking you pull in work you can accomplish in that 2 weeks without leaving anything on the table.
Kanban - is less structured, but the timeline isn't a strict and the number of meetings can be a lot less..
I am oversimplifying it, but my suggestion if you do not have a road map is to figure out who your PM and PO is and work with them to get the vision, write out some user stories( A user story is an informal, general explanation of a software feature written from the perspective of the end user. Its purpose is to articulate how a software feature will provide value to the customer) this is not coding, this is high level basic features. The development team with deem how they want it developed.
Sorry if this is long, I can go on and on but hopefully, it gives you a starting point and helps a bit
Yep, I get it, if I remember this is a passion project and not a job so I can see how the unpredictable part comes into play.
oooooooooh, thanks for the input, so i didnt even realize i was doing an Agile mindset
as a developer
sprint is pretty similar to weekly meeting it feels like
Normally in a sprint you have daily standup, planning meeting, retrospective and sprint ceremonies. Its very structured but works.
ohhhhh then i have done sprints then
thanks for the info
planning, daily standup and retrospective im familiar
Yep, your in an agile framework then
agile development is industry standard nowadays, I don't know anybody who sticks to the waterfall model 😅
Agreed
The company I use to work out up until recently ran all their projects as waterfall.. it was a nightmare. It took a lot of convincing to move to agile and then their problems with waterfall disappeared and clients were a lot happier..
Then they let me go ... Thanks for making me money.. cya
ooof
does this expect to return true?
this is on item container
i assume yes but
using the new filter format in 3.1.0-rc2 makes string comparison not applicable unfortunately, whereas you could in 3.0.0 before
ill make an issue on the repo
It behaves like a Formula. So you have to use equalText() in case of strings
ohhhhhhh alright
So basically the same as visiblity formulas
works like a charm, thanks

what if i want to have two conditional clauses?
right now this is what i have
equalText(item.item_type,"Throwables") && item.quantity > 0```
The math-parser doesn't know && and ||. You have to use the keywords and & or instead
It's one of the things I actually dislike, but it is what it is...
aaaah
also i dont think disabling this option works
disabled, it still shows the delete button
like so
(this is item container)
I'll note that one
@formal goblet by any chance, does formula js has a function to concat a string together as well?
${
concat(
fetchFromActor('GM Panel', "fetchFromDynamicTable('all_skill_table', 'all_skills')"),
",ATK,DEF,EVA,HEA,UTL,ALL"
)
}$```
The following is my initial code but it returns this error
No, that one comes also from the lib: https://mathjs.org/docs/reference/functions/concat.html
Math.js is an extensive math library for JavaScript and Node.js. It features big numbers, complex numbers, matrices, units, and a flexible expression parser.
Is there any way to fix the 'item template has been deleted for item' error on a character sheet? I added an item and forgot to edit its item template beforehand and now I get that error every time I add something to the sheet, and there's no way to actually see the broken item to delete it in the first place.
Create an Item Container with no filter and you'll see it
Oh, thank you so much!
This is an odd question: We are using CSB to create sheets with a lot of item containers and items. These items all use templates with a lot of hidden attributes. The hidden attributes on these items basically read/store keys from the actor sheet that we want the items to be able to change.
Example: Every item reads/stores the 9 attributes of the actor (Str, Dex, Sta, etc) so that if the item needs to modify the actor's attribute, it does so using 'item modifiers' that change the hidden attribute.
We've noticed a lot of lag when making any change to an item, is this just a by-product of using so many hidden attributes on items?
I'm trying to set up a system of equippable weapons, with item containers I can divide them correctly, but I can't understand how to recover the statistics of the primary weapon rather than the secondary. I tried with Template Item Modifiers and Conditionals but I only get the value of the last equipped weapon data. Where am I doing wrong? Keys are weapon_slot from a radio group 0,1,2 as values and weapon_damage is one of needed key. Any suggestions?
Well, the more fields you have, the more time it needs to compute. It's not limited to hidden Attributes but to all Components
Is there any more efficient way to do it?
I'd say only pull data when actually needed instead of for every Item all 9 attributes of the actor
Otherwise... it's not the most efficient system, so performance issues can occur
Can you demonstrate what you've got so far?
Is there a "just in time" way to modify an actor key from an item attached to that actor using an item modifier on the item?
Wdym just in time? The whole sheet is recalculated upon changes
So currently, the hidden attributes are used to getProperrtyFromActor() and assign to an item key. That item key then can be modified by the item's "item modifier" code. Trying to modify an actor key directly using an item's "item modifier" code doesn't work.
So let's say we want feat items (built from a feat template) to be able to modify any attribute. Right now, in the feat template, we have 9 hidden attributes that basically assign a call from getProperrtyFromActor(strength) to an item key called 'strength'. Then in the item modifiers for a specific feat, you can have strength modified by some code or number when the item is attached to the actor.
Is it possible to modifier an actor key directly from the item modifier code of an attached item without first assigning it using a hidden attribute? I thought items only had scope to see their own keys or those defined in hidden attributes?
Item Modifiers are built to modify the values of Labels of Actors, idk why it shouldn't work in your case.
How come
token.toggleEffect(statusPath, {active:true})
creates a new instance of the status every time?
Btw, getPropertyFromActor() is outdated and got even removed in the current version
Sorry we are using the new function (fetch maybe?). Our item modifiers do modifier the values of labels of actors, but only (I thought) if they were read and stored into the item through fetchFromActor first as a hidden attribute? Otherwise, if you reference an actor label key in an item modifier does it automatically know it's supposed to change the actor value? (What if an item has a label key the same as open actor label key?)
Item Modifiers consist of 4 mandatory fields:
- Priority
- Key
- Operator
- Formula
The key has to be the target-Component key of the Label in the Actor. Item Modifiers cannot target the Labels of Items. It can be a Formula, which is calculated based on the props of the Item, but it doesn't have to. It's only important that the result is a valid path (like Strenght or InventoryTable.0.Weight).
So the key is meant to be a direct actor label key without the need to pre-assign that to a hidden attribute first?
Yep
What about references used in the formula? Can actor label keys be referenced there directly without assigning them via hidden attributes?
You can fetch them with fetchFromActor() in the Formula-part, you don't have to save them prior
Hmm that might be why we're pre-reading them using fetchFromActor() in hidden attributes to make the code cleaner
We might be able to change that though do to the lag
I'm not familiar with that method to be fair 😅
I don't know what other method I would use to enable or disable a status effect on a token
here an example, both values are the same, danno_attacco should be 3d12
template modifiers
and one of the weapons items
Well, template modifiers apply for all Items of that Template. And because you are using the Set-Operator, the last Item will always override the values set by other Items
What you're probably missing is a Formula for the Modifier Key to change the target you want to modify
Maybe this is your issue? It's needs a path, not an ID
Oh yeah but thats just a fault in my example, I used the path
Then idk, someone familiar with the Foundry-API can help better in this case
Something like that? switchCase(slot_arma, '1', 'danno_attacco', '2', 'danno_attacco2', 0)?
No, you want to modify either danno_attacco or danno_attacco2, not both at the same time by the same item
If I understand it correctly ofc
Only 1 weapon can have the value 1 and only one the value 2, not both values at the same time. With the formula ${switchCase(weapon_slot, '1', 'attack_damage', '2', 'attack_damage2', 0)}$ seems to work, thanks for the tip!
it would be useful to have the possibility to set the size of the item container reference label, like all the other labels 
is there a way to make this work for initiative? I keep getting a finite number error.
I think you can't use the User Input there
Yeah that's what I figured, is the best work around to have the modifier input box on the sheet then pass that off to the initiative calc?
Anyone have a suggestion of how to set the initiative to a static attribute from the character? IE, laundry system, init starts as the dex stat for the character, but their position in the battle queue is adjusted depending on what actions they decide they will take.
You can adjust that in the settings for init
I have tried a couple times, it is just defaulting to 0 regardless of how I try to point it to the dex stat on the sheets.
I have mine rolling 2d10 + speed, maybe try 0d0+dex?
I will open my foundry here and take a look getting kiddo to wchool
School
I'll be, that worked. Thank you very much.
hey, might be a multipart answer but I need some help, its been aminute since ive added to the system i built out, but now this roll command isnt outputting anything, any suggestions? Thanks. : <p>Attack Roll: ${item.name}$ </p>
${current_endurance>=item.weapon_endurance_expenditure_requirement ? [1d20+:virtue_body:+:agility_mastery_bonus:] : notify('warn', 'Not enough Endurance')}$
<p>${#setPropertyInEntity('self', 'current_endurance', "current_endurance - item.weapon_endurance_expenditure_requirement")}$</p>
<p>${#setPropertyInEntity('self', 'spent_endurance', "spent_endurance + item.weapon_endurance_expenditure_requirement")}$</p>
<p>${name}$ expent ${item.weapon_endurance_expenditure_requirement}$ Endurance Point(s).</p>
Wielding State: ${ athletics_mastery_bonus < item.athletics_weapon_mastery_requirement ? 'Weak' : athletics_mastery_bonus > item.athletics_weapon_mastery_requirement ? 'Strong' : 'Normal' }$
<p>BHR Range: ${item.weapon_bloody_hit_range}$ </p>
Open the console (F12) and show the error
It should just be Dexterity or however your key is
Hi everyone, can anyone tell me the syntax for the visibility formula in the advanced configuration? I would like to hide a label if the value of a key is different from a specific value, I tried with weapon_type !='shotgun' but it doesn't work
Hi.
It should be equalText(weapon_type, 'shotgun'). This will show the control only when the condition is true.
Edit: my bad, read your question wrong! Not sure there is a not() function, if so change to not(equalText(weapon_type, 'shotgun'))
Yeah, comparison operators don't exist for strings
This link clarifies the operators
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#313-operators
great now it works! thank you all!
Wait, what? How can you have no access to name?
It's my first time seeing this type of error message
hmm
it suddenly just broke out of nowhere one day
and I hadnt changed any of it either
Ok, let's do some common troubleshooting... I need:
- Foundry-Version
- CSB-Version
- Activated Modules
- Browser-Type
You have a pretty old V11-Build. The latest one is 315. There might be a bug related to this version, but I cannot tell for certain
okay so i should just update CSB
gotcha, hmm, im worried if i update though itll mess up other stuff
It shouldn't break anything with minor version-updates, but backups are always advised with updates
Ok, I am getting to the point of adding in items. I'm assuming using the item container is the proper receptical on the char sheet side. To have the item impact character stats... I assume you utilize the conditional modifier tab?
Also... for the drop down menu on items for what skill is used by different weapons for instance.... what would be the best way to have that directly correlate to the skills on char sheets?
It says that this system works with drag ruler on the wiki but I can’t figure out how to assign the speed attribute in the module’s settings.
Yes, you can use Item Modifiers ti affect stats.
What I've done is put a dropdown in the item so to choose the needed skill and a label in the Item Container to hold the corresponding skill value. Similarly you can refer the selected skill directly in the item roll.
Can you make a macro which activates/deactivates a checkbox within a character's sheet?
Do you need a macro? It can be done via a label roll message.
%{throw "1";}%
Last line is there to prevent the creation of a chat message, should not be necessary with the next version.
Instead of a value (0 in the example) you can use a formula, like a conditional:
${condition?1:0}$
You only need the Document#update()-method from Foundry. If you need some examples, then check the "Scripts"-section: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/home
Thank you both!
I don't know how to ask this question, but is there a limit to the number of ternary operators that can be used in a Rich Text Field and displayed?
Here's my example: This is content in a rich text field column of a Dynamic Table of an Item. When it's displayed, most of the ternary operators display the right content, but then it starts displaying 00, 01, and 02 for the rest.
Below is the code in the Rich Text Field (Which check for other values in other dynamic tables of the item) and how it displays. you'll see that the "Boost" statement is the same code listed twice and the first time it works and the second time it displays 02.
Boost allows a character to increase ${(fetchFromDynamicTable('drawbacks_selection', 'drawback_title', 'drawback_is_selected', true).toString().includes("Single"))?concat("a single Trait type"):concat("one of their Attributes, Abilities, or Powers")}$ temporarily, ${(fetchFromDynamicTable('extras_selection', 'extra_title', 'extra_is_selected', true).toString().includes("Omni-Boost"))?concat("chosen each time the power is used"):concat("specified when the power is purchased")}$.
Attributes: Dots put onto an Attribute ${(fetchFromDynamicTable('drawbacks_selection', 'drawback_title', 'drawback_is_selected', true).toString().includes("Limited"))?concat("increase the base Attribute only"):concat("roll over into the Mega Attribute at 1:1 to the specified limit (normally Quantum+1)")}$
Boost allows a character to increase ${(fetchFromDynamicTable('drawbacks_selection', 'drawback_title', 'drawback_is_selected', true).toString().includes("Single"))?concat("a single Trait type"):concat("one of their Attributes, Abilities, or Powers")}$ temporarily, ${(fetchFromDynamicTable('extras_selection', 'extra_title', 'extra_is_selected', true).toString().includes("Omni-Boost"))?concat("chosen each time the power is used"):concat("specified when the power is purchased")}$.
System: For each dot of Boost, the character gains +1 Dot to the specified Trait or Traits while Boost is active.```
The reason it feels like some 'limit' causing the issue is if I reorder the "Fetch/Ternary" statements, it's always the last ones that get the '00' regardless of which they are
Anyone know the best way to make a shopkeeper template? If I put an item container and a dynamic table side-by-side, they don't line up. Also, I can't seem to figure out how to reference a dynamic table's entries for labels, if that's even possible.
Am I mistaken or you could define prices directly in the item template?
I could do that, but then the price for an item will always be the same, right?
Not at all, you could just use a Number Field or Dropdown and change it item by item.
Well, what I mean is - if I have an item that costs 5 gold, then it'll cost 5 gold in every shop I put it inside, right?
You could change the price of the single item instance, since it would not change the price of the original item. So you will have, say, two containers with one instance of the item each with its price.
-Oooh, good point. That solves that problem, thanks!
Glad to help 😉
You could also have the price be a formula with the base item price * a multiplier that is stored as a attribute on the store sheet.
@wet heronyour making RMU for foundry im long time RM player 20+ years plus and i am running 3 games.
There's no limit for ternaries. But what you don't need is concat(), because I don't see multiple strings concatenated together in your case
Fair point on concat. I've run into weird issues just using string literals within quotes on ternary operators in places before. But the use of concat I don't think is the issue as I use that in other places too. I just can't figure out why after a number of calls, it starts spitting out numbers.
So pardon my ignorance, but what am I doing wrong to get the "true" response instead of the desired damage bonus value?
You cannot declare local variables in Label text, that's only possible in Label Roll Messages
Alright, the variable is defined in hidden attributes. It currently is functioning for values -1d6, -1d4, and 0. But anything above that spits an error.
Never mind, I missed a couple "?" to make it work.
You should test if toString() returns the desired result. Keep in mind that CSB-Formulas use the mathjs-parser, which has its own rules compared to pure Javascript.
I can check but again, the code works once and the exact same code doesn't work when put after it.
Does anyone have some sample weapon templates they made that I could take a look at? Or item templates? I'm looking to better understand how to set them up.
Hi guys. I"m trying to install the CSB system but i have an error. It ask me to install a module, and this one is not working/findable.
(sorry it's in french)
any clues ?
It always went auto for me
No idea sorry
i have finally found a way... installing the previous 2.0.0 version
The Example-Template also has a Weapon-Template: https://gitlab.com/custom-system-builder/custom-system-builder/-/tree/develop/sheet-library/Example?ref_type=heads
How do you find system.props again? I need to check a variable but I can't find it at all.
game.actors.getName('actorName').system.props or what exactly are you looking for?
That works perfect, thank you!
hey so im encountering a really odd bug here. I have an item being added to a sheet from a compendium which i sent to a gm of my system. this error keeps happening every time a edit is made to the sheet. the items are not showing up in any item containers either. happens for items with the unique tag and without it. i have tried a reload of the item sheets to no avail.
Items and Item Templates are out of sync, you have to reselect them again. You can fix those by adding an Item Container with no filters selected, so that it will display all owned items
how do i resync the template and base item though?
Create the Item Container, reload the Actor, go into the Items and select the right Templates. That's it
i see
So I'm having a small issue with the item container, red circle in pic , which is probably due to me being a dummy, but I tried making labels for for people to have section to put down item quantity and I have other tabs inside the page, blue circle in pic, when anything outside the item container is edited it erases the item containers quantity and misc section information. Anyone know what Im probably be doing wrong?
Can you screenshot the same area in the template?
And now the config-form of Quantity
I see. Well, the input won't be saved this way
Gotcha, yeah I figure I was doing something stupid
Just don't know how to do so, if there's a library of code I can look up or something so I can try and learn I can be pointed towards Id appreciate it.
Code of the Item Container: https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/main/module/sheets/components/ItemContainer.js?ref_type=heads
Besides that I'd also need to think about it how to include Input Components into Item Containers, so I can't point you to certain directions.
You can emulate the Checkbox by using an Icon and setPropertyInEntity() in the Label Roll Message to change the state.
gotcha yeah Ill try that, thank you so much
Number and text-fields would be harder
Ok... question. I see that it say == only works on integers and not on strings? How would I go about doing the logic of "if keyA=stringB, then value = X"?
Basically for creating backend logic for items within a dropdown menu.
Use equalText(stringA,stringB)?X:<falsePart>
Hmmm, I must be messing something up then.
${equalText(wealth_dropdown,destitute)? '5':equalText(wealth_dropdown,poor) ? '25': equalText(wealth_dropdown,average) ? '50': equalText(wealth_dropdown,affluent) ? '75': equalText(wealth_dropdown,wealthy) ? '95': ''}$
I have that currently as a hidden attribute. With a key of wealth_value
But am getting zero return on wealth_value regardless of the dropdown menu position.
In the setup of equalText(stringA, stringB) stringA is the dropdown menu component key, and stringB is the dropdown menu item key.
You need sinlge quotes around Dropdown values in the formula: equalText(wealth_dropdwn,'destitute').
@fierce harbor THANK you so much!
Hello everyone! would someone be albe to help me understand how to fix this issue when a player tries to alter teh hp of an enemy?
You have to grant owner permission to the player for enemies in order to allow that.
No problem.
How long did it take? 😅
the most time consuming part is the Data tab
i started this homebrew project about 3 months ago
its a full blown customizable ability builder

some abilities hit multiple times so its a lot of dynamic table mess-arounds
most of my time on this homebrew are now spent on actually building the content, i got 124 abilities implemented, 11/48 equipments and 33 enemies (and counting)
all 124 abilities are from the ability builder from pic above

oof 😅
Is there a way to move/copy an item from a character sheet without having to re-make it? An item was modified inside a character's sheet after being added during the campaign, so I want to be able to keep all those settings without having to re-make them from scratch
Hi, i have question. I've just acquired Foundry and i'm trying to do a simple d20 roll through the character sheet, but even though the d20 appears the roll just doesn't work. Instead, it just sends the message in the chat.
Click on the item image in the sheet and drag.
Oooh, sick. Thank you!
I was trying to drag the name xD
It took me a while to realize too
Sorry, I don’t get your problem.
If you get the roll result printed in chat, the roll worked.
Please specify what is not working? And what system / character sheet aur you using?
Ok, how far off am I with this?
Conditional modifier screenshot is from an item, which is a pistol. Trying to get an weapon agnostic variable set which can be called for a roller icon on the sheet for any weapon dropped into the inventory. Trying to set the value for the weapon by grabbing the target skill to be used from the actor it is placed on.
It was poorly explained, but i already solved the problem. Thanks for answering though!
Is fa_base_pistol a key in the Actor or Item?
UPDATE: With more testing, it seems that this is a limit on the number of times you can use ${...}$ within a label Text field, or a field in a Dynamic Table at least (Might be a universal limit). Any use of ${...}$ (Not just fetch) after the 10th gets weird numbers 01 through 09 then 10 to 19, etc.
I've done some more testing on this and it's very strange. I seem to have narrowed it down to a limit of 10 fetchFromDynamicTable calls. I tried it using two fetchFromDynamicTable calls that alternate from 2 different dynamic tables and then 1 repeated call from one table and results all start to act weird after the 10th call.
Here is what I did (Simplifying everything down to just outputting the results from the toString() calls)
If I have a Rich Text Area that repeats the same fetchFromDynamicTable from 1 Table over and over, it outputs correctly. However, if I alternate calls between 2 Tables, it works a few times, then starts getting messed up. It appears to call one of them and returns a 0 for the other.
Hi everyone !
Need a little help, i have a question, can i fetch a value of an item into an other item plz ?
That's only doable with a Script. Here a few usable paths:
actor.items(all Items of an Actor)item.parent(the attached Actor to the Item if present)
Useful links:
I'll investigate that at a later time
@formal goblet fa_base_pistol is a key on the actor for their base pistol skill.
@formal goblet - I am getting errors in a template and sheet that I cant fix. Hope you can provide direction.
at fetchFromDynamicTable (Formula.js:590:47)
at math.js:26531:54
at math.js:26516:66
at Object.evaluate (math.js:24162:45)
at r.evaluate (math.js:24139:55)
at Formula.computeStatic (Formula.js:858:27)
at Formula.compute (Formula.js:442:21)
at processFormulas (ComputablePhrase.js:139:35)
at async processFormulas (ComputablePhrase.js:156:46)
at async ComputablePhrase.compute (ComputablePhrase.js:212:34)
at async ComputablePhrase.computeMessage (ComputablePhrase.js:352:9)
at async Label._getElement (Label.js:171:21)
onError @ foundry.js:753
:gift:call_wrapped @ libWrapper-wrapper.js:507
:gift:Hooks.onError#lib-wrapper @ listeners.js:138
:gift:Hooks.onError#0 @ libWrapper-wrapper.js:187
(anonymous) @ foundry.js:5771
Promise.catch (async)
render @ foundry.js:5769
render @ foundry.js:7111
render @ character-sheet.js:27
render @ foundry.js:14259
_onUpdate @ foundry.js:14363
_onUpdate @ foundry.js:19131
callback @ foundry.js:13737
(anonymous) @ foundry.js:13711
#handleUpdateDocuments @ foundry.js:13711
await in #handleUpdateDocuments (async)
_updateDocuments @ foundry.js:13458
await in _updateDocuments (async)
update @ commons.js:8677
await in update (async)
updateDocuments @ commons.js:8001
update @ commons.js:8098
reloadTemplate @ templateSystem.js:778
(anonymous) @ templateSystem.js:1081
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2Understand this error ```
If I recreate the template and drag and drop some of the elements I get the following
fetch @ foundry.js:68326
notify @ foundry.js:68223
error @ foundry.js:68260
_handleError @ foundry.js:3468
(anonymous) @ foundry.js:3450
value @ socket.js:532
value @ socket.js:459
L.emit @ index.mjs:136
(anonymous) @ manager.js:207
Promise.then (async)
it @ websocket-constructor.browser.js:5
value @ manager.js:206
L.emit @ index.mjs:136
value @ index.js:131
value @ manager.js:193
L.emit @ index.mjs:136
value @ socket.js:324
L.emit @ index.mjs:136
value @ transport.js:97
value @ transport.js:89
ws.onmessage @ websocket.js:69``
Is there a limit to the number of nested items?
Weird part is, I have been working on this all day without issue. I allowed a player to come in and test, then started to get issues.. They do not have access to the template just the sheet.
Items are not nestable, you probably mean Components. And no, there's no (reasonable) limit for nested Components
I used items as a whole in general term
not specifically speaking about items as a component.
You mean Documents then or what exactly?
Trying to fix my template and sheet because at this point its not useable.
The error regarding foundry.js:68326 Maximum object expansion depth exceeded
the second is the error regarding ncomputable token fetchFromDynamicTable("Attributes", "Base_Total", "Attribute", "Constitution", "===")
at fetchFromDynamicTable (Formula.js:590:47)
I figured a bit a of direction will help, I cant determine exactly the issue since this references something that worked earlier
nothing changed
Hmmm... I'd check if the json-structure of the template is still valid or not
How would I do that
Export and inspect the file via an editor or an IDE
I have it open currently in visual studio code right now
It's hard to tell for what you should look out. Best would be to create a second template and compare the general structure
Yeah, thats what I attempted at first, and threw and error as I was copying things over
I will look through the file.. I would love to clean up the doc make cleaning. Remove the deleted columns and what not but that will be a secondary project
Is there a way to convert a character file to a template?
Thanks! I'm just glad I identified the issue as it's hit me a few times and I never knew what was causing it
Changing the document type in the json and reimporting it maybe?
I will try that
Nope, doesnt even populate at that point lol
I will dive into it tomorrow..... ugh... this is agravating
Did anyone ever get Item Piles to work with CSB?
its pretty workable, scant few bugs though
I'm trying to understand how item modifiers work, can someone please explain?
I'm trying to make an item that gives attribute bonus
https://gitlab.com/custom-system-builder/custom-system-builder#52-item-modifiers
What part you are struggling with?
Hi, does anyone know a custom sheet for Icons?
I read all about it already but i couldn't solve my problem. I'm trying to understand how to make the item modifier appear in the actor sheet, but nothing seems to work
The instructions aren't very clear and english is also not my main language too
Is there a means of getting the total kg's of all the vendor trash an Actor is lugging around?
In this example, the variable is the question "Will you heal?", and the player can check or not check it
But, if the player doesn't mark the box and press "V", the "setPropertyInEntity" will still update the health, but without sending it to the chat
${!willheal? 'HP: ${!setPropertyInEntity('self', 'HP', "min(20 + constitution * 6, HP + 5)")}$' : ' '}$
I want to NOT heal my player if the variable is unmarked. How can I do this?
Your issue is that your innermost Formula will be executed first. So you have setPropertyInEntity() > conditional
Thx I'll try
Can you send me an example plz?
${!willheal ? concat('HP: ', string(setPropertyInEntity('self', 'HP', "min(20 + constitution * 6, HP + 5)"))) : ''}$
Thanks ^w^
It's working perfect now!
On the actor place a “label” with “label text” 0 (zero).
Make a item with item modifier and use as “key” the “component key” of the above label.
Chose “op” + and “value formula” 1
Then see how the above label will change if you drag the item (or even several copies of it) into a container of the actor.
You can not modify a “number field” (most probably your attribute is one).
So you need to have several steps and use them together.
The “number field” attribute, the modified “label” and one more “label” as sum calculator for the both bevor and roll message (I myself placed the last one inside the attribute name description).
@brave trench Right so to move the convo from DM to this channel about setting up Item Piles on CSB
Here are the list of configs you should set up to get things going
- Set actor class type
- Set datapath to quantity and price, in this case we'll assume the component
quantityandkeyexists in your item template, but you can change it to anything you want, as long as the data type is numeric
- In System Specific Settings, Set currency, this assumes your actor template has the component
zenyas the main currency, feel free to change the currency name as you see fit
- Set item pile similarities, this makes it so that purchasing an item, or looting an item, properly stacks to each other, just input the value
nameandtypethere
And that's it, anything else you can check the documentation on how to use Item Piles, the above is just the CSB-specific settings 😅
Thank you so much. I'll get started on this. Hopefully I don't have to bother you with any other questions. ^_^. This looks simple enough.
You mentioned a few bugs though, what can I expect as far as bugs go?
Hello, how do I write the formula to show the number of 6 I made with my roll? I wrote ${:roll:d6cs>5}$ but it doesnt work
on item pile type item pile, the below settings (not sharing settings) cannot be modified, it reverts back to its original state everytime for some reason
thats it
${[:roll:d6cs>5]}$
Guys, good afternoon!
The CSB gives an error when I run this script generated from an item. Is this something the CSB doesn't support, or am I doing it incorrectly?
Can you post the generated one?
The /sheetRoll-command only works with Actor Roll Keys
That's odd because I'm having no issues creating an item pile, merchant, and a container.
I did run into an issue though, I'll ask here first in case it is something you know of. When I buy 1 item, it works fine. When i try to set that amount to anything other than 1 in the interface, my browser freezes. (I'm using the browser as a player to test the buying/picking up side of the module.
I've set my ammunition items to have their own quantity property so that they stack. I thought maybe this was the issue since its quantity is an item property rather than an actor property but when I buy 1 at a time, it stacks properly. If i try to buy 3 at once, it breaks. Any thoughts?
Any hints in the console? Otherwise I'd look at the code of the module to check how it interacts with this case
Ah, I narrowed it down to trying to buy more than the actor had currency for. Though it shouldn't freeze the page lol. Works fine if I have the proper amount.
I am a bit crazy today it seems. I am trying to use a script to generate as a label. The script take the current value of current dice size (i.e. 1d6) and increase it a number of steps based on a value. I pass these through using ${sameRow(dicesize)}$ and ${DICE0}$.
If I assign them static values and use this a rolled macro it populates only as it should but only for rolling purposes. It errors out if I try to pass the values above and doesnt populate AT ALL in the label field. It gives me a wall of text almost like its not seeing the %{}%.
Maybe I am missing something or I am tired..
%{const initialFaces = [2, 3, 4, 6, 8, 10, 12];
const extendedFaces = [6, 8];
function getNextDice(currentDice, steps) {
// Function to find the initial index in the sequence
const findStartIndex = (currentDice) => {
const match = currentDice.match(/(\d+)d(\d+)/);
if (!match) throw new Error("Invalid dice reference");
const [, n, f] = match.map(Number);
return { numberOfDice: n, face: f };
};
const start = findStartIndex(currentDice);
let numberOfDice, faces;
if (start.numberOfDice === 1) {
numberOfDice = 1;
faces = initialFaces;
} else {
numberOfDice = start.numberOfDice;
faces = extendedFaces;
}
let faceIndex = faces.indexOf(start.face);
if (faceIndex === -1) throw new Error("Invalid dice face");
// Advance the steps
for (let i = 0; i < steps; i++) {
faceIndex++;
if (faceIndex >= faces.length) {
faceIndex = 0;
numberOfDice++;
if (numberOfDice % 2 === 0) {
faces = extendedFaces;
} else {
faces = extendedFaces;
}
}
}
return `${numberOfDice}d${faces[faceIndex]}`;
}
// Example usage:
const currentDice = ${sameRow(`dicesize`)}$; // Starting point
const steps = ${DICE0}$; // Number of steps to advance
const result = getNextDice(currentDice, steps);
return result; // Output the result after advancing the steps
}%
What is sameRow('dicesize') returning?
its returns a range but example would be 1d6
const currentDice = 1d6; // Starting point
This is how it will look like after the inner Formula resolves
correct
This is how it should look like:
const currentDice = '1d6'; // Starting point
I just need to bracket it give me a second
this is what it produces in the label
this is what I get running it as a roll
I need it ultimately as a label .. I will reference it in the roll function later on manually
remove the function declaration and check if it solves the issue temporarily
does not resolve
this resolves as a roll fuction (this is hard coded tho)
This DOESNOT produce a result in a label
const extendedFaces = [6, 8];
function getNextDice(currentDice, steps) {
// Function to find the initial index in the sequence
const findStartIndex = (currentDice) => {
const match = currentDice.match(/(\d+)d(\d+)/);
if (!match) throw new Error("Invalid dice reference");
const [, n, f] = match.map(Number);
return { numberOfDice: n, face: f };
};
const start = findStartIndex(currentDice);
let numberOfDice, faces;
if (start.numberOfDice === 1) {
numberOfDice = 1;
faces = initialFaces;
} else {
numberOfDice = start.numberOfDice;
faces = extendedFaces;
}
let faceIndex = faces.indexOf(start.face);
if (faceIndex === -1) throw new Error("Invalid dice face");
// Advance the steps
for (let i = 0; i < steps; i++) {
faceIndex++;
if (faceIndex >= faces.length) {
faceIndex = 0;
numberOfDice++;
if (numberOfDice % 2 === 0) {
faces = extendedFaces;
} else {
faces = extendedFaces;
}
}
}
return `${numberOfDice}d${faces[faceIndex]}`;
}
// Example usage:
const currentDice = "1d6"; // Starting point
const steps = 10; // Number of steps to advance
const result = getNextDice(currentDice, steps);
return result; // Output the result after advancing the steps```
result as a roll
nothing much text as a label
clarifying, I am calling this as a macro in the roll fuction, returns text if pasted in the field..
using %{return game.macros.getName('dice0').execute();}% produces a object
That one is missing an await
Macro execution is asynchronous
SyntaxError: await is only valid in async functions and the top level bodies of modules
Labels with keys are executed synchronously
I removed the await because it was throwing errors about the async
Without the await it will always return an unresolved promise
Btw, what is your procedure supposed to do?
scale the dice rolled based on a stat. So say you normally roll 1d6 I will pass 1 to the formula and it will scale to 1d8, then 1d10, 1d12, etc.. this is dynamic and can go on forever since stats can increase to over 100, this number could be 30d6 at the end of it
So each weapon will get a value to start and be stagnic and that value will grow based on the the str of the character
Ok, and when does it increase the amount of dices?
I believe I have it set at strength value/6+1, so ever 6 levels or so
let me verify that tho
It should be >= and not =>, that's a huge difference
+1 after 10, but yes thats basicly it
Yeah I got it correct in Foundry, this is my chicken scratch on excel
I type my notes while thinking through layouts, not everything is correct lol
Maybe I need to rethink the approach
I was thinking of just passing in the steps and the starting die and letting it scale from there
Having a linear mathematical expression is better than having for-loops
let me revisit my code and see if I can figure out a better option then
I have the following sequence in mind:
0: 1d6
1: 1d8
2: 1d10
3: 1d12
4: 1d14
5: 1d16
6: 1d18
7: 1d20
8: 1d22
9: 1d24
10: 2d6
11: 2d8
Would that be correct or should it be different?
again the roll function works.. I just dont know why the label doesnt lol
thats close
I need it exactly, close is not enough 😅
1
1d2
1d3
1d4
1d6
1d8
1d10
2d6
2d8
3d6
3d8
4d6
4d8
6d6
6d8
8d6
8d8
12d6
12d8
16d6
huh, that escalates quickly
LOL
would have to come up with something after 16d6
but figure alternating them between 8 and 6s
would work
I might be able to get away with just going d6s, but I would have to discuss with the PO
[2d6]->(3d6)->[4d6]->(6d6)->[8d6]->(12d6)->[16d6]..
from 2d6 -> on
each dice would double from the last
something like that, I can mess with numbers as we go to see what scales right
Ok, finding a mathematical function, that would fit for this sequence, would be challenging... I love irregularities
hahah
Let me sleep on this, and come back fresh in the morning, if you think of anything in general let me know. I can sell it based on scaling.. IDK yet
@formal goblet I want to create a sheet for a ship... It needs stats just like a character would (HP, attributes like handling, armor etc, slots for cargo) so I figure a typical character sheet should work.
The different thing about a vessel vs a character though is that it is piloted by a character, and guns maybe by another couple of characters. Is it possible to set this up so that all players can access this one "actor" but perform different tasks, like piloting or gunnery using their stats mixed with the stats of the ship?
This can get quite complex. What I did for vehicles to incorporate the stats of the pilot, I just made a Text Field, where the pilots name could be entered. Going from that, I can use fetchFromActor() with a dynamic name.
Having multiple roles makes it more complex
Do you have an example sheet of where you did that? I'm contemplating even going through all this. Ultimately the vehicles in my systems impose limitations or caps so it really isnt hard to just know the cap and let players roll from their sheets. Might not be worth the hassle to automate a vehicle when its that simple.
It's in german, so it would be hard to comprehend
I just tried that, pretty simple. What about multiple roles makes it complex? cant you just have different players plug in names at different text fields? As long as each of the separate battle stations are different rolls targetting different keys?
The issue with that is that I'd want different roles to have only access to things they should have (e.g. disallowing a gunner having access to the steering of the vehicle)
It gets way easier if you only need to fetch stats from players and nothing more
Oh, I see what you mean. Ive never played with hiding components/tabs before, but I've seen something like that in the sheets. Is that possible? To hide parts of the vehicle they don't have access to?
I don't even need it that complex, just curious if that would even work.
The visibility formula doesn't allow Scripts, so probably not
That would be cool but not necessary, I'll just tell my players not to push buttons not in their station or they get blown up. 😁
Has anyone tried v12? I'm assuming it will not work for a while but just curious.
If anyone can help me. I have a system configured in the custom system builder and both the Crag character and the one circled in red manually have the same settings but only Crag stands out when I hover the mouse over it. The other one in red only shows the name through the option but does not highlight it.
I tried and everything I've made is seemingly working for the moment, the only issue I'm having is getting it to work with Dice so Nice.
I could also see this being user error, but I can't for the life of me think of how I could've screwed a simple dice command to not give out a 3D Dice so Nice roll.
Sup, I think I need a bit of help.
I have a working character sheet template which took time to create, but is working properly, all my formulas are working and reloading the sheets does not erase data.
However, I created another template by duplicating the first, and my formulas (which are the same for the most part) are not working. Worse, reloading the sheets erase the data.
I assume this is a classic case of "problem exists between keyboard and chair" but can anyone help me ? 😅
Actually, merely closing a sheet erases its data.
I deleted the sheet and created another one and a few formulas worked, but other number fields show [object Object], updating them then closing the sheet erases them again back to [object Object]. I'm kinda lost...
Heya!
Just a stupid question, I know, but do the two templates have different names? It happened to me once and I almost lost it before noticing 😅
They do
I have freedom_template and jedi_template
Whenever I add something new to the template, reloading or closing the sheet erases it
Any console error?
Well, I'm at a loss. I would expect at least some kind of error.
Would you mind trying to delete one of the templates and see if it goes back to normal?
The first template is doing ok.
I'm gonna at the very least finish the first draft of the new one and see how it goes after
I have three different classes so far (Jedi, Clone and Wanderer) and they all have unique mechanics, so they need different character sheets :/
I understand, got a similar set-up 🤦🏻♂️
But then I decided to simplify my life 😅
Oh, I wouldn't say my system is not simple, it's kinda fluid and quick because I try to get only one roll per action, but yeah each class is unique and while the mechanics are easy and simple, they require dedicated tabs in the character sheets
And that might be what is generating these errors
Yes, it almost always gets down to the little details that mess the whole mechanism.
Did you made the copy via the “duplicate” function of the sidebar actors tab?
Or did you made a sheet and drag-dropped the needed parts over from the first sheet?
I definitely duplicated from the sidebar
Meaning, from freedom_template I got freedom_template(Copy) or something
Which I renamed to jedi_template
Okay, fine.
Do you have links to scripts or getfromactor functions or similar inside the template?
Do you have controlled some of the keys, if they are still right?
I have zero scripts or getfromactor. The most complex formula I'm currently using is ceil(x) 😂
The keys are alright.
I think the fact I didn't delete one of the tabs in the new template was messing with most of the values
Right now I'm able to edit and reload without an issue
Do you use setPropertyInEntity() somewhere?
I didn't.
Hmm, weird. Well, whatever
so uh, is CSB usable in foundry V12?
@formal goblet I'm just getting a zero here instead of the correct number, does the filter value need to be on the actor?
Formula is in an item, trying to fetch from an actor the value on a table that matches the item's name
fetchFromActor('attached',"fetchFromDynamicTable('stations','testTotal','stationName','name')")
'name' and name are 2 different things. The first one is a static value while the other one is a variable, which will be replaced with the corresponding value.
What you probably want is this: fetchFromActor('attached',"fetchFromDynamicTable('stations','testTotal','stationName','${name}$')")
I don't think Ive ever seen ${}$ inside another ${}$, is that mentioned anywhere in the wiki/readme?
Works though, thank you ^_^ I'll check that out too while I'm at it. I figured the 'name' part was what was giving me trouble.
I managed to make my equippable items have a roll button on the actor sheet, but inside the equippable item sheet i can't seem to be able to get any information on the actor sheet. Any tips on how to solve that?
Are you trying fetch Actor data from an Item? Or what are you trying to acomplish?
Just testing V12
I can not drag an CSB actor onto the canvas anymore.
In other systems no such problem.
CSB Actor sheet (formulas, rolls, items) working as far as tested
Just to let you know.
Yes, that.
You can use fetchFromActor() to do that
perfect, thank you!
Given that I have a roll message set to roll a dice, how would I make it so I run a macro or a single line of JS?
You can use the %{}%-delimiters to run JS-code: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#33-script-expressions
Thank you that worked!
Do you know how I would hide it from trying to return a value?
I thought of wrapping it in a display:none; paragraph but I reckon there's a simpler way
Basically I am adding AutomatedAnimations.playAnimation to play AA macros that match the item name
${#'%{...}%'}$
Aaah, like the one I used in #Roll, thank you!
Would I be able to put a link to a journal entry in a rich text editor on a character's sheet ?
Yep, as long as it's the Dialog editor (1 of the 3 options available). You only need to drag the Journal to the editor.
Oh nice. I guess I cannot do the same in a Label ?
The only other option being I start being more concise on my character's sheets 😂
You could do it in a Label too, but with some additional steps required, because you need HTML
I see. Thanks !
is CSB ready for 12?
We haven't looked into it yet, so I can't tell what works and what not
I want to set the maximum of a number field to the value of another number field. Is it possible?
I tried with and without ${} but I can't seem to get it to work
You are missing the closing $
That was it, thanks!
fiddly question for everyone here. My system is a Forged in the Dark-based system. In that system, when you make a Skill roll, you roll Xd6 where X=the current rank of that skill. If that rank is 0, you roll 2d6 and keep the lowest.
I have the bit working in a label roll message if the skill is 1 or greater. Trying to figure out how to handle if the skill is 0.
For reference, the skill in question here is detect. Here's the current code in the Label Roll Message:
<table>
<tr>
<th>Detecting ... </th>
</tr>
<tr>
<td><strong>Results</strong></td>
<td><strong>${Roll}$ successes</strong></td>
</tr>
</table>```
${#RollFormula:= detect == 0 ? '2d6kl' : '${detect}$d6cs>3'}$
${Roll:= [:RollFormula:]}$
THANKS!!
Anyone know why this conditonal statement doesn't perform the if false statement? Item is looking for a check box in a dynamic table on actor. all 3 parts act properly when separated, the condition returns true/false, the if true or if false formulas both return properly... Add the conditional bits (? and : ) and it just acts as if always true.
${fetchFromActor('attached',"fetchFromDynamicTable('stations','sizeMod','stationName','${name}$')") ? fetchFromActor('attached','actor_size')+sameRow('damage') : sameRow('damage')}$
having a hard time understanding most of that. I get a little bit but not enough to solve the issue. 😅
fetchFromDynamicTable() returns an Array, not a single value like a string or a number
And an empty Array is always truthy
why is it returning an array when I've specified for it to look for a single row matching the ${name}$?
That's not, what it is doing. It doesn't stop with the first match
That's why there's also first(), that can be used to pick the first value in an Array
how does first() decide what is actually first? or maybe the better question is in what order does an array get listed?
Either way I don't think that will help in this situation, right? Is there a way to get this to work with checkboxes?
In case of an Array from a Dynamic Table, it goes from top to bottom
This would be the solution:
${sameRow('damage') + (fetchFromActor('attached',"first(fetchFromDynamicTable('stations','sizeMod','stationName','${name}$'))") ? fetchFromActor('attached','actor_size') : 0)}$
Still getting the same result. no errors, just always acting true no matter checked / unchecked
Would it seem like a viable feature request to be able to adjust item properties from an item container? (For example, being able to put a checkbox or dropdown menu in an item container, such that adjusting them would also adjust the item, too.)
Oh, that's what that means! I saw that, but I misunderstood what it meant. Thank you.
Though I'll point out, I think it would be a pretty significant QoL improvement more than a small one--but happily upvoting!
That and the ability to reorder item container items are probably the big two things I'd love to see.
How about this one?
${sameRow('damage') + fetchFromActor('attached',"first(fetchFromDynamicTable('stations','sizeMod','stationName','${name}$')) ? actor_size : 0")}$
That's already doable in the beta
Yeah, that one worked. I tried the first() on my version and it didn't work, but rearranging it like you did seemed to do the trick.
Is it possible to make a /sheetRoll label in an item that uses the owner actor's sheet?
yeah, you need to use fetchFromActor('attached', ... , ... , ... ). that is what martin and I were just talking about.
Using Item Piles, have you had any trouble being able to drag and drop items from a character sheet to the trade pop up when requesting a trade? I can't seem to drag any items over.
Did you drag the picture of the item? Not the text name?
Yeah, that was it, never mind... I guess not very optimal as the item pics are pretty small by default, and it looks like the pic/name are one entity, but still works. Thank you
Some related doubt, i can't make this work.
Could anyone help me?
${fetchFromDynamicTable('escondidos_atributo', 'escondido_atributo', 'keyescondidos_atributos', 'first(sameRow('talentotree_atributo','fisico'))')}$
What im trying to do its to take a value from a dynamic table, that is chosen with a dropdown list. Then that value its a variable that refers to an actor ${variable_modifier}$.
${fetchFromDynamicTable('escondidos_atributo', 'escondido_atributo', 'keyescondidos_atributos', dropdownKey)}$
the dropdown list its in a dynamic table, so it doens't have to refer the same row value?.
Ah, then yeah
${fetchFromDynamicTable('escondidos_atributo', 'escondido_atributo', 'keyescondidos_atributos', sameRow('talentotree_atributo',fisico))}$
It works, thanks @formal goblet
Its possible to make that inside a variable?
${roll:=[ 3d20dhdl - %{return await game.macros.getName('HE').execute({entity: entity})}% + ${sameRow('talentotree_tree', 0)}$+${fetchFromDynamicTable('escondidos_atributo', 'escondido_atributo', 'keyescondidos_atributos', sameRow('talentotree_atributo',fisico))}$]}$
i want something like
${roll:=[ 3d20dhdl +${mod:= - %{return await game.macros.getName('HE').execute({entity: entity})}% + ${sameRow('talentotree_tree', 0)}$+${fetchFromDynamicTable('escondidos_atributo', 'escondido_atributo', 'keyescondidos_atributos', sameRow('talentotree_atributo',fisico))}$]}$}$
to reuse this mod
Technically you could, but that would complicate a few things. You'd have to put the content in a Rich Text Area and execute it from a Script
You can go through this conversation: #1037072885044477962 message
Thanks
should we go ahead and upgrade to v12, or wait for the CSB update?
@formal goblet So hey, as a player, when I try to look into other people's sheet (permission: observer), i can do it
But why is it when I add an item to that actor, I can no longer look into the sheet?
item added to actor
player view:
for some reason, having any item causes this error to appear on the player and they cannot view the character profile
Seems to be a bug. Can you open a ticket for that?
hmmmm alright, lemme try to reproduce it though, fresh install of csb seems to work fine
@formal goblet Oh one more thing, by any chance, do we have any feature for item drag-and-drop on actor sheet in CSB? apparently its a core feature but i have no idea how to drag an item off an actor
You can drag the icon (not the name) around
hey dpose the custom system builder work with the new update ?
I have an rich text area in a dynamic table for skill icon input, so my player can just copy and paste an icon to the rich text area with key "iconskill"
But whenever I edit the label button "Roll Skill" placing ${iconskill}$ in the last line (in the other lines, I have things like rolled, skill value and other things), I get an error and the skill is not rolling
Without the icon it's rolling perfectly.
Can someone help me plz? I want to send the icon to the chat on the same message
Not verified
Can you show the exact setup?
Yes, but is in portuguese
(this down is just an normal skill roll, it's working, but when I try to refer to ${iconepericia}$, the key of my rich text area where my player can put an image, to just print on the roll message the skill Icon, I get an error)
${!selecaodepericia}$
🎲 Rolagem: ${rolagem:=[:tipodarolagempericia:]}$
📖 ${!selecaodeatributo}$: ${atributo:=switchCase(selecaodeatributo, 'Vigor', valorvigor, 'Força', valorforca, 'Destreza', valordestreza, 'Sabedoria', valorsabedoria, 'Inteligência', valorinteligencia, 'Vontade', valorvontade, 'Consciência', valorconsciencia, 'Manipulação', valormanipulacao, 'Carisma', valorcarisma, 'Sorte', valorsorte, 0)}$
📖 ${!selecaodepericia}$: ${pericia:=(fetchFromDynamicTable('pericias', 'nivelpericia', 'nomedapericia', selecaodepericia))}$
⭐ ${higieneimportapericia ? 'Higiene afetou em ${valorhigiene}$' : '...' }$ ⭐
✨ Modificador: ${modificadorpericia}$
📜 Resultado Final:
${rolagem + atributo + pericia + modificadorpericia + (higieneimportapericia ? '${valorhigiene}$' : '0' )}$${!rolagem == 20 ? ' ACERTO CRÍTICO' : ''}$${!rolagem == 1 ? ' FALHA CRÍTICA' : ''}$
(I want to include "iconepericia" rich text area with the custom Icon made by player here, after "Resultado Final (final result)"
And what's the error in the console?
So, basically, this "iconepericia" rich text area it's only the skill Icon on the dynamic table, because I want my players to put custom icons on this area, and when I try to print "iconepericia" key inside the roll message area, I get this error
Ah yeah, Dynamic Table. You have to use sameRow()
Oh, I totally forgot about that!! I'll try
Now I'm getting this
With the code:
${sameRowRef('iconepericia')}$
No Ref
Ok
maybe it's because my roll button is on another panel?
the code to roll is in "rolar perícia" button
and the dynamic table is separated
Can you help me plz?
Wait, I'll try something
${fetchFromDynamicTable('pericias', 'iconepericia', 'nomedapericia', selecaodepericia)}$
I'm using this and i'm getting another error
"selecaodepericia" is my dropdown key with all the skills (pericia), where my player can select the skill to roll
nomedapericia is skill name
Open the console and enter game.actors.getName('actorName').system.props.iconepericia (replace 'actorName') and show the result.
Oh wait
actorName, the sheet model name?
However the Actor is named, y
Then without .iconepericia
Expand that one
Here it's the table "pericias"
Martin, I guess we solved it
It was necessary to open the icon image rich text camp
And save it, to update the path
Now it's working and it's showing the icon on the roll message
Thanks ^-^
It was because I added this camp with icon image later
So it wasn't updated because some ready skills I never opened the rich text area default Icon
So, I'm trying to build a new game world, and get CSB up and running, and I'm bumping into this error:
Running Version 11, Build 315.
You need the module Chat Commander
Cheers
I am having troubles finding a valid manifest URL for this module (for the most up-to-date foundry). Any ideas where to find it?
this one does not work:
https://gitlab.com/woodentavern/foundryvtt-chat-command-lib/-/tree/master/src/module.json
You don't need a manifest URL. Just install it via the package manager
I am having a bit of a brain fart right now. I am trying to make a dice function based off of a number field that rolls X+1 dice and keeps the highest. It should be something like ${ (str + 1)d20k1 }$ but I can't seem to get it right
${[(:str:+1)d20kh]}$
ty
I am looking to try Custom System Builder coming from Simple World Builder. is it possible to import compendiums built in simple into custom so I can clean them up for this builder insteead of starting over? I made a module and put all my compendiums into it however they do not show when enabling that module on Custom System Builder.
Different systems are not compatible with each other, so you'd have to start from 0
oh ok. dang. i was hoping scenes and tables could at least come over. thanks for the quick response.
You can export and import these if they do not contain system-specific data
Scenes without Tokens and Journals without links are less of an issue
awesome. i will try that
I got something like this to work a while ago, but I'm having issues now. I have an AttackBonus label that, when clicked, rolls ${[1d20]+AttackBonus}$ to chat.
The actual AttackBonus label is ${Strength + AttackMisc}$ which are both Number Fields. My goal, preferably, is to make AttackMisc a text field where the players can write, like, 1[Feat]+2[Proficiency] etc, to comment their Misc bonuses. What would be the best way to do this, because I keep running into different issues. If I do ${Strength + [${AttackMisc}$]}$ then it returns [#] instead of just #. If I do ${Strength + [:AttackMisc:]}$ then it returns the proper result, but as a string so when I click the label I get an "Uncomputable token" error.
I've got no issues
Maybe it's my formatting? Here's it exactly:
Where lblInitDex is a label of their Dex bonus, and txtInitMisc is the Text Box
This is the problematic part
Sorry, that's my current formula. As previously stated, when I change it to ${Strength + [:AttackMisc:]}$ it gives the the uncomputable error
I've also tried ${Strength + [${AttackMisc}$]}$
Sorry, I was looking at two different ones for the names, lol.
But the label on those with actually SHOW the correct number, even with the Roll Formulas.
That's with ${lblInitDex + [:txtInitMisc:]}$
It just gives me the error when I actually click the button
(I have to go do something, so I'll be slow to reply
There are still several issues with using [] in Label text. You could just show the string, that wouldn't be a problem. But it gets one when you try to parse it as a Roll Formula
Because every time you reload the sheet, the value changes (if you have dice-formulas, not only static values)
Yeah, I'm with you there, I just thought that was the only way to get the comments on the numbers to work. Like in my screenshot, with the [Feat] comment. The comments were my main goal to get them working.
You can get it to work if you use the Formula in the Label Roll Message directly instead of saving it in the Label text
Okay, yeah, that does work. Unfortunately, it's suboptimal for the way I've done my sheet but thank you!
I use fundryserver to host my games and use Filezilla to transfer files across. What should I name the module folder to store the chatcommands module so that CSB can reference it correctly?
~/Data/modules/_chatcommands
what does this warning mean? can I just drag and drop the css file into the relevant place in my library files, or is there some other mechanic it's referring to?
You can just drag in there. You just cannot select it from the file browser, so you have to insert the path manually
ahhhhh I see what you mean
hoping i'll have enough data loaded in to start styling soon 🙂
I can also recommend the Custom CSS module, which works better than what CSB offers
I just added it! haven't played with it yet, but I'm looking forward to it
I'm testing this out for the first time, and having trouble placing an actor on my scene. When I drag my test actor onto the scene, it doesn't place, and the console gives the error:
at new PlaceableObject (foundry.js:26050:13)
at new Token (foundry.js:58249:5)
at TokenLayer.createObject (foundry.js:33985:12)
at TokenLayer._onDropActorData (foundry.js:41484:20)```
Forgive me if this is the wrong place to ask, but I'm not really good enough to know where to go for help from here.
I've never seen this error before... What Foundry version are you running?
Can the dropdown list formula option grab a column from a dynamic table as well as adding a few custom options?
Yeah it can
I tried to do fetchFromDynamicTable('station','stationName') just to grab the array but its coming up blank. Also said to separate the diff labels with commas, tried that and it just threw errors. I've never tried this before and not sure how to set it up and the guide is kind of confusing to me.
fetchFromDynamicTable() should be enough tbh
Oh, i figured it out. first issue was just a space in a weird spot, the error was because the each key needs to be a separate formula separated by commas. ${fetchFrom...}$,${key1}$,${key2}$ I was just using 1 set of brackets with commas.
Is it possible to fetch an array from a dynamic table using two different filters?
Not without a Script
Are you aware of a bug, or maybe just a reason why this is happening?
label 1 = ${sum(fetchFromDynamicTable('damageTable','integrityLoss', Whole Vehicle))}$"}
Label 2 = label 1's key. throws a some props not computed error in console.
This only happens when filtering off of the dropdown menu. If I remove that filter the field computes, minus the filter of course. Label 1 computes accurately either way.
The Formula of Label 1 doesn't seem to be correct. You can either have 2, 4 or 5 input parameters, not 3
lol yeah you're right. I thought it was working fine since it summed everything properly. 😅 Thank you.
Are there any tutorials available? the Git readme has answered a lot of questions but would like to watch someone else do it and explain stuff about items and maybe abilities/magic.
Never mind, I'm still having an issue with this. I thought I had it but it was another weird fluke. Do you have any idea what is wrong here? Test1 phys dmg should equal -4. Test label is just a key of Test1, should copy it.
It has something to do with the formula on the drop down list, If I switch to custom keys it works fine. What am I doing wrong?
nm, I think I actually got it this time. dropdown formula had to be in single quotes ${'totalHardware'}$,${fetchFrom...}$
Version 12, Build 324, the most recent one.
CSB is not verified for V12
Ok, perhaps a stupid question. But if I wanted to write something that would evaluate and then use the lower between two values, how would I go about doing that?
IE, I want to have something along the lines of value = (lower of variableX or variableY)
min()?
For the visibility formula for a section on a character sheet. I want to make a table only show if the name field on a character sheet matches a string. how would I write that formula? thank you for any help provided.
equalText(nameField, 'string')
oh ok that seems way more easy than expected. if i want to check it against multiple strings should i just use or between?
equalText() or equalText()
Thanks, I got it working with nested ternary operators.
Probably ghetto, but it is functioning. So... meh
Ok, that works just as well with way less bloat, I'll switch it to min(). Thanks
RAndom dice question, i have large formula that conciders roll this or that, and it rolls all the dice regardles if its true or false. any idea how to fix it? we use dice so nice so the roll looks like a bug
For the dynamic table in template does the slash through trash can mean they cannot delete it?
Contruct the roll-string before using it:
${#rollFormula:= advantage ? '2d20kh' : '1d20'}$
${[:rollFormula:]}$
It will prevent players from deleting the predefined row
perfect
Hello, my tabbed panel is not working, it let me click to create a newe tab but it doesnt allow me to proced after that
Anyone knows how to fix it?
Does it create the new tab or not?
It doesnt, only allows me to click on the button to add, and nothing happens
Are you seeing any error in the console (F12)?
Can you show the tabbed panel setup, please?
It needs a key written in component key, otherwise it is null.
Does it let you save the component with the name or it gives you an error when you write the name?
I am able to save it
Well, it should work...
The yellow error happens when i open de edit component
The red one when i try to add a tab to the tabbed panel
Maybe some file is missing?
Try deleting the panel and remaking it giving it a new name from the start.
Don't know, never happened to me
Oh well, I literally did nothing 😅
Sorry for not being of real help, cannot seem to fix the problem.
Try it with V11 instead
ok, will try it
v11 is the foundry version or the cbs version?
Foundry
Ok, thks
It worked, thank you for your help
Hello, I am currently testing CSB and would like to know if it is possible to "nest" equippableItem : for example I have a "People" equippableItem in which I could add another equippableItem like a "Trait". Then if I drop the people equippableItem on the actor, will I have the People and Traits items on it (certainly the good item containers on the actor sheet) ?
It seems that I can't add an equippableItem in another one (or maybe I am doing wrong)...
Nope, totally not possible right now 😄
Is there a way to make a sheet element only visible based on the visibility formula if the viewer has permission? It seems like when I try that the formula overrides the sheet permissions.
That's a bug that got fixed in the beta
Cool! Is there any idea when the beta will be ready for implementation for use other than testing?
There's currently some heavy restructuring of the code base. And estimations without time-organisation are impossible
So a while out? Cool. From everything I hear, it'll be well worth the wait. I'm excited for it!
is there a way to have a label roll message drop a /command into chat? I am looking to implement the module special dice roller and it uses /commands to process the special dice
Good question, I think it still can do that, but that's quite some time ago... Most of us don't invoke chat commands from a Label Roll Message anymore because we use Javascript instead (which works better)
oh dang i dont know how to write js. thanks for the info. I'll see what i can try. may have to learn js.
%{
game.specialDiceRoller.l5r.rollFormula('rr2w');
}%
That would be an example.
ooooh wow you are amazing
Looking at these two checkboxes, is it possible to make it so that they are mutually exclusive? In other words, if one box is checked, the other gets automatically unchecked and vice versa.
That would be the behavior of a Radio Button, not a Checkbox
I haven't fiddled in CSB in over a year I think. Last time I recall radio buttons weren't a thing. Are they available now?
Yep
Oh, rad!
A year is quite a lot 😅
You can go through the changelog if you want to know what changed so far
Heh, yeah. I just made the systems and settings my game required and called it a day.
Easiest system update ever 😄 Thanks, Martin!
Hello, newbie here. Trying to build my custom system in CSB, but when I look at Formulas I just check out mentally...
Trying to set up my component based item system where Players and GM can make items with predetermined components.
My current goal is to make the "PropertyModifier" field only appear when a specific option is selected from the Dropdown in the "ComponentProperty". How would I go about doing that?
(For example, the Modifier field only shows up when the GUTS component is selected (GUTS component key is IC-GUTS))
Should be able to do this by using the advanced option for visability
Example
write whatever formula that might be viable and put it in there. I use this for fields I dont want other to see I make it something x =0 and players cant see the field.
Ohh, I see, I missed that field there. I'll try to figure out what formula goes here, thanks!
No worries, I planned on making something based on class but I havent gotten around to it yet
Hey, I've got a label setup to show the number of types of cards in a hand. The only problem is it doesn't update with the hand as cards get drawn and discarded. Any fix for that?
Here is the label text: %{return game.cards.getName('Chips - ${name}$').cards.filter(e => e.name === 'White Chip').length}%
You'd need a World Script, which updates your Actor, when something with the Cards changes
Ok. Thanks!
hey guys can anyone help me please. right now im using Roll20 but want to switch to foundryvtt. I use my own set of rules with self made character sheets in excel etc. Is it possible to create like an own sheet in foundry with macros in the sheet? and which system should i install then? because right now my friends have to switch between the excel and roll20 and then just roll the dice there. i tried to install for example D&D but the initiative there is rolled with d20 but in my game i use d6. so basicly what i want is to "copy" my excel into foundry and choose fields when players press on it a dice will be rolled. i read about 2 systems. first is simple world-building (Which i havent tried yet) the other is custom-system builder which i tryied but got this error message when downloading it. (i also changend or older foundry version 11 Build 315 but noting changes)
which one is better for me? i tried simple worldbulding and it seems to be fine. but can i change somehow the initaitve dice? and in the charakter sheets there are 3 tabs (info, inventory and attributes) can i add more? spells, traits etc?
You need to install the module Chat Commander to let it work
I have no clue about Simple World Building, this chat is only for CSB. SWB's channel is here: https://discord.com/channels/170995199584108546/1037073983335563457
Thanks !
I'm a bit swamped by an unexpected behaviour. Shouldn't this conditional disable the prompt if the condition is not met?
${darknessChance>(item.baseCostDD*20)?(#concat(?{challenge:"Difficulty: "|0|5|10|15|20|25|30|35|40|45|50|60},'')):''}$
concat() is useless, but the result is the same with or without it.
It doesn't. The order of execution is the following:
- check for
# - check for
! - user input templates
- user input
[]- the rest of the expression (including conditionals)
Does it mean I should try to put the conditional inside the user input? Because I'm trying but to no avail...can't seem to find a way to do that.
The conditional will be evaluated after these special cases
Ah, I see. I'll resort to a simpler approach, then. Thank you for your time!
Heyo! I need an assist with a code:
${(?{Energy:'Energy Spent ='|"CNothing","None"|"CStam","Stamina"|"CWill","Willpower"}))}$
${#Aspect:= ref(AspectLocked)}$
${#AspectDice:= equalText(Energy, 'None') ? 1 : 0}$
${AD:= [:AspectDice:d:Aspect:]}$
${setPropertyInEntity('self', Energy, "equalText(Energy, 'None') ? ref(Energy) : ref(Energy) - 1")}$
The idea here, is if the player selects the option 'None', the AD shouldn't roll. But it's still rolling every time.
Any idea where my mistake is? I made this a while ago, and don't really remember how to read it anymore
${#AspectDice:= equalText(Energy, 'None') ? 1 : 0}$
This part more specifically
if I switch the 1 : 0 btw, it never rolls.
check what Energy returns in your case
In which way?
${Energy}$ somewhere
okay, just checking
it returns the key, either CNothing, CStam, or CWill
Depending on the choice.
Then it should be one of the 3 instead of 'None'
Someone here had told me iit should be 'none' in the past, since I don't know how to read it, I left it that way.
Okay, lemme try
What should the order of the 1 : 0 be?
I was also tolld 0 : 1, but that never rolled.
The first one is taken if the expression resolves to true, otherwise it takes the second one
I need to catch the last and first number of a number field, its that possible?
so 2d6
i need the 2 and the 6
a 28d8
i need the 28 and the 8
will always be a dice
%{return entity.system.props.key.split('d');}%
It is on a dynamic table. and they need to be separed
It's also on a item container roll
so how can i use the correct key?
You just add [0] or [1] at the end
I need to know where the key is and where the formula will be
From the dynamic table im using:
${#dice:= sameRow('matrizdmg_mod')}$${[:dice:]}$
and for the item container im using:
${!item.wpdmg}$
the formula
intentionally it's supposed to be something ${}$+%{}%
with these keys
simplifying if the dice is 2d6 I want the run macro to be 2*6
${#dice:= sameRow('matrizdmg_mod')}$
%{
const a = '${dice}$'.split();
return a[0] * a[1];
}%
thank you
quick little question is there a way to say roll n d6's in a row where n is a value in a number field? I am looking to make it A roll label roll message
not to be added together
but 1d6 n times
Yesterday, I spoke too soon. This change with the Radio Buttons broke the logic in the character sheets that calculates item numbering.
I checked the gitlab article for Radio Buttons...so if I understand this correctly:
WARNING : Contrary to the other components, the value of a radio buttons group is obtained in Formulas by using the name of the group, not the key to the radio buttons.
then changing the Label Text formula to
${item.weaponsGroup ? 'Yes' : 'No' }$
Now it looks like I can't get the character sheet to display a Yes for a selected Radio Button and a No for an unselected one. They just both say the same.
I assume this is because the Value is not correct. In my thinking, the Value should be some sort of if/else statement, like "if this Radio Button is selected, then 1. Otherwise, 0" but I don't know how to codify this and would appreciate some help.
Unless I'm overthinking it and it's a simpler solution.
The first of two screenshots here shows the character sheet and its template on the right top and bottom, with the Label Text showing the new item calculation for the Radio Button group. The second screenshot shows an item and its template with the component for one of the radio buttons.
I need the content of both Radio Buttons
Only doable with a Script currently
Your values should be distinct
weaponsGroup will always be '1' in your case
I don't know what to put so that if Equipped is selected, the sheet says Yes for that column and No for the Inv slot column. And then if it changes and the player selects Takes up inv slot the yes/no switch.
Then make one value 0 and the other one 1
thank you, been trying to fiugure out what would be required for That script. I'll keep trying.
Already tried that and both remain at Yes no matter which one is 0 or 1
Because you have to do weaponsGroup == 1 ? ...
${item.weaponsGroup ? 'Yes' : 'No' }$ is not correct?
'0' and '1' are both truthy, so you have to compare the values
'0' is not the same as 0
Do you mean like so?
${item.weaponsGroup == 1 ? 'Yes' : 'No' }$
That seems to work correctly if the second radio button is selected but not for the first one.
The first one: ${item.weaponsGroup == 0 ? 'Yes' : 'No' }$
Sorry, I think I got confused. I forgot to update the Inv slot column on the character sheet. Once I did, it now works correctly. Thanks for your help again!
One thing just keeps leading to another 😓 And this one is a head scratcher for me.
The character sheet should be looking at every Yes under the Inv slot column and summing them up. But not only is it doing that incorrectly now (after updating the items as discussed above), but I'm not even sure how it's calculating anything at all, considering I don't see a formula for it where there should be one. Obviously I'm missing something here.
Oh right, Iit's been so long I had forgotten hidden attributes exist. Okay, no issues then. Until there is... 😅
The 10 seems to come from item modifiers
You're right, as usual. I thought it was the hidden attributes, but that wasn't it.
Guess I have to go and change every single item modifier individually 🫤
This has probably been asked before but there is no way to set an Initative roll button on the sheet correct? I got it set up properly through the token just wanted to confirm there is no way to set it up on the sheet
hey guys, i guess i have some kind of complicated question: i just started with foundry and have my own system, thats why i use Custom System Builder. First of all and most important: I have this excel, is it even possible to display all the fuctions in the sheet in foundry?
You could construct a Script, which would set the Initiative. That would be doable. Otherwise, no
Awesome thank you
Then i would like to ask: 1. Is it possible to set individual initiative rolls for every player? 2. Is it possible to make a rule in the game when a d20 is rolled for "Intelligenz" for example and you value is 13 and you roll a 12 that there is a "Success" notification. other when above 13 then not success? also when you have to roll two dices and both need to be sucessfull? 3. as you can also see in my excel a lot of attribtus are conected to each other is it possible to make this formalas also in the sheet or must i just enter the value? and always when i player is lvl up i need to change everything in the excel and then transfer it into foundry? How difficult would you say are my questions to adapt for me as someone how cant program and is new to foundry?
There's an example-template for the project, which you can use to get an overview of the functionalities: https://gitlab.com/custom-system-builder/custom-system-builder/-/tree/feature/referenceItemContainer/sheet-library/Example?ref_type=heads
- Doable
- Doable
- You can also use Formulas to connect stats together. You should check the following 2 docs for more info:
- https://gitlab.com/custom-system-builder/custom-system-builder
- https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System
The difficulty depends on how complex your calculations are, so it is pretty much comparable to Excel (which also has a ton of complex functions like ARRAYFORMULA())
thanks a lot! i will try it out!
Can you have panels within another panel that are laid out in columns that are not equal width? For instance, a panel taking up 1/3 of the width and a panel taking up 2/3 of the width?
You'd need custom CSS for that
nods Thank you
I'm trying to use that to make a label roll, but i'm not being able to.
Can you paste your syntax?
${fetchFromActor("attached","varname",0)}$
${[1d20+fetchFromActor("attached","max_for",0)]}$
"max_for" is the key to the value of the maximum strenght of the actor. I have a feeling what i'm doing wrong is on the 1d20 though
Hmm we haven't used it for a roll, so the only thing I can think is try it out of [] and see if it works?
it does not 😢
${[1d20] + fetchFromActor(...)}$
Ok... so question. I'm trying to have a variable on an item populate via a stat variable on any actor it is attached to.
I've tried ${fetchFromActor("attached", "dex_stat")}$
${ref(target.dex_stat)}$
That one should be correct
Ahh... I see, I was trying to populate a text field with the response, but it won't do it. I can make a label and it will pull, so a pebkac.
hey guys small questions, whats wrong here? i try to make the result rounded with no dezimal. i checked every key and its right and when deleting the math.round i get a result. do i use wrong formula?
It's just round(), no Math there 😅
haha damn it thanks!
never lucky with "fetch from dynamictables".
did i misstype something?
fetchFromDynamicTable('talentotree', 'talentotree_tree', 'talentotree_nome', Test)
bassicaly i want the variable "talentotree_tree", from the dynamictable "talentotree", that have the name Test "talentotree_nome"
Then you also need Test in quotes, because it's not a variable then
thanks!
there's a way to multiply a variable?
like 12*${}$
being more specific
12*max(${idk}$,1)
something like this
thanks
Hello, how do i use a item value on a formula? For context , i was trying to make the character hp be based on his (class + his con)* his level
Anyone know how I can retrieve the Label Text (or component key) from a label so that I can pass it into a macro that I'm calling from the Label Roll Message on that same label?
Hello,
I am trying to clear out a dynamic table called history. It is a history of every roll the character has made, and gets a little big. (the roll is how exp is calculated so I need to keep a history of it until after DM approval)
This is my current code ... but nothing seems to happen.
%{
update = {};
update['system.props.history'] = {};
entity.entity.update(update);
}%
any idea why that would not erase the values?
Ok figured it out. I will leave my notes here in case anyone else needs to search for how to clear a dynamic table. Even though it is an object in memory if you treat like an array it will work so the following worked.
%{
update = {};
update['system.props.history'] = [];
entity.entity.update(update);
}%
quick question can i somehow make this fields clickable so that a dice will be rolled? the players will enter there a number (1-20 as its a d20 game, but 1 i critical success) . Would it also be possible to make a rule that when the dice is same or lower then the number there will be a success text or something? And would it also be possible to make double dices because on some talents i need this fuction as well because player have to throw a STR and DEX throw at once. but as soon es one is not achieved is a failure
You can only do that with a static component key, there's no this
Use either Item Modifiers or one of these Scripts: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Scripts/Scripts-for-Items
Good question... Can you create one inside? Otherwise no
- No, only Labels can perform Label Roll Messages
- Yeah, that's possible. Just save the roll result, use a ternary-operator and output the desired text
- You can do that the same way as the second point (just with 2 roll results instead of 1)
thanks for the response! im sry i hardly understand what to do 😄 im pretty new here. can you give me an example how to use your solution?
${#RollErgebnis:= [1d20]}$
${RollErgebnis <= Genetik ? 'Erfolg' : 'Fehlschlag'}$
guess i quiet dont understand the system. i entered it into the lable text and get this:
You have to enter it into the Label Roll Message (not Label text)
ok nice now it seems to do someting but there is still a error message comming
Make sure that the keys match of course 😅
Ist vermutlich Gen statt Genetik, wenn ich das richtig sehe
ok jetzt check ichs 😄 der text kommt ins lable rein aber der key muss von der zahl sein. macht natürlich sinn! Danke schonmal! wie kann ich dann noch zusätzlich im chatlog neben dem "Erfolg" die gewürfelte zahl direkt anzeigen lassen? aktuell muss ich auf das "Erfolg" draufklicken um den Wert zu sehen. wenn es ein doppelwurf ist muss ich dann in die formel die du mir geschickt hast neben dem Genetik dann zum Beispiel +Stärke eintragen oder wie funzt dass dann?
Einfach das #, das versteckt einzelne Formeln
Und zum Doppelwurf... brauchst dann natürlich nen zweiten Wurf. Kannst einfach den aus der 1. Zeile kopieren und eine andere Variable verwenden. Die Auswertung, ob es ein Erfolg ist, erfolgt dann in etwa so:
(RollErgebnis <= Gen and RollErgebnis2 <= Sta) ? 'Erfolg' : 'Fehlschlag'
ok nice danke ich probier mal rum!!!
So hat alles soweit geklappt 😄 letzte frage für heute:(Versprochen) In meinem Regelwerk werfen die Spieler bei Talenten auf Doppelwürfe. In dem Beispiel Springen ist Körper & Genetik jeweils ein W20. Der wurf klappt soweit. Eine besonderheit wäre jedoch, das Ihnen sogenannt Ausgleichspunkte zur Verfügung stehen. UKP und Expertise. Diesee Werte in dem Beispiel sind 4 & 5 also ingesamt 9. Das bedeutet wenn ein Spieler auf z.B. 10 & 10 Würfeln muss, aber jetzt eine 8 & 15 gewürfelt hat hätte er ja den zweiten Wurf um 5 Punkte nicht erreicht. Diese Ausgleichspunkte können deswegen bei jedem Wurf passiv den Wert ausgleichen. Quasi 9 Ausgleichpunkte hätte er, braucht aber nur 5 um aus der 15 einen 10 zum machen die dann zum Erfolg führt. Eine 20 bleibt aber ein critischer Misserfolg und führt in jedem Fall zum nicht gelinge des Talents. Kann man das in einer Formal hier darstellen?
Wirste bisschen rechnen müssen, aber ja, sollte gehen. Dann wäre es sinnvoll, wenn du einen Wert ausrechnen würdest:
${Ausgleichspunkte:= UKP + Expertise}$
${Gesamtwert:= Ausgleichspunkte - max(RollErgebnis1 - Attribut1, 0) - max(RollErgebnis2 - Attribut2, 0)}$
${Gesamtwert >= 0 ? 'Erfolg' : 'Misserfolg'}$
Hmmm, so I have a question. I currently have an item container that displays various things it pulls from items placed in it. For instance:
Is there a way.. to instead of having a label that displays only what it pulls from the item, have the capability to add or subtract from the total on the item?
I notice I can only make those displays in the item container labels. But I'm curious if there would be some way to pull it off in the "roll" label, which has other elements it does? IE, could you have some sort of pop up that would inquire how many shots are used? And then adjust the running total on the associated item?
Roll label:
${#?{difficulty:'Difficulty'[check]|'Average'|'Easy'|'Difficult'}}$
Modified Percentage:${value:= (ref(item.skill_name) + firearm_mod) * switchCase(difficulty, 'Easy', 2, 'Difficult', 0.5, 1)}$
${#specialsuccess:=ceil(value/5)}$
${#fumble:=100-(floor((100-value)/20))}$
${item.name}$ roll is:
${die_roll:=[1d100]}$
Which is a
${die_roll<=specialsuccess?'special Success':die_roll>=fumble?'Fumble':die_roll<=value?'success':die_roll>value?'failure':''}$
Spectactular, it is functional.
Ok... another question for folks. How can you (or can you at all) have a formula in a ternary operator?
What I am looking to do... is reduce various variable aspects of a vehicle, when the HP of the vehicle is reduced to half or lower.
What I'm currently dorking around with is:
${current_hp <= breaking_point ? '{vehicle_base_speed / 2}': '{vehicle_base_speed}'}$
