#Custom System Builder
1 messages · Page 21 of 1
This can be done with javascript
and is it possible to use dynamic table as item container?
Nope, incompatible to each other.
Uh, that's Javscript you're using there. There's a difference in the syntax between CSB-Formulas and Script-Expressions (Javascript): https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System
And don't forget to add a return when using Script Expressions (before you ask why it's returning undefined).
Well, the Example-Template already covers most of the common cases 😅
Is there a way to have drop down menus affect one or more stats? For instance starting characteristics based on species?
(I apologise if this has been asked before but I have no idea how to narrow down my search results for that specific question 😅 )
The stats themselves have to check what is selected and modify their values accordingly. Or you use Items instead of Dropdowns, these can modify values directly.
To start with I’ve tried using a condition to modify a stat, but so far I’ve only managed to make that work with a checkbox and I’m not sure how to get it to change based on what checkboxes are turned on. Can conditions be affected by drop downs? Or am I needing a totally different approach?
Thank you for your time, I’m not very well versed in programming as is and I’m just starting to dip my feet into the system so far, I’m doing my best to teach myself what I need with the documentation and example sheets 😅
Im trying to use fetchFromActor('target', "B_Resistance") but it keeps saying Uncomputable token target
Wait nevermind its working now...
Pretty sure I want some hidden dynamic tables for what I want looking with fresh eyes.
EDIT: Or maybe not, I think items might be the way to go...?
Basically I'm trying to make a system for 40K Black Crusade and I'm wanting to have sheets automatically update based on species, archetype etc, and since those give a variety of things like bonuses, skills, even items, I'm not sure if this is realistically possible within the limits of CSB or not.
The existing Deathwatch sheet doesn't do this so it does make me wonder if it is in fact possible.
did anyone bind atack with sequencer jb2 animations in CSB?
Yes, but i did it in 2 steps. First the roll and than the players activate there macro with shift-click the roll button again.
Bonuses is easy with items. Granting whole skills or even items is out of reach if you don´t want to rely on scripts.
That what I thinking the case might be, thank you.
I'm having a bit of trouble with dragging and dropping items, just using the _template stuff for now, the items are applying to the template sheet as I can see stats changing, but nothing is displaying in the item container. I've not edited any of the templates (aside from making a test armour) so I'm not sure what's wrong.
Open configuration of the container. After adding templates you have to adjust the filters.
Well, it´s a bug that the export file does not contain the selections 😅. You have to reselect them
You have to activate the template in there.
Ohhhh
I've turned it all on just to be sure but there's still nothing showing up
I'm assuming I've missed something, I'm just not sure what.
Oh, okay, _Inventory items work but nothing else will display. I'm a bit lost on why tbh but I'll work it out 😂
OHH, you need the container radio buttons in the item for it to show up, managed to add that to the armour template.
OHHHH, I completely missed what the container filter was doing, I was too focused on the checkboxes
Evening, ppl.
I'm trying to update a value inside an item, on the left you can see how the label is set in the container. All it does is send '10' to the chat without updating the value inside the item...
I'm doing something wrong, for sure, but cannot see what...
Any kind soul willing to help me through?
hi... these condition in labels are quite a topic today - i have problems as well:
${roll:=[1d20]}$ + ${rollstats:=[:HS_INT:]}$ = ${roll+rollstats}$ <- works perfectly, but when I want to add condition based on dropdown list (only 2 values) it doesn't work... probably I am doing something wrong (I'm quite a noob in coding all this stuff)
${roll:=[1d20]}$ + ${(dd_powers_attribute == 1) ? rollstats:=[:HS_INT:] : rollstats:=[:HS_PRE:]}$ = ${roll+rollstats}$ - it doesn't even roll :?
worked around it and used secret section to determine rolls before - this way it works... now i just need to figure out how to include additional description, color and styles of the rolls
<section class="secret">
<p>${roll:=[1d20]}$</p>
<p>${rollint:=[:HS_INT:]}$</p>
<p>${rollpre:=[:HS_PRE:]}$</p>
</section>
<p><strong>Score:</strong>${roll}$+${(dd_powers_attribute == 1) ? rollint : rollpre}$ = ${(dd_powers_attribute == 1) ? roll+rollint : roll+rollpre}$
is it even possible to change style (eg. font color) as a condition based on dropdown?
I'm having trouble with drawing a number from an item. I'm trying to create "species" items to automatically set initial characteristics, and based my code around the examples provided in _template (armours in this case, when you add an armour it automatically updates General Armour Protection and such). I can't for the life of me get a number to update based on any items however, like the _template can. I don't know what I'm missing.
CSS question. I added a quick roll "button" at the top of a character sheet. It's a label with the fa-dice Label Icon. I want to make it larger, but I've tried scale, font-size and a few other things, I just can't get it to resize. Any hints?
Never ever use conditions outside of functions like setProp...(): ${setPropertyInEntity('item', 'varCostVal', "item.varCostVal == 0 ? 10 : 0")}$
Should be this instead:
${#roll_formula:= ds_powers_attribute == 1 ? HS_INT : HS_PRE}$
${roll:= [1d20]}$ +
${rollstats:= [:roll_formula:]}$ =
${roll + rollstats}$
Yeah, you just put a formula into the style-tag. For example:
<p style="color: ${!condition ? 'green' : 'red'}$;">Conditional colored text</p>
Take a look at the item modifiers of the item template.
🤦🏻♂️
Thanks a lot, pal!
it definitely uses condition, but doesn't execute as intended - instead it just writes one of the color names. If I use color code like #002233 it returns error.
<p style="color: ${dd_powers_attribute == 1 ? 'green' : 'red'}$;">Roll</p>
Try the fixed one (missed a !)
Damn it! Now I'm both ignorant AND blind. Thanks Martin!
@formal goblet Any ideas when this will be merged?
https://gitlab.com/custom-system-builder/custom-system-builder/-/merge_requests/45#dfbee68b73205255658a7bc96b6e1026f79b8eb3
Look like development of CSB stopped from October?
I'm planning to continue on February
Hey I’m using custom system builder for a dolmenwood game, is there a way to import b/x monsters and basic items/equipment into it?
Is there a way to create a new entry in a dynamic table outside of JS and the "+" button?
Nope
You'd need a mapper, which maps the data into CSB-valid format. This can be tedious.
You can use the Data Toolbox module. There is a youtube video showing the setup for importing the (needlessly complex D&D) monsters. I have used it for bulk importing various item types, but there is always (for me) some tweaking afterwards because my spreadsheets (see the video) are not very complex. It just makes creating things faster.
Yes it's good module.
I have use it for easy item creation (spells skills other )
I see in the _armor template the item modifiers are in the window for configure modifiers, however these don't carry over to a new instance of an actual armour item, but it still modifies stats appropriately. I have tried a similar thing with my species but nada, nothing is updating. If there's a step I'm missing with the example interactions that work I'm not seeing it.
You won´t see them in the actual item, but they will still apply. Small hint: You can only modify Labels
I'm trying to do something that I think should work but I can't seem to get it to work.
Can a dynamic table drop-down list spawn from an item container?
I'm trying to make a repository of weapons and equipment and then have the players equip them in certain spots via the dynamic table drop down.
I've just cracked it, I think, none of it worked until I included a label with the same key and the number 0 in the text. I saw this was in the _template sheet too but I didn't see any formulas so I didn't know if it even did anything. I'm not sure how it updates but I guess that was the step I was missing.
The value also gets doubled for some reason, but it's mostly working now
So you want a Dropdown list, which can select the Items? To do that, you need the Formula-option in the Dropdown list. In there you have to provide a Script to get the right items from the Actor.
Either multiple items or multiple modifiers of the same kind.
Ah yes, I made a typo in the keys for two of my modifiers, thank you
I had two of the same 😅
Ayyyy
This is driving me nuts. The const sd line throws "unexpected token" error but I cant figure out why. Does anyone have any suggestions? Its in a dynamic table.
%{
let up = ' <i class=\\"fa-solid fa-cloud-plus\\"></i>';
const sd = "${sameRow('skillData')}$";
if(sd == "Generic Spell") return up;
return "";
}%
and what is the unexpected token? 😅
After futher investigation, its not the this code. This is the process the causes the error. I manually create a new record in the Dynamic table. I then run a macro that creates a dialog and from the responses, populating some of the fields using something like system.props.spells.29.skillData. This all works. The above code is in a label in the dynamic table and is the source/trigger of the error. However, if I then manually modify the field that is being referenced by the originally indicated code, the error abates.
The initial error generated is
I think it relates to synchronous execution.
I'm trying to have a roll deal damage to a target and it works but the function shows up in the result is there a way to make it not show up there?
That didn't work but its ok
Ok, so I've built my custom system and now I want to share it. How do I do this?
I want to be able to give the entire system as it works in my Foundry, and package it to run on my friend's computer (also has a paid license)
Any help is greatly appreciated. Please and thank you!!!
You usually just export the templates. In most cases that's all you need. Otherwise you can also submit your work in our GitLab so that we can include it in the sheet-library.
If I wanted a whole world with created actors and items also brought over, would exporting/importing the templates and then the assets separately do the trick?
Yep, that's also fine
I have backend tables in character sheets that basically hold all the values for my character sheets. Fingers crossed they transfer.
Thank you
Im trying to use the visibility formula in advanced configuration but its not working with this equalText('${Discipline_Cat}$', 'Attack')
Try it without ${}$
Still doesn't work
Discipline_Cat is a dropdown list if that's important
I might just switch over to checkboxes
The following code generates an error. This is test code to see if I can get an idea to work. Any ideas as to why the error is occuring?
${#SL:="name@Arcana, skill@0, stat@3"}$
${setPropertyInEntity('self', getRefFromDynamicTable('spells', 'skillData', 'helper', NN),SL)}$
Nvm, think I found it. 😛
Follow up! I think I got this to work ```
${(fetchFromDynamicTable('item.action_table', 'action_name'))}$```
Now, lets imagine that the item.action_table has more than one action_name... can I somehow get this to show as a seperate row on the item table? It currently concatinates the row, but I'd like each to be seperated/ or at least listed vertically rather than horizontally.
I don't think so
Hrm. Would it be possible to make a drop-down that picks one or the other, then use this as a reference for other fields?
Would submitting to the GitLab save all of the created items, and such?
I've made something like 200-ish objects that I'd like to transfer over as well.
Ah, I am reading documentation on exporting an adventure... let me see if that works
Anyone had done code for group rolling to share? i mean to make all players characters role perception
Hello, I have an issue. I cannot use setPropertyInEntity for a dropdown key.
Is there any way to use setPropertyInEntity with Dropdown ?
It should be usable for a Dropdown. How do you do it?
I create a dropdown :
Then i use ${setPropertyInEntity('self', 'randomDropdown', 2)}$ or ${setPropertyInEntity('self', 'randomDropdown', "2")}$
But drop down is then bogged and is shown empty
Before / after i click
Value exist somehow, but it's not shown in dropdown and behavior is inconsistent, if i use key in formula it will work or not depending on how I use it.
And when I restart my web page / foundry, value is then set to null
${setPropertyInEntity('self', 'randomDropdown', "randomDropdown+2")}$
But i do not want to add 2, I just want to set it to 2
Example :
I think it's probably due to the fact value is set, but my client doesn't refresh data for Dropdown with proper value. So my sheet on my PC show a value, and server have another one. When I refresh it then probably select default dropdown value
(sorry for my english ^^')
so ${setPropertyInEntity('self', 'randomDropdown', "randomDropdown==2")}$ (sorry for my english too ^^')
Hmm, "randomDropdown==2" is a condition, so it will set it to true or false (according to previous dropdown value)
It doesn't work with numbers for some reason... Seems to be a bug
Oh ... I should use some work arround maybe ... like adding a text column to my dynamicTable, us it as key value, and then use a hidden attribute using this text as filter with fetchFromDynamicTable to recover my value
Yeah, it's working with text + my solution
Hi folks, I am trying to create a user input for a roll that would allow the user to select an action from a dynamic table, and then reference that action for the roll. However, I cannot get the dropdown to populate. Here is what I have thus far:```
${?{Action to use: 'Action to use?'|{fetchFromDynamicTable('item.action_table', 'action_name')|}}$
Guys, I think I found a bug, when I use this formula in a lablel :
%{return await game.macros.getName('Slots tout').execute({actorName: '${name}$'})}%
Everything is fine, but as soon as I put a Key on it, then my actor sheet start doing some very weird stuff with my variables (like disapearing and stuff).
Am I doing something wrong? Is it something known?
Hi, how can you sum the weight or used slots (any parameter) from item container?
in the Example_V2_3_1_EN_Martin1522 total weight is taken from item container, but this label doesnt have any formula or link to item container
Take a look at the item modifiers of the item template
Label Roll Messages and keyless Labels are asynchronous, everything else is synchronous.
there's this key Total_Weight_${Container}$ - this has to be the same as key of the label?
yeah
I don't know what that means 😅
dear lord... it finally worked. That was a lot more workaround than I expected...
${#die:=fetchFromDynamicTable('item.action_table','action_dice')}$
${#rowcount:= count(action)}$
${#one:=action.at(0)}$
${#two:=rowcount>=2?action.at(1):''}$
${#three:=rowcount>=3?action.at(2):''}$
${#onedie:=die.at(0)}$
${#twodie:=rowcount>=2?die.at(1):''}$
${#threedie:=rowcount>=3?die.at(2):''}$
${?{actionselect: "Action?"|one|two|three}}$
${roll_die:= switchCase(actionselect,one,onedie,two,twodie,three,threedie)}$
${[:roll_die:cs>=4]}$```
If anyone can think of better, I am all ears... but I finally have a button to roll an action from an item (assuming no item has more than three actions, which shouldn't happen unless I make it so.)
so I must be doing something wrong :/ items don't inherit modifiers from template and the formula only works if I individually set modifier for each item
I'm trying to quickly cobble together a basic character sheet for a system.
I want to have it so that there's a button that will roll xd6 , based on an attribute the player selects. However, the individual dice results is what matters, not the total. So I want 3d6 to give, for example, "1, 4, 5" rather than "10" (and then having to click the 10 to see the individual rolls). How would I approach this? Is there some kind of loop function I can make a formula do?
i think what you need with low skill is reaaaly long IF-TRAINs one instruction has only one answer something like${?{dice|0}}$ ${[1d6]}$ ${ dice>1 ? [1d6] : 'X' }$ ${ dice>2 ? [1d6] : 'X' }$ ${ dice>3 ? [1d6] : 'X' }$ ${ dice>4 ? [1d6] : 'X' }$ ...and so on this way you always have them seperated but for example if you top at 10 and roll 1 you will get 1d6 ad 9 X it will look like slot machine.
if you want to calculate them you need to gather values
${ S2:=dice>1 ? [1d6] : 'X' }$
....and so on
```Than you can use to get max or avarage or add... anything you can make math for
Thank you! I'll give that a try when I next can :)
Thankfully the highest the player can roll is 5d6.
I don't know if this is a Foundry issue I'm having or not, but I'm unable to link actors or items within rich text fields like normal. I drag and drop the entry I want and rather than a link, it just gives me the UUID text:
EDIT: From Foundry support (in case it was on Foundry's end):
Looks like the system might not be enriching that text field to support those links
Does that sound right and/or intended?
hello! I am new to all of ths and just tried to install the custom system builder, but it says I need to install some dependencies manually. How do I do that?
hello! can you round up? I'm using slot system and want to count slots. Right now eg. 20 arrows = 1 slot, 21 arrows = 1.05 slot and it should be 2 slots up until 40 arrows. Using round() always rounds down until .5
Hi, Trollbait. If I remember correctly, you also need to install Chat Commander. Do you host your games on your own computer or on the Forge?
My own PC
You can get Chat Commander here: https://foundryvtt.com/packages/_chatcommands
Chat Commander, an Add-on Module for Foundry Virtual Tabletop
Do you know how to install a module? if you go to your Foundry setup page , then to Add-on Modules, then you should be able to look up the module and install it. Then you should be ready to go with CSB.
floor() and ceil() are the other 2 rounding functions.
ceil was what i was looking for! thanks
You can install Chat Commander (module) via the Foundry Package Manager.
Is there a way to increase the size of the character portrait on a character sheet or change its location or is its position static?
The position is more or less static, but can be adjusted with CSS. The size can be adjusted over the template config (one of the header-buttons).
Linking only works with the Dialog-option within the RTA
Thank you! As an aside, CSB is great! It took me a bit to figure things out as someone with no programming background, but now I've got a couple of character sheets that my players are really going to enjoy. Thanks for developing the system.
Sure, np
forgive me, but where is that located?
In the home-screen of the Foundry Application
Where you install systems and modules
thanks! That made it work! I apreciate it
If I ask for some help with this, will someone be able to help me figure out what to do to get the desired sheet layout? I am currently fooling aroud with it and following the guide on github but an experience person talking me througstuff and tinkering would be amazing
I am fairly new to all of this and I barely have an understanding of only a few programing bits
Am I able to display a text field in a lable formula? Something like :character_name:? It would make the Chat dice rolls much more 'personable'. I've tried lots of syntax, but think I may have missed somethng obvious. Cheers.
Have you tried ${character_name}$ ? This assumes you have a Text field with the Key character_name.
This should work without issues.
Hey everyone I wanted to create a simple system to play One Page Rules online with my friends but I don't want to go through the full coding of a system. I've checked Simple wordbuilding, custom system and sandbox. What are the pros and cons of each one?
Funnily enough I’ve been using simple world building for a custom skirmish game I made and I have to say from what I’ve experienced the template system in that one is a nightmare compared to the one System Builder has.
Adding something new to the template in Simple Worldbuilding doesn’t update any actors made with that template meaning that if you’ve made units and need to change something you need to do it manually for everything…
That and more importantly I’ve found absolutely no info about how to use Simple Worldbuilding online.
In Simple Worldbuilding’s favor it’s somewhat compatible with Condition Lab & Triggler (which Custom System Builder is most definitely not) though I’ve found only the macros activated on gaining and losing the effect work, the Always HP module also works cleanly with Simple Worldbuilding.
To use Simple Worldbuilding I’ve needed to rely on macros but with Custom System Builder almost everything works in the character sheet.
I have not tried Sandbox so I cannot judge it.
(Sorry if this is a bit rambling and incoherent I just kept listing things as they came to mind)
Custom System Builder is a miracle... it frustrates me, it confuses me, it sometimes has problems... but it is a miracle
That works! Thanks very much.
Does anyone know how to make a user input template?
I am confused on what its asking in the wiki.
anyone made a roll all players macro script? would gladly look at to capture the esence 😄
Hey all, design/implementation question for everyone out here. The system I'm working on uses equipment to provide character customizations. When an Actor equips an Item, I want it to make between 1 and 3 different actions available to the Actor.
My first thought is to use Items and an Item Container, but I'm not sure how to handle the variable number of actions (roll formulas) on each item.
For example, a Sword of Smiting might give the actor both a Basic Attack roll and a Skill roll to intimidate. In that same system, a Turtle Shield might give the actor a Reaction Roll to reduce damage, a Skill roll to hide, and an Attack roll when the shield is thrown at a target.
I'd want the actor to have a list of actions laid out like :
-Basic Attack (Sword)
-Intimidating Flourish (Sword)
-Absorb Damage (Shield)
-Turtle Camouflage (Shield)
-Shell Shock (Shield)
Where the items on this list change based on the equipped gear. I know how to do the equipping part already, but I'm having a hard time visualizing how to use Items and and Item Container to capture this.
I hope I'm clear on what I'm trying to accomplish. Anyone do anything like this already? If not, any good ideas on how to leverage the system to do it?
You could have the actions on the item sheet as label buttons "Action 1", "Action 2", and "Action 3" and then just have the item container have columns with label buttons that copy said action buttons.
So the item container would show "Sword" as an item, and next to it you'd see clickable buttons for "Action 1", "Action 2", and "Action 3" (Though you could obviously name them whatever you want).
Ok Question ripper mods are popular anyone tried to use mastercrafter and add a roll from charactersheet to it?
My idea would be using item_modifiers as flags that allow otherwise hidden labels on the mainsheet to be seen.
Anyone know how to have a roll check for a value (ammo for a weapon in this case) and then not complete the roll if it doesn’t have it?
This is really broad. Can you narrow it down more?
i was asking if anyone made a macro to roll all players at once for example for perception and show who succeded. and if anyone made something similar i would borow code to try to force my values into it
Is there a way to have items only appear in one container at a time without filtering specific items to specific containers? I'd like to have two or more rows available for Talents (and other items later) rather than a single, long list. Currently however if I place an item in one container, it appears in any that doesn't filter the entire type of item out.
(Also, is there currently a way or organise item containers and dynamic tables alphabetically yet? I saw last time this was asked was to wait for an update, I don't know if that's happened yet or not).
Thank you for the help so far, I do appreciate it.
I'll give a little explanation how Item Containers work internally, so that you know where the issue lies.
Item Containers do NOT hold Items, they only display the links to the Items an Actor has. The real Item holder (and also the only one) is the Actor.
So the question you have to ask is not "How do I place an Item in only 1 Item Container?", instead you have to ask "How do I let it display the right Items?"
Ah, so unless there's a way to tell it to only show an item once, or otherwise filter it out, it will always display in every eligible container?
As long as it passes the filters, it will be displayed
Fair enough, thank you.
And the sorting feature is already finished for Item Containers, it's just not released yet
I'm smacking my head against a brick wall over item modifiers displaying on the sheet again, I got it working with my Species items just fine but if I do the same thing with these talents they no longer work, nothing displays, not even an error. Why on earth would it work with my species modifiers but not the talent exp? I've followed the exact same process for both, as far as I'm aware.
I don't see any modifiers
All of those "species_x" ones modify the label I have set up just fine, the "talent_cost" one however just comes up blank
And what is the key of that Label?
For the species, it's all "x_inital" (where x is the characteristic) and for the talent label I have it as "talent_exp"
I can display the exp cost in the item container just fine with "$(item.talent_cost}$, but not outside it with ${talent_cost}$ like I did with the species characteristics
You are modifying talent_cost, not talent_exp
I think I've crossed wires somewhere, the modifier itself is talent_cost but the label on the sheet is talent_exp, much like how the species_x numbers appear in the label marked x_inital (I wasn't sure if that key needed to be different or not.)
Forgot to come back and say this worked. So, this worked, thank you! Unfortunately Dice So Nice still rolls those hidden die so I disabled the module for now so the players don't get annoyed at the hidden dice rolling high lol
The modifier key has to match the Label key. And if you use +, -, * or /, the Label has to contain a number
Why would all the species_x ones work then? I'm really not trying to be difficult, I apologise, it's just these seem to fly in the face of what you've just said, and yet work.
As I say I did literally everything the same with these talent costs to display them, but it's just not having it.
They shouldn't unless you have additional Labels with the species-keys, which are getting modified.
Only the ones in the species template, the number boxes have the key species_x and so do the item modifiers.
I've double checked my talent item and the number box for the xp cost is talent_cost and the modifier is also talent_cost
The item is fine with the modifiers. What is wonky is your actor template
Open the console (F12) and type game.actors.getName('yourActorName').system.props and check if the result contains the species-keys.
Do you use the actor id or the actual name? Because either way I'm just getting:
Uncaught TypeError: Cannot read properties of undefined (reading 'system') at <anonymous>:1:37
The actual name
I think I missed a capital letter, oops. Yes the species-keys are there
Then you have Components with those keys in the actor template
That's why the formula resolves
Does it make a difference if it's in a table or not, I've just realised that's one thing I have different currently
Nope, normal Tables are just a visual thing and Components in there are treated as if there was no Table.
Fair enough
Yeah, I can see talent_cost isn't showing up in the list of keys in the actor
Yep, because you don't have a Component with that key in the Actor Template
I don't for species-keys either though, aside from the ones in the species item
The console says something else. Did you reload the actor?
I did yes, I'll do it again just to be sure
Then you have components with these keys, simple as that 😅
You can export the template or actor and search in the JSON if you're unsure.
I mean sure I might as well, but the only components I can find with a species_x key are in the species item. It's the same thing with talent_cost and I'm getting very different results.
Oh FFS, I'm an idiot
I didn't, at ANY POINT, check my "hidden" tab
I am so sorry for that bloody rigamarole.
Nothing unexpected for a dev 😅
I do very much appreciate the paitence, thank you.
Definitely time for bed lol
Yup, completely works as expected now 😅
I need help with two things about a label roll message in my item container.
First is how to not have something show up in the chat but still happen. I’m running a setPropertyInEntity changing health by the amount of damage and I want it to happen but I don’t want the remaining health number outputting in the chat message.
Secondly I want to stop the roll from outputting to chat if the weapon finds it has no ammo.
4.9. Hide formulas in chat messages
When using formulas in chat-messages, you can hide some formulas to perform preliminary calculations assigned to
reusable variables. To do so, prefix your formula with #, for example :
${#testResult := target - roll}$⚠️ Formula hiding can be used only in messages, not in label values.
Like this for the first question?
For the second one I had a similar question and off memory it could be done something like this?
${ testResult > 0 ? [1d6] : 'No Ammo' }$
Replace 'testResult' with whatever the variable key name should be
Ok, Ill try it out, thanks
this is pretty straight forward. get the players, iterate over them each rolling their stat and check that against the target value. i got something like that and can share if you want later today.
I need help, I'm trying to use this ${${item.Uses_Ammo}$ ? 'Uses Ammo' : 'Doesn't Use Ammo'}$ in a roll in order to check if the weapon has a checkbox checked but it just breaks the thing and doesn't roll and I don't know why.
i think i saw someone resolved DSN issue with hidden rolls so you shoul search thru earlier posts
:O
If only it was easier to search in a specific thread, have to search the entire diy-systems channel lol
You don't need to use another set of ${} inside an existing ${}
so it should be ${ item.Uses_Ammo ? 'Uses Ammo' : 'Doesn't Use Ammo'}$
I think
please do
Did some searching and found this. Which makes sense to build the roll formula prior to rolling, however in my scenario I'm not choosing between 2 different types of rolls, but rather that I want it to display a string or a roll.
If I was just building two different roll formulas it'd be fine and easy, doing something like this
${#actionDice:= GoingWild ? '1d20' : '1d8'}$
<b>Action Die:</b> ${[:actionDice:]}$
But I want it to display a string like 'X' or 'No Ammo' or just nothing at all if the condition is not met. If I make it a ${[X]} it'll just break xd
I suppose I could make it say 0 instead, but.. m.
Is the item container the only component that supports drag and drop?
wrote DM to you
That didn't change anything. Thank you for responding though.
ok a strange ida can i add set on roll if its private or public depending on result?
Also second question how to ask on roll if actor has item with name X? cant find in documentation
mind sharing the sheet template?
I realize I contributed very little and you did a ton
Does anyone know how to make a forumla that will only show a label icon if a dropdown is selected to a certain field?
Like if the dropdown reads "Yes" then the label dice roll will appear on the sheet.
what you look for is visibility formula in advanced configuration of field
Yup. But what exactly would the formula look like?
That's what I'm trying to figure out.
https://gitlab.com/custom-system-builder/custom-system-builder#43-conditions without brackets so like datpointyouwantasref='yes'
also use ==
so dat==3
condition you write are condition for it to be shwon. so i expect you use some dropdown yes?
Yes
I am trying to get it so when the dropdown equals my desired result the roll appears.
so remember those have values and names so here you should use values. if its a text 'bracket it'
I personaly use mostly numbers so i dont need to think so yes is 2 so 2==2 and it works
Do you have an example of a formula you use for the visibility then?
Sorry I meant to reply
to be visible it has to be true. you have for example dropdown with key 1 and 2 labels for 1 is yes and label for 2 is none the component key of button is drop1 so to visible on yes do drop1==1
component key
And to confirm 1 is the label?
Now im waiting for mine 😄
Who knows how to check if actor has an item to use in condition?
Something like %{return entity.items.map(item => item.name).includes('itemName');}%
it will retur true or false yes?
Conditions are described here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#315-conditions
that one i guided him thru
${%{return entity.entity.items.map(item => item.name).includes('Szósty zmysł');}% ? 'has item' : 'does not'}$ is it my correct understanding it will return true/false?
Well, yeah, but you left the cases out with comparing text-values instead of numbers.
Yeah, it's a boolen, that will be returned
You can put the result-text into the Script as well. It's the same syntax.
thanks a lot that works like a charm i think you should add those to FAQ
There is already an example in the Wiki with items to be fair.
And everybody, who knows js a bit, can adjust that.
i spent like an hour looking thru it so i think maybe visibility is the issue 😄
Is there a way to make it so a roll does not show up in the text box?
Hmm, so the issue probably lies in that it doesn't know how to parse item.Uses_Ammo.
That works on its own right? Like does ${ item.Uses_Ammo }$ parse correctly?
And on the flip side does this work? What I usually do when troubleshooting something that doesn't actually give helpful errors is I just break down each corresponding bit to find which part specifically it's getting upset at.
${ 2>1 ? 'Uses Ammo' : 'Doesn't Use Ammo'}$
${#...}$
What you think you're doing:
${condition ? string : string}$
Reality: ${condition ? string : stringt Use Ammo'}$ (Invalid operator t)
And if there is a plus outside the formula brackets?
Then there will be a plus... It will be treated as static text
Is there a way to send it to the gm roll section instead of public roll?
If you don't want to select the roll visibility above the Chat Box, then only via a Script.
Thank you. Can setProperty target two fields at once or only one?
Is there any way to attach an item to an item? I essentially want to make a firearm attachment item go into an item (firearm). So in other words, an item container inside an item (or however that would work).
Only 1
Nope
Alright. How would I pull from a dynamic table, grab the numerical value, and add that value to another number field?
setProp(..., ..., "first(fetchFrom(...)) + ...")
hi, can you, for example, trigger change of value in another field? like clicking on a label changes value in another label?
Labels are unchangeable by players by default, but you can trigger changes in Input Components.
Input component is something, that must be prepared outside the regular character sheet, right? like some addon to my system?
Nope, Input Components are:
- Number Field
- Text Field
- Checkbox
- Dropdown
- Radio Button
- Rich Text Area
so how do I trigger for example a checkbox? I have a button label, that after clicking would mark separate checkbox or radio button, like ${checkbox := 1}$?\
Ah
Thanks for the help
Do I still need to use setProp when I am trying to add the value from the dynamic table to another number field?
Would that not override the number already within the target number field?
Are we talking about a derived or a persistent value?
I believe in this instance its a persistent value. Essentially, I have two values that are associated with two difference pieces of armor. So they are listed as an individual field within my dynamic tables. I need to take both of those values, add them together, and then set that value into my number field.
Well,
- derived values -> formulas
- persistent values -> setProperty()
And also:
- Input Components cannot contain derived values (exceptions are additional fields in the Component like min, max in Number Field)
- Non-Input-Components cannot contain persistent values
So what's the work around here? Combine the values of the armor values and just add them this way?
Is there really no way to just fetch the value from the dynamic table and just add it to the number field?
Well, that would be a Button, that adds that value to the designated Number Field with setProp. What should happen if you press it multiple times?
I would want it to only add the value once.
Ehhhh. Why not make it derived and let it autocalculate without any user-interaction?
Well this is a current work around for item containers. Since the players have their armor within item containers. The durability of the armor items are suppose to go to a number field in their health section.
this is great, but i dont know how to address radio button - checkbox is working, but radio button? i believe this is different addressing :/
And why number field? Why not a Label? Is a player supposed to change it manually?
The player subtracts the durability of their armor when they are hit.
My system has it so armor acts as a barrier to their health pool.
Weird mechanic, but ok.
Label Roll Message:
${setPropertyInEntity('self', 'numberFieldKey', "sum(fetchFromDynamicTable('dynamicTableKey', 'columnKey'))")}$
What it does is that it overrides the value of the number field with the sum of all entries in a specific column of a dynamic table.
did anyone set mastercrafter from ripper to roll crafting skills in CSB?
I see. So I can't just fetch two number field values and add them that are within a dynamic table?
And with what you gave me above I would have to combine both armor set values so like the gloves and arm guards?
Also thanks for calling it a weird mechanic :)
${setPropertyInEntity('self', 'radioButtonGroupKey', "'radioButtonValue'")}$
You can with fetchFromDynamicTable(). You have to specify which entries should be considered (either all entries of a column or only those, which pass the filter). If you have a filter, you need 2 additional arguments: the filter column key and the filter value
My coding power is zero, as its a popular dev (ripper-mastercrafter)maybe i will seduce you to tell me how to force insert your roll script into his default sample that works ```SAMPLE const roll = await actor.rollAbilityTest('str');
return {
success: roll.total > 12,
consume: true,
}; and CSB side rolllet rollMessage = await actor.roll(
'WIEDZA(WIE=Alchemia).roll',
{ postMessage: false}
);
let speakerData = ChatMessage.getSpeaker({
actor: actor,
token: actor.getActiveTokens()?.[0]?.document,
scene: game.scenes.current
});
rollMessage.postMessage({speaker: speakerData});``` Is it posible or i need calculate values outside of character sheat?
As i understand we need to return succed or false after macro on return
So can I fetch let's say arm wraps value and then cloth gloves value and add them? If so how would I do that with a fetch.
I can tell you in more detail if you provide screens of the template
${setPropertyInEntity('self', 'radio_bonus',"'3'")}$ - it only removes the checkmark on radio button :/ i have 3 buttons valued 1, 2 and 3, keyed radio1, radio2 and radio3 and they're in group radio_bonus
Try out text-values instead of number-values
this! works excellent now. big thanks!
Here is a part of the first dynamic table. "Arm Wraps" & "Wrapped Gloves" are two different items, but they need to be added to the same number field. The second image is the health section. Both "Arm Wraps" & "Wrapped Gloves" need to be added together and be placed both in the "Left Arm" and "Right Arm" armor boxes. Those can be seen in blue.
${first(fetchFromDynamicTable('light_armor', 'armor_dura', 'armor_name', 'Arm Wraps'), 0) + first(fetchFromDynamicTable('light_armor', 'armor_dura', 'armor_name', 'Wrapped Gloves'), 0)}$
And then would I use setProp to take that value and place it in the number fields?
And with setProperty:
${setPropertyInEntity('self', 'numberFieldKey', "first(fetchFromDynamicTable('light_armor', 'armor_dura', 'armor_name', 'Arm Wraps'), 0) + first(fetchFromDynamicTable('light_armor', 'armor_dura', 'armor_name', 'Wrapped Gloves'), 0)")}$
Thank you Martin.
Hello~ I just started getting into CSB this week and steadily learning but I'm a bit stumped on why Mod is not correctly being equated for the Saving Throw.
I followed advice to use ternary in the Label text ${(sameRow('Base') == 20) ? 5 ..... : 0}$ and so forth for when players put in their score in Base that they get the correct modifier under Mod. Am I missing something as to why the value for Mod doesnt work? Im certainly not understanding something correctly 😵💫
Why is the sameRow(‘Mod’) being added to the sameRow(‘Is_Prof’)?
What you probably want: ${sameRow('Mod') + (sameRow('Is_Prof') ? Prof : sameRow('Mod'))}$
Reality: ${(sameRow('Mod') + sameRow('Is_Prof')) ? Prof : sameRow('Mod')}$
That would add mod together twice wouldn’t it?
If that is being modeled after D&D saving throws then there should be a 0 after the : instead of another sameRow(‘Mod’) I’m pretty sure
Is there a way to combine these two so that the table doesn't show up if Uses Ammo is false?
${item.Uses_Ammo ? Table Here: ''}$
<Table>
<tr>
<th><strong>Ammunition</strong></tr>
<tr>
<td>Current Ammunition</td>
<td>${item.Uses_Ammo ? ${item.Ammo}$ : ${#}$}$
</tr>
<tr>
</Table>
hello guys, I don't know if any one of you is also using mclemente's health Estimate module, but I didn't really managed to make it work with csb. I'm guessing it's the path to HP that is causing the issue. My keu for hp is pv so I've tried the following paths failling to have any result :
actor.data.data.props.pv
actor.data.data.attributeBar.pv
actor.system.attributeBar.pv
actor.system.props.pv
Am I doing something wrong or should I reach out to their support to try to solve the problem?
this is the one I'm tracking. I've also tried just attributeBar.pv
I'd say it's system.props.pv (I expect that the actor-context is already provided). And don't use actor.data, that one is deprecated.
Just tried it but it doesn't work. Probably a module issue then, I'll try to see with them if we can figure out a solution
Thanks a lot 😁
Gotcha
<td><strong>${item.Uses_Ammo ? ${setPropertyInEntity('item', 'Ammo', "item.Ammo - ${item.Ammo > 1 ? 1 : 0}$"}$ : ${#}$}$</strong>
Why is this not working?
Wait...
Ok I was just missing a )
hows it going yall. For some reason my roll isnt working the way I want it to
Result: ${[(sameRow('Skill_Value'))d20cs>=11]}$```
it says I am getting the stringterm back instead of the number value
Thank you so much. I had been doing it without that this whole time
Im using health estimate. I can look at it after work 🙂
Inside health estimate setting use: “actor.system.attributeBar.pv” – that works for me.
The screenshot you provided is from the token resources which is not related to health estimate at all.
Your “pv” has to come from a numberfield with a set maximum.
Using a “configured attribute bar” will not work.
thanks brother, this path worked! 😁
Sorry to disturb again, but by any chance do you use splatter too?
This is the path I'm using and doesn't trigger any thing (the manual macro for blood splatter works correctly, so I'm guessing it may be the paths used again)
Sorry, I don’t use splatter.
But I found this configuration help from ripper:
https://wiki.theripper93.com/free/splatter#manually-configuring-splatter-for-your-system
The wiki for TheRipper93
Tried this already 🥲
Thanks a lot for your time though!! 😁
For those who might need the answer afterward, the path is just props.key. If it doesn't work the first time, just reinstall the module and make sure you are applying enough damage to trigger the set threshold.
Wow it's good to hear that.
Do we have ability fetchFromDynamicTable the row instead of column?
I have service user - which contain DynamicTabls with data. I have getting such data from different OTHER actors by fetchFromActor
${label:=fetchFromActor('ServiceUser',"fetchFromDynamicTable('item_durability', 'durability_label','durability_key','${DURABILITY_VALUE}$')", '0')}$
${style:=fetchFromActor('ServiceUser',"fetchFromDynamicTable('item_durability', 'durability_style','durability_key','${DURABILITY_VALUE}$')", '0')}$
I wan't make 1 call to the external table, take whole row like [ 'durability_key', 'durability_label', 'durability_style' ] and then use it inside the script by array position instead of a lot of requests.
Hi
I'm trying to generate character stats from a macro and save them directly into the character sheet.
I'm using this macro found in the CSB documentation as base and modified it to include dice roll.
let actors;
let roll = new Roll("3d6");
let currentProperties = new Map();
let updatedProperties = new Map();
// Get the selected tokens. Default: currentPlayerActor
if (canvas.tokens.controlled.length > 0) {
actors = canvas.tokens.controlled.map(a => a.actor);
} else {
if (!actor) {
ui.notifications.error('Make sure that you select atleast 1 token or that you have a configured actor');
return;
}
actors = [actor];
}
for (const a of actors) {
// ***Define all needed keys here***
const keys = ['_attributePhysiqueBase'];
// ***Define all needed keys here***
keys.forEach(key => currentProperties.set(key, a.system.props[key]));
// ***Perform all your calculations here***
await roll.toMessage();
//_attributePhysiqueBase is 0 at character creation
updateProperty(a, '_attributePhysiqueBase', '${_attributePhysiqueBase + %{return roll.total;}%}$');
// ***Perform all your calculations here***
for (const element of keys) {
if (!updatedProperties.get(element)) {
ui.notifications.info(a.name + ': ' + element + ' -> unchanged');
} else {
await a.update({['system.props.' + element]: updatedProperties.get(element)});
ui.notifications.info(a.name + ': ' + element + ': ' + currentProperties.get(element) + ' -> ' + updatedProperties.get(element));
}
}
}
// Use this update-function
function updateProperty(actor, key, formula) {
updatedProperties.set(key, new ComputablePhrase(formula).computeStatic(actor.system.props).result);
}
However, I get an error when trying to run it:
Error: Cannot convert "undefined" to a number
I am using CSB on Foundry v10
However, it is running fine if I replace
updateProperty(a, '_attributePhysiqueBase', '${_attributePhysiqueBase + %{return roll.total;}%}$');
with
updateProperty(a, '_attributePhysiqueBase', '${_attributePhysiqueBase + 4}$');
For example
Any idea what I'm missing ?
Nope, it's purely column-based. You'd have to use Script-Expressions instead.
Which version of CSB? Because the latest one dropped support for V10
I'm on CSB 2.4.3
Seems fine, I'll take a closer look
Is there a way to return the dice result in its label roll message?
Heh, all this scripts and macros it's like a magic for me) CSB functions its much easy for understanding
Take a look at the method below. ComputablePhrase expects a formula and a context-object it should perform calculations on. Because roll is not in the props of the ComputablePhrase, it returns undefined and throws an error. Either you put the roll-object into the props, resolve the object and put the result into the formula or you perform an actor-update on your own (recommended).
Thank you for your swift answer !
I must admit I am still learning about all this, and I didn't quite get everything 😅
Specifically: how would I get "roll" into the props of the ComputablePhrase ? By putting it into the character sheet template ?
Ty so much ! Ill definitly check this one out
What would the formula be so when someone enters like lets say 300 in a number field. A label would then take that value and times it by 2 to show 600.
Enough examples in the documentation git
Hi anyone who knows how this work deeper i like generated macro scriptas, but do you know how to on return get a value from the result? ```let rollMessage = await actor.roll(
'WIEDZA(WIE=Alchemia).roll',
{ postMessage: false}
);
let speakerData = ChatMessage.getSpeaker({
actor: actor,
token: actor.getActiveTokens()?.[0]?.document,
scene: game.scenes.current
});
rollMessage.postMessage({speaker: speakerData});
how to tap into resultsreturn{
where.i.can.find.results=or.how.to.find.them
}```
Hi, I believe you can access the value from the roll using either
return rollMessage.total;
Or
return rollMessage.result;
The main difference is that [rollMessage.total] will return the total result of the Roll expression (for example "17")
Meanwhile [rollMessage.result] will return the Roll expression after it's been evaluated (for example "11 + 5 + 1")
what if i have few rolls in my expresion? i mean those ${}$
You mean several Roll objects ?
Sorry, I don't quite get what you mean by 'those ${}$'...
What such total would beTest z modyfikatorem ${?{wplyw|0}}$ na wiedzę o ${sameRow('WIE')}$ rzut ${roll:=[1d100]}$ ${#par:=fix((((sameRow('WPRAWA')-2)*10) + INTS+(first(fetchFromDynamicTable('UMZ','UMZWY', 'UMZN', 'Wiedza'),0))+wplyw-roll)/10)}$ daje ${par}$ Sukcesów do i need to rip text and just leave nesesary? i need "par"
I must admit I'm having a hard time to comprehend those lines...
Is this the message you want to post according to your first message ?
there at final is number value par ${par}$ i want to acces it. as i understand total would put me a string value of whole message shown, if result would include calculations but still with other text
Ah, I think I understand
Roll.total and Roll.result will not return the whole message shown, only the resulting arithmetic expression after Roll is evaluated.
However, those are Javascript lines of code, you will need to use %{}% for it to work in CSB
Your issue is close to the one I am experiencing, which means I'm afraid I won't be able to help you much more...
i try to send results to mastercrater to have craft succes or fail value
Hello I am having a slight issue. When I am trying to install this module, first I cannot find it in store and secondly whenever I am trying to install via link, It's showing me this.
https://gitlab.com/custom-system-builder/custom-system-builder/-/raw/3.0.0/system.json is the link I used btw.
Thanks in Advance
It´s a system, not a module
@formal goblet hey is there a way to do conditionals inside of a roll? im trying to have a toggle that can be used to change the dice rolling formula. for example the usual roll is 2d6 but a boosted roll is 3d6dl. i cant seem to find any examples of this in the example sheet and documentation so help would be greatly appreciated.
${#roll_formula:= checkboxKey ? '3d6dl' : '2d6'}$
${[:roll_formula:]}$
thank you very much. i see now that i was supposed to make a roll table.
Hello, new to the Custom System Builders. I am having issues with the tabbed panels: the content of the tabs will only show up to the right of the tabs header. And I cannot find how to change it. Does anyone know what I am doing wrong/how to fix this?
Are you using a custom CSS class ?
Use a different name than tabs 😅
@formal goblet I am having the same issue. I have tried to implement your indicated solution of using "text values" but without success. Can you provide the exact solution, modifying the OPs code? Thanks
About which issue are you talking?
Opps. Forgot to include the mesage link.
#1037072885044477962 message
ha, this fixed it, thanks! 🙂 also, thank you in general for building this system!
LinkedFluuuush built most of the features
here
I apologize for not being clear. What is the correct format for the setPropertyInEntity to change the selection of a radio button given something similar to ${setPropertyInEntity('self', 'npc',"'1'")}$ (which doesnt work) where there are 3 values, 0, 1, and 2 and the keys are "pc","rival","nemesis".
change the values to text ones instead of numbers. The number ones are currently bugged if you want to change them through setProp...
I am not sure what you mean by that.
Instead of 1, 2, 3 change it to a, b, c
And then the format of setProp...() would be setPropertyInEntity('self', 'radioButtonGroupKey', "'value'")
ok. I understand. Thanks
Again, the answer is probably obvious, but I am running into an issue with fetchFromDynamicTable.
I have a Dropdown List with key [currentpursuit]
I have a DynamicTable with key: [pursuittable] with a column [pursuit] and a column [onthepursuit]
I made a label which should show the value under 'onthepursuit'
I think this formula should return the value under 'onthepursuit' for whatever value is chosen inder 'currentpursuit' (the currentpursuit refers the the same dynamic table, you can chose from the values under 'pursuit', this works).
Could anyone please help me 🙂
Hey! Can someone help me?
A actor has a item container, and the items have a dropdown list with the item's main modifier (str, dex, etc), these modifiers are in the actor's sheet. I want to reference the modifier in the actor's item container. How do i do this?
For example, a sword scales with the actor's dexterity. In a item container i have a label roll, but i dont know how to add the actor's dexterity.
I am not an expert, but I think you should just add the key of the specific attribute to the formula: dex+[roll]
Actually, i discovered!
Had to ${fetchFromActor('attached', "${attribute}$")}$ and the dropdown list determines the "attribute".
I was able to fix it myself. the error was in the currentpursuit dropdown item
There's no way to uncheck a radio button?
Well, it´s possible through setPropertyInEntity() but I wouldn`t recommend it: https://ux.stackexchange.com/a/13513
hey im having an issue where my item container is refusing to grab the value of a label within in a item container.
here is my formula for the key of "WpnAtkTotal" this is grabbing the players skill value and name elsewhere in the sheet and using this to determine stat usage and then getting the skill levels.
${switchCase(item.wpnSkill, 'Archery', POI,'Crossbow', POI,'Light Artillery', POI,'Pistol', POI,'Rifle', POI, PRW) + item.WpnAtk + WpnAtkMod + first(fetchFromDynamicTable('SkillList', 'SkillLvl','SName', item.wpnSkill )) }$
for some reason using this piece of code does not work when attempting to grab "WpnAtkTotal" and always gives me an error. the first part works fine alone.
${[:AtkDiceTotal:d6 + :sameRow('WpnAtkTotal'):] }$
You cannot grab values out of an Item Container: https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/180
Oh okay ill have to tackle this problem some other way.
<a class="content-link" draggable="true" data-skill="Under Water Basket Weaving" data-uuid="Macro.ID" data-id="ID" data-type="Macro" data-tooltip="Roll Skill">Under Water Basket Weaving</a>
Then in your macro
let skillName = event.srcElement.dataset.skill;
I know it is a little old, but I just learned how to do it after messing around so figured I would share if it is still a desire of yours.
omg THANK YOU
class="content-link" is needed but you can add other classes if you are playing with the css to make it look prettier
I use class="content-link chat-button" draggable="false" to make it work a little better and then include a css
a.content-link.chat-button {
color: black;
padding: 2px 4px 2px 4px;
border-top: 1px solid #ECECEC;
border-radius: 5px;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #ECECEC;
}
which gives me a nice rounded button look
I'm new to this, but how can I make a label that once clicked creates a roll ? I have a number field called attack_num and I want to click on a label and roll a number of d6s equal to that property, how can I do it ?
I've tried a few times messing with the roll message of the label but it only returns text
try this [:attack_num:d6]
Sorry ... outside of a csb script it needs double
[[${attack_num}$d6cs>=5]] OR
${[:attack_num:d6cs>=5]}$
is there a way to show it like the top one instead of the bottom one ?
Yes, but not easily. You would need to set up a bunch of html and css
<table style="width: 100%;" border="0"><colgroup><col style="width: 33%;"><col style="width: 33%;"><col style="width: 33%;"></colgroup>
<tbody>
<tr>
<td colspan="3" style="text-align: center; vertical-align: middle;"><h2>${!rollname}$ <span style="font-size:x-small">(${!rollsubname}$)</span></h2></td>
</tr>
<tr>
<th style="text-align: center; vertical-align: middle;">Roll</td>
<th style="text-align: center; vertical-align: middle;">TSC</td>
<th style="text-align: center; vertical-align: middle;">Crit</td>
</tr>
<tr>
<td style="text-align: center; vertical-align: middle;">${rollval:=[d100 + :rollbonus:]}$</td>
<td style="text-align: center; vertical-align: middle;">${!rolltsc}$</td>
${#rollcritval:= (rolltsc >= rollval? rollcritmod : rollcritmod * -1)}$
<td style="text-align: center; vertical-align: middle;">${critval:=[d10 + :rollcritval:]}$</td>
</tr>
<tr>
${#result:= (rolltsc >= rollval? 'Success' :'Failure')}$
${#resultcolor:= (rolltsc >= rollval? 'green' :'red')}$
<td colspan="3" style="text-align: center; vertical-align: middle;"><h3 style="color:${!resultcolor}$">${!result}$</h3></td>
</tr>
</tbody>
</table>
Here is an example of a pretied up html section ... (there is a bunch of code to do logic behind it _ which I have ommited)
That is the end result
So as you can see, you can pretty it up, but you have to work with the html
Can't I just call the roll.toMessage function?
I wanted to do something simple to play one Page rules but I think I bit a bit more than I can chew
if you want to do the roll to message try this
let roll = new Roll("${attack_num}$d6")
roll.toMessage();
}%
%{console.log(undefined.error)}%```
%{ --- means to use javascript
%{console.log(undefined.error)}% produces an error which stops the roll from finishing so a second message does not get thrown into the chat since all you are interested in is the roll.toMessage() part
Can you create a item container inside another item ? I want my weapons to have an effect, this is just a basic text description and a number regarding the "power" of said effects. I want to be able to add these effects to my weapon and show them in a column on the character sheet.
so the weapon would have a "pack" of items that are migrated to the character once you add the weapon to the character
Can't I even reference it in the character sheet? Like having a table in the item and then show all the names in the character ?
I'm starting to work out items, which look to be great, if I can fugure them out!
I have a weapon damage label called 'dam1_label'. The Label roll message is:
<h3>${weap1_text}$ Damage</h3>
<p>${character_name}$ inflicts ${[:weap1_damage:]}$ damage</p>
Am I able to apply a modifier to this dam1_label from an equipped item?
As indicated, you cant using the native command system. However, if you use Javascript and the world scripter module, you can simulate the effect of dropping items onto items for the purposes of passing data forward. Example: Dropping item Scope (+1 to hit) onto item Rifle (which is Accurate, +1 to hit), which, when on an actor sheet, passes "+2 to hit" to actor when gun is rolled from character sheet.
If the modifier is numeric (ie "+1), then you can use item modifiers on the item to send the value to the actor sheet. If the modifier is a text value, that requires a javascript.
do you have an example that I could use to learn it ? I'm terrible at JS xD
Here is my core code that makes the magic happen. It may not be particularly well written. It also must be put in the World Scripter module. You really need, as a minimum, a basic understanding of JS and JSON. In this code, I am dropping two different item types (qualities and attachments) on to the target item. You may only need one type. It is designed with the idea the source item has fields and the target item has a dynamic table that will store the data from the source item.
Does someone knows a way to organize / reorganize an item list?
@lyric swan How do you want to re-organize it?
I was thinking of a drag n drop system allowing to reorganize the item list inside an item container... that would be cool. If there is nothing already existing, I'll try to work on a world script.
So I did this, it allows you to drag and drop items from an item container in order to reorganize them (it moves the drag object just before the object on which the object is dropped). I'm no js pro or anything, juste a random dude doing random things, so it may be stupid, but for me it works.
const items = document.querySelectorAll('.custom-system-dynamicRow');
items.forEach((item, index) => {
if (!item.id) {
item.id = 'draggable-' + index;
}
item.setAttribute('draggable', true);
item.addEventListener('dragstart', (event) => {
const draggableElement = event.target.closest('.custom-system-dynamicRow');
if (draggableElement) {
event.dataTransfer.setData('text/plain', draggableElement.id);
console.log('Drag started:', draggableElement.id);
}
});
item.addEventListener('dragover', (event) => {
event.preventDefault();
});
item.addEventListener('drop', (event) => {
event.preventDefault();
const id = event.dataTransfer.getData('text/plain');
const draggableElement = document.getElementById(id);
const dropzone = event.target.closest('.custom-system-dynamicRow');
const draggableParent = draggableElement.parentNode;
const dropzoneParent = dropzone.parentNode;
if (dropzone && draggableElement && draggableParent === dropzoneParent) {
if (dropzone instanceof Node && draggableElement instanceof Node) {
dropzoneParent.insertBefore(draggableElement, dropzone);
}
}
});
});
});```
(You have to put this in a world script macro, using the Word Script module)
hi
I'm trying to retrieve from an object the value of a field in a dynamicTable of a character sheet to which the object is linked, which I compare to a dropdownlist in said object.
${fetchFromDynamicTable('cat_armesdt', 'valeur', 'liste_categorie', 'Pistolets')}$ in the character file: works
${fetchFromActor('attached', "fetchFromDynamicTable('cat_armesdt', 'valeur', 'liste_categorie', 'Pistolets')")}$ recovers value from character sheet in object sheet.
I'd like to replace 'pistols' with a value that I'll retrieve from the 'armelist' dropdownlist on my object sheet.
How do I go about this, if at all possible?
Next, if 'Pistolets' isn't in the dynamicTable, I'd like to use the default value for Pistolets (set in the object file).
Any CSS maestros out there who can point me in the right direction? I have a Main Table that has 1 row/2 cols. In each of the cols is another table, each with different row counts/heights. I want those tables to vertically align to the top. I'm not having any any luck with the vertical-align: top property in the parent table.
I've also tried designating the parent table as a flex container and using align-self in the child tables, no luck.
Any tips would be greatly appreciated.
So I know there were plans to be able to stop a script showing Test Undefined after each roll
did that end up going through?
The current solution is to add throw "Done" at the end of your JS.
Maybe have a look at https://discord.com/channels/170995199584108546/1154507115172466810
thanks, worked perfectly
Hi so I'm having some minor difficulties setting some stuff up. atm I'm trying to make item you drag and drop item on character inventory then when used it uses strength stat and drains the user of x amount of stamina
hi @glad spade maybe you can help me with the following (module item piles). i have 3 rarity tiers for items (normal = system.props.itemrarity === 0, magic = system.props.itemrarity === 1, rare = system.props.itemrarity === 2).
is there a possibility to create item piles or vaults where the items can be sorted/highlighted by their rarity?
i saw in the style settings "vault styles" where i input this values (see screenshot) but it doesn't do anything. am i missunderstanding something, or is there something special with CSB i should change?
also for normal item piles does it make any difference how the character sheet is configured? or are all the contents of the item pile pop-up not changeable (example see second screenshot)?
- It only affects vaults
- Style needs to be filled in, such as
box-shadowwithinset 0px 0px 7px 0px rgba(0,255,9,1)in the value
@scarlet skiff 
sorry i dont really follow what i have to do...
i cant write anything into the style column (see screenshot)
i know this styles should only affect vaults. i was just wondering if vault coloring is not working maybe changing the visuals in the item pile would work too
so i think the missing style column is the problem but i can't input anything there
Yeah most likely a bug then
I guess no simple fix.
Any other way how i could Display items differently depending on properties of the Item?
Not at the moment.
Does someone have a macro that can be used to update items on sheets when the template is updated?
Hello! I installed Custom System Builders but it's asking me to manually install an add-on, do you know what it is?
Chat Commander https://foundryvtt.com/packages/_chatcommands
Chat Commander, an Add-on Module for Foundry Virtual Tabletop
Thank you!
I know that a JS macro can be made that can sequentially open, update template using .click, and close items on a given sheet but I was hoping someone has something more efficient.
I have use regular CSB - without modules for highlighting the Durability and the Rarity. By using dynamic table. For sorting - I'm waiting new version of CSB - which allow sorting inside the item container - I I'm not mistake.
Yes with CSB this is possible but the question is changing the visuals for Item piles and using it for easy loot distribution. Thanks anyway 😅
I am trying to move items, actors, and templates between worlds using compendium import/export. It appears that this requires the templates to be re-selected after import. I have a lot of items which makes this very arduous. Am i missing something? Is there a better way to do this so all template references are maintained?
Your problems are known and as far as I know, no one found a good way for export/import.
Also, in all templates the item-filters in all item containers will be gone and had to set anew.
Hey, anyone able to vocal ? i have a few comprehention problems : creating items, equipments, inventory system, token and map sizes, and character sheet design
Thanks. I have a plan to fix this. When an item is created store the name (not id) of the source template within. Then, after an import to a game, a macro can be used that will open each item, perhaps by folder, select appropriate template and update it, and close the item. Of course, this requires that the template name not be changed. I already have code that does most of this.
I meant the item containers in the character template. They will lose their set filters.
That I am aware of that. I havent looked into to that, so I am not sure how to target the actor json to correct this. Thats not as bad since you only have to perform a few conter fixes after import unless you have 30+ containers (like i do)
I'm scared of how long is your message, over 20 minutes you are writing
Organizing my thoughts, but the anwer is scary
So after some poking around to see how the container references can be kept, the Solution would be a bit of a pain. I would use the css class to store the template id as id_abc123_cdf465(in this case, two ids). If the container is nested, all elements in the "path" would need to be named. The highest level element would then have a css with a path of path_element1_element2, etc. The macro would iterate through actors, getting their templates and then, for each, start with game.actors.get( "id" ).system.body.contents which each gives an iterable list and uses path_ for quick navigation. Get the template id from the css and update the template field(s) on the actor _template. The actor templates will need to rendered and a .click event will need to be used to force the actor update. I am not sure that its worth the pain for most people to set up this structure.
Hello everyone, I'm new here, I've been tinkering for the past few weeks with CSB, and I was wondering if it is possible to fetch item data in a specific "Item Container" component. In my case I'm trying to get the ARMORAC value from EQUIPPEDARMOR (an Item Container).
I know it can be done with dynamic tables, should I just rewrite the EQUIPPEDARMOR component to be a Dynamic Table?
If so how can I populate a Dynamic Table with Items from an Item Container?
If the data is numeric, you may be able to use item modifiers to send the value to the actor such as a "+1". If you are trying to access non-numeric data, such as an item name, then that requires javascript. It depends on what you are doing with the data
That's spicy, I was thinking about using modifiers, but haven't really read them thoroughly, I guess I'm diving back in the docs D: Thank you!
Still no one available for a vocal ?
Sry, I´m working on my thesis until 01.02, so I don`t really have time 😅
@formal goblet and company! Just wanted to say thank you so much for everything over the past year! We were finally able to share our game on Foundry and people are now playing our original ttrpg system with tons of items cooked in. Can't thank you enough!
If anyone wants to see how we used CSB, https://www.warpedtree.com/games/surge/foundry-vtt-for-surge
We will still be doing some fine tuning, but this version is presently in use for two Twitch groups who have adopted our system. One on Vibe Tribe and one on ADH&D ventures!
Again- you guys were pivotal in making our system accessible for newcomers to our platform. Serious undying gratitude.
👀
Ain't sure if you meant hour or date with the us system x)
Hello everyone, I have been reading the readme to the point my eyes have glazed over... could someone please tell me if it is possible to call another method inside of another method? For example: ${<code does something>}$ and then ${<this code uses the output of the earlier code, then does something else>}$. Even if this is not possible, if anyone has plausible workarounds I would appreciate it. Ty.
Depends what the intent is.
Sounds like you are trying to index variable data tables. I am presently not aware of a way to do this.
But i'm still a novice as well.
Hmm, well I thank you anyway. Time for a change of plans.
I had data that I wanted to call on, so I had a dice roll provide the value for a given field, but it became a static value. Then i used that value to populate other fields. It was a two part feature and required manual interference everytime I wanted a different value.
^
I dont know if this helps at all.
It doesn't, but it does save me time trying the same impossible task.
Can I ask what you were trying to do? Maybe I can think of something else.
If you want a dice roll have two end results, it can be done within the same roll message.
Otherwise it is possible to send the first result to a hidden field and use this as reference for the second part.
He meant the first of February.
Youst write your first question here. Maybe someone can give an answer, even without voice communication?
To long tbh and long answer on pc break my brain
Hello again, expanding on this, I managed to have a working inventory and equipment system, with Items adding modifiers depending on whether or not they are equipped. Is there any way to modify an Item's Key value without opening the Item itself? Specifically I have to set a checkbox within the Item to true or false without opening it.
What do I have to do to make a max value for an attribute like HP?
Only from Item-Container, see: https://gitlab.com/custom-system-builder/custom-system-builder#4211-setpropertyinentity
Or via macro.
Use two number fields. One for maxhp other for currenthp. Place ${maxhp}$ inside the maximum value filed of the currenthp number field. The system will automatically generate a bar with the key of currenthp.
Thanks, works like a charm!
Hello all, new here. Please forgive in advance because I'm not very bright on this stuff and am muddling through creating a skirmish game system using CSB. Question on dice syntax. I have a item field that sets a number of d10 dice to roll. The desired outcome is to output in chat the result of each d10 result. So I have a roller button to activate that and the string I'm using. My string is ${[1d10] * item.dmg}$ but that just multiples the d10. I know this is silly easy for you guys but im stumped. can you help?
It should be ${[:item.dmg:d10]}$
ok thanks, what do the colons do?
They allow you to use actor values as die sides.
You may want to look at this (chapter 4.6)
https://gitlab.com/custom-system-builder/custom-system-builder#4-formulas
thanks, been reading it for hours and struggling,, thanks helping!
My pleasure
Torlan, do you happen to know if there is a foundry plugin module that forces the chat to not add die values but display the individually rolled dies?
without having to click the chat
Not that I know of. Never looked for one, I'll let you know as soon as I can acces a PC.
This is a problem that several others already had. As far as I remember someone has solved this via a world script, but I don’t remember who it was. Maybe search above in this cannel.
Do not know if this is of any help (or even appropriate...otherwise please tell me and I'll remove the link)...
https://glumbosch.home.blog/2021/03/05/how-to-show-all-dice-automatically-in-foundry-vtt/
Hello again friends, new issue this time. As seen on Gitlab it is possible to set the properties of dynamic tables:
${setPropertyInEntity('self', getRefFromDynamicTable('Spells', 'Uses_left', 'Name', 'Fireball'), "min(first(fetchFromDynamicTable('Spells', 'Uses_left', 'Name', 'Fireball')) - 1, 0)")}$```
However, this is hardcoded to only change the value of the table entry for "Fireball"
For use in templates, I would much rather be able to use component keys where a player could enter the text "Fireball" such as:
```Decrease value of the field Uses_left in the Spells Dynamic Table for the spell named Fireball :
${setPropertyInEntity('self', getRefFromDynamicTable('Spells', 'Uses_left', 'Name', '<Component Key That Points to Fireball>'), "min(first(fetchFromDynamicTable('Spells', 'Uses_left', 'Name', '<Component Key That Points to Fireball>')) - 1, 0)")}$```
If anyone knows how to do this, I would appreciate your wisdom.
You may use concat() to build the formula string, thus you can put any text in it even user entries. Should work.
This was exactly what I needed, thank you so much. You are a hero.
I'm revisiting CSB for a new game design, and trying to make some new macros , but I'm getting an error in the following attack macro:
'Attack Rank=${myskill:=[:attack01rank:]}$ ${targetdefense:=getPropertyDataFromActor("target","defenserank")}$ Modifier=${modifier:=?{Modifier|0}#}$ Attack Roll=${myroll:=[(:myskill:-:modifier:)d6even]}$ Defense Roll=${defenseroll:=[(:targetdefense:)d6even]#}$
---I know the error is in the " [(:myskill:-:modifier:)d6even] " portion, but what am I doing wrong there? It should take the 'myskill' varable and subract the 'modifier' variable and roll that many d6s looking for even results
Try using another variable for that difference.
Additionally, what is the error you're getting?
at StringTerm.evaluate (foundry.js:12750:11)
at Roll._evaluate (foundry.js:10286:42)
at Roll.evaluate (foundry.js:10250:25)
at ParentheticalTerm._evaluate (foundry.js:12359:28)
at ParentheticalTerm.evaluate (foundry.js:11253:25)
at Roll._evaluate (foundry.js:10273:20)
at Roll.evaluate (foundry.js:10250:25)
at Formula.evaluateRoll (Formula.js:945:24)
at async Formula.compute (Formula.js:420:30)
at async processFormulas (ComputablePhrase.js:139:21)
at async ComputablePhrase.compute (ComputablePhrase.js:212:34)
at async HTMLAnchorElement.<anonymous> (Label.js:271:21)```
^ error message...
I think its the " (:myskill:-:modifier:)d6even" part...I need to write that differently?
Try defining a var for that difference and then us it for the roll.
My sincere apologies, im not following...can you post a tiny example?
something like xxx = myskill - modifier ???
(in pseudocode)
Exactly
got you - thanks, wil try that!
Welcome. Not sure, though.
Yes, that works...thanks @fierce harbor !
Glad to hear that 😉
One new issue, then I should be set:
The following line throws an error:
${targetdefense:=getPropertyDataFromActor("target","defenserank")}$
I get the error "Undefined function getPropertyDataFromActor" - has this been deprecated or am I just not using it correctly?
Isn't it fetchFromActor()?
I'll try that...I last did macros in Foundry a couple years back...things have changed...lol
Yes, that works perfectly, I am set...thanks again for your help. I need to read up on the changed codeset...
Don't mention it, we just help each other 😉
Can someone help me?
I have a *label * which sums all my items to give me a Encumbrance number.
I wanted to get this final emcumbrance value in the label to use in other formula and show the Encumbrance level, like, Light, Medium, etc.
But CSB seems to not recognize the label final number as a valid value to use in other formulas
Look, this is my Encumbrance formula, which sums all the different weights. This label has the carga_atual unique key
${floor(sum(fetchFromDynamicTable('misc_items', 'misc_items_carga')) + item_carga + tesouro_carga + item_po + item_pp + item_pc)}$
This is the formula that I wanted to use, getting the value in carga_atual as a reference
${carga_atual < 401 ? "LEVE" : (carga_atual < 801 ? "MÉDIA" : (carga_atual < 1601 ? "PESADA" : (carga_atual < 2400 ? "SOBRECARGA" : "SOBRECARGA")))}$
I have seen this happen when one of your vaules in the original formula produces null or ref. Check your original formula and validate that first. Second what does your log say? Does it produce an error?
Lastly, why are you putting ( arround your if statement..
${carga_atual < 401 ? "LEVE" : carga_atual < 801 ? "MÉDIA" : carga_atual < 1601 ? "PESADA" : carga_atual < 2400 ? "SOBRECARGA" : "SOBRECARGA"}$
Good evening. Has anyone had trouble putting item containers in an item template? Im trying that but the test item i created wont seem to accept the "subitem"
Subitems are not possible at the moment. As far as I remember they are on the wish list for future updates.
Ehhh…do I get it right that you not using CSB “items” via itemcontainer, instead you just “write” them in a dynamic table?
I used javascript to allow dropping of sub items on to items but it records the relevant data in dynamic tables instead of item containers.
Looks like it was a bug. Normally you can't select Item containers in an Item template. But if you select a Rich Text field first and then try to change it to another type of object you then get the option to do an Item Container which is where I experienced the issue.
Hi everyone, is there a system with this program to create a career that contains within it weapons, potions, specialization objects, etc.? I would then like to import the career into the character sheet and populate all the fields. can you help me?
Yes
I'm using a dyanmic table for the items. I find it easier
Learning to code hahah I thought I needed to put ( in order to separate the formulas
That was the case, thanks. The formula was wrong hahaha
Just a quick question, have you guys experience with conditions? Do conditions work with strings? Like can i set ${KEY}$ == "myStringValue" as a condition?
I'm asking because I'm only able to check conditions on numbers so far, and I suspect there's something about string evaluation that I can't grasp
Folks, how can I refer to a dropdown option in a condition? I tried the dropdown option key, but it didn't work. Is there something like dropdownKey.dropdownOptionKey ?
I believe what your looking for is
error. If you need to compare strings for equality, use equalText() instead:
equalText(selectedAttribute, 'Strength') ? 1 : 0.```
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System
I have had issues in the past with drop downs, so I would like more context on what your trying to do with them before answering if possible
I remember reading this, maybe I should stop programming for the day 🤣 thank you very much
LOL, I do it all the time
Good morning! Having trouble linking journal entries into Rich text fields in item descriptions. When I drag a journal entry, it just copies a string of text that looks like a URL or something instead of the clickable link. What am I doing wrong?
looks like this
The Link is fine, just be sure that in your template at the bottom of the rich-text-field the "Style" is selected to "Dialog editor".
In the words of Sir Galahad from Holy Grail "That's easy!" Thanks so much for the help!
So I'm trying to have an item in a players inventory pull a number from their stats and add it to a dice roll any advice on how to do that
Just use the stat key you need. Should do it.
Ok ill give it a go
Hi, I was wondering how I could refer to a dropdown list's keys
I've managed to figure out how to use a dropdown + dynamic table, but I just want an "if then" using the custom dropdown to tidy up everything
${equalText(dropdownKey, 'Strength') ? 'Strength selected' : 'Something else'}$
Sorry for the late response, but thanks a lot. Solved!
How do I take a label and have it roll a certain die when clicked, with options prevented for blind, public etc?
Not possible to set this from inside the label. You have to set this inside the chat roller and then use the label.
Finally submitted... My time has come 😄
Welcome back Martin.
Everything fine with your thesis?
Yep, just took a while
Gut Ding will Weile haben.
Ich drücke dir die Daumen 👍
Jetzt nur noch das Kolloquium 😅
Äääh - ja - betonung auf "nur noch", eh? 🥶
Hi! little up! 😆
an idea for this?
${fetchFromActor('attached', "first(fetchFromDynamicTable('cat_armesdt', 'valeur', 'liste_categorie', '${armeliste}$'), '${defaultValue}$')")}$
Does anyone know why my userInputTemplate isnt working?
I'm probably doing it very wrong, but Ive tried setting in different ways and it didnt work
Is brigatemplate the correct template name? I usually write template names wrong 😅
yes
Can't find anything about this, sorry
Thats okay
Do you atleast have any examples of how its used? like how do you use the component keys on the trigger message?
Honestly I have never used userInputTemplates.
Reading the project page it looks to me like the sintax might be ?#{brigatemplate} or ?#{brigatemplate actorname}.
Damn...
I cannot access a PC now, so cannot try it...
That sintax is not clear for me.
What about ?#{userInputTemplate brigatemplate} ?
Nevermind i've done it the other way 😛
Cool 😉
May I know how?
This way
In the Label Text field of a Label component, is it possible to iterate over the elements of a matrix returned by fetchFromDynamicTable in order to format the results?
Scenario: I have a dynamic table with 3 fields (A select checkbox, a Thing Title, a Thing Description). In another Label, I would like to display any Things that are selected (checkbox = true), but formatted like this:
Thing Title 1: Thing Description 1
Thing Title 2 Thing Description 2
I understand I could make the dynamic table have only 2 columns and combine the Title/Description with formatting into one, but I don't want to do that.
You could write a series of nested conditionals:
${checkbox1?(checkbox2?(...(checkboxN?concat(<all the Things you need>))))}$
so to have all the possible combinations available.
Or call a macro to do that more cleanly.
The number of items in the Dynamic Table varies, so I don't think I can know the number of checkboxes. Is it possible to run some JS code within the Label Text field? Or just certain formulas/expressions?
Just curious...is this code that you're putting into a Label Text field?
You can use scripts, I believe, but what you need might be a bit complex. A macro would be better (you could use foreach(), for example).
Chapter 4.5
https://gitlab.com/custom-system-builder/custom-system-builder#45-scripts
nods I've done some macro work before so might need to look into that. I could get the matrix, pass it to a macro (I need to go back and see how to pass a parameter to a macro within a label text field), then get the formatted result back and display
Yup, that would give you more flexibility.
Oh the passing parameters is shown on that page
I know it had changed formats so looks like it's back
Now I need to remember how to get the passed parameters in a script macro 🙂 Been a second
If I remember correctly, you can directly call the param in the macro. So if, say, the macro has params a,b,c you can call a,b,c inside the macro body. Please be advised: my memory is quite faulty 😅
That's the part I seem to recall, I wasn't sure if I had to assign them to a local macro variable or not or if they were defined
You can use local vars, but it's not mandatory as far as I know.
As an example I took the Emergency Campaign Resolver from the FoundeyVTT macro page and substitute a passed argument for the local var targets :
//Rocks Fall, everyone dies.
const targets = []
game.user.targets.forEach(i => {
const name = i.name;
targets.push(name);
})
if (targets.length === 0) {targets = "no one, this time"}
const roll = await new Roll(`8d10+100`).roll();
console.log(this.roll)
const results_html = `<h2>Cave In!</h2>
The cave collapses from above, dealing <a class="inline-result"><i class="fas fa-dice-d20"></i>${roll.total}</a> damage to <strong>${targets}</strong>.`
ChatMessage.create({
user: game.user._id,
speaker: ChatMessage.getSpeaker({token: actor}),
content: results_html
});
Yes.
But that is the original code, below is the modified code:
//Rocks Fall, everyone dies.
const mytargets = []
if (targets.length === 0) {mytargets = "no one, this time"}
else
{
mytargets = targets;
}
const roll = await new Roll(`8d10+100`).roll();
console.log(this.roll)
const results_html = `<h2>Cave In!</h2>
The cave collapses from above, dealing <a class="inline-result"><i class="fas fa-dice-d20"></i>${roll.total}</a> damage to <strong>${mytargets}</strong>.`
ChatMessage.create({
user: game.user._id,
speaker: ChatMessage.getSpeaker({token: actor}),
content: results_html
});
Should work as a starting point.
Hope it helps.
Just did a test (with your help in mind) and it worked perfectly! Thank you so much!
Don't mention it, it is my pleasure being of help 😉
This is a great group for that!
True, a lot of kind and helpful people!
I'm getting an error when using the 'await' part of this from Script help when calling a macro from a Label Text field
%{return await game.macros.getName('FormatExtras').execute({extraNames: '${recalculate(fetchFromDynamicTable('extras_selection', 'extra_title', 'extra_is_selected', true))}$', extraDescriptions: '${recalculate(fetchFromDynamicTable('extras_selection', 'extra_desc', 'extra_is_selected', true))}$', extraCosts: ${recalculate(fetchFromDynamicTable('extras_selection', 'extra_cost', 'extra_is_selected', true))}$})}%
I'm passing 3 arguments (extraNames, extraDescriptions, extraCosts) with 2 being strings and 1 being a number
Error:
[Detected 1 package: system:custom-system-builder]```
Because of that, it only seems to work if the first row of the dynamic table is selected. If I select any other row (the filtering) it doesn't seem to pass the arguments right
Okay I think I see one issue, when passing a matrix returned from fetchFromDynamicTable, I shouldn't use the ' ' around that call right?
I believe so, yes.
or do I need something like extraNames[] = fetchFromDynamicTable....?
You are basically selecting one row, so an array should not be necessary. I'm thinking about recalculate: is that necessary?
Oh....maybe not?
Ideally I might be passing any number of rows, as it's based on which rows have their checkbox selected (the filter of 'extra_is_selected') so I could be passing arrays instead of values
And I'm not sure about true working, either. Might you try with 1? It is sometimes the case with checkboxes.
Hmm, the 'true' seems to work on the first row selection at least
but I can try '1'
True that, so you should handle arrays in the macro, you're right. But not it the macro call, because fetchFromDynsmicTable return an array by itself.
So the 'variable type' passed with execute() doesn't need to be cast? Just sent as a variable name?
Right.
One more potential issue: When passing multiple parameters are they separated by comma (,) or another delimiter? I'm using commas
The scripts help section doesn't specify
It is a comma-separated list.
Oh apparently there's a second error:
processFormulas https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/formulas/ComputablePhrase.js:166
compute https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/formulas/ComputablePhrase.js:212
computeMessage https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/formulas/ComputablePhrase.js:352
_getElement https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/sheets/components/Label.js:191
render https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/sheets/components/Component.js:246```
I wish I was a more knowledgeable coder, but I just get by hehe
Oh wait a second...
That is a parenthesis-related issue: maybr some are not closed or there is one too many.
You can use on online code checker, just google for one 😉
I may have my commas in the wrong place...which is correct?
execute({name: '${name}$'}, {name2: '${name2}$})
or
execute({name: '${name}$', name2: '${name2}$'})
I was comma separating INSIDE the {}'s and I'm thinking maybe each {} is comma separated
Latter one, I believe.
Anyway, it's bedtime for me so I'll be seeing the outcome of this all tomorrow in the morning.
Good luck with your code 😉
Sleep well and thanks again for your help!
It's an object we're passing to the function, so the later one is the right one.
And here is some more info about Script Expressions: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#33-script-expression-
@formal goblet Heyy, available for vocal ?
Hi so I'm trying to make it roll 'DamageDice'd20 off a dynamic table any advice on how to do it?
Thanks! I'll try again but I'm not sure what I'm doing wrong to get the errors I'm getting about failed data preparation and unexpected characters
I know how to fix this. ${[:sameRow('DamageDice'):d20]}$ I think. On phone so can't test.
Nah didn't work but I think i got it figured out
Ok happy to hear you found a work around.
Returning to my issue with trying to call a macro from a Label Text field. I am not sure why I'm getting this error.
I have this in a Label Text Field, to call a Macro with the name FormatExtras:
%{return await game.macros.getName('FormatExtras').execute({extraNames: 'Extra Name', extraDescriptions: 'Extra Description', extraCosts: 10});}%
The macro literally only outputs the values to the console and returns the word "Done";
return "Done";```
The console outputs correctly but I get this error and nothing is displayed (i.e. the word "Done")
```SyntaxError: Failed data preparation for Item.jLZtEECAswkksjSV. await is only valid in async functions, async generators and modules
[Detected 1 package: system:custom-system-builder]
processFormulas https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/formulas/ComputablePhrase.js:284
computeStatic https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/formulas/ComputablePhrase.js:330
computeMessageStatic https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/formulas/ComputablePhrase.js:371
_prepareEntityData https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/documents/templateSystem.js:253
prepareData https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/documents/templateSystem.js:133
prepareDerivedData https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/documents/item.js:96```
Your way worked better thank you
There a way to hide the value a character rolled for initative?
Rolled or the number itself.
this part
keep the value just hide it from players
I don't know how to hide that. Sorry.
thats ok thank you regardless
how would i go about making a filter with the Item Piles module that targets specific item templates?
The issue is that the Script is executed in a synchronous context (keyed Labels). await is only available in an asynchronous context (keyless Labels and Label Roll Messages).
That's core-functionality from Foundry, not CSB
I guess the better question is how would i filter out certain items from the Item Piles vault, because so far the only thing i figured out is filtering out "type" for "equippableItem" but that just filters out everything. I can't seem to figure out the attribute path for anything worthwhile that would be able to seperate the spells and stuff from the vault. Sorry for the noobish question i can't seem to find much information on the topic.
Heya, how would I go about adding a (edit): javascript custom function (for complicated formulae and ease of alteration) to CSB so that I can just call the function on character sheets?
nevermind i figured it out
Could you explain what you have done please? Im looking into using Item-piles too.
so for the filter i did system.template, and for the filters themselves i had to go into the F12 console and search for the template key/id which for my system i wanted to filter out a few things. There is probably an easier way to do this but it works for now.
hope that helps
Hi! is there a system with this program to create a career that contains within it weapons, potions, specialization objects, etc.? I would then like to import the career into the character sheet and populate all the fields. can you help me?
Hey there!
I'm trying to create a simple sheet, but my coding is bare to none, can anyone help?
Here's the code
${
If (Agility_points <=0
{
Agility_points -5;
}
Else if (Agility_points <0 && Agility_points <11
{
Agility_points;
}}$
I have this code in label text
I advise to take a look at this article here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System
You fixed version should look like this: ${Agility_points <= 0 ? Agility_points - 5 : (Agility_points > 0 and Agility_points < 11) ? Agility_points : 0}$
Thank-you! I'll take a look!
Thank you 🙂
I removed the Key from the Label and the error went away. Thank you. I feel that is something that should go into the help pages:
https://gitlab.com/custom-system-builder/custom-system-builder#45-scripts
is the await necessary in the Script call? Or could I remove it there and just create a function in the Script that is async? Or would I get the same error or would it not update on time for use in the label display?
await is necessary if you need the result of the macro. And no, you cannot just add an async-function, the whole call-chain needs to be async.
Thanks! Now I just need to figure out why I'm getting this error.
This is my script call
%{return await game.macros.getName('FormatDrawbacks').execute({extraNames: ${fetchFromDynamicTable('extras_selection', 'extra_title', 'extra_is_selected', true)}$, extraDescriptions: ${fetchFromDynamicTable('extras_selection', 'extra_desc', 'extra_is_selected', true)}$, extraCosts: ${fetchFromDynamicTable('extras_selection', 'extra_cost', 'extra_is_selected', true)}$});}%
I'm trying to pass 3 fetchFromDynamicTable matrices to the Script (it will pass values (2 strings matrices and a number matrix) based on whether a row is 'checked' (extra_is_selected). However even with a macro that only has return "Done"; in it, I get this error:
I get the error even when the fetchFromDynamicTable returns nothing (nothing is checked) but when I check a row I get this error:
processFormulas https://assets.forge-vtt.com/bazaar/systems/custom-system-builder/3.0.0/module/formulas/ComputablePhrase.js:166```
Maybe it's something with the Type Matrix that fetchFromDynamicTable returns and passing that as an argument?
Either you wrap the CSB-Formulas with quotes and treat it as a string with CSV or you get the data from the tables within the macro within the props-object
So only primitive types can be passed? (e.g. strings, numbers, etc?)
They are just untyped, that´s the issue
Okay thanks! One more question, if I pass the dynamic table entity I'd use JS processing to do what fetchFromDynamicTable does correct? (Sorry probably a basic question but wanted to be sure)
You can pass entity to the macro and see what it contains. What you usually want is entity.system.props.dynamicTableKey
That's what I was thinking. I'll check the item paths and see. I'll try it both ways and see what works best. Thank y ou again!
Folks, does anyone know how I could set a dynamic table to have labels who shows the position of the row?
I mean, I wanted the first row to have a label "1.", but if I lower the row, the label changes do "2."
Does anyone know the fix for this?
I deleted an item that was still in an inventory and now this error appears whenever I try to update all actors and also prevents me from adding a new item to the inventory.
It seems I can fix it by deleting the actor entirely but that's really tedious especially if I have to restat an actor
is there a way to get tables in tables to be direct below eachother?
atm there's a big gap..
There is a layout dropdown if you put them into a container panel to lay them out vertically
Thanks! ill try!
btw love the freedom this gives me 🙂
There are also options to lay things out in a grid which makes it very easy to lay out how you want
almost, but i hink ill solve it with Panel in panel
I'm guessing it could be possible to set a invisible variable, and always increase one. I was reading fetchFromDynamicTable, but only has the Column, and not Row
You can nest panels so you should be able to get it perfect
Is there a sameColumn argument?
One issue you may run into is that items from a dynamic table are never actually removed from the entity object. They just get the "deleted" set to "True", so the 'index' of the row might not be row's number if you've deleted things above it
That brings up an interesting question: Does fetchFromDynamicTable automatically only return those things that haven't been deleted?
I see. So what I wanted is not possible then. Thanks
I'm not an expert so there might be a way around it. But there doesn't appear to be an index property just the index of that row in the overall DynamicTable Matrix
Hey, anyone able to vocal ? i have a few comprehention problems : creating items sheet ( making it non modifiable, good looking and linked to the class ) , token and map sizes ( a chair is like 1m large and the character very small and can't center it on those), and character sheet design.
Close the system - within the world datas find the “actorsname.json” – open it with a (text)editor – search and delete this items parts and save – restart your system.
That is kinda cursed, but thank you
But this is the way to safe the rest of the character and get rid of a broken link.
Makes sense
Hi, just wondering, is there a way to sort the contents of an Item Container?
Or to manually re-arange them?
That has been a requested and I believe is planned for an upcoming update
Thanks!
Is this the best system to use for MCDM's playtest? I just want some quick and dirty stats, roll some damage, click to show abilities and so forth. I don't need anything automated
This has a few others interested you may ask: #system-development message
@glad spade i found the culprit but i dont know why it would be set this way. this is just for your information if you want to dig into it.
Is there a way to remove initiative rolls? I am trying to use a fixed value to determine who goes first.
You can put [:yourvalue:] in the init roll to do that.
Where do I look for the init roll formula?
Should be in the General Config, on the right.
Got it. Thanks.
Hello again!
I've realized that running the same code, with slight variations for every skill, ie 120 times, per sheet, might not be viable, is there anything I can do to put it into a funktion? Or somehow clone it easily?
How about using a Dynamic Table for the skills? This would require only one definition.
Will look into it, that would only mean about 10 instead
dont think it will work, se sheet has a lot of skills, and every skill har three components, one name(also th rull button), a "points" that is editable, and then the mod, that reads the Point field and change depending on the value
instead of reading the component key, can it read "field Left"?
It can reference components of the same row with sameRow()
intresing, ill look into it, thanks!
Hey, anyone available to vocal ? i have a few comprehention problems :
Creating items sheet ( making it non modifiable, good looking and linked to the classes of the characters ),
token and map sizes ( a chair is like 1m large and the character very small and can't center it on those) and character sheet design.
I dont get the SameRow, every row has a "skill"_points
Can i somehow make is as below code? so instsad of changing everyone, in can check same row and if Key has "pionts" in the key, it get h´the value'
${ sameRow(points) <= 0 ? sameRow(points) -5:
sameRow(points)> 0 and sameRow(points)<11 ? sameRow(points): 0}$
Hi, maybe someone can help me with this issue, I've tried a lot of versions now but I can't get max() to work when fetching values from a dynamic table (in the label of a an item container).
In the image the first 3 'lines' show that the components work individually, (fetching the two variables and the max function) , but in the last line when I combine it I get an error (see right pane) .
Can someone tell me what I'm doing wrong here?
Thanks.
~~Hello, I want to calculate Total Armor based on a dynamic table.
I have the total with sum(fetchFromDynamicTable('table_defense', 'armor'))
Now I added a checkbox "active" to "table_defense" and I want to sum "armor" only if "active" is checked. Is it possible ? 🙂
~~
Solved : ${ sum( dotMultiply( fetchFromDynamicTable('table_defense', 'active'), fetchFromDynamicTable('table_defense', 'armor') ) ) }$
Guys, im new to custom system builder, just want to ask where i should be making dynamic table so it would work with dropdown list options...? Because i tried that inside character template itself, then also tried creating item template for that, i dont get it
NVM i figured it out
The solution is to use max() for every fetchFrom and then a final max() at the top-level. The thing is that max() behaves differently when passing a single/multiple numbers/arrays/matrices.
You need to use quotes for the keys in sameRow(): https://gitlab.com/custom-system-builder/custom-system-builder#424-samerow
You can take a look at the sheet-library to get some inspiration (also take a look at the Example-Template): https://gitlab.com/custom-system-builder/custom-system-builder/-/tree/develop/sheet-library
mornin'
i have run into some issues again,
i know below is not as it should, but i cant seem to understand how to make it work.
if sameRow('points') = > 5 then is should display 6
${
sameRow('points') <= 0 ? sameRow('points') -5:
sameRow('points') > 0 and sameRow('points') <6 ? sameRow('points') : 0:
sameRow('points') > 5 and sameRow('points') <9 ? sameRow('points') : 6:
}$
the whole code i want to use is
${
Sprak_1_points <= 0 ? Sprak_1_points -5:
Sprak_1_points > 0 and Sprak_1_points <6 ? Sprak_1_points : 0:
Sprak_1_points > 5 and Sprak_1_points <9 ? :6:
Sprak_1_points > 8 and Sprak_1_points <11 ? :7:
Sprak_1_points > 10 and Sprak_1_points <13 ? :8:
Sprak_1_points > 12 and Sprak_1_points <15 ?: 9:
Sprak_1_points > 12 and Sprak_1_points <18 ? :10:
Sprak_1_points > 14 and Sprak_1_points <21 ? :11:
Sprak_1_points > 17 and Sprak_1_points <24 ? :12:
Sprak_1_points > 23 and Sprak_1_points <27 ? :13:
Sprak_1_points > 26 and Sprak_1_points <30 ? :14:
Sprak_1_points > 29 and Sprak_1_points <40 ? :16:
Sprak_1_points > 39 and Sprak_1_points <50 ? :17:
Sprak_1_points > 49 and Sprak_1_points <60 ? :18:
Sprak_1_points > 59 and Sprak_1_points <80 ? :19:
Sprak_1_points = 100 ? :20:
}$
sameRow() would fix, but if i try it with just one row, it seem to use some other variable
Don't forget to use braces around conditionals when using logical operators. And you also have to strictly follow the syntax with ternary-operators <conditional> ? <truthy-statement> : <falsy-statement>
What you want:
${sameRow(points') <= 0 ? sameRow('points') -5 : (sameRow('points') > 0 and sameRow('points') < 6) ? 0 : (sameRow('points') > 5 and sameRow('points') < 9) ? 6 : ...}$
so if i understand this should work
${sameRow('points') <= 0 ? sameRow('points') -5 :
(sameRow('points') > 0 and sameRow('points') < 6) ? 0 :
(sameRow('points') > 5 and sameRow('points') < 9) ? 6 :
(sameRow('points') > 8 and sameRow('points') <11) ? 7:
(sameRow('points') > 10 and sameRow('points') <13) ? 8:
(sameRow('points') > 12 and sameRow('points') <15) ? 9:
(sameRow('points') > 14 and sameRow('points') <18) ? 10:
(sameRow('points') > 17 and sameRow('points') <21) ? 11:
(sameRow('points') > 20 and sameRow('points') <24) ? 12:
(sameRow('points') > 23 and sameRow('points') <27) ? 13:
(sameRow('points') > 26 and sameRow('points') <30) ? 14:
(sameRow('points') > 29 and sameRow('points') <40) ? 16:
(sameRow('points') > 39 and sameRow('points') <50) ? 17:
(sameRow('points') > 49 and sameRow('points') <60) ? 18:
(sameRow('points') > 59 and sameRow('points') <80) ? 19:
(sameRow('points') = 100) ? 20
}$
all i get is error
You forgot a value at the end
Like so? (sameRow('points') = 100) ? 20
You cannot use the ternary without an else-value
And you have to use double-equals for comparison
I follow the == but I don't understand ternary
${sameRow('points') <= 0 ? sameRow('points') -5 :
(sameRow('points') > 0 and sameRow('points') < 6) ? 0 :
(sameRow('points') > 5 and sameRow('points') < 9) ? 6 :
(sameRow('points') > 8 and sameRow('points') <11) ? 7:
(sameRow('points') > 10 and sameRow('points') <13) ? 8:
(sameRow('points') > 12 and sameRow('points') <15) ? 9:
(sameRow('points') > 14 and sameRow('points') <18) ? 10:
(sameRow('points') > 17 and sameRow('points') <21) ? 11:
(sameRow('points') > 20 and sameRow('points') <24) ? 12:
(sameRow('points') > 23 and sameRow('points') <27) ? 13:
(sameRow('points') > 26 and sameRow('points') <30) ? 14:
(sameRow('points') > 29 and sameRow('points') <40) ? 16:
(sameRow('points') > 39 and sameRow('points') <50) ? 17:
(sameRow('points') > 49 and sameRow('points') <60) ? 18:
(sameRow('points') > 59 and sameRow('points') <80) ? 19:
(sameRow('points') >= 100) ? 20
}$
There are many operators in JavaScript, one of which is the ternary operator. In this article, I'll explain what this operator is, and how it can be useful when building applications. I have a video version of this topic [https://youtu.be/MmwtZ0AwN9A] you can check out as well to supplement your learning.
I think ":20" should work instead of last "samerow"
"?19:20"
Oh I do not have the brain to understand this..
Thanks a lot, worked straight away.
I'm terribly sorry, but I can't find the time to investigate, can you please help me fix it?
Closest I get it this...
${sameRow('points') <= 0 ? sameRow('points') -5 :
(sameRow('points') > 0 ? 0 :
(sameRow('points') > 5 ? 6 :
(sameRow('points') > 8 ? 7:
(sameRow('points') > 10 ? 8:
(sameRow('points') > 12 ? 9:
(sameRow('points') > 14 ? 10:
(sameRow('points') > 17 ? 11:
(sameRow('points') > 20 ? 12:
(sameRow('points') > 23 ? 13:
(sameRow('points') > 26 ? 14:
(sameRow('points') > 29 ? 16:
(sameRow('points') > 39 ? 17:
(sameRow('points') > 49 ? 18:
(sameRow('points') > 59 ? 19:
(sameRow('points') >= 100) ? 20:
}$
Either ...(sameRow('points') >= 100) ? 20 : 999}$ or ...(sameRow('points') > 59 ? 19 : 20}$
I'm afraid I don't know that one Jerzy, but I also have a question. Probably super easy too.
Label Icons come from a web service, right? How do I select/use this?
Right, tyvm Jerzy. GL... 🙂
Some of those are "Pro", If I subscribe to fontawesome, is it hard to educate foundry that I can use it?
Guys is there any like recent custom system tutorial videos? Because those i had found were for previous versions (sorry for poor english im not a native speaker)
Ah... another visual-learner! Nice to meet you. I'd make some myself when I know enough to be useful, but my web-camera keeps breaking trying to film my face. 🙂
(( Sabrecho is watching this one for an answer too. ))
The github documentation is kinda straight to the point and where i dont have knowledge on CSS (or how its called) its really confusing
The YouTuber 'Web Dev Simplified' has this tutorial about css if you like... https://youtu.be/1PnVor36_40?si=x2erIANyG7qLxA_T
🚨 IMPORTANT:
Learn CSS Today Course: https://courses.webdevsimplified.com/learn-css-today?utm_medium=video-description-no-mention&utm_source=youtube&utm_campaign=css-20-minutes
In this video we will cover everything you need to know to get up and running with CSS in only 20 minutes. We will cover CSS syntax, how to add CSS to your HTML, CSS co...
Before I sign up for FontAwesome so I can use even more icons, is there something I need to do to verify it in CSB/Foundry?
simply dont sign in. its not worth it . what you may need is free rest you can achive with html and CSS
Shiet, just got hacked and forgot to save what i did
Update, with sameRow() it works, but it reads some other variable and does not change. so im going back to the orignal idea with the full key, a tad more work, but excel replace is my friend
thankyou for your time
Question. I know there is a fetch from dynamic table command to grab columns. Is there a similar one for items?
Did nayone color not field but a background for item?
i need help again, in a label, in label roll, why doesit not roll ?
${[1d20]}$
i just get a error
[[1d20]] use if not variables.
Put : on either side of agility_mod
Full formula should be ${[1d20] + agility_mod}$
yeah, but nothing happens
no error or enything
do i need dice so nice for it to work?
Did you check the console (F12)?
No
im not th one running the server, but ill check
hmm can it be with something that server is running foundry v.11?
Truth be told, I do not know. Do you have a newer server to test it with?
[[1d20]] works, ${[1d20]}$ does not
i know it worked before the migration, so i think that could be the issue
Oh well, only problem is adding a variable with the working form...
${[1d20+:agility_mod:)]}$
testing
Strange. Not at computer so don't have my notes.
the intesing thing is that it does not say anything, im requesting the console log
Nope (at least no CSB-Formula, it's possible with Script-Expressions)
Only thing that comes to mind is ${[[1d20]]+agility_mod}$ ...
No error, but no roll
It doesn't matter if you're the one running the server or not, the relevant logs are on client-level
Uncaught (in promise) Error: Unresolved StringTerm [1d20] requested for evaluation
at StringTerm.evaluate (foundry.js:12750:11)
at Roll._evaluate (foundry.js:10286:42)
at Roll.evaluate (foundry.js:10250:25)
at Formula.evaluateRoll (Formula.js:945:24)
at async Formula.compute (Formula.js:420:30)
at async processFormulas (ComputablePhrase.js:139:21)
at async ComputablePhrase.compute (ComputablePhrase.js:212:34)
at async HTMLAnchorElement.<anonymous> (Label.js:271:21)
When you do ${}$ you only use a single "[]" not a double.
Yep. It means that the Roll Formula you provided couldn't be resolved (probably wrong syntax)
That is what I knew, but he said it did not work 🤷🏻♂️
Thank you. I can at least stop looking.
and put spaces in it
same with both one [ ] and two
${[1d20 + :agility_mod:]}$
Agility_mod is fixed, but simmilar isue
Wait, that one comes from the Tokenizer?
This error is not related to CSB
Welp
with just ${[1d20]}$ i get this
for me this is greek
or possibly Islandic
CSB is running 3.0.0 and FVTT is v11 if it matters
It's an known issue apparently, from the upgrade to V11
Is there function in CSB that will identify the highest value rolled in a pool of dice (or a simple way to do this)? I'm creating a character sheet for a game where the degree of success is determined by the highest value rolled on a pool of six-sided dice. The roll part was easy enough (<p>${[:hg_str_val:d6]}$<p>) where hg_str_val is the character's strength attribute which determines the number of six-sided rolled. I tried the max function but it returned the sum of all the dice rolled.
In Foundry VTT you are looking at something like "4d6kh1", which rolls 4 six-sided dice and displays the highest...I would think that syntax ("kh1") would work there as well?
Since I'm here...has anyone come up with any workaround to hide a formula value in a Label message? I know the "#" trick only works with chat messages, but was hoping someone might have figured out a way to do that in Labels.
That worked! Thank you for responding! I didn't realize Foundry had all of these advanced dice commands.
I'm not a coder and could use help cleaning up the following. I'm trying to get the degree of success to display based on the highest value rolled in a dice pool of six-sided dice. I'm messing something up in my conditions statement. <p>${roll:=[:hg_str_val:d6kh1]}$<p>
${roll >= 5 ? 'SUCCESS WITH NO COMPLICATIONS!': roll = 4 ? 'SUCCESS WITH COMPLICATION': roll = 3 ? 'SUCCESS WITH COMPLICATION': roll <=2 ? 'FAILURE WITH COMPLICATION!'}$ </p>
==instead of=- You are missing an else-case at the end
Thank you!
Can a table with multiple checkboxes be displayed in a container? I have an item template I created and it includes a table (named "tags_table") consisting of multiple checkboxes that describe optional functions/tags that can be added to the item. I created a label in the container and used ${item.tags_table}$ in the label prefix but no checkboxes show up.
Only labels can be shown in an Item Container. What you can do is have a label for each checkbox to show its state and even modify it if you set that label as button. I do not remember what code is needed in the roll message of the label, unfortunately, but it has been written previously in this thread.
The example-sheet has that functionality
Thanks!
Is it possible to replace information in lables with a macro?
Or even better, can I somehow import information from an excel/file?
Part 3.3.1. is important, so keep that in mind.
Can items be deleted from a sheet by macro?
Thinking of a system that cleans up herbs that run of usability.
Should be doable, a simple item.delete() is enough. Check the last example in 4.5. Scripts: https://gitlab.com/custom-system-builder/custom-system-builder#45-scripts
Thanks for the answer, Martin.
But after writing it down I realised that my main problem would be the automatically out sorting of the right items, getting their IDs cause names are exist several times, and so on.
It would be much simpler for me if I could use Turbo Pascal in here…
That means that you need to register a certain sheet-update-hook, where you have access to the updated props. This approach is more complex of course
Yea, and this is to much for a 60 year old brain that uses its programming skills last time something 35 years ago…
Never mind – just more handwork will do it also.
Sorry, sometimes I ‘am just a grumpy old man.
Damn, I'm not even half as old as you 😅 . But well, I can understand. The pace in which our dev-technologies are developed is hilarious
Bless you, pal, you give me hope. Was afraid I was the only grumpy old man (though a bit less old 😉) still dealing in this kind of stuff 😅
I haven't even worked with React or the Foundry-API in a more in-depth manner as I should probably do when I want to continue to work on this project (at least experienced with Angular and Spring Boot). All I did so far was more or less plain Javascript 😅
But you are a pro in this.
And a good teacher.
Thanks man. I just don’t want to get loose of a drug I get addicted with in 1984.
Ah right, I made a bunch of new documentations, but I wouldn't say that I'm a pro in JS. I started with JS literally just a year ago
Same here, year was 1990.
Some fast learner you are! Great job, indeed!
I have a question about using a Macro script inside a label text message. The script returns a string which contains some sheet values like this ${variable}$. Is there a way to have those values evaluate to their sheet values before displaying as part of the label text message? Right now it's just displaying the code ${variable}$ instead of the value of the variable.
Could you post your code, please?
Sure (I think this is what you want)
Label Text
%{return await game.macros.getName('FormatPowerSelections').execute({tableSelection: entity.system.props.extras_selection, tableType: 'extra', tableDisplay: 'chat', tableFilter: 'selected'});}%
There is a macro that creates a string output, which has things like this that are returned in that string:
Gain +${(rank)*2}$ Physical Bashing / Lethal / Aggravated soak
My goal is that when that string is displayed as part of the label text (from the macro) that instead of showing ${(rank)*2}$ on the sheet, it actually computes that based upon the value of "rank"
I create the string just using regular string concatenation
recalculate() can do that
Do I add "recalculate()" into the string inside the macro? or do I feed the results of the return statement in the label text through recalculate()?
It's recalculate('<scriptPart>')
Great! so I should have this as my label text?
recalculate(return await game.macros.getName('FormatPowerSelections').execute({tableSelection: entity.system.props.extras_selection, tableType: 'extra', tableDisplay: 'chat', tableFilter: 'selected'});)
Well, don't forget the delimiters for Script-Expressions and CSB-Formulas 😅
${recalculate('%{...}%')}$
Not sure if this is right, but it only worked if I removed the single quotes from around the %{ }%, otherwise it was putting in two of them (one from the returned string and one in the code above). Is that correct?
But otherwise it worked perfectly!
Might be, was not sure if it was untyped after the transferral or not
It appears to return it as a string from the macro in my case. Thank you gain!
You should be able to this with a single line (Not tested but essentially filtering the 'armor' summation based upon whether 'active' is checked)
${sum (fetchFromDynamicTable('table_defense', 'armor','active',true))}$
Hi any estimates when it can be?
How can I change the background of a actor sheet using CSS with a custom image? Like it should only be
.custom-system-actor-content { display: flex; flex-direction: column; padding: 8px; overflow: scroll; height: 100%; background-image: url (example/here.jpeg); }
Correct?
Cuz I change the color of the whole thing. Make it a gradient and all that... but it wont find any image I place in the url 😦
You need to put the whole path to the image
yeah I just put the example there, but I've put the whole path in and even moved the paths into core foundry folders to see if it would work
But it just keeps ssaying 404 not found
in the errors
Also don't forget the "
Ive done that as well
and ' ' just out of curiousity
done alot of testing. but it always returns 404
😦
Done it with and without
Im wondering if its a Module issue since I have to use Custom CSS in order to edit the css...
I use custom CSS module, mine works correctly.
background-image: url("path/path/image.jpg");
With no issue
I just tested your code
.custom-system-actor-content {
display: flex;
flex-direction: column;
padding: 8px;
overflow: scroll;
height: 100%;
background-image: url("images/folder/image.jpg");
}
worked fine on mine
Not sure whats happening but I'll be sure to update ya if I can fix what ever the issue is.
It works !
Hi,
I have a problem with passing value calculated in other label to my macro js script. I would really appreciate some help.
When I try to simply use calculated value in simple label formula, it works, simple example in my label:
${[:count_tags:d6]}$
Its rolling fine, it takes value from count_tags properly (3 right now) and roll 3d6, so caclucation its correct. But I want to use external js script to complicate roll logic a bit more. Right now, I try to invoke my js script inside different label and pass as argument value of count_tags, but it returns undefined value.
How I try:
%{ return await game.macros.getName('test1').execute({count_tags: '${count_tags}$'})}%
This is my test1 js script. It will be doing some more specific things, but now it only contains console log 'cause I want to check if passing value works:
function PotentialRoll(use_value) { console.log("be be " + use_value); } PotentialRoll();
result from console:
3foundry.js:5744 Foundry VTT | Rendering CustomDialog VM2162:5 be be undefined commons.js:8802 Foundry VTT | Created ChatMessage with id [nKustLTOXrv0d6Km]
result in foundry:
I don't see in your macro that you access count_tags.
I am trying to simple use console log for now, to access value:
function PotentialRoll(use_value) { console.log("be be " + use_value); } PotentialRoll();
and checking in console if vale is as expected.
I have more complex script that got additional logic inside, that I want to reuse with custom builder. Now its working on popups with html templates and roll messege, user needs to specify all inputs each time it want to roll, and I want to just pass values from character sheet.
So right now I would appreciate any example that will pass value inside JS, I am not sure if I am doing it right. This is some parts from my JS code, that I am trying to change. You can see that I am trying use values in my logic also got some errors and undefined values:
Check this section: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#334-calling-macros
You have defined a function with a parameter but you're calling it without passing a value, so ofc your console shows undefined 😅
EDIT: Partially Solved (For my case but not the general case)
Is there a way to use fetchFromDynamicTable to return items that 'partially' match a string? For instance, a table that has:
Craft (Arts) 20
Craft (Engineer) 10```
And do fetchFromDynamicTable('skillTable', 'skill_value', 'skill_name', 'craft') ?
It seems all the operators available are for numerics.
My Solution: I was able to us fetchFromDynamicTable(...).toString().includes("partial match text")
any news on progress for the next update or are we still in "indefinitely months away"
not to be rude. I get that the dev's got things going on. Just haven't been active in here in a while so I'm not up to date with things
The ~ operator performs a RegExp matching with the filterValue 😅
Oh! Thank you! I didn't see that one listed in the allowable ones!
I want to show an item description in the chat.
I have a simple Item Sheet (+ its template), with just a rich area text (component key "description").
On the Actor Sheet I have an item container with this item + a label (dice icon). My label roll message is: "${sameRow('item.description')}$". But it doesn't work.
sameRow() will not work in the Label of an Item Container
Hard to say. I'll be more active now but Linked is still practically unavailable and I don't know when this will change
So it is impossible to show the "item.description" in the chat ?
It's basically just ${item.description}$
lol was simple. Thx
From the other day: Is there a way to run any type of script from a keyed label synchronously?
Uhm, Script-Expressions work pretty well in keyed Labels. I think your issue is calling macros in keyed Labels, am I right?
Oh I see also that label roll messages can run async macros!
Yes, but it appears that label roll messages support asynch macros too right?
Label Roll Messages are always async, so yeah
Okay that may solve my problem then! Thank you as always!
I add a number field "charge" on my Item Sheet.
With the same "dice icon", how to make "item.charge=item.charge-1" ?
I tried with setPropertyInEntity('self', 'item.charge', "item.charge'-1") and different variation of it but I don't find
In Custom System Builder, is there a command or code for chat output / roll messages that can be added to the expression to allow the user to 'click to expand' a portion of it?
Try:
${setPropertyInEntity('self', 'charge', "item.charge - 1")}$
But I am not sure if „self” is the right address when used inside the item sheet.
I use it from within item container with “item”.
I also had a similar issue, using attached. It did not work and I'm still trying to find a solution 🤷🏻♂️
Using it from itemcontainer is working for me flawless.
Oh well, I'll have to tinker with it again and see what I did wrong. Thanks!
I am adressing the item with a label from its row in the itemcontainer without opening the item. I can add, substract and even have a if-then working.
Using self as target, right?
No, "item".
Ok, I'll give it a try 😉
This is my setup for the label behind the "green Top", "yellow Down" and "white Off".
Works like a charm. Thanks a lot!
Same for me Thx 🙂
How to concatenate variable and string like this
${ item.use_charge ? setPropertyInEntity('item', 'charge', "item.charge - 1") + " / " + item.charge_max : "unlimited" }$
Example of result in the chat I want: "1/2"
Or to make this in a single row
Without knowing too much about what you're doing, I feel you would be better served having two labels, one for "charges" to show remaining charges, and one for "max charges" with a leading prefix of "/ "
So I'm trying to check if equipped = 0 say it is already unequipped and if equipped not = 0 set it to 0
${[:Equipped:] == 0 ? 'Already unequipped': setPropertyInEntity('Equipped' = 0)}$
I cant seem to really grasph how to do so
I think I have to use Script Expression for chat message and Labels for Player Sheet 👍
Love this ❤️
I did this new version so the change that you do to the item container are kept when you open / close it.
Just put you containers in this line :
const containerSelectors = ['.base_action_container', '.base_action_container2', '.base_action_container3'];
I did some CSS enhancement with my containers so this could mess up with your CSS, you may need to set something up so it looks pretty
Is there a link/site I can learn the basics of css to improve the appearance of my sheets? Seeing what others have done I am hyped.
Is there an easy way to do that? Either in defining the original value of the key or some code that gets run when an item modifier changes a key?
Thx for update. I don't know what I did wrong but my items are out of the table :/
Here is the script with my container name. On a new Actor, items (<tr>) are in the table before I do the first drag and drop
Hello, new to CSB. I'm unable to get item values to list (or sum) in my item container. I think I'm setting them up wrong. I'd like items and their weights listed in the container and then give a total of all item weights. Is there tutorial somewhere? Seems this is basic, but I can't figure out where I'm going wrong.
Does SubTemplate can use variables from parent template? Or how we can pass form parent to child?
wait, but where are you pasting the script?
I installed World Scripter and did this
⬆️
is there a way to do slot based encumberance in CSB?
hey so I needed to make a character sheet within foundry
how would I go about starting that?
its for the Naruto 5e system
I thought there was already a naruto 5e system built for foundry.
I had come across it like a year ago. I don't remember where
I'll try to find it ^^ though if you find it please let me know!
I'm not seeing anything on it? Unless its called something far different xD
honestly I just want to be able to make a character sheet, if I can do that is good enough ^^
now to learn how to import it xD
${setPropertyInEntity('self', 'Equipped', '0')}$
${Equipped := 0}$
So I've been trying to get equipped to change to 0 and I'm not really sure what I'm doing wrong with it
I don't have context but, I use setPropertyInEntity to change something on my character sheet like a number field.
The := is used for reusing a formula result.
This maybe your issue
idk cause when I tried to set it to 0 it didnt stay set to 0
Are you changing a label, initiative formula or an attribute bar?
trying to change checkbox to true and false
can you screen your item container render?
Welcome to this channel.
Output of values from inside an item on the container via a label:
https://gitlab.com/custom-system-builder/custom-system-builder#312-item-container
Total of values can only be done using item modifiers:
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/FAQ/Frequently-Asked-Questions
I don't know if the result of a formula can change a checkbox, unfortunately.
Sorry I could not be of more help.
Well, it seems to be working?
Yes it works, just line are kicked out of the table. I can still sort and everything.
Here is the dif without the script
Oh I see, as I said the script was made to match my CSS. I use a ''grid'' instead of a ''list'', and I didn't need the columns. You can tweak the CSS to align your data with columns tho
I fixed it: line 26 container.append(element); >> container.find('table').append(element);
Yes now it's in the <table> and I can reorder
In sub template I can't get value from actor which contain item of main template attached, but scope is present
so here's a question regarding inititive. I'm trying to make it so that the system, when rolling initiative in combat to use a formula consisting of the 1d6 + two modifiers from the sheet. One (brawnsmod) works just find but i'm not sure what to do with stand speed (from a dropdown only applicable when a checkmark is checked). So far, the best way i see is using a hidden attribute whose value is based on a dropdown option selected.
@lyric swan @turbid sphinx
I implemented your solution in my world and it works like a charm.
Thank you very, very much for this. 😍
One Question:
I have several containers with the same filter but on different pages of the sheet and some containers for one item type, but with different filters. Is it possible that some of the containers can use the same sorting?
Hum, I don't think so because the order of each container is unique in this script.
@formal goblet
You cannot use : from the ternary-operator in Roll Formulas because it collides with other delimiters. You could use switchCase() instead, which could serve as an alternative. Otherwise the solution with the hidden attribute should also work fine and is probably better to keep the initiative-formula clean.
Well, subTemplates do not support calculations and stuff. You can use them to create copies of parts of the template, but... well, they are pretty much useless nowadays.
Are you willing to integrate it into CSB-core? Would be useful to have it built-in (and I wanted to rework sorting/filtering anyway, so it kinda fits well). You can clone the branch with the sorting-feature and implement it there.
Oki.
Just for my understanding and I am not sure if I get it right. Does the script store the rearranged list in a separate file?
so is this fine for the hidden attribute? ${#roll_formula_stand:= stand_checkbox ? concat('+', switchCase(speeddropdown, 'standspeed_a','5','standspeed_b','3','standspeed_c','1','standspeed_d','-3','standspeed_e','-5')):''}$ I wanted to keep the checkbox thing there since i only wanted to apply when the checkbox is on.
You cannot use # and temporary variables. They are handled like Label text.
so can this be tweaked for a hidden attribute?
cause this text is meant for a hidden attribute.
Well, just remove #roll_formula_stand:= and the +-sign. Also make sure that the default-value is 0. Besides that it looks fine
You can test the code in a normal Label text beforehand
Practically the same result
${stand_checkbox ? concat( switchCase(speeddropdown, 'standspeed_a','5','standspeed_b','3','standspeed_c','1','standspeed_d','-3','standspeed_e','-5')):'0'}$ something like this?
Well, concat() is pretty much useless now
And you can keep the numbers as non-strings
those numbers are supposed to be based on the dropdown selected, and the value its suposed to fetch.
Yeah, these can be non-strings
so no quotation marks around them?
Yep
okay got it to work
I have this code that applies a value to a dynamic table based on a dropdown, then reduces the corresponding stat. This technically functions and works as is
${#setPropertyInEntity('self',getRefFromDynamicTable('status_table','status_number','status_effects',status_effect_list),status_potency)}$
${#shield_drop:=fetchFromDynamicTable('status_table','status_number','status_effects','Shattered Shields')}$
${#setPropertyInEntity('self','shield','base_shield <= 0 ? 0 : base_shield-shield_drop')}$
${#armor_drop:=fetchFromDynamicTable('status_table','status_number','status_effects','Corroded Armor')}$
${#setPropertyInEntity('self','armor','base_armor <= 0 ? 0 : base_armor-armor_drop')}$
${#speed_drop:=fetchFromDynamicTable('status_table','status_number','status_effects','Paralysis')}$
${#setPropertyInEntity('self','speed','base_speed <= 0 ? 0 : base_speed-speed_drop')}$```
And then on a new turn I have a button that reduces the duration of status effects and if it's 0, it should reset any effected stats. However it bugs and always resets things even is the duration is not 0
``` Lingering Status Duration:
${setPropertyInEntity('self','status_duration','status_duration <= 0 ? 0 : status_duration - 1')}$
${#status_duration = 0 : setPropertyInEntity('self',getRefFromDynamicTable('status_table','status_number','status_effects',status_effect_list), 0)}$
${#status_duration == 0 : setPropertyInEntity('self','shield','base_shield')}$
${#status_duration == 0 : setPropertyInEntity('self','armor','base_armor')}$
${#status_duration == 0 : setPropertyInEntity('self','speed','base_speed')}$```
Not sure if something is wrong with the second set of code