#Custom System Builder
1 messages ยท Page 50 of 1
${ref(concat('pc_', sameRow('pc_attack_stats'), '_mods').toLowerCase())}$
๐ฎ
damn, that's SO much cleaner
@dense verge ^^^
Does this do the same thing? I'm so confused haha
yes
concat adds elements
pc_ + 'nameofrow' + _mods -> ensure it's lowercase
==
pc_might_mods is the output
best part is, it'll expand with your rows ๐ฉ
Wow thats great, thank you for explaining, this seems like a fantastic community. Thank you once again
Why did I get a ping from this chat?
oh my, im sorry!
i meant to get @void spire
Hehehehehehe
martin the mvp.
๐ฉ
martin gave us a link
Martin you beautiful man
concat(switchCase) is revolutionary. I just managed to condense 24 image labels into 2 (could even do one if i really wanted to)
and clean up several code blocks to a quarter of their size.
What is the easiest way to reference a value from a (non-dynamic) table in a character sheet, for a separate item sheet?
Damn, you're fast...
If the item is linked to the actor, you can use "fetchFromParent" https://gitlab.com/custom-system-builder/custom-system-builder#4215-fetchfromparent
If you know the actor name, you can use "fetchFromActor" https://gitlab.com/custom-system-builder/custom-system-builder#4214-fetchfromactor
ah perfect thank you so much!
I'm having an issue with importing/exporting things with compendiums. When i export items, they lost their reference to the template, what should I do?
Hello everyone! I am trying to figure out a formula for handling options in two dropdowns. The idea is that they both have the same options but once one is selected, the other dropdown doesn't have the option to select it now and vice-versa.
The two dropdowns are called Icon_Attribute and Shiver_Attribute. It seemed to work when only one of them was a formula, but now that they are both formulas, it stopped working.
This is the formula for Icon_Attribute:
${concat('no-attribute',switchCase(Shiver_Attribute, 'att-nerve', '', ', att-nerve'),switchCase(Shiver_Attribute, 'att-motion', '', ', att-motion'),switchCase(Shiver_Attribute, 'att-control', '', ', att-control'),switchCase(Shiver_Attribute, 'att-sage', '', ', att-sage'),switchCase(Shiver_Attribute, 'att-temper', '', ', att-temper'),switchCase(Shiver_Attribute, 'att-insight', '', ', att-insight'))}$
This is the formula for Shiver_Attribute:
${concat('no-attribute',switchCase(Icon_Attribute, 'att-nerve', '', ', att-nerve'),switchCase(Icon_Attribute, 'att-motion', '', ', att-motion'),switchCase(Icon_Attribute, 'att-control', '', ', att-control'),switchCase(Icon_Attribute, 'att-sage', '', ', att-sage'),switchCase(Icon_Attribute, 'att-temper', '', ', att-temper'),switchCase(Icon_Attribute, 'att-insight', '', ', att-insight'))}$
Could really use your help, thanks in advance!
Nevermind... I figured out that I just needed to remove the space between the comma and the option name, I feel dumb.
%{return ['no_attribute', 'att_nerve', 'att_motion'].filter(entry => entry != entity.system.props.Icon_Attribute);}%
I'm trying to get a label on an actor to update with a value from an item label roll message. Here is how I am currently attempting it:
I have also tried just passing in a number but that hasn't worked either.
You can only update Input Components, so Labels and Meters are out
For item displayers, I have want my CSs to have one item displayer showing all items and one that shows all spells. Each spell will have an aspect value with the same key and each item will have a size value with the same key. But when I try to use the filter to specify that the one item displayer will only accept item.aspect_val, ${do item.size_val }$ and vice versa for the other, I wind up just getting a huge error and the sheet crashes. Am I using the item filter formula wrong; does it need to use a conditional modifer formula or something?
What's the item filter formula?
can i display a horizontal rule with a text field or is this only possibly with a rich text area?
A text field, no, a label, yes, but you'll have to be careful as without text it will be hard to find and remove, depending on how you intend to use it, I would suggest using a rich text area, or using custom CSS to achieve your goal
would you give me a simple example of how a css line could be done?
dont want to use rich text areas
I cannot, as I have not learnt CSS yet, maybe @sinful spade could help you when he gets on
Unfortunately CSS in CSB is a bit of a dark art, as it is outside the scope of CSB
You can customize your sheets with your own CSS. You can add a CSS file in the system configuration. The path must lead to a CSS file, starting from Foundry's Data Directory.```
I have got so far as creating a file and making 1 override at the moment, my project is a long way from beautification, but this might help:
https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors
ok got it working, thx!
I guess I know more than I thought ๐
Hi!
I have a weapon that deals 2D6 points of damage. On a critical hit, I want it to deal the maximum possible damage, which is 2*6=12. How can I achieve this?
(I tried using a 'replace(damage, 'D', '')' method, but it doesn't perform the calculation as intended, instead it just displays 26 instead of 12.)
crit ? 12 : 2d6
26=12 i pressume you meant 2d6
The goal is to automatically calculate and apply the maximum possible damage for any dice expression used with weapons in combat (2d8, 3d4, 1d10+4,....)
@floral crater query ? true : false is what you need
@floral crater for dynamic rolls, you'd need to build your roll expression, maybe have a damage key to pull from
https://gitlab.com/custom-system-builder/custom-system-builder#46-add-rolls
It's not what I want to do. Using query? true:false would require testing all possible dice values in the chat.
What I want to do is, starting from a damage input with a different dice value, I can have the maximum damage calculated automatically.
That's why I'm thinking of replacing the 'D' with a '' so that the calculation is done automatically. But apparently this produces a text result and not a mathematical one, so the calculation doesn't work.
examples: 2D6->26->12; 3d4+2->3*4+2->14.....
@floral crater how are you determining if the dice rolls a crit?
once you get you have a crit, I would have 2 components, 1 for number of dice, and one for how many sides
using num for number of dice and sides for number of sides, it would then be
determine if crit ? num * sides : [:num:d:sides:]
How to define whether or not a review does not correspond to my request, that I know how to do. ๐ What I want to know is how to calculate the review when it appears.
oh so you want to know how to determine a crit?
๐
3 different problems in 1 request
no, just one, I don't think we can understand each other (I use an online translator).
no probs
I know how to use query?true:false. ๐
If I have a critic (i.e. true), I'll search the character sheet for the damage entry (2d6, 3d4+1, 1d10 for example).
From there, I want to be able to automatically calculate the maximum value of this entry (for the above examples, 12, 13 or 10).
To do this, you need to extract the 'd' from the input, so that you can multiply the number of dice by the value of the dice.
using your last query, how do you retrieve 'num' and 'sides' to perform the num*sides calculation?
split your damage entry into 2 parts, so instead of dice = '2d6', have num = '2' and sides = '6'
have a 3rd for modifier, mod = '1'
determine if crit ? num * sides + mod: [:num:d:sides:+:mod:]
it's counterproductive and adds extra entries that unnecessarily weigh down the character sheet. Thanks anyway for your help.๐
if you don't wish to change the entries, you could use JS split()
Failing that, make another entry with max damage (which I'll look for in case of criticism) but that seems redundant. There must be something better to do.
${${!replace(rollFormula, 'd', '*')}$}$
that's what I tried to do but I must have forgotten a ')' probably. I'll try again.
Hello all ๐๐ผ can I store a roll formula in an hidden key and use after that key when I need the formula content?
Or when I put ${mykey}$ it will give to me only the results?
there is a missing ')' at the end of your formula before '}', otherwise it works. Thanks
I misread i believe it would be ${[:mykey:]}$ if your hidden key is mykey = '2d6'
@formal goblet could you help me understand why the first formula doesn't work?
${fetchFromUuid(Assigned_Player, "lookup('Dynamic_Equipment_Table', 'mount_label', con, true)")}$```
when this does
```${fetchFromUuid(Assigned_Player, "lookup('Dynamic_Equipment_Table', 'mount_location', 'Mount_Heavy_Weapons', true)")}$```
i assume its lacking quotes
You just want a black line running the width of a label?
Lol it's no different than css anywhere else!
still a dark art to me
Oh, no, it is it's just not different within CSB ๐
The syntax is fine. What are the values?
And Assigned_Player?
the second formula returns the correct info, the first doesn't
both same except pulling from first and second column
The second one is a UUID of an Item
correct
Then do fromUuidSync('uuid').system.props.Dynamic_Equipment_Table in the console and validate the values.
Quotes
Expand one entry
What does sameRow('uuid') return?
That's an Item Displayer
it's an item on an actor, referencing a dynamic table on an item on another actor
yes
Just not a Dynamic Table, but not an issue
I need you to validate fetchFromUuid(sameRow('uuid'), 'Mount_Type'))
Hi all! Is something like this possible to do as a roll?
${[lookup('pc_armour_displayer','melee_defence_armour', 'body_armour', 'Body Armour')+
lookup('pc_defence_stats_table','pc_total_defence_stats', 'pc_defence_stats', 'Vitality')]}$
The first lookup should be bringing the result 1d4, the second is simply a number. I thought in theory this would work when put into the label roll message. Am I missing something or can I not call 1d4 from a dynamic table? Thought I would ask before I pull my hair out trying to work on it. Thank you!
${[:lookup(...):+:lookup(...):]}$
I am so confused, I am literally using the same line in my debug, and it works just fine
oh, yours is different to mine sameRow('uuid', 'Mount_Type') versus (sameRow('uuid'), 'Mount_Type')
Error on my side
np
This does actually roll now but I am just getting an Error instead of a value in the roll, I checked the lookup keys and they return the correct results. Anything else I could be missing?
Use find() instead of lookup()
thank you, I'll give that a go
hmm, same thing, it still rolls but the results is Error
have you tried sending each part to a chat message to ensure they are grabbing the data?
I created a couple of labels to check the lookups/finds returned the correct results and they did.
the code essentially reads 1d4+2 but for some reason it isn't working as a roll
is there an error in the console?
and you encapsulated both lookups with ::? and de-encapsulated the +
It appears to be a value expected error, but the find/lookup returns a value and yes all encapsulated except the +
I would try something like
${mod:= find(...)}$```
and if they show fine, then do
```${dice:= find(...)}$
${mod:= find(...)}$
${[:dice:+:mod:]}$```
Great, thank you, I will give that a go now!
That works! Thank you very much for your help
np
helll yeah nosferato ^^
@formal goblet I have narrowed it down to this,
this works as should and returns mount3,mount4,mount5,mount6
${fetchFromUuid(Assigned_Player, "lookup('Dynamic_Equipment_Table', 'mount_label', 'Mount_Heavy_Weapons', true)")}$
this does weird stuff, as it returns mount1,mount2,mount3,mount4,mount5,mount6,mount7,mount8 (all rows)
${fetchFromUuid(Assigned_Player, "lookup('Dynamic_Equipment_Table', 'mount_label', con, true)")}$```
this just errors
```${con:= 'Mount_Heavy_Weapons'}$
${fetchFromUuid(Assigned_Player, "lookup('Dynamic_Equipment_Table', 'mount_label', "con", true)")}$```
and this shows no errors or anything at all
```${con:= 'Mount_Heavy_Weapons'}$
${fetchFromUuid(Assigned_Player, "lookup('Dynamic_Equipment_Table', 'mount_label', 'con', true)")}$```
${typeOf(con)}$
Seems fine. Then idk
Ah, actually... Execution context
con is part of your current entity, not the entity you want to execute your formula on
idk either, but am sort of glad it wasn't me going out of my mind, I have a goal in finishing this project, to bug martin as little as possible ๐
because i'm using a input template?
So this is the fix
${con:= 'Mount_Heavy_Weapons'}$
${fetchFromUuid(Assigned_Player, "lookup('Dynamic_Equipment_Table', 'mount_label', '${con}$', true)")}$
omfg, it finally works
I would never have thought it would have been applicable when the code is literally next to each other
yes I know, in the backgound they are worlds apart
@formal goblet many thanks again, and now I can finally sleep
@formal goblet so quick question, I should try that first if I get errors with cross referencing items spread across actors?
You have more if you try to understand instead of just randomly trying stuff (although that can also help to understand...)
randomly trying stuff is unfortunately the way I learn
${fetchFromUuid('uuid', "name")}$ vs ${fetchFromUuid('uuid', "'${name}$'")}$
thats going to be different within context of item/actor/child
if I understand correctly
You have to ask "Who executes which formula?"
This is what I wrote for the Item filter formula
Thanks
Has anyone figured out how to edit the dice from [!1d6] yet?
I have more than one display type so editing the provided class's positioning...
what you mean?
i mean for this roll, i'd like the d6 to be in a dropdown panel with 1d6 > 4
but for say, this roll:
i'd like the dropdowns to be under motor and 1d4+3 respectively for the differnet roll results
like this, then roll the selection?
huh?
I mean to edit the visual location of the display
๐คฃ i cant just edit the provided system generated classes - since it would edit ALL rolls. and i havent found a way to put different classes on the rolls yet
i cant say...
<span class="hi">[!1d6]</span>
and the hi class appear on the dice
oh I see, nope not a clue
Same here
that would be a core foundry thing I would assume
It isn't
kind of annoyingly, i tried exaclty my example, and the hi class appeared on the first d4 but not the second one in this image:
in this case since it's just one D6 i could style the first four to look like the second but doesnt help for pools
@formal goblet ${#dos=fetchFromParent(lastDOS)}$ is this how i would set a variable on an item, from a component on the sheet
${myVar:= 1 + 2}$
${myVar + 3}$
https://foundryvtt.com/article/dice-advanced/ Fulfilled Rolls
The official website and community for Foundry Virtual Tabletop.
the dice displayed are CSB generated, not foundry
you can tell by the html structure
as per martin The current downside of this Script is, that the replaced value doesn't have an explanation (the clickable grey box around the value in the Chat Message). It might be possible with a different approach, but I'll skip that here. If someone comes up with a solution to this issue, you're free to share it with me, so I can adjust the example to include that.
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Handling-Dice-Pools
Not the issue
ok
@formal goblet So this is the formula i have, ${dos:=fetchFromParent(lastDOS)}$
<table>
<th><tr> ${name}$ </th></tr>
<th> ${dos}$ Degree's of Success! - ${switchCase(abilityrank, '1', "Iron" , '2' , "Bronze" ,'3', "Silver" , '4' , "Gold" , '5' , "Diamond" , "None")}$ - ${item.abilitylv}$ </th>
<tr><td>Base Damage: ${!basedam:=damage_per_rank * abilityrank}$</td>
<tr><td>Total Damage: ${!((basedam + abilitylv) * dos)}$ ${!damagetypedrop}$ Damage</td>
${#setPropertyInEntity('item, 'cooldown_active', cooldowndrop)}$
</table>, and this is the error im gettin (see above)
err or brlow
lastDOS is undefined in your case
Then quote that. Otherwise it will try to find the value in the current entity, not your parent.
@formal goblet like fetchFromParent('lastDOS')
Y
@formal goblet thank you
You've likely already thought about this martin, but how difficult would it be to make it where the dice pool inherits classes?
I didn't implement this and my brain doesn't work because I'm sick rn
You'd have more success with Linked on that matter
Oh jeez, hope you feel better soon
@formal goblet so the first 10 im guessing is attached to this, ${dos:=fetchFromParent('lastDOS')}$, how do i get it not to show up
@formal goblet just want the name at the top
So I have absolutely no idea about coding, but I've been getting a bit of help from a friend. I'm trying to have an Iten Displayer with a Meter have a Value and a Max taken from an Item. I have boxes on the item that show the item's durability. I just don't know how to get it to read from that and make it actually display the correct values. If anybody can help me figure this out I'd greatly appreciate it!
help! I can not open anymore my actors sheet modder aaaaargh
I put a lookup in a number field and then pufff my template broken
my template is broken....there is a way to recover some work ?
you'd need to reference the values from the item not the new things you've made.
make a new label column for the meter.
<span class="custom-system-meter-fill" style="width:${item.currentDurabilityKey}$"</span></div>```
im not certain the code how how but you can use console to delete specific elements from the template without needing to open it.
You'll need to wait till someone who knows more about javascript, console commands, and the behind the scenes of CSB is online.
The devs for this are not in the US, so you'll have better luck in 12 hours or so.
im shocked that the template wont open because of a broken component though, have you tried restarting the server its on?
or maybe duplicate the template and try and open the duplicate
Can happen in rare cases.
Export the Template and edit the JSON until you find the faulty part. For that, you can delete certain Components, reimport the Template and check, if it opens again. If not, add the deleted part back and delete some other part. Repeat until you find the faulty part and the Template opens again.
You can even readd the faulty part and go deeper into the Component hirachy and repeat the steps above, until you find the actual culprit.
i've noticed invisible labels appearing in my sheet - not entirely sure when they're being created, but they're messing with the spacing and impossible to click - i have to drag everything out of the containing panel and delete that panel to get rid of them.
I've also noticed them in Shadoghast's sheet.
while the highlight seems small it's a good 10px of display padding.
Yes I tried
Tried also ๐ฅฒ
Ok now I know ... Dramatically Save often and Save different ...
hi, how do I edit the font size of all equipable items that belong under a cetain template. How do i create a macro for that?
I just need the command that allowes me to edit the ritch text area of the template
you can target the template's UUID as a class to get all of it's children in your css file
Second weird issue of the night:
yet all the images are loaded and displayed, but i occassionally get these errors poping up.
These come from your Template. The formulas there are not resolved
hello, is there a way to reference a roll formula in a dropdown for roll messages? (if it contains for example: 1d4,1d6,2d6) the square brackets dont roll and say cant convert to number.
${[:dropdownKey:]}$
What's the content of ${dropdownKey}$?
this as i described i would like that it rolls wichever is selected in the sheet
Ok, your issue is, that the content of your Dropdown is dm1, dm2 and so on and not the Rolls you're expecting
yeah but keys should be unique or not? i dont know much of coding as it is 10+ years past since i learned it a bit but if i remember correctly everything should be unique to prevent conflicts
In theory yes, but it also depends on the context. Column Keys in a Dynamic Table should be unique within the Table itself, but you can have the same column keys within different Dynamic Tables. Same with the Dropdown, these should be unique within the Dropdown itself, but not necessarily within the whole character sheet.
ok good to know so how do i fix my problem then?
Just adjust the option keys to match your option labels
like this?
yep
thank you very much that fixed it ๐
FYI there's a console.log always logging the previous value for the Rich Text Areas
Having an issue where using ${sum(lookup("perks", "perk_points"))}$
For a dynamic list perks and number input perk_points causes the sheets to continuously recalc because it can't compute lookup for the table. It doesn't have issues when the table is empty, and the same string (replacing the field references) works for another dynamic list on the same sheet
No idea what it was, but deleting the dynamic table and recreating it fixed it :/
I'm not sure how not? The code functions as expected, and I don't see any random errors. Yet- randomly I get those popups.
Also any suggestions on dealing with the invisible labels?
Side note I did a thing!
The Template doesn't resolve formulas. And if you have a formula in a src-attribute of an image, it will cause an error because of the HTML
Oh shit.
Is there a better way to handle that then?? ๐ฅฒ
I don't want to remake all 24 invisible labels again
Don't think so
I don't know why it should create invisible Labels if they are not part of the Template
This message
There are several of them and they are not just on my sheet
So they're also in the Template?
Yes
I sent a video of me inspecting the element
2 things if you dont mind making a note somewhere...
Sometimes i have labels that have no visable content, just divs and spans that are css styled.
since i style using the template preface- the template doesnt get styled (only the sheet) this makes it much easier to grab weirdly positioned elements to be edited.
However ๐ฆ this means in the sheet they are labels with content that is not visable and thus cannot be clicked - they actually shrink to 0px and i have to f12 manually set a width in them. Really 100% my fault but a inconvenience. Could it be possible to get a checkbox or something that manually places that empty label market to be clicked in the template only overriding it's default only show if empty? (And before you ask -- no this is not the same issue as the invisible labels appearing on my sheet, those are not styled in any way and i have no idea how they're getting there. they have default css classes causing weird padding).
secondly, i finally figured out how to make progression clocks (as i showed in my earlier video!) im super happy with them and they're so useful. Would it be possible to have them added a native CSB elements? I'm sure other users would 100% get a use out of them.
Is there a way for me to roll a label using a macro ?
For example
I have a label with
Component key = atk
that has a Label roll message like
${[1d20+Agility]}$
How would i roll it using a normal foundry macro ?
Is there a way or would i have to rewrite it from scratch just to make it roll using a normal foundry macro ?
I wanted something like :
const componentKey = "atk ";
const actor = canvas.tokens.controlled[0]?.actor;
if (!actor) {
ui.notifications.warn("No character selected.");
return;
}
//Roll the thing
- We actually do that already for truly empty Labels with a clickable square. The thing is, that HTML is not considered as empty content, thus the square will not be shown. I had the same issue with
<img>within Labels, but I couldn't find a satisfying solution for now. A min-width would solve the non-clickable area, but not the invisibility-issue. - It would generally be possible, everybody is open to add or change stuff within the system. But it would raise a few questions/topics regarding how we should integrate it (own Component type vs. styling-type of a Number field or even a Meter, flexibility in terms of max-amount, color, etc...). I think the best way would be to open a ticket and we can discuss the specifics there
Right-click the Label in your character sheet
apparently it was very simple, i just had to do actor.roll();
const componentKey = "atk";
const actor = canvas.tokens.controlled[0]?.actor;
if (!actor) {
ui.notifications.warn("No character selected.");
return;
}
actor.roll(componentKey);
That would also work, yeah
yeah i figured that was the cause of the ones i styled by hand - which when doing that i know what i'll be running into which is why a checkbox in the dialog making the label to over-ride non-empty content to show the empty box square anyway would be a good patchwork solution.
And once forgotten you face the same issue. That's also unsatisfying
true enough, though - i can f12 and override the width and height so i can click it and engage that setting.
Rather than f12 force update every time i want to make a change
Though better solutions may help with the random invisible labels that are cropping up
We could make it to always display the square. Might look a bit weird in the Template, but that's just the Template
oh - what about a "all square" toggle in the GM settings near template refresh?
toggle it on when you have some annoying element to grab, toggle it off to not have constant visual clutter when you dont need it
Wiki feature request placed, instructions provided for anyone who wants to make a 4-segment clock โค๏ธ
https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/437
Hello!
I'm trying to automatically have all tokens made with a template have a health bar on the token.
I've been struggling to do so, has anyone else solved this?
Is there a way to call the "reload" button in an item? Or to reload all items using a macro?
I'm implementing a macro to create items and it works, but you have to reload the sheets to make their data appear
And would be nice to just have that be done at the end of the macro running
settings -> core -> default token settings.
it wont be by template but ๐คท
Fair enough. Thank you very much!
Would it be possible to ask for a screenshot?
I'm not seeing it in my settings.
Just updated everything and I see it now.
Thank you very much
True/false: If I have a Label field with an integer as the Label text, I can use that integer as if it were a number in formulas?
yep.
you may have difficulty editing that number with formula tho.
so if it's only outbound you're clear.
Next question, do you know how to add attribute bars so that they can be seen by the Default Token configuration?
Similar to how this is visible in 5e in that setting:
in your template there's a button that says configure attribute bars
you make them there, and i assume they'll show up in the token list
I've done that as my attribute bars are defined like that in the template.
Sadly that doesn't seem to carry over to the wider selection.
Sadly, still no
i havent added bars to tokens yet so idk mate
It happens.
I'll keep digging
This feels like a dumb question, but is there a standard method to add newlines to a tooltip?
How do I reference an actors key inside an item modifier? I have done it when the key was inside of a Dynamic Table using fetchFromActor but I can't figure out how to call it if it is not inside of a dynamic table? Surely this is as simple as it sounds with something like:
${fetchFromActor(pc_hp}$
or
$fetchFromParent(pc_hp)
I have also tried system.pc_hp , system.props.pc_hp as well as every ( & ' combination I can possible imagine...
What am I doing wrong as I know it must be relatively straight forward! Thank you!
pc_hp... The referenced key must be a Label or Meter
pc_hp is a label , I'm just completely stuck on how I can reference it with fetchFromParent or fetchFromActor from within an items configure modifier. I know I must be messing up the syntax but I can't figure out what it is that I'm doing wrong
I can get it to work when adding the key into a dynamic table but not outside of one..is that the only way it'll work? I would ideally be able to target keys outside of a dynamic table
${fetchFromParent('pc_hp')}$
Yes, that is what I thought however it doesn't work. Thank you for your time!
Omg I know why...I'm an idiot. The targeted key is a formula in itself and it doesn't override it when using =
Thank you again
is there a way to add more pictures to the character sheet?
use the html img tag in a label
or css background-image
Hello mates how are you?
Today I am in obsession with a drop-down. There is a way to taget a column from a dynamic table into the character templates and use the data inside the rows for make a drop-down into an item ? I tried with fetch from parent, lookup and lookup ref .. the best I had was the whole list o null ... Other ways every time ERROR
Isn't the whole list your goal?
Yep but not 1 row with the whole list ahah I need a list to select
You can use the Dynamic Table option if you use the parent. prefix for the Dynamic table key. Otherwise the setup remains the same.
I will try ... Thanks so much
Nope still not work ... It is simpler create a new custom list or there is a way to resolve it? In the readme I haven't found anything that I could get to try by myself.
Show what you got and what you try to achieve in a more structural way.
Oh dear lord, can you provide real screenshots pls? You can use the Snipping Tool for that, that comes with every windows install.
Yes .. I feel so dumd after 20 years without coding one moment
I hope this one is better
Way better.
Now the configuration of your current Dropdown
in foreground there is the item template... zona protetta should become my drop-down. Datas are in background in _Personaggio template and the key of the dynamic is targetprotection
dynamic table column*
I have tryed also with drop down item custom but I can not figure out the associated values of the custom drop down keys into the item display in the actor template
I solved it. I made it easier for myself in another way, for now it's enough for me. In the future I'll try again, when I'm better. Good night everyone and thanks for the support and patience. Peace โ๏ธ
How can I pass a variable from js to formula? For example:
%{
let x = "key_in_parent"
let result = ${fetchFromParent(x)}$
return result
}%
I'm trying to figure out how to make the ${fetchFromParent(x)}$ run, but to no avail
${#%{
localVars.x = 'key_in_parent';
}%}$
${fetchFromParent(x)}$
Is it possible to make it work with more than one element?
This is the code that's giving me headaches, I'm trying to be able to parse formulas like 1d10+2+X+Y (where X and Y are keys to parent's labels) into 1d10+2+3+4.
%{
const dmgParts = "${item_dmg}$".split("+")
let dmgFormula = "";
for(const i in dmgParts){
if(dmgParts[i].includes("d") || !isNaN(dmgParts[i])) {
dmgFormula += dmgParts[i] " + ";
} else {
dmgFormula += "${fetchFromParent(dmgParts[i])}$ +"
}
}
return dmgFormula
}%
Execution order is from inner formula to outer Formula
It would be easier to fetch the value directly in JS instead of via a CSB-Formula with entity.entity.parent.system.props[dmgParts[i]]
worked like a charm โค๏ธ
I feel like I'm so close with this one:
${
equalText(sameRow('name'), "Escape Artist") ?
setPropertyInEntity('item', lookup('state_table','state_active','name','Stuck'), item.state_active ? 'false' : 'true' ) : ' '
}$
equalText works, the lookup brings in the correct checkbox...
I am just trying to make the checkbox go from true to false in the last part and I can't seem to get it working...what am i doing wrong? Thanks
try lookupRef
Error on that one
the lookup just brings back true, I know its so close haha
here's my checkbox updater setPropertyInEntity('self', lookupRef('Dynamic_Equipment_Table', 'Mount_Medium_Weapons', 'mount_label', 'Turret Left'), true)
${
equalText(sameRow('name'), "Escape Artist") ?
setPropertyInEntity('item', lookupRef('state_table','state_active','name','Stuck'), false ) : ' '
}$
this just returns false as the roll instead of updating the checkbox
I just figured that issue out last night, the sheet isn't updating
reload the sheet and the checkbox should be false
nope, it is still true
then there is another issue
Try it with a minimalistic build
sorry, I'm not sure what that means
Use setPropertyInEntity() with only static values first. Then raise the complexity step by step
I've got another one which references only the table it is in and it is updating the checkbox, it looks like this:
${setPropertyInEntity('item','is_active',item.is_active ? 'false' :'true')}$
this works fine
This doesn't match with what you've tried.
The former tries to update a Checkbox within a Dynamic Table, while the latter tries to update one at the top level
how would i do the former with static values? Sorry I'm very much a newbie
setPropertyInEntity('item', 'state_table.0.state_active', false)
the roll brings back false and doesn't change the checkbox
What does ${item.state_table.0.state_active}$ return?
false
Seems fine. Then negate to true and try it out again
i made everything in state table - state active true and now it returns Error
Which one?
this one
Which error
syntax error unexpected operator
The full message
Logger.js:33 Custom System Builder | Unexpected operator . (char 19) SyntaxError: Unexpected operator . (char 19)
You used whitespace. Probably somewhere between the dots or around it. You're not allowed to do that
in this code? it was directly copied and has no spaces
Validate which code it means by looking at the bottom of the error message
yes just looked and it is saying that error is for that code
Then you have a dot somewhere, where it's not supposed to be
Expand the props and look the path up
Ah ok, these are Item Displayers, not Dynamic Tables
Wait a sec, do you try to change the content of a Label with setProp?
Yeah, you do
Is this correct or incorrect? haha
setProp only works on Input Components like real Checkboxes. Labels are out
You have to change the state of the Checkbox of the actual Item
I see, yes the checkbox is in the item, so my original code was only changing the checkbox label to false and not the actual checkbox...
I did try item.state_active ? 'false' : 'true'
and that only returns true
is it possible to reference the actual item itself in setProp?
No. Use setValues() instead
So i have to use the uuid of the item Stuck as the first argument? Does this mean that it will change the active state for all instances of the item Stuck?
or only within that actor sheet?
UUIDs are unique across the whole world
the return I get now in the roll is
Stuck => {"state_active":false}
it still isn't changing the actual checkbox?
Now open the item sheet of Stuck
Ok, what am I looking for?
Is the Component key of the Checkbox correct?
yes component key is state_active
Try in the console fromUuidSync('uuid').system.props and prove that
That's an Item, that is not attached to anything
Apologies, the UUID inside of the character sheet will be unique as well which is where I got confused. Is there a way to automatically reference a UUID in setValues
I can use find for that maybe?
^
Yeah, would work
so the new code:
${
equalText(sameRow('name'), "Escape Artist") ?
setValues(find('state_table','uuid', 'name','Stuck'), 'state_active', false) : ''
}$
now returns: Stuck => {"state_active":false:} in the roll
the console seems to have a problem with the label text as pictured
A'square'
I'm using this in the label text, just to make it a square checkbox which is green and red which works ok, this is conflicting with the set values?
<i class="fa-regular fa-${item.state_active ? 'square-check' : A'square'}$" style="color: ${item.state_active ? 'green' : 'red'}$; background-color: white;"></i>
The A is the issue
It still only returns Stuck = > {"state_active":false}
no errors in the console though
The return is correct
oh it works....I had to add the ? : thank you so much for your patience and your help, I really thought I was close 2 hours ago
I'm back with another weird one. Console not showing any errors. I'm trying to get a value in a Dynamic table (adice) to be reduced by 1 for each 6 rolled in a pool of d6s. Instead, it is zeroing out the value on any combined result of 6. I don't know if what I'm trying to do is even possible with a pool, I may just have to limit it to rolling 1 die at a time for the check. Here is what I have for the roll message:
?{armorroll:"Armor Dice"[number]}
)}$
<p style="font-family:'Title';font-size:30px;text-align:center">Armor Roll</p>
<p style="font-size:30px;text-align:center;weight:bold">${result:=[:armorroll:d6]}$</p>
${#result==6?setPropertyInEntity('self', lookupRef('armors','adice'), "min(first(lookup('armors','adice')) - 1, 0)"):0}$```
Side note, can someone help me with this dice code? I'm trying to get it to roll 1d6 that explodes on 6s (with no limit) but also rerolls 1s (no limit). I can them both to work, but which ever is first only works once, in this case the exploding 6. If it rolls a 1 and then rerolls, it will continue to reroll ones but will no longer explode on a sixe. If I put the rr1 bit first, it will reroll 1s as normal, but if it rolls a 6 it will explode (as it should) but then if it rolls a 1 it will not reroll. Not sure what I'm doing wrong (or if I can make it work).
[1d6x6${equalText(edge,'Knack (Melee)')?'rr1':''}$]
[1d6x=1x=6]
x=1 to explode 1's
Sorry I may have misspoke. I want the 1s to be rerolled (and thus replaced) not to explode, and that is working, though as I said only until the next argument happens.
right
the cs>0 was just so I can roll a lot quickly and look for a min of 4 dice rolled
you just want the final result right? which would be 3
Ones should be rerolled and not counted, hence the rr rather than x. But the problem remains that if I have rr1x6, it will reroll ones (as it should) until it rolls a six (which will explode as it should) but then it will no longer reroll ones.
or you want the 6 and 3?
And no, I am still looking for the total of the roll.
including the 1's?
No, 1s are rerolled and not counted (hence the rr)
tricky
Agreed. As I said the formula I presented works, except one argument seems to supercede the other, in order, and I don't know how to make them both work without one superceding the other.
heres the working code
(async () => {
// Number of d6 dice to roll
const numDice = 1; // Change this as needed
let rolls = [];
let explosionQueue = Array(numDice).fill(0); // Queue to track exploding dice
while (explosionQueue.length > 0) {
let roll = new Roll(`${explosionQueue.length}d6`);
await roll.evaluate();
let results = roll.dice[0].results.map(r => r.result);
rolls.push(...results);
// Find exploding dice (1s and 6s)
explosionQueue = results.filter(r => r === 1 || r === 6);
}
// Remove 1s from final sum
let successfulRolls = rolls.filter(r => r > 1);
let totalSuccess = successfulRolls.reduce((sum, r) => sum + r, 0);
// Prepare a chat message with results
let messageContent = `
:game_die: <strong>Rolling ${numDice}d6 (Exploding on 1s & 6s)</strong><br>
Rolls: ${rolls.join(", ")}<br>
:white_check_mark: Successes ( > 1 ): ${successfulRolls.join(", ")}<br>
:fire: <strong>Total Success Value: ${totalSuccess}</strong>
`;
// Send message to chat
ChatMessage.create({
content: messageContent,
speaker: ChatMessage.getSpeaker(),
});
})();
}%```
Is the only way tp do it in a macro? I was hoping to make it native to a sheet in a label chat message.
Hello, I return with a question: Is CSB able to read Conditions from Triggler/Condition Lab and use them? I created a Condition using CL called "Strength", which is supposed to give players an option to increase damage by 50%. I made their weapons have a +50% damage button, but I want it to be only visible if the Strength condition is present. Is there a way to do it, or is CSB unable to see these conditions?
Unfortunately from my understanding, it is a limitation of foundry roll modifiers, however that code is for a label roll message, not a macro
Is there a way of adding items from the item tab to an item displayer automaticaly with scripts?
i managed!
They're all stored locally so just a matter of pulling them
now i'm getting an error related to "Uncomputable token"
I'm translating 3:16 Carnage to CSB. It has weapons with damage that change based on distance (Near, Close, Far).
Is there anyway to populate an Item Displayer with those values from an equipable item?
Do you mean you want the item displayed to show the selections, or that you want to determine the range and show the appropriate value?
I'd love for it to show all 3 ranges, and display the corresponding values in the item sheet.
So, on the Item Displayer is it possible to show "Close" "Near" "Far"
But have the information populated byt the equippable item sheet?
I don't know if I asking this well๐
You can set up a label on the item displayed that calls the key from the item.
Use ${item.<your key>}$ as the label
Replace <your key> with the key for the dropdown on the item.
OK so not sure what I am doing wrong here, I want to roll 2d6 vs a target number that is a defined variable
${[!2d6>:BLDSV:]}$
@fair yoke ${[2d6cs>:BLDSV:]}$
https://foundryvtt.com/article/dice-modifiers/
The official website and community for Foundry Virtual Tabletop.
if foundry can count successes but doesn't have the simple functionality of comparing both dice added together to a target number, I'm going to be annoyed.
I'd rather not play fun and games with macros again
what do you mean versus?
I mean battletech system rolling, 2d6, add them, compare to target number
total value of both dice greater than target number?
so yes
I am unaware of a way to do what you want without using JS
${result:= [2d6]}$
${result > BLDSV ? 'Success' : 'Failure'}$
excellent, thank you
just modified it to !2d6 so I get the individual dice results too
this saves me allot of frustration
also made it >=
Hi there! i'm back, still trying to port a system over to foundry using CSB lol so right now i have what might seem like a complex situation: currently I am attempting to get the character sheet to calculate bonuses received by what the equivalent of feats are to the system. For example: if the player marks their sheet as having the feat [Accelerate], their movement should get a +1. What I was thinking is having a drop down window where they can chose to grab the feat but i dont know how to proceed to have the dropdown window values be used to apply to their character's stats.
You should use Items with Item Modifiers instead of Dropdowns
the thing with that is, do i have to create an Item sheet for every single feat?
Yeah
It's not the only way, but probably the most feasable one
is there a way for me to edit a dynamic table's values from the template?
Only if you have Input Components
what are input components?
Text Fields, Number Fields, Checkboxes, Radio Buttons, Dropdowns and Rich Text Areas
I saw a note saying the system doesn't/can't use compendiums. Is this going to be fixed in the future? I heavily use compendiums for my games and they use less space than in-world items.
This system is not made to work with Compendiums. Using Compendiums may result in unexpected behaviour. Notable issues are with Templates stored in Compendiums (see [#324]), or items in items in Compendiums.
Other things may work. Fixes may come, but don't expect them in the near future.
okay so sorry if this seems like a silly question, but im trying to read through the gitlab documention and i do not understand the wording on some of the parts. for example, for the dynamic table it says "The +-button in the body of the table is used to create predefined lines. These lines will get added to the characters synchronized with the template. Each field can be filled with predefined data, which will be editable later by the players." Which pre defined data and from where?
K... bummer. Compendiums are so clutch. TY
All rows in the Template are predefined lines if you add some
okay, what about on the player's character sheet? when they add a line they arent able to add anything to the dynamic table
They still are. Those are just not predefined from the Template
This is an item displayer, the data under "Close" and "Near" is being populated from the item sheet, which is perfect. But, I cannot figure out how to get it to roll when clicking the dice notation.
${[:item.damage:]}$ or something similar along the line
Unfortunately, that doesn't work. There is no where to enter in roll commands for the ItemDisplayer.
Show me the content of Near
On the item sheet you mean?
In the Item Displayer
${[:item.nearBasicDropdown:]}$
nearBasicDropdown is the dropdown menu that holds the dice notation.
Hot diggity damn, thank you.
Hello It Is me... If I have two dynamic table with the same Rows and I want to show inside the rows of the A) column (label) the text I wrote in the B) dynamic table?
I tried with the sameRow(lookup('tableBkey','columnBname')
And show me ALL the B column list in each A column field instead the list distributed row by row...
Ok, so Dynamic Table A and Dynamic Table B.
What exactly do you want to display inside the Label of Dynamic Table A? You said, that you want to display a text from Dynamic Table B, but you haven't specified, which text exactly.
.. I would copy the intere list form a column of a dyn.table and show it to another...
${lookup('dynamicTableB', 'columnB')}$
and it works but not as I want lol
You haven't told any additional requirements
like if I have A) column with 1 2 3 .... 7 rows in a dyn.table and I want to fill it with the 7 things wrote row by row in the column of a B) table...
The size of both is the same?
yes
And what about the case, where the size isn't equal?
with size you mean rows ? or all the structure?
The count of the rows
yes is the same
Is it guaranteed to be the same size?
E.g. players are not allowed to add or delete rows
${lookup('DynamicTable', 'column', '$predefinedIdx', sameRowIndex())}$
empty .. in console it give logger js 33
You have to show the whole error message
Otherwise try out ${ref(concat('dynamicTable.', sameRowIndex(), '.columnKey'))}$
I tried sometimes and I have my result with this o.O
${ref(concat('ArmorTarget.', sameRowIndex()+7,'.HitArmorTarget'))}$
I had some fields empty and I tried like this to have my table filled
thanks so much as always
Where I can see supported languages? Hope there are some improvments about it. Wanna check
Sorry, one more question. That 536 lines of codes is all translation? Nothing else?
i have a bunch of tokens/actors that have undefined in place of several values that are used in the sheet to display currency and it causes a lot of errors to appear every time i reload the sheets after changes
can i somehow use the "Scene.epovfpnsCVTtMaSC.Token.Lm0wTtCoTjAW1yrr.Actor.LQfGhq92WVeWRIXQ" to set the values for the token/actor? i already have a script for changing stats and know the paths that need changing so adjusting the script to force all non numbers to 0 shouldn't be too difficult if i can figure out howto target the right thing
there are around 200 errors, ~10 per actor/token on every reload
Yep, that's all for CSB
fromUuidSync('uuid')
either doesn't do what i need or i'm using it wrong
Are there any video guide I can watch to understand how CSB works?
I don't think there are any up-to-date ones
is there any way to force all tokens made from one actor to reload?
i have fixed the actors but there are bunch of guards that i would need to find andreloal manually to get them to stop errors
Sad...
One more question - what colors in that coding means? I guess some color you need to change and some not? Or thats some else meaning? Just to understand what you need and not to change
Syntax highlighting is a feature of text editors that is used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms. This feature facilitates writing in a structured language such as a programming language or a markup lan...
actor.getDependentTokens().forEach(token => token.actor.templateSystem.reloadTemplate())
actor is not defined
can i please get more detiled instructions, i dont know foundry well
Is there a way to pull what elements have a certain key? I'm being told I can't use a key because I've already used it when as far as I'm aware this isn't the case
Hello there how are today?
${#A:=number(sum(lookup('ArmiCorpoACorpo','PesoArmaCAC')))}$${#B:=number(sum(lookup('ArmiAPortata','ADFPeso')))}$${A+B}$
I tried to hide in label (i saw I can declare only in chat message some local var) but there is a way to do it in a label without write the partial somewhere else ?
i tried also with html <div display:none (or block)> ...${A...}$....${B...}$ .... </div> but I only messed the thing XD
PROBLEM SOLVED: this way ${concat(sum(${A:=number(sum(lookup('ArmiCorpoACorpo','PesoArmaCAC')))}$,${B:=number(sum(lookup('ArmiAPortata','ADFPeso')))}$))}$
${sum(lookup('ArmiCorpoACorpo','PesoArmaCAC')) + sum(lookup('ArmiAPortata','ADFPeso'))}$
I tried but it gives me error...mmm one sec I try again with your formula
now it works..... maybe I wrote something wrong before
Thanks you so much
Okay
I have a really big issue
and a session tomorrow.
I have updated from 3.0.0 a few weeks ago.
And the exported template from 3.0.0 does not import correctly into 4.4.2
And I don't mean the lookup changes and so forth
I have both of the versions of the system open here, and I'm going to show the problem since it's a bit hard to explain:
export imported onto v3.0.0:
This is correct
The problem is the two tabs. Debate and Combat
Where here they are separate things, as they should
This is in 4.4.2
In this version, it duplicates the Combat Tab over the Debate tab
but not only that, it duplicates the tabs within it.
Instead of deck1 2 and 3
we have deck3 deck2 and deck3
which will scramble all information
that was stored within those tabs too
Check which keys the tabs have
they've been duplicated
when exported into 4.4.2
so they have everything the same
which causes loads of errors
but exporting the same json of a template into 3.0.0, it exports correctly
I mean in the original version
with the different tabs and different keys
Then try to rename the key of the Tab to something else. Maybe that helps
All different keys, was just checking again to be sure
okay, I'll try
Same problem
re-keyed all tabs
Did you rename before an export?
yes
huh...
same name with a 2 in the end
super confusing
I looked at the json
and it does have two "CombatTab" keys in it
but it also has the "DebateTab"
How about increasing the version gradually instead of making such a huge jump? Or you fix the JSON manually and reimport that
I did fix it
but all I did was 'find and replace' all of the specific changes.
like 'lookup' and such
and it worked for the other system
cause I had two
well, two that I migrated
very different systems, but the other one had absolutely no problems
this one on the other hand
I migrated it as well, and didn't worry cause I had already prepared the whole session before-hand
only to check now and see that all of the data is broken due to the key-duplication
This Json I sent you here though is not fixed, cause I was trying to export again to test it.
So this is the fresh exported, working version
that only needs some of those find-and-replace
This is the fixed version
however, both have the same issue in 4.4.2
also, I did update it to 4.2.3
first
Very interesting
I just tried to update it to 3.2.5
from 3.0.0
and already in 3.0.0 it already has the same issue
only when exported into 3.0.0 it exports correctly.
Hi everyone,
I am working on a project that involves a lot of "item-interaction", which means there will be a lot of items on the sheet. Do you all have any advice on how to handle items and such in a way which doesn't slow the game engine to a crawl? Particularly, if there are any work-arounds to having attached items at all, but still able to use "item-presets" or possibly way to somehow "un-attach" the item from the character sheet, but keep a reference to it so that it can be added back with a single click?
I'd love to hear your ideas and suggestions, because I am currently at my wit's end :D
Thanks in advance!
is there a way to make it so that when a player clicks a rollable button on the character sheet, a prompt shows up saying something along the lines of "any additional bonuses?" and then the prompt allows the player to input a number and add that number to the roll?
Martin, I have tried changing the keys of the bugged exported sheet, and it doesn't allow me to change any of the bugged tabs in any way
I'm trying so hard to figure this out in time to rest before the session tomorrow
that helps me immensely thank you
how do i use the lookup function in CSB? do i just type the code in the label text area of a component?
I am rushing to troubleshoot something here so my brain is faltering for anything else, but I thought maybe this roll that has lookup in it might help you learn about it a bit:
${#concat(string(?{Act:'Actions?'[number]|(sameRow('ACost'))}), string(?{Roll:'ROLL'|'2d10',"Normal"|'3d10kh2',"Advantage"|'4d10kh2',"Domination"|'3d10kl2',"Disadvantage"|'4d10kl2',"Submission"}), string(?{method:'METHOD/DETRIMENT?'[number]|0}), (?{Sphere:'Spheres?'[number]|0}), (?{Energy:'Energy Spent ='|"CNothing","None"|"CStam","Stamina"|"CWill","Willpower"}))}$
${sameRow('ACN')}$
Roll
${RollResult:= [:Roll:]}$
Aspect
${#Aspect:= ref(AspectLocked)}$ ${#AspectDice:= equalText(Energy, 'CNothing') ? 0 : 1}$ ${AD:= [:AspectDice:d:Aspect:]}$
Method
${method}$ = DC-${method*5}$
TOTAL
${(floor((RollResult) + (((lookup('SkillList', 'SLevel', 'Skill', sameRow('ACS')))/10)*2))) + (floor(((ref(sameRow('ACCS')))/10)*2)) + (AD)}$
DC
${(sameRow('GT1GM')) - (Sphere*5) - (method*5)}$
Cost
AP
${Act}$ used out of ${setPropertyInEntity('self', 'Actions', Actions - Act)}$
${Energy}$
${setPropertyInEntity('self', Energy, "equalText(Energy, 'None') ? ref(Energy) : ref(Energy) - 1")}$
${sameRow('ACO')}$ย
- ${Sphere}$ = ${setPropertyInEntity('self', (lookupRef('OddityTable', 'CSpheres', 'OddityName', sameRow('ACO'))), "first(lookup('OddityTable', 'CSpheres', 'OddityName', sameRow('ACO')), 0) - Sphere")}$
${CharName}$
${CharSurname}$
what is the #concat for?
lmao thank you still
the # makes it so that that part of the roll in-chat
concat I believe is used for when you have both strings and not-strings in the thing
but don't quote me on that last one
It would make for a pretty shitty quote
I have a system import issue here and a session with it tomorrow, and I'm so damned xD
what im trying to do is make a hidden dynamic table on the character sheet, and then reference it into a label that becomes visible when stat thresholds are met
oh I see
This roll here references a dynamic table to change a value in it. The name of the table is OddityTable.
right
In case there's any info there that helps you
do you happen to remember how the sameRow works? does it use whatever value you set in that row?
sameRow is necessary when indicating a key that is in the same row of the dynamic table.
this is gonna sound super silly since i know how to set the variable name for a column but how can that be done for a row?
so, a label referring to a number field in the same row of its dynamic table needs not only to point to ${NumberFieldInQuestion}$, but ${sameRow('NumberFieldInQuestion')}$
What do you mean?
Each row does not have its own key, necessarily, but they can be referred to in dropdowns that specify table, column and row.
okay thats what i mean is can a key be applied to each row
So that you can select a row from a dynamic table in a dropdown and then reference it. This is what happens in that roll over there. it's referencing a dropdown
I'm not great at explaining this stuff, cause I'm dumb when it comes to it. But lemme add some visual representation to what I mean:
Then in the refernce in the roll I did this part:
first(lookup('OddityTable', 'CSpheres', 'OddityName', sameRow('ACO')), 0)
This was part of the automatic spendature, so I don't think you need first
lookup('OddityTable', 'CSpheres', 'OddityName', sameRow('ACO'))
This is what the table looks like:
The purpose here was to have the dropdown in the dynamic table, indicate a specific tab in the other dynamic table, so that when I roll it, it automatically deducts a number of points from CSpheres in that other dynamic table.
okay thats really awesome
I have an idea. You can export smaller chunks of the Template into ItemSubTemplates. With that, you should be able to export the content of your tabs into separate Templates and move them back into the main template with a new Tab in the new version
sameRow('ACO') there basically speaks of whatever was the specific row selected by the dropdown.
I'm not sure I know how to do that, let alone put it back together. I'm going to try and understand what you mean
oh wait
you mean as in
hmmm
I think I understand
being that the only parts that broke are Debate and Combat
I only have to export everything but that, then try to export just debate and combat separately, then just drag and drop the windows
but
I don't really know how to export just the debate and combat.
Create a new Template and export that
You just create multiple small Templates, export them all and merge them together afterwards
Okay, I'm doing that. Just to clarify, I mean that I don't know if I'll know where to cut the Json without mangling it, but I'll try.
You don't even have to go into the JSON. Just create a new Template and drag the content of the Tab in there
oh, thought that might carry the problem
Yeah, no issue
done.
Except for combat and debate
These can be carried over in separate Templates
is there a way to hide these lines from the right sheet? i have the values set to hide the text unless certain stat thresholds are reached, the left sheet being the template showing everything
But how am I getting the Debate tab back?
That one doesn't even export
neither does the deck1 tab
they get replaced by combat
Drag the content of it in the old version to a new Template
ooh
I'm dumb
yeah
that was a great idea
I'mma go to 3.0.0 and export just the working tabs
awesome, one moment
Hello everyone, I have a problem when using the Custom System. I have already created the value_max_hp (where the character's maximum hp is calculated) and his current HP (represented by def_hp), both are recognized in the token's attribute bar, but I cannot edit the Current HP value (def_hp) on the token even when typing or trying to use macros, only if I go to the character's sheet and adjust the value there and update it. Could someone help me please? I'm trying very hard to learn how to make my own RPG system.
Hello @formal goblet and @brittle moth .
I have worked on the Nightrprowler 1ed (old french RPG) character sheet for a while and here is the latest version I made.
I would gladly give it to the project ๐
Thanks for your work !
so you cant alter values on targets you dont have control of but can you ref them
Hello everyone. I'm working on my Supers! Revised Edition system for CSS and I have a small issue maybe related to my non-coding skills ^^ . I have a Mooks/Henchmen template who need to have an Initiative score equal to my RATING key and when the Mooks/Henchmen rating decrease, if I refresh the Mooks henchmen, the decrease should be the same
Now you can see a group of Mooks I created. At default the initiative value is at the same level as the rating
Let's say now I decrease the Rating to 1 and I refresh
The Initiative stays at 3 and I don't know what's wrong with the following formulae
Maximal value is ${:RATING:}$
Default value is also ${:RATING:}$
and Minimal is set ร 0 but I suppose I could let it blank
Can someone point me towards the right direction ? ๐
Colons are not allowed there
And once a value is set in an Input Component, it will not change automatically.
@formal goblet @fringe silo Thanks for the help, I swear I'm trying to understand exactly what you're explaining to me. But I still haven't been able to understand the error exactly, from what I saw I should use the use number fields with max-values โโinstead to be able to edit the hp value, but from what I saw I had already done this from the prints I sent both fields are Number Field and in Current Hp (def_hp) I put the maximum value ${ref('valor_hp_max')}$ (referencing the maximum Hp). I didn't understand, where did I go wrong?
That should be enough. You should then have an Attribute Bar in the Token settings
Yes, I do. However, the problem is that I can't edit its values โโon the token just by going to the character sheet, the same problem I found in this topic: https://www.reddit.com/r/FoundryVTT/comments/133zg0h/help_with_custom_system_builder_and_hp_bars/
That's the wrong Attribute Bar. That is the Attribute Bar you've created manually. These are read-only
Thanks for the help, are you referring to this attribute bar that I sent? What would be the correct way to do it in Value and Maximum?
You delete that
Because these are all read-only
As soon as you define a number field with a max-value, the system creates one
I think I understood, I followed the steps below:
1 - I deleted the attribute bars.
2 - In the Current HP, I left the component key: def_hp, the component type: Number Field and Maximum value: ref('max_hp_value').
3 - In the Maximum HP, I left the component key: max_hp_value, the component type: Number Field.
Did I do everything right up to this point?
You have to use the formula delimiters in the max-value, otherwise it looks fine
You can also change ref('valor_max_hp') to valor_max_hp, but that's optional
@formal goblet Great, it worked, my mistake was forgetting to use ${}$, both in ${max_hp_value}$ and ${def_hp}$. Thank you very much, now I'm going to try to find a way to make a macro to add and remove the hp value.
This should help: https://github.com/GamerFlix/foundryvtt-api-guide/blob/main/README.md
Hello. I'm working on using CSB to create a setup for my party for the Iron Kingdoms RPG, figured I should ask here first: has anyone set up any templates for Iron Kingdoms before?
Hi all I did a quick look at this thing and well got confused and confounded by it would really like help with putting together a system for Prowlers and Paragons if possible if Anyone would be interested in helping me out that would be great right now I am using a macro and PDF character sheets. But would like a custom system I could share with others. Thanx to any that would like to help.
I'm having an odd issue since updating to the latest version of of CSB, I can't make any text I add since have any alignment other than centre unless I edit it in the html editor. Has something changed that might cause this?
(Edit: This seems to be restricted to tables and bullet points (never mind, it's only SOME entries that it's doing this on...))
I also used to be able to add an indent to paragraphs (I just pressed space a few times, that seemed to be the only way) but now I have to copy and paste one from before the update, otherwise it'll be removed automatically.
I'm trying everyhting, even just putting the key, it's been a while. What am I doing wrong?
(Edit: This seems to be restricted to tables and bullet points (never mind, it's only SOME entries that it's doing this on...))
Okay so it's still inconsistent which text boxes this happens with, but this is only an issue with Left and Centre alignment, Right and Justify seem to work correctly? This is very odd, and is making adding new entries a pain I will admit.
system.props.key
Thank you thought I tried that whoops
Oh fun, Headings don't work this way, only paragraph text. This is a such a weird issue
We changed the rich text area editor due to deprecations
Fair enough, what are we supposed to use/do instead now?
Dunno to be fair, I haven't really used the new one and I don't have an insight there, which behaviour should be intended and which not
So this might be a bug on Foundry's end then?
I would assume Left alignmet acting as Centre is not intended lol
i seem to be misunderstanding how filters work, im trying to make it so this item display only shows items with the equipped1 checkbox checked, but its clearly not working becuase its not checked and its still there.
Hard to say, but that would be my first guess. Although it would be weird, if other systems wouldn't have the same issue.
@brittle moth do you have more info?
Letter casing matters
Very odd behaviour (now sans audio ๐ )
Yeah Justify actually aligns Left now and Left doesn't do anything
im trying to figure out how to make this weapons stats be a referenceable number on the character sheet. not really sure what im doing wrong but this becomes litterally nothing on the character sheet
Remove function
still doenst show anything
What do you want to show from the Item?
i just want its might stat to be a referenceable value from the item display
Then use ${item.Might1}$
like outside the display
Your Formula is outside the Item Displayer? Then find() or lookup() is the right way.
lookup is what im using though
And is in theory correct. I can't validate more without more info
i mean heres the whole template not sure what else i can give you, as you can see the actual character sheet just has nothing there
and yes i reloaded it
And where's Itemtest? Because that's the Table you're performing the lookup on.
nvm im so stupid i renamed the item display table im sorry
Anyone has any tips on managing multiple worlds with the same system I build? I have two player groups that play the same system I build (they do not share a story). The world I build has the expected issues of a first build by a new builder :D, so I often have to make changes. It would save me a lot of time if I don't have to make every change twice.
You create a development world and export your changes to your other worlds. You can use the standard exports or a Compendium, whatever fits your needs.
Where can I find out the way to target a token (or multiple tokens like AoE effect) and interact with their keys/fields values like hp and the other things?
Good evening everyone ๐
You can target Tokens if you press T.
You have to describe, in what kind of ways you want to interact. Something like e.g. "If I press this Button, the current HP of all targeted Tokens should decrease by 3".
Oh ok... right. For example: on a good roll to hit in a fight, I throw dies damages with a label button from my actors/foes templates
Anyone know if there is a way to make a dialog popup conditional?
${sameRow('explosive')==true?#concat(?#{npcdmgmods}):''}$
This is wrong, but hopefully it gets across what I'm trying to do.
Too unspecific.
- What is rolled?
- What is considered a "good hit"?
- And why is the damage rolled from the defenders instead of the attacker?
${#${!sameRow('explosive') ? concat('?', '#{npcdmgmods}') : "''"}$}$
Oh right..
1
Once I select my target, I throw dice with a button (label) with a roll formula
2
If the throw is a success, for example.: on a d% I have to get the result under the 65%, and I get 43 it is a success.
3
Defenders: cause if I am the Master I want to try to kill the party and obviously vice versa, the actors/attackers have to survive and try to go on in the storyline
Thank you that worked...now I need to fix a bit of the following code.
I am trying to automate the management of some labels/numeric fields... And as always I am very thankful for all the support
There will be issues with the part about applying damage automatically.
I assume that your players will be rolling the attack and the damage. It's easy to determine, if the attack would succeed or not, but applying damage to Tokens a player doesn't own will not work. The reason is simple: Lack of permission. The update must be done by someone, who has permission.
This process can only be automated with Javascript
But It will be possible with some row of coding inside the template with the %{}% or I have to add somewhere else inside some file of the CSB folder?
Nice, got it working, thanks @formal goblet
${#pool:=${!sameRow('explosive')?ceil(sameRow('dice')*(short==true?'0.75':(medium==true?'0.5':(long==true?'0.25':'1'))))+(door==true?'-1':'0')+(slit==true?'-1':'0')+(enclosed==true?'1':'0')+(vacuum==true?'1':'0'):sameRow('dice')}$}$
<p style="font-family:'Title';font-size:24px;text-align:center">${sameRow('atk')}$</p>
<p style="font-size:24px;text-align:center;font-weight:bold">${roll:=([:pool:d6]+sameRow('pips'))}$ Damage</p>
<p style="font-size:14px;text-align:left;font-weight:bold">STR Roll > ${roll}$ target is Stunned<br>STR Roll โค ${roll}$ target is Wounded<br>STR Roll โค ${floor(roll/2)}$ target is Incapacitated<br>STR Roll โค ${floor(roll/3)}$ target is Mortally Wounded</p>```
%{}% will execute Javascript, so that could suffice. But I can't help further on that point, because I don't know the exact solution to this problem. I only know, that you have to use sockets to do client-to-client communication.
Thanks Martin my question was just to know if it was possible. When will I get there, at that point, I will decide what to do. ๐
Many things are possible in theory. It's always a question of how much effort you need to invest.
I'll take a look but can you open an issue on gitlab ? 100% certain I'll forget this issue if it stays in the discord only ๐
Hey, maybe someone can point me in the right direction.
I have a template ready and have assigned it an avatar and a prototype token, however when I create a new character and I select my template once the character is created, the default token and avatar don't match.
Is there a way to switch to the template with the chosen avatar / token ?
prototype token of the template has no effect
Oh
Wait, did I post in the wrong channel? whoops
is there a way to allow negative numbers in the number field?
nvm, its letting me go into negatives now
Hi all! I'm trying to figure out how to get a label to use a rollable table. I figured it would probably be a macro, but I wasn't sure how to then have the label activate the macro.
Hello. I'd like to add a Condition to an Item ('Test') which would apply a modifier to a weapon item displayed in an Item Displayer component.
I have the uuid of the weapon, which is stored in a field in the modifying Item, as attached (the Text Field containing the uuid has the key 'target').
How would I code a Condition to modify the attack % of the weapon corresponding to that uuid displayed in the item Displayer which has the key 'weapons'?
Is it even possible?
Hi!
Can you get a dropdown's label and if so, how?
Right now I have a dropdown called "rarity" which goes like this:
If I create a label and I add inside it the following line:
${rarity}$
It will show the key and not the label
This is the intended behavior
Is there a way to get the label instead?
No
Alright, thank you :(
Label is literally just for display, nothing else
It is not possible. Item modifiers are only able to modify the Components of the direct parent entity.
You can also use Roll Tables, using the syntax [#<rollTableName>]. Just put a # before your roll table name, inside brackets, and the system will roll its default formula and integrate the result in the message.
You can customize the Roll Table formula by adding a Roll formula in this syntax: [#<rollTableName>|<rollFormula>]. The formula must follow roll formula syntax, with :: to delimit the keys. This formula can be a Dice roll or a constant value, the latter will always draw the same result from the Roll Table.
https://gitlab.com/custom-system-builder/custom-system-builder/#46-add-rolls
Is it possible to chain a query inside a query?
For example:
${blue == 1 ? ${yellow == 1 ? 'green' : 'blue'}$ : 'white'}$
Oh man, I missed that when I was reading through. I was so focused on macros I didnโt think to look for roll tables. Thank you so much
you CAN remake the labels using conditional logic however.
dropdownval == 1 ? 'labelof1' : ... so on
yes, but you dont need more ${ }$ use regular parens
Mind showing a fixed version of my example?
also i've found it far more readable if you
${ dropdownVal == 2 ? 'yellow' : ''}$```
what are your component keys?
let's just say 1 2 3 4 5 for now
??? and their lables?
bc its gonna be
dropdownKey == 1 ? 'label1' : (dropdownKey == 2 ? 'label2' : (...
it's fine, I just need an example on how I should type it
just do label1 label2 etc
i just gave you one?
if your key values are 1 2 3 4...
and you want their labewls label1 label2...
so this?
${%{return game.user.role >= CONST.USER_ROLES.TRUSTED}% ? (item.rarity_choice == :star: ? '1:star:' : item.rarity_choice == :star::star: ? '2:star:' : item.rarity_choice == :star::star::star: ? '3:star:' : item.rarity_choice == :star::star::star::star: ? '4:star:' : '5:star:') : '???'}$
(looks better on my notepad)
or should I add a "(" for each rarity level?
idk if you can :star::star::star: since it may confuse csb logic of : else
how are you calling the star in csb?
and yes, yo uneed a ( for each new logic
cond ? if : ( cond ? if : else
You don't necessarily if you chain at the else-part.
oh don't worry it's an emoji on my side, not a ":"
I'm confused now
${blue == 1 ? (yellow == 1 ? 'green' : 'blue') : 'white'}$
I tried this and it returns an error
${%{return game.user.role >= CONST.USER_ROLES.TRUSTED}% ? (item.rarity_choice == :star: ? '1:star:' : item.rarity_choice == :star::star: ? '2:star:' : item.rarity_choice == :star::star::star: ? '3:star:' : item.rarity_choice == :star::star::star::star: ? '4:star:' : '5:star:') : '???'}$
should I redo the () for each iteration instead?
:star: is causing a syntax error
Use equalText() instead of ==. == only works for numeric comparisions.
oh right, it's a string
so uhm
item.rarity_choice == โญ
becomes
item.rarity_choice.equalText('โญ')
right ?
Or even switchCase(), which should be more comfortable for this example
There are examples for each function
on the gitlab?
Yeah
nice
time to read

I tried this:
${%{return game.user.role >= CONST.USER_ROLES.TRUSTED}% ? switchCase(item.rarity_choice, ':star:', '1:star:', ':star::star:', '2:star:', ':star::star::star:', '3:star:', ':star::star::star::star:', '4:star:', '5:star:') : '???'}$
but it still returns an error
Show the console
Can we return the number of items stored inside an item or a character?
Like for example let's say I have a backpack with 2 swords inside a "weapon" item displayer and 1 apple inside a "food" item displayer
Inside the player's backpack item displayer labels, can I create a label called "items" and return the number of items stored inside the backpack? (which should be 3 in this case)
and if so, how?
all my items have a "quantity" value so I would just need to cumulate all the "quantity" value of each items inside the backpack's item displayers
I thought of a lookup for all item displayers one by one but that sounds tedious
This, or if the format is the same across all Items, then you can use a little script like:
%{
return entity.items
.map(item => Number(item.system.props.quantity))
.reduce((acc, quantity) => acc + quantity);
}%
I created a label and set its label text as this:
%{
return entity.items
.map(item => Number(item.system.props.Quantity))
.reduce((acc, Quantity) => acc + Quantity);
}%
But it returns "NaN"
Then one of your Items contains a quantity, that is not a number
I found a bug with Item Piles:
If I create an item called "Backpack" and add items inside its Item Displayer, and then drop the backpack on the ground, the backpack item inside the item pile will have no items stored inside and they will be lost forever
is there a way to reference a choice in a roll message?
I have this
${#concat(
?{checkdifficulty: "Check Difficulty"[number]},
?{statchoice:'Which Stat'|MEstat,"Mind"|BEstat,"Body"|CEstat,"Community"}
)}$
and I what to display which stat a user chose in a roll message.
want*
for the sake of referencing rolls
Trying to use the max() formula. It works fine on it's own, but when I try to assign it and call it later, it tells me that it can't calculate and the token is un-computable.
So this:
Works on it's own, if I don't reference KitBonus anywhere else.
But if I try to use it later, like this:
I get these errors
Thoughts why it works and then doesn't?
Is it possible to change the color of certain metes but not others? Not sure if there is a built in CSS class for it, to take advantage of that idea.
So, I have a label in an ItemDisplay that is a button to roll from a label inside an item. The way I went about it was simply ${[item.Roll]}$, Roll being the key of the label inside the item. That, however, gives me an error. How am I supposed to write this? I clearly got it wrong.
I have been working on making my own system and been working on learning this stuff. I might just be tired, but I am trying to display a value. Specifically. I am tryin to get "${floor((STR - 10) / 2)}$" to work. I have a value, it's KEY is STR, it gives me a value of -5.
The component is a text field. I tried putting the value in "Default Value", "Autocomplete Formula" and even "Visibility Formula" I've also tried making the component a number field. Is the formula wrong? Did I mess something up?
I've never done anything like this before and I'm stumped. I can't figure out what I'm doing wrong. lol...
Please help.@formal goblet
Also, I joined the discord to get help on a problem with trying to set variables with the := command, specifically when combining it with component keys E.G.,
It works with:
${DMG:=[2d10]}$
But throws up an error with:
${DMG:=[(:Equip:+:XP:)d10]}$ (which gives 2d10 normally without the := formula)
I found this out while trying to get the following to work
${DMG:=floor([(:Equip:+:XP:)d10]/fetchFromActor('target', "Unit_Cohesion"))}$
${setPropertyInEntity('target', 'Unit_Strength', "target.Unit_Strength - DMG")}$
The idea was to automatically deduct the Strength of a Target by the amount calculated.
${floor([(:Equip:+:XP:)d10]/fetchFromActor('target', "Unit_Cohesion")) setPropertyInEntity('target', 'Unit_Strength', "target.Unit_Strength - 1")}$
Works perfectly, except with the last line (placeholder amount to be deducted is 1 in the example)
So if there's an easier and less convoluted way of doing this without setting a := variable I'm all ears!
The :<key>: is only true in a roll formula, not in label formulas.
Ah I see, I stand corrected!
I see a lot of errors come out of setting a value based on an operation in the sPIE(). You could try doing the math outside that and then using sPIE with fixed value.
I got the following working for my use case and it does exactly what I want it to do:
%{localVars.damage = ${floor([(:Equip:+:XP:)d10]/fetchFromActor('target', "Unit_Cohesion"))}$; return localVars.damage}% ${setPropertyInEntity('target', 'Unit_Strength', "target.Unit_Strength - %{return localVars.damage }%")}$
But the problem now is that doesn't display how the damage was calculated
Thanks I'll give that a shot
I'm not sure of all the answers, but your stuff is working as intended for me. Here's configuration pictures so you can see where the setup might differ.
(I already have a STRMod on my sheet so I had to add Willis to the beginning of yours)
Output on my test character:
You can get pretty verbose in the roll messages with css for display tables, so if that's working for you, I'd just have the display of the math as a separate bit where you format it for display and hide all the scripts behind some ${# ...}$.
One thing to keep in mind while working with what formulas you're going to use is that hypothetical players won't be able to use any formula with a setPropertyInEntity('target', ...) that targets a token they don't have Ownership permissions on. This is a Foundry thing, not a CSB thing.
So stuff like stat reductions and automatic damage application won't work unless you give players ownership.
If it's a GM-only button, then you're good. Just trying to forestall a bunch of work that you might put in that works fine for the GM only to have it break as soon as a player tries to use it.
That's really helpful, appreciated.
So how would I go about working towards automating combat for players, AKA like MQoL but for my custom systerm?
Or does it look like it's something that steer away from in CSB?
I personally mounted tracking damage as "Something I'll have to do" for a CSB game.
As a personal opinion only, I prefer that. We're simulating the tabletop experience in Foundry, not a video game. Not a condemnation of using those tools, just a personal preference.
label
Where are you putting the formula to get it to display like that?
Just what you see in the pictures.
Do you mean the STRMod: part? That's typed in the Prefix field, I cut that out, sorry.
Do you have just a blank number value to input manually? I put a default value. Do you know if that would make a difference?
Yes, the STR field is a number field, that's what's shown in the first picture's config menu. I didn't bother with a default value, but I typed 10 in there.
I just tested it with a min, max and default value set in the number field config and it works fine.
Put that formula into a Label text and you're fine
Ah, yeah. I see what I didn't ask now.
In further explanation of it all, and what Martin was saying there, it's actually comprised of two different components, one is a number field (key STR) and the other is the label component where the calculation is done (key WillisSTRMod). So you input to STR, and then WillisSTRMod does the calculation and displays the value of the mod.
It works. I took out any spaces and no more issues. Can't remember exactly what I tried last night but I don't care cause it works now lol. Thank you
Good to hear, good luck with it!
Thanks!
Can't tell you if you don't tell what you want to automate exactly
Seems like either MeleeBonus or RangedBonus is null
${#concat(
?{checkdifficulty: "Check Difficulty"[number]},
?{statchoice:'Which Stat'|MEstat,"Mind"|BEstat,"Body"|CEstat,"Community"}
)}$
${statchoice}$
I'm trying to use the Drag Ruler module, and it's worked before but I accidentally deleted the formula for the Speed Attribute and can't seem to get it right again
So it's just a normal formula issue and has nothing to do with the module?
I guess? It worked just fine before, and the module is up to date with the core system, and I don't get any error notes
If you've deleted something accidentally, you can use the "Undo"-Button in the Template to restore the previous state. Be aware, that it only keeps a history of the last 10 changes.
I don't think that's going to work, I've tried to fix it more than 10 times. It asks for the speed Attribute and for my sheets it's "Speed_Total". Then it uses that to give walk/run/too far measurements, and I can only get it to register the too far distance
I need more info. Like what you've configured in the settings and what your actual properties are in the sheet
The path should be actor.system.props.spd_base
aha! you're a genius! Thanks for the help ๐
Oh sorry, I meant if someone chooses Mind on the on the dropdown the roll would also have a label that says "Mind".
${switchCase(statchoice, 'MEstat', 'Mind', 'BEstat', 'Body', 'Community')}$
Thank you!
was wondering if there was a way to automatically update attributes from targeted tokens on a character sheet, they pop up when i reload but i want them to just appear when a new token is targeted.
It won't trigger an update of the sheet. You have to build your own solution if you want to rerender you sheet with every target-switch
Does initializing a variable save the value? So if I want to do math with the MEstat could I do something like statnum:= statchoice then use switchCase for the lable and statnum for the value? Or is it just a reference?
anything about this?
Item Piles simply doesn't know how to handle our implementation of Items in Items
Hey everyone, I hope it's okay to ask, but does anyone have a template for Prowlers & Paragons Ultimate Edition?
Quick question about formulas in number boxes, do component keys work with them? I can get, say, ${2+2}$ to work but something like ${strength+toughness}$ does not seem to.
They do work
Hmmm, not sure what I'm doing wrong then
Oh, if I have a key that changes value, should the number box change to reflect that? If I have a species modifier that defaults to 0 and then gets changed after the fact by adding a species item to the sheet, for instance?
Mouse-over the info icon of the Default value
Okay, so I take it that doesn't just apply to changing the template, but any changes at all
Yep
That's why it is called default value
Alight alight, I just interpreted it a bit differently, again I thought that applied to editing the template, not an inability to change it at all.
no way to fix it? Should I contact the item piles dev?
You can ask if you like.
Actually... @glad spade how ya doin'? ๐ฑ
We've implemented nested Items in our system and I wanted to ask, how we're going to resolve it with Item Piles, because the module obviously doesn't have the knowledge to resolve that correctly for now. So creating Items into a Scene causes the Item to loose nested Items, because it doesn't resolve the references correctly.
I'm a bit stumped again. I made a table and want to grab from it. Basically, if a number in one place equals a number on this table, I want it to spit out the matching result in the other column of the table to a different label.
Are we talking about a normal Table or a Dynamic Table?
The table I am trying to grab from is a dynamic table. I have my stats in a regular table and want to grab the value of one stat, check for the matching number on the table, then spit out the result from the other column in the dynamic table to a spot on the original regular table.
Do both need to be dynamic tables or do I just need their keys for start and finish locations?
Regular Tables have no relevance in terms of formula computations. So it doesn't matter if a Component is inside a regular Table or not. Dynamic Tables on the other hand are relevant.
You probably want to use the find() or lookup()-function to peform searches in Dynamic Tables
I just don't know what formula to use. The following formula is the one that seemed to make sense to me, but again, brand new to this so I have no idea if this is the right one. Grabbed it from the github.
function lookupRange(
extensibleTableKey: string,
targetColumn: string,
lookupColumn: string,
value: number,
opts: {
orderBy: 'ASC' | 'DESC';
isSorted: boolean;
isInclusive: boolean;
} = {
orderBy: 'ASC',
isSorted: false,
isInclusive: true
}
): Primitive;
Depends. Do you try to do a lookup() with exact matches?
You can also read through the descriptions of the functions, they contain examples
It depends, item piles has a way to deal with it, but it has been very 5e focused since no one has come forward with any other alternatives ๐
Here's how 5e is defined:
https://github.com/fantasycalendar/FoundryVTT-ItemPiles/blob/master/src/systems/dnd5e-4.0.0.js#L59
It's very specific and internal code to IP at the moment, but I could expose this in the API, but if everyone expects their specific CSB setup to work out of the box with different item types and different properties, that may be wishful thinking
Referring to container type items, dunno why my reply @ disappeared
I did just try that.
lookupRange('pointstable', 'pointscosttable', 'abilityscoretable', str_points)
From my understanding, first one is the overall dynamic table. The second one is the value you're looking to gain, the third one is the value you're checking and the fourth is the destination?
Alright, I'll check it out tomorrow (hopefully).
And yeah, the module can't work with the system without proper configuration of course, that's just the nature of the template system.
The first 3 are correct. The last one is the value to check against. find(), lookup(), lookupRange() work similar, but return different results. Make sure you use the right one depending on your case.
... I am a little dumb. I was forgetting to enclose the formula in ${}$ ... Thanks for your help though!
IDK if this has been asked already, what is the proper way to do something like adding one value from a dynamic table to another value from the same table, and then outputting to a label? Screenshot, I'm trying to add Core Stat and Skill Level and putting it into Total.
(my current formula that isn't working)
You don't need the math. part in csb. Sum(...) should work
Well that does help some, it's returning 0 now instead of ERROR
Although you probably need to do a find() to return the specific values you're trying to add.
For this, I don't have much experience with this function, is there a good way to have it reference the same row of the table that the label itself is in automatically?
You should probably take a look at the git wiki then.
I have been but I'm struggling to interpret it
Ok, can you give me a screenshot of the table and the config for it then?
And then explain what you're trying to do with it?
I'm making a list of skills in Iron Kingdoms, with number boxes for the base stat, the skill level and then a roll button that displays the final mod.
Thanks for the response! I've developed the system a bit more and here's what I'm trying to automate:
-
Unit Creation. Have 2 tabs, one with radio buttons to select different Equipment that affects the number of d10s rolled and Troop Quality that affects the amount of Cohesion they have (wip but working with the help of an Update button and to change stats after picking the radio buttons)
-
Calculating the Rolling of dice and damage done after mitigation. Xd10 damage Based on the selected Equipment. Divided by the Cohesion of THE ENEMY UNIT (works so far with fetchFromActor ('target'))
-
Deduct the calculated damage from HP of THE ENEMY UNIT (this is the sticky part, since @manic crypt pointed out that setPropertyInEntity ('target',...) only works if a player has Ownership permissions on the target token)
So you can use sameRow('<columname>') to reference the values and then sum to add them. I would format the label in pc_skills_total like this:
${sum(sameRow('pc_skills_stat',0), sameRow('pc_skills_level',0))}$
do you need a hand with setting up the roll on the total column, or do you have a handle on that already?
I think I got a handle on the roll but I'll be sure to ask if I need help, thank you very much!
Ok so it turns out I actually do need some help with the roll command, this is recognized as a roll by the API but it doesn't return a sensible result.
${:sameRow('pc_skills_total',0):+[!2d6]}$
Here's a screenshot of the output
You don't need samerow on that roll, you can just use the key
so the format would probably be best represented by ${[2d6 + :pc_skills_total:]}$
Now for some reason this just returns 'ERROR'
What error is it showing?
in the console
Oh, I see it now. Do you see how what you typed is different from what I typed in?
the closing bracket [] needs to be around the key you're calling for that format to work.
So, when I tried that, then the roll button just does nothing
Does it throw a console error? It should be working.
How do I access the console?
F12
although.. yeah, I'm wrong on that one. BTW, I'm super iterative when it comes to code, so I sometimes give the wrong thing at first, because I spend a lot of time doing it wrong then figuring out what I'm doing. What I was wrong about in THIS instance is that you can't call the skill total directly.
give me a sec to give a proper reference for it.
Hey, no worries about the iterative coding. That is how it be. You're still better at this than I am hehe
see if this code does what you want it to (I know, it's kind of extra..)
<th>Roll result for ${sameRow('pc_skills_name')}$</th>
<tr><td>Skill Total:</td><td>${sum(sameRow('pc_skills_stat'),sameRow('pc_skills_level))}$</td></tr>
<tr><td>Roll:</td><td>${roll:= [2d6]}$</td></tr>
<tr><td><strong>Total Result:</td><td>${sum(roll, pc_skills_total)}$</strong></td></tr>
</table>```
And, just to confirm, I put this in the roll message box?
Roll message box for the total column, yeah. It kind of ignores the label in the same column in this case.
Because I've actually never tried to access the label of the same component in a roll message, so I just avoided the problem by repeating it in the roll message formula.
Alright, now it's throwing this error. If it would be easier to have a new column for a roll button instead of just the total column, that's perfectly fine.
ah, missed that that was still there.
<th>Roll result for ${sameRow('pc_skills_name')}$</th>
<tr><td>Skill Total:</td><td>${total:= sum(sameRow('pc_skills_stat'),sameRow('pc_skills_level))}$</td></tr>
<tr><td>Roll:</td><td>${roll:= [2d6]}$</td></tr>
<tr><td><strong>Total Result:</td><td>${sum(roll, total)}$</strong></td></tr>
</table>```
That works perfectly, thank you so much!
That looks like what I expected it to, is there anything you want to change?
The one thing I wanted to change was to have the individual d6s shown (doubles are a crit in this system) and that was just adding an '!'
If you add a ! to the formulas you can get rid of the highlight boxes if you just want plain numbers there.
or to take it off the skill name in the header.
I'm not 100% certain what you mean by that, apologies
so for line 2, instead of what's written, replace it with <th>Roll result for ${!sameRow('pc_skills_name')}$</th>. It should remove the white box around the word Greatsword.
er.. Great Weapon
Close enough hehe
You can do the same thing for any of the formula results. I usually only leave it around the roll results, to sort of call those out.
That doesn't seem to be removing the white boxes, but it's ok, I kinda like them.
Continuing work on getting my custom system working:
Saw the following example from the gitlab under Conditions:
You can directly use the key of a checkbox to test it is checked
Example : ${ checkboxKey ? 'Checked' : 'Not checked' }$
Does anyone know how the Radio Button version of this? Or a list I can refer to in future?
I don't know the specifics of it, but I've seen Martin recommend against using the radio buttons for an application in the past in preference of using a dropdown.
I do remember from reading through it that you can't have all the buttons of a radio button group unchecked, so if you want a "none" option you need another button with that value.
How can I retrieve the token image for players/targets to include in a label roll message? Can't quite get my head around if fetchFromActor() is the right path or if I need to use %{}% and return it via JS.
as far as returning it goes, you're probably going to have to go through JS, since the .img doesn't show up in props (although you could return it on the item sheet, I guess?). For displaying it you'll need some css in the roll message. (forgot to reply directly, @misty terrace )
if I'm doing a roll from a label roll message from a label with the component key "arcana", how can I reference that from within the label roll?
reference the label value (the value in the label bin on the container) in the roll message in the same component?
the component key of the same label that's running the roll message
like a me.key
So I can use a generic template for each skill
So this kind of setup
without having to manually code each one
I see what you mean.
Umm.. I think that the best way to do that would be something nested in a dynamic table, so you can have the label set to sameRow() and reference the a name column.
That way the formula you set up for the roll label applies to the whole skill list
I see where you're going. It's probably faster and less confusing to just manually make a diffreent message for each skilll
I wish that I could reference a set of me.ATTRIBUTES from components
that sounds like more of a Martin question, tbh. I can't say for sure that something like that isn't possible, but I don't think it's going to fit into the core CSB without being a change to how they're handling the data. You can see the fields in actor._templatesystem._componentmap.<componentkey> and could maybe do something with JS in that realm, but it's beyond my depth.
arcana on my sheet for instance:
As for how I addressed it inside CSB, I have this DT:
with the roll column coded thus:
?{stat:'Attribute for roll '|STRMod,"STR"|DEXMod,"DEX"|CONMod,"CON"|INTMod,"INT"|WISMod,"WIS"|CHAMod,"CHA"},
?{modifier:'Skill Roll Modifier'[number]|0},
?{difficulty:'Difficulty of Check?'|6|8|10|12|14}
)}$
<table>
<tr>
<th>${!sameRow('Name')}$ Roll</th>
</tr>
<tr>
<td>Roll</td>
<td style="text-align: center; vertical-align: middle;">${roll:=[2d6]}$
</tr>
<tr>
<td><strong>Target:</td>
<td style="text-align: center; vertical-align: middle;"> ${!difficulty}$</td>
</tr>
<tr>
<td>Dice Mod:</td>
<td style="text-align: center; vertical-align: middle;">${!modifier}$</td>
</tr>
<tr>
<td>Stat Modifier:</td>
<td style="text-align: center; vertical-align: middle;">${!stat}$</td>
</tr>
<tr>
<td>Skill Rank:</td>
<td style="text-align: center; vertical-align: middle;">${!rank:=sameRow('Rank')}$</td>
</tr>
<tr>
<td><strong>Result</strong></td>
<td style="text-align: center; vertical-align: middle;"><strong>${result:= roll + modifier + stat +rank}$</strong></td>
</tr>
<tr>
<td><strong>${!roll == 12 ? 'Critical Success!' : roll == 2 ? 'Fumble!' : result >= difficulty ? '<br>Success!' : '<br>Fail!'}$
</tr>
</table>```
So it pulls the skill name from the DT
Oh, nice. There you go then.
the minimum value on my meter is not working
It doesn't cap the value automatically. That's intended
is there a way to actually set a nimimum/maximum value for a number?
Use the min() and max()-functions
If you reference the Radio Button Group, it will return the value of the Radio Button, that is selected. You can either use equalText() or switchCase() to compare the result with something.