#Custom System Builder

1 messages · Page 19 of 1

dense pine
#

No change on anzything and I worked in my templates all weekend

fierce harbor
#

This is all

#

Trying to update...fingers crossed...

formal goblet
fierce harbor
formal goblet
#

I already had a few cases where the issue was on forges side

fierce harbor
#

Updated everything and it's all f'd up...badly, for what matters...
Console is in italian, but I think you understand what it says...anyway, first one says it could not load TabbedPanel.js due to application.xml MIME type not allowed, following say that several CSB components could not be loaded...Code-Lord knows why...

static cargo
#

Wow, that's ... special.

#

First thing I'd do with that is here...

fierce harbor
static cargo
#

Oh, hehe.. right. "Assumpitons"...

#

🔇

fierce harbor
#

Custom System Builder uninstalled and reinstalled...nothing works, just like before 😭

fierce harbor
#

Well, I'm out for tonight. Need some rest, then I'll try and tackle the issue tomorrow. Cya.

ornate junco
#

Can I use setPropertyInEntity to set the value of a label from a number field in an item?

formal goblet
ornate junco
#

If so what would that formula look like?

ornate junco
formal goblet
ornate junco
#

Thank you Martin.

#

Always appreaciate the help.

latent sorrel
#

This will be difficult to explain, I think. I am getting about 12 errors that I think relates to the same issue. This is the simplest to explain. I have a button that deletes a specific item from an item container and adds a new item. The item has item modifiers which are used to generate a sum. I have a label prefix that is part of the errors. The error starts with
Formula.js:870 SyntaxError: Value expected (char 9) (at math.js:27324:37)
and ends with
{formula: "concat( < 65 ? 'red' : '')", props: {…}
The missing value after concat actually shows up on the sheet (ie no error or undefined on the sheet) and is part of the sum from the item modifiers. I think the error is generated between when the item is deleted and the new one is created. The links in the error dont seem to point to the problem code. Any ideas? Thanks

static cargo
#

Hey guys... Feels like I've just got something simple making me want to gouge my eyes out.

if (!token) return ui.notification.error("Select a token first.");

This won't stop the script if nothing's selected. Thoughts?

formal goblet
latent sorrel
#

The label prefix is <div style="color:${concat(${RemainingXP}$ < ${minimumXP}$ ? 'red' : '')}$";>

formal goblet
latent sorrel
#

Great! That removed 8 of the 12 errors. The following error I think is being caused by the previously stated issue. I can't find the code that seems to be the culprit in the links:

formal goblet
latent sorrel
#

I installed it in Foundry when the beta went live and didnt see a need to switch over to the "live" version (waiting for next version). I update to the live version to see if it resolves the issue.

shy tendon
#

Quick question:

I used to use a really ugly nested IF statement that would pull a value. Now, I moved to using a switch case. This formula is within a dynamic table

Then, I used a fetchFromDynamicTable that would pull whatever that value was from the nested if statement. However, now that I am using the switch case, that fetch no longer works. It just gives me an error. Does the switch-case not actually provide a value that can be fetched?

shy tendon
formal goblet
#

And the formula

shy tendon
#

${fetchFromDynamicTable('weapon_magazine_dyntable','weapon_magazine_bullet_damage','weapon_magazine_used','1','>=')}$

This is the fetch code. The weapon_magazine_used is a checkbox that I look to see if its been checked.

Then the switch case is (and im cutting it a bit short since its very long but the switch case itself does work): ${switchCase(sameRow('weapon_magazine_bullet_type'), ref('bullet_one'),ref('bullet_one_dmg'), ref('bullet_two'),ref('bullet_two_dmg'), ref('bullet_three'),ref('bullet_three_dmg'), ref('bullet_four'),ref('bullet_four_dmg'), ref('bullet_five'),ref('bullet_five_dmg')........

#

Essentially, I have a table of bullets and that table provides bullet damage, bullet weight, and a whole bunch of other very specific attributes. I used to use a nested if statement however, the games been lagging a lot with this. And the console will often sit there recalculating bullets anytime anything is changed on a character sheet (these guns are items which are within item containers on actor sheets) and this can go on for a while with some annoying lag. I figured going to a switchCase would reduce lag. Unsure if thatll actually work but considering it was like a 30 nested if statement, maybe it caused the lag. But thats why I made this change in the first place but just having issues with now fetching the value the switch-case got

formal goblet
shy tendon
#

oh okay

#

lemme try getting rid of ref, maybe thatll work?

formal goblet
#

But I can't tell what causes the issue from the information you've provided.

shy tendon
#

hm

formal goblet
#

Prolly not

shy tendon
#

yeah it didnt. shame

#

It worked before with the nested if statements but now just doesnt. Very confusing

formal goblet
#

Actually, replace 1 with true and remove the comparison-operator.

shy tendon
#

true without quotations right? or with

formal goblet
#

Without, it's a keyword

shy tendon
#

kk

#

${fetchFromDynamicTable('weapon_magazine_dyntable','weapon_magazine_bullet_damage','weapon_magazine_used',true)}$

#

still seems to provide an error .Strange

#

Just to provide a bit more info. But you can see here that the items dynamic table, the bullet damage column (where the switchCase is) successfully finds the correct value. But once referenced by the fetchFromDynamicTable it can't get it

formal goblet
shy tendon
#

It's in a label that is not within the dynamic table but still on the item template

formal goblet
#

Ok, that's fine

shy tendon
#

Yeah. I'll have to workshop this at some point. I could use a drop down but referencing the value of the key in the drop down is a bit confusing for me tho I'd prob have to just mess with it

formal goblet
#

dropdownKey becomes the selected key, and that is then processed by ref()

shy tendon
#

Yeah. It's just weird because I still have to fetch it from the dynamic table. And when I tried doing ref(fetchFromDyn...) it didn't seem to workn

formal goblet
#

Which version of CSB are you using?

shy tendon
#

Possibly a bit older but nothing crazy. Maybe updated 45 days ago. Unfortunately I'm away from my computer now

formal goblet
shy tendon
#

Ah okay loll

pallid kettle
#

So I've been working on making something with CSB (day 2.) I was putting some text boxes in a table and I cant figure out why the label for two of the text fields are out of alignment with the others. Is there something I can do to fix this or do it be like that sometimes?

formal goblet
# shy tendon Ah okay loll

Actually, you're using 2.4.4 and not 3.0.0 if I see the error message correctly, so you're not on the latest one.

shy tendon
#

Fuck. Alright. I'll get my friend to update it lol. I will return tomorrow once it's updated and if I maybe get it working or go with drop down. It's not even my campaign but I do all the coding on it lol

Thank you for the help, much much appreciated

formal goblet
#

Which components are you using in the table btw?

pallid kettle
#

I'm kinda driving without a steering wheel here. I have next to knowledge of CSS. I've been learning as I go. Where can i find out how to do that?

Components are three text fields and 2 dropdowns.

formal goblet
#

Any alignment rules for the table?

pallid kettle
#

Ah, yep. that was it. Forgot i had tried to do something eariler with it.

formal goblet
pallid kettle
#

Thanks!

cloud marsh
#

Actually ignore that. I didn't read that properly. I thought it was a panel not a table. Sorry.

pallid kettle
#

np, thanks for answering

cloud marsh
ornate junco
calm dock
#

Hey is thier a way to move the avatar symbol area on the sheet when making a custom one or shrinking the panels to a certain size in the header

vagrant hollow
calm dock
#

@vagrant hollow ahh thanks

fierce harbor
#

I'm trying to set thing so that when you click on a certain label the chat shows a simple message containing, among other fields, a description. My intention was to put the description in a hidden dynamic table in the sheet and then pull data from there, problem is that players could delete roes and data won't be there for new actors created from scratch and not by duplication. Any idea on how to achieve what I need?

formal goblet
fierce harbor
formal goblet
fierce harbor
formal goblet
#

Never worked with them 😅

fierce harbor
#

Oh well, nvm 😉

latent sorrel
shy tendon
#

😭

#

So weird. The fetch works for everything that is not using a switchCase

shy tendon
#

wtf

#

So I switched it around just incase. So instead of having a label (that is outside of the dynamic field where the switchCase is present) that pulls data from another label that has a switchCase, instead the field within the dynamic table will reference a cell that used a switchCase that is outside the dynamic table. But this actually also does not work.

Referencing a cell that uses a switch case returns nothing

#

So I think that is just my issue in general. Maybe a bug, I don't know. But referencing a cell that uses a switch case does not work?

formal goblet
shy tendon
#

Sure

glad spade
#

Item Piles 2.8.2 should add support for CSB

ornate junco
# formal goblet Should be in a button

So when I do that it does throw up an error. Also is there a way to set the property entity as a one time thing so the players can still edit the field?

formal goblet
formal goblet
ornate junco
#

It should have access to Armor_Durability

formal goblet
ornate junco
#

Oh

#

That's lovely

#

Maybe I need to remake the armor template.

#

${setPropertyInEntity('self', 'head_armor', 'item.Armor_Durability')}$

#

This is the formula I'm using

formal goblet
ornate junco
#

Would they all need to be within the same panel?

#

Because at the moment mine are not in the same panel.

formal goblet
#

Panel is irrelevant

ornate junco
#

Let me try to make a new template

#

or possibly item container

ornate junco
#

It will set the value but it then locks up my templates and sheets.

#

Do you want the world in a download to take a look?

#

Could it be my custom css?

formal goblet
ornate junco
#

I'm a little stumped on what is happening

formal goblet
#

Can you send the templates?

ornate junco
#

Yup!

#

Just the jsons, correct?

formal goblet
#

y

ornate junco
#

Both the armor template and the char_template

#

Things might look weird since there is no styling

formal goblet
ornate junco
#

I am not able to leave it in there as it results in me not being able to edit the sheet and freezes my foundry.

#

It would be in the inventory tab at the end for armor.

#

I can try to readd it and then resend it

formal goblet
#

That works without any issues on my side

ornate junco
#

Can you show me exactly what you did?

#

Just to confirm that I'm not implementing something wrong.

formal goblet
#

Just added your formula to the Label Roll Message of inv_armor.Durability

ornate junco
#

${setPropertyInEntity('self', 'head_armor', 'item.Armor_Durability')}$
You added this formula to confirm?

formal goblet
#

y

ornate junco
#

When I placed that formula within the property its giving me this error:

#

This is what I have in there currently

formal goblet
ornate junco
formal goblet
ornate junco
#

Would you be able to go into:

#

And send me what's inside of it.

formal goblet
grave ether
#

how do I create a button?

formal goblet
grave ether
#

ok

pallid kettle
#

Okay, so I’m trying to do a thing.

I want to display a character’s weaknesses and resistances based on their current elemental attunements. Characters can have up to 3 elements attuned at a time and weaknesses/resistances can add up.

For instance a character attuned to Fire would take 1/2 dmg from fire. A character attuned to Fire and Water would only take 1/4.

I have elements set up in dropdown lists.

Any ideas on how could approach this somewhat elegantly before I hamfist this?

vagrant hollow
vagrant hollow
formal goblet
vagrant hollow
glad spade
#

What is your quantity property in item piles

#

and where it is located in the item's template

#

@vagrant hollow

vagrant hollow
# glad spade What is your quantity property in item piles

Wow, just was trying to type a bug report ^^
It is a number field with key “quantity” right beside the “item price attribute”, which is working perfectly.
Setting is “system.props.quantity”.

Maybe not related – in console I get “An error occurred while rendering MerchantApp 103. Cannot read properties of undefined (reading 'getKeys')”

Thanks for a marvellous module.

glad spade
#

Can you paste the entire error, please? 🙂

#

And images of your setup would assist me as well

vagrant hollow
lyric swan
#

Number fields are stored as strings (no idea why) btw

glad spade
#

I was told that item.templatesystem.getKeys() can be used to get an item template's keys

#

Maybe you are on an older version of the system that does not support this?

#

I am doing this:

if (game.system.id === "custom-system-builder") {
  const itemTemplates = game.items
    .filter(item => item?.templateSystem?.isTemplate)
    .filter(item => item.templatesystem.getKeys().has(item.system.body.contents));
  for (const item of itemTemplates) {
    itemTypesWithQuantities.add(item.name);
  }
}
vagrant hollow
glad spade
#

As am I

#

What if you type this into the console at the bottom and press enter?
game.items.getName("_Armor").templateSystem.getKeys()

#

Replacing "_Armor" with one of your item templates

#

the name of it, that is

vagrant hollow
glad spade
#

So it exists

#

Well then I will add an additional check 😄

#

This is why I don't like adding support for additional systems in the code, so many small issues lol

vagrant hollow
#

And "gmptown" right beside for price works perfect.
I totaly understand you.
Sorry, that I was coming up with it.

calm dock
#

im almost done woth the fiorst sheet then need to do the mech sheets then i need to figure out how to get it working like a sheet nd macro for combat rolls

glad spade
vagrant hollow
vagrant hollow
glad spade
#

Progress at least.

#

I'll look into it again, at some point next week

vagrant hollow
glad spade
#

Nah, I think I just need to take another look

vagrant hollow
grave ether
#

is there anyway to combine arrays with text? This works to pull all the arrays together but would like to have names added to seperate the tables.

${concat(fetchFromDynamicTable('PCF_Table', 'skillName'), fetchFromDynamicTable('MCF_Table', 'skillName'), fetchFromDynamicTable('DXF_Table', 'skillName'), fetchFromDynamicTable('AGF_Table', 'skillName'), fetchFromDynamicTable('SCF_Table', 'skillName'), fetchFromDynamicTable('KIF_Table', 'skillName'), fetchFromDynamicTable('INF_Table', 'skillName'), fetchFromDynamicTable('SKF_Table', 'skillName'), fetchFromDynamicTable('CTF_Table', 'skillName'), fetchFromDynamicTable('DVF_Table', 'skillName'), fetchFromDynamicTable('VHF_Table', 'skillName'), fetchFromDynamicTable('TCF_Table', 'skillName'))}$

pallid kettle
#

So on the Dynamic Table, 1stType and 2ndType reference the drop down lists with the corresponding keys. If the value of the same row ‘Element’ is the same as the Drop Down, it answers as “True” and “False” if it does not.

I need to have ThridType reference the ThirdType label above for the same True or False statement.

However, it doesn’t seem to like referencing the answer to a formula. Is there a way to do this?

grave ether
#

What is the outcome your looking to achieve ?

#

Also, for a 3rd variable try using and()

#

but it looks like your trying to reference text

pallid kettle
#

So the goal is for 3 tables to reference the same dynamic sheet. They will grab values based on whichever element is true.
Another table will then add those values together and define what they mean. (0 = Normal damage, -1 = 1/2dmg, etc)

grave ether
#

OK so I do something similar but I use nesting ifstatements which has been working for me. The major issue you have is that the values your referencing is text so you need to use equalText() which is basicly a if statement in itself

#

let me see if I can piece this together for you based on my understanding

#

so I understand, the goal is to have a true true true or does that matter?

#

or are you saying if this is true tue false = this, if its true true true = this, if its true false true = this...

#

return will always be the element

#

the values of type 1 2 and 3 are variables

pallid kettle
#

So the True in each column marks which element the character is attuned to. The first two are easy enough because they wont change.
That third column changes, but cannot be equal to either of the first two.

grave ether
#

Running some simulations on my side to see if I got the context correct, give me another moment, I have to figure out the comparison in my head lol

pallid kettle
#

lol okay. This is my first time with system and I'm pretty sure this is the hardest part I'll have to do for the sheet and its been giving me fits. I just want to make sure my players dont have to manually calculate their weaknesses and resistances each time they swap elements.

grave ether
#

Yep completely get it

grave ether
#

@pallid kettle try something like this - You could also tackle it via script.

#

${and(and(fetchFromDynamicTable('TableName', 'FirstTypeSelect') == 'true', fetchFromDynamicTable('TableName', 'SecondTypeSelect')) == 'true'), fetchFromDynamicTable('TableName', 'ThirdTypeSelect') == 'true' ? sameRow('Elements') : 'No'}$

#

thats basicly saying true to all values you pull the samerow from elements, mess with sameRow and fetch

#

sub out the tableName for whatever it is

formal goblet
formal goblet
grave ether
#

Its temporary, so I am just going to leave it like it is. I can combine the list which then pull the numbers and I roll based on it

#

Later on it will be different but its what I got = )

#

Assigning an array to each string value I would like to insert is a bit much

#

I would of thought that string() would of worked but it didnt lol

pallid kettle
grave ether
pallid kettle
#

i'v forced ThirdTypeSelect to work for this. It currently does not.

So my info will be populated at the bottom.
Type 1 table gives the weaknesses and resistances based on what element type 1 is.
Type 2 and 3 do the same for their respective elements.

Those get added together on the value table. (Thats not complete list because I can't get the ThirdTypeSelect column to work)

Does that make sense?

grave ether
#

Interesting, can you shoot me your sheet template?

#

Gives me a good chance to test before i push it back to you

pallid kettle
#

Sure, I apologize in advance.

grave ether
#

No worries! I am just happy to help, been staring at my sheet for hours

grave ether
#

@pallid kettle see my PM - need a new file

lapis meadow
#

Using Dynamic Table, there's a way to sum all the numbers from a column?

foggy grotto
#

^ I too would like to learn such.

formal goblet
lapis meadow
mortal flower
#

can someone help me? I'm trying to make one roll quote with advantage and disvantage in Custom System Builder, anyone know how to do this?

pallid kettle
#

I have a label with a fetchFromDynamicTable formula in it.

If I give the label a component key, the value disappears from the generated character sheet.

Am I doing something wrong or is this normal?

formal goblet
formal goblet
# mortal flower can someone help me? I'm trying to make one roll quote with advantage and disvan...

I´d create a simple user input prompt to ask if the roll should be performed normally, with advantage or with disadvantage. Then I´d construct the roll-formula respectively and use that:

${#?{Roll_Mod:'Roll Modifier'[check]|'normal','Normal'|'advantage','Advantage'|'disadvantage'|'Disadvantage'}}$
${#Roll_Formula:= switchCase(Roll_Mod, 'normal', '1d20', 'advantage', '2d20kh', 'disadvantage', '2d20kl')}$
${[:Roll_Formula:]}$

Reference:

pallid kettle
formal goblet
pallid kettle
#

unless im missing something

potent fossil
#

Hello I'm using a script to call a macro and to pass data it as follows :

%{return await game.macros.getName('ProcessRolls').execute({labelroll: '${item.labelroll}$', jetint: '${item.jetint}$', typemag: '${item.typemag}$', modificateur: '${item.modificateur}$'})}%

but when the macro tries to use these values there a null. I tried this macro to test if they are passed correctly, and it returns nothing

async function displayPassedData(args) {
    const { labelroll, jetint, typemag, modificateur } = args;

    let content = `<p>Received Data:</p>
                   <p>labelroll: ${labelroll}</p>
                   <p>jetint: ${jetint}</p>
                   <p>typemag: ${typemag}</p>
                   <p>modificateur: ${modificateur}</p>`;

    ChatMessage.create({
        user: game.user._id,
        speaker: ChatMessage.getSpeaker(),
        content: content
    });
}
#

Am I doing it wrong?

formal goblet
formal goblet
potent fossil
#

I change it but same problem, nothings apears in the chat

pallid kettle
lapis field
#

Hello!

I am currently looking for a way to write a visibility formula so that something appears only if a certain dropdown list (with key A) is set to one of its options (with key 1).

So far I had A==1 as a visibility formula but that doesn't seem to work...

What should I write?

formal goblet
pallid kettle
formal goblet
lapis field
#

Thank you! I'm usually having trouble understanding the notations in these readme things but if someone points out the exact one I should use I can figure out what to put where haha

#

Now if I want it to show up on two options of the dropdown, what do I write?

equalText(DropdownKey, 'Dexterity' or 'Strength')

#

what should the or be?

formal goblet
# lapis field Now if I want it to show up on two options of the dropdown, what do I write? eq...

equalText() can only accept exactly 2 input arguments, in return it returns you a boolean value (true or false). If you want to combine results logically, you can use the or or and-operator: equalText(dropdownKey, 'Dexterity') or equalText(dropdownKey, 'Strength').

or:

  • false or false -> false
  • false or true -> true
  • true or false -> true
  • true or true -> true

and:

  • false and false -> false
  • false and true -> false
  • true and false -> false
  • true and true -> true
lapis field
#

Thanks again, I did read that, but without any coding experience my comprehension from these text is not great :0

hazy saffron
#

Odd question: I'd like to duplicate the sheet's label roll message format for the results of the roll but in a macro where I format the roll specifically. In particular I want to have the roll result displayed next to a Die icon with a border and when clicked, display the individual rolls like shown in the pic, with colors of successful dice and explosions. Is there code I can copy from somewhere for that?

lyric swan
#

I see a lot of people with this image used as a separator, is it done using CSB feats in the sheet, or is it some custom CSS stuff outside of CSB?

grave ether
#

Css stuff from my understanding

#

I know icons can be used like the d20 roll icon

#

As long as it comes from https://fontawesome.com/

lyric swan
#

Ok ok, fair. If this is done with CSS they must be able to add any kind of image anyway.

hazy saffron
oblique willow
#

I just updated to foundry v11, and to the latest CSB. Is there a reason all items are orange now, and can I change the colour somehow?

formal goblet
oblique willow
#

Apparently Monk's enhanced journal recolours them now? How strange.

It has no colours enabled on the settings, so I wonder why its doing this ...

#

Disabling Inline roll styling fixed it? I don't even know, I'll just be happy it worked

pallid kettle
#

Is there a way to truncate the dispaly of a formula on a template? I have a set of formulas a half a mile long and it takes a few to get to the undo button.

lyric swan
#

Trying to use the "Initiative formula" in CSB settings, I put [1d20 + @VIT] but I always get 1d20 + 0, what am I doing wrong? (system.props.VIT = 3 on that actor).

lyric swan
#

oh god, sorry mb, I should have check this

oblique willow
#

How do I add a label to a label roll message only if it isn't null?
Essentially, if label not null output label

Need to find a way to do that, because currently if a roll message includes a null label it doesn't output at all

hazy saffron
lapis field
#

Another dice question. My system rolls 4dF + modifier. I want to include a way to reroll the one blank dF whenever the outcome of the 4dF part of the roll is 3. Basically a roll of +++0 is regarded as a potential critical hit. Rerolling the 0 and getting a + confirms the critical hit. I would also like to get a visual confirmation of a critical hit (++++, or +++0 with a rerolled 0 coming up +). Can anyone point me in the right direction?

formal goblet
formal goblet
oblique willow
#

${Label != null ? Label : nothing }$
Although from my experimentation I expect a CSB-Formula will always result in a inline roll, since it does even with a null input.

#

Still, finding a way to not break the roll formula just because a Label is null would be good.

formal goblet
oblique willow
#

That works, I didn't realise ! would hide it

#

Hm, when using it on a rich text area, it errors out unless it is opened and saved on the character first.

potent fossil
#

Is it possible to set a minimum value for a hidden attribute?

runic perch
#

question is CSB suitable for making a system that uses a card deck instead of dice?

formal goblet
runic perch
formal goblet
#

You'd basically need your own small subsystem for carddecks

#

I don't even know if Foundry has card decks by standard

kind basin
#

Is there anyway to have a sort of equipped item slot ? where my players could drag their armor from their inventory into this spot. Bonus points if i can use this slot to pull basic info about the equppied item likes it armor value

formal goblet
kind basin
#

I've got some item containers. I just didnt know if i could drag an item from a container called "Bag" and into a spot called "Armor" for example. i have it working where the players can open the item and change a drop down item and that changes the container. wasnt sure if there was another way

formal goblet
#

So you have to think a bit different here

kind basin
#

got ya! ok. I can fiddle with it and get it working. just wanted to make sure there wasnt another way to make it work. I appreciate ya as always @formal goblet

kind basin
#

Alright, one more Question. I have a item that features a button. When pressed it runs ${setPropertyInEntity('self', 'Armor_Durability', 'Armor_Durability -1')}$ and works like a charm. i also have an item container where i would like one of the components to be that button. just so the player doesn't have to open the item every time. I got the button to appear but it doesnt run the code. I tried copying the same code to the button on the item container and that doesnt work either. Can this be done?

tired spoke
#

Hi all, first time user of foundry (any vtt really). Making a warhammer fantasy 2e game and using CSB. I have 0 experience in programming, so going to ask a bunch of noob questions.

#

First is how do i link Dynamic tables to drop downs if there on different sheets? lets say the DT key is stat_advance and the column key is stat_list. i put both in and get no link unless they are on the same sheet. The pdf says somthing about putting parent. in first but it does not work. thanks

formal goblet
kind basin
formal goblet
tired spoke
wet helm
#

Hi all, I'm still quite new to Custom System Builder and have the following question: Is ist possible to generate a dynamic table from another danymic table? To be more precise, maybe: I want to have a (hidden) master table where I put in all Skills that are available to the players including the calculations. On the Character Sheet I want to have different sections (e.g. "Melee") where only the skills which are labeled "melee" in the master table would automatically appear. (Explanation why I want to do this: Easier calculation of available Skillpoints, tidier backend and more flexibility to show skills at more than one place on the character sheet). Any Feedback or suggestions if this is possible and (if yes) how would be highly welcome.

grave ether
# wet helm Hi all, I'm still quite new to Custom System Builder and have the following ques...

Yes, I call these helper tables and use them all over the place. All you truely need to do is create the first table then reference that table in your other dynamic table. For example, I have a helper table named Melee, in it consist of Attack bonus, Range Bonus, Misc. My dynamic table is called helperMelee. In this case I would just fetchFromDynamicTable('helperMelee', 'Attack_Bonus') in my other dynamic table for whatever attack_bonus is) changes made on the helper table will adjust the other but not viceversa

wet helm
grave ether
#

If you need help specificly, I am happy to look at your vision and sheet to help further

wet helm
latent sorrel
#

I cannot get sameRow('options') to work in a dropdown that is in a Dynamic Table. The same code works in a label. Am I missing something?

latent sorrel
#

Its an item. Here is the template. Its very much a work in process. It may give weird errors because its pulls from a master sheet. The issue is under the "Bonus Tab", enter a CSV in the untitled textbox. There is a test label that should show your entry via sameRow.

grave ether
#

OK let me look

#

I dont understand why your export is providing extra data and will not import on my side

#

Had this issue with someone elses sheet recently,

latent sorrel
grave ether
#

Ahhhhh

#

That maybe why

#

That looks like what I was expecting

#

got it

#

Your trying to reference the options on intemMods right

latent sorrel
#

YES

grave ether
#

OK where are you trying to reference this at?

#

As in, from the sheet or from another table

latent sorrel
#

from same table, same sheet.

grave ether
#

ok just making sure

#

ahhhh IC

#

OK

#

Your using formula

#

Change that to Dynamic table

#

Table Key and Column need to be included

#

That will allow the dropdown to appear

#

trying to get it to work with the formula now

#

I assume you have some custom stuff going on as well

latent sorrel
#

I am not sure I follow. I think you may refering to some wayward code that I dont think applies

grave ether
#

No, I was just saying if your using as formula in conjunction with the pulling of the dynamic table then there you go

#

both work

#

sameRow is not working in this context since sameRow looks at the row not the column

#

Does that solve the issue or is there more to it I am missing

latent sorrel
#

ok. Thanks for the help. That worked. It just seemed that the column was specified by the value of sameRow

grave ether
#

sameRow only looks at the value of the row your trying to calculate on so if I was to write an additional formula that was referencing the data of say options I could make that column read as a label something like ${sameRow('options') + 10}$ <-- this would then be applied to all fields in that column referencing the data of that row to calculate

formal goblet
#

Imagine the Dynamic Table is a 2-dimensional coordinate system. sameRow() will return the value of x = currentRow of the formula & y = specified column.

grave ether
#

Correct

#

Lets not talk about the z axis ... that just gets CRAZY

formal goblet
#

That's just an additonal dimension 😅

grave ether
#

Thats a bit better, not so hurtful on the eyes lol

#

after a2 + b2 = c2 you lose me on math lol

wet helm
#

I've already got another question which I need to solve before the helper table thing 😁 . Maybe someone can help me with this... My formula is: ${fetchFromDynamicTable('table_score_to_dice', 'dice_value', 'score_value', sameRow('spec_score_melee'))}$ This is a panel within a dynamic table. What it should do is: 1. go to table "table_score_to_dice"; 2. look at the column "dice_value"; 3. find the row in the column "score_value" that equals the column "spec_score_melee" in the same row of the original dynamic table (<== the one where the panel shall be generated); What it does is basically produce an empty label, so I guess, I am doing something wrong or do not understand the synthax correctly...

#

Hope it is clear, what I am trying to do and what my problem is.

#

So in this example I would expect the panel to generate "d6" but it stays blank.

wet helm
grave ether
#

{fetchFromDynamicTable('table_score_to_dice', 'dice_value', 'score_value', sameRow('spec_score_melee'))}$

{fetchFromDynamicTable('table', 'value returned', 'reference colmun', 'filter')}$

Your filter maybe off, if your looking at another dynamic table you will need to use another fetchFromDyanmicTable to make that happen,

sameRow only references the table your first fetching and in this case it appears your nesting tables? You said panel but the panel should cause issue. if its a panel with a table that table will have its own reference ie ${ref}$

wet helm
#

hmmm, I was fearing that it was a problem with the cascading tables. And I was already thinking about including a second fetch but I can't figure out a way to tell the system that it should refer to the correct row row then.

#

So what I want it to do is to compare the value of "spec_score_melee" (adds up "spec_points_melee" and "spec_heritage_melee") and look in the "table_score_to_dice" what would be the correct dice for that value.

#

Is there a way maybe to store the value of spec_score_melee just for that one comparison?

grave ether
#

Suggestion, dont filter and tell me if it pulls something

wet helm
#

If I don't filter it pulls everything from the column "dice_value" in the table "table_score_to_dice".

#

I tried the formula before with a simple example:

#

Here it works just as intended but i would have liked to do that in a dynamic table where it compares not to a single number field but to a certain field in the same row.

grave ether
#

OH

#

try equalText()

#

Your referencing a string

wet helm
#

Ah! That might be it! I'll give it a try. Thanks again for the quick help!

grave ether
#

the d complexes things

#

lol

wet helm
#

It does 😂

lyric swan
#

Noob question : is there a way to do a roll (like 1d20) with a script macro (not a chat message)?

#

tried this :
let roll = new Roll("1d20").roll();
roll.toMessage({flavor: "Rolling 1d20"});
not working

latent sorrel
grave ether
lyric swan
#

Yes ty !

pallid kettle
#

Is there a tutorial on how to create a total for weight of a specific item container?

formal goblet
lapis field
#

I'm running into another thing using the equalText(a, 'b') in a visibility formula (where a refers to the key of a dropdown list and b references a key of an option in the dropdown list).

I have 5 weapon slots formatted as dropdown lists: weapon_1, weapon_2, weapon_3, weapon_4 and weapon_5.

I want the description of the weapon to appear if it is selected in any of the weapon slots.

equalText(weapon_1, 'sword') or equalText(weapon_2, 'sword') or equalText(weapon_3, 'sword') or equalText(weapon_4, 'sword') or equalText(weapon_5, 'sword')

The above visibility formula only makes the description of sword appear when it is selected in dropdown list weapon_2, 3, 4, and 5. Not when it is selected in dropdown list weapon_1.

Why would that be?

formal goblet
lapis field
#

No empty space

formal goblet
#

🤷‍♂️

lapis field
#

Should work aye?

formal goblet
#

Aye...

#

What do you get if you just reference the key of the 1st dropdown?

#

You can also check the selected value with game.actors.getName('actorName').system.props in the console.

lapis field
#

I'm an idiot haha - I'm making a Mexica themed game and all the weapons have impossible names - so it was indeed a spelling thing I completely glossed over lol

empty glen
#

I've got my actors setup with an item container, but I want to roll an actor stat from the item sheet. Is it possible to reference an actors stat from an item sheet?

#

Also, can I do a dice roll where every highest value explodes but I only keep the highest of that chain. For example, I roll 3d6. Die 2 and 3 come up "6", so they both get another roll. The one associated with die 2 is 4 and die 3 is a 1. So the final output would be 10.

grave ether
pallid kettle
#

Is there a way to allow commas in a numberfield?

grave ether
#

use a txt box instead

pallid kettle
#

yeah ._. that would be smart huh?

grave ether
#

LOL its easier than fighting with it

#

If you want them to have a + or - you can always create a button that adjusts the value

pallid kettle
#

Its for gold pieces, the txt box will work perfect.

formal goblet
formal goblet
tired spoke
#

Wonder if you can help me with this chestnut. Have a problem with a formula ${(ref(skill_current) + string(skill_state))}$ There are 4 options for skill_state /2,+0,+10 and +20. They all work besides the /2.

latent sorrel
#

@formal goblet In a dynamic table, Is there any way to have unique values in a dropdown that are based on a text field in the same row as the dropdown?
#1037072885044477962 message

formal goblet
formal goblet
latent sorrel
empty glen
# formal goblet `fetchFromActor()` can do that

I feel like this is an easy one: I've got a dynamic table on an item sheet. There is a text field, a number field, and a label. I want the label to match the number field of that same row. I've tried "parent.{component_key}", "item.{component_key}" and a few other things I could think of. Any ideas? TIA!

formal goblet
# latent sorrel I thought so but that doesnt work. Empty dropdown. It does work in a label.

ok, that one is my fault... forgot to integrate optional references...

You can fix that by your own by adjusting the code in custom-system-builder.module.sheets.components.Dropdown.js - line 168 until the update fixes it:

const keyOptions = ComputablePhrase.computeMessageStatic(this._formulaKeyOptions, entity.system.props, {
  ...options,
  reference: options.dynamicRowRef,
  defaultValue: '',
  triggerEntity: entity
}).result.split(',');
  const labelOptions = ComputablePhrase.computeMessageStatic(this._formulaLabelOptions, entity.system.props, {
  ...options,
  reference: options.dynamicRowRef,
  defaultValue: '',
  triggerEntity: entity
}).result.split(',');
formal goblet
empty glen
#

The target label is the third column in the item.

For example, the listed item in the dynamic table is "pistol", the next column is it's point value of "5". Ultimately, I'm trying to create a label in the same row that will roll (pointvalue)d(actorstat). You already showed me how to get the actorstat via fetchFromActor() but referencing the pointvalue is harder than I thought.

empty glen
formal goblet
empty glen
empty glen
# formal goblet `sameRow('pointValueColumn')` 😅

Strange thing happened. I had it working, closed it down for a couple hours then came back and it doesn't work anymore. This is the Label Text:

${sameRow('Concentration_Num')}$d${fetchFromActor('selected',"Def_Type")}$

The sameRow works but the fetchFromActor isn't coming up. The spelling is correct on Def_Type.

formal goblet
#

That´s why they´re better fitted for Label Roll Messages

empty glen
formal goblet
#

What´s the error in the console?

empty glen
#

How do I check? Sorry, I'm new to Foundry.

formal goblet
#

Press F12 and open the console-tab

empty glen
#

Failed to load resource.

#

Could this be because I've been doing some work remotely on a different pc?

formal goblet
#

That one is about loading images, not really interesting in this case. Try the Label Roll Message again and screenshot the log

empty glen
formal goblet
#

And you have a token selected?

empty glen
#

I guess I opened it from the Actor sidebar. Is there any way to fix that or do I have to make sure I open it from the map token every time?

#

It worked when I did it from the token.

formal goblet
#

Selected means on the map selected

empty glen
#

Copy. Thank you, again!

formal goblet
#

You can also specify a static name in fetchFromActor() 😅

empty glen
#

The item is actually an "Aptitude" for Deadlands Classic. I've set it up to easily give the same aptitude to several actors based on 10 aptitude templates. So, from what I understand, a static name wouldn't work the way I want it to. BUT I don't understand all that much about CSB, as you can probably tell.

ornate junco
#

Is there any way to set a drop down value acording to a number value?

#

Like if someone is half health I need it to show the value: Critically Injured?

formal goblet
pale tusk
#

I need to customize the permissions on a character sheet tab as to whether it displays. Currently, there's a checkbox that selects whether it displays or not, so the visibility formula (referencing that checkbox key) is: powers_toggle -- what do I need to do so that, to see it, the checkbox must be true and the player viewing it must be the owner of the actor?

formal goblet
oblique willow
ornate junco
pale tusk
oblique willow
#

How do I use setPropertyInEntity to toggle a checkbox? I can set it to true no problem, but I can't set it back to false.

dense pine
#

Initiative Formula: If the formula has a roll and a number (eg 1d20 +X) is the roll of all combatants stored separately and can be accessed or only the sum of this formula stored?

formal goblet
formal goblet
silk lake
#

do percent symbols work fine, or would it be detecting it as a remainder?

#

guess I can just test this faster than waiting

oblique willow
#

Is there a way to allow players to re-order their item containers? Inventories are going to be messy otherwise

vagrant hollow
oblique willow
#

Amazing, looking forward to it

silk lake
#

Is there a way to automatically update a value, such as when I add more con the max health updates automatically?

#

cause as it is, I have to still set it to what it should be, because its the max

formal goblet
silk lake
#

it is set to a formula, but its not updating as I update the con, like just the displayed number, not the formulaic value

#

cause the formula behind it does go up, but it doesn't automatically change the display

#

along with this, is there a way to not allow certain people to edit the max values on their own?

forest junco
#

Hello, I'm having a bit of a problem getting this condition to set properly. I'm trying to make it so that when you two-hand the weapon, you roll strength dice twice. Here is what I have so far:

${[((:str_score:+(2h_checkbox?'str_value':0)+:mod_value:):sameRow('dmg_die'):cs>=4)]}$

But it won't roll. I've tested it just without the (2h_checkbox?'str_value':0) portion and it works fine. What do? Thanks!

silk lake
#

is there any errors popping up in the log for it?

#

such as not knowing how to convert the 2h checkbox or anything else?

forest junco
#

yeah, it's calling syntax errors and unexpected values.
NS_ERROR_UNEXPECTED: 28 theme.min.js:4
SyntaxError: Unexpected operator ) (char 2)
SyntaxError: Value expected (char 1)
Uncaught (in promise) Error: Unbalanced group missing opening ( or closing )
[Detected 1 package: system:custom-system-builder]

silk lake
#

${[((:str_score:+(2h_checkbox?'str_value':0)+:mod_value:):sameRow('dmg_die'):cs>=4)]}$
Only problem I could see is maybe an extra parentheses at the end. "cs>=4)"

#

cause
${[((:str_score:+(2h_checkbox?'str_value':0)+:mod_value:) the first two before str_score stop there.
:sameRow('dmg_die'):cs>=4)]}$ But the end here has nothing to close off

#

but I doubt that'd be the problem as you said when you remove the 2h_checkbox it works fine

#

no wait, I'm blind, its not an extra. I think

forest junco
#

yeah, but it's probably unnecessary and just bogging up the line

silk lake
#

Don't know if this will work for you or anything with your code. But I ran into something slightly similar
${[((:str_score:+(2h_checkbox?'str_value':0)+:mod_value:):sameRow('dmg_die'):cs>=4)]}$ is current
${100 + (equalText(class,"tank") ? ((100 + (8 * con_score))*0.2): (0)) Is what I had to do for something else.
so you could try
${[((:str_score:+(2h_checkbox?'str_value':(0))+:mod_value:):sameRow('dmg_die'):cs>=4)]}$ cause all I had to do to fix my case was make sure the default 0 was opened and closed (0)

#

I'm not really the best at code, so I just kept trying shit till it clicked into place

forest junco
#

Same. Looks like that's not doing it either, but thanks for your help!

silk lake
#

do you have a different formula to just return 2h_checkbox?'str_value':(0))+:mod_value: to see what it equals all on its own? so you can verify it returns what its meant to?

formal goblet
formal goblet
silk lake
forest junco
#

So this is my current code, realizing that I'm in a dynamic table now.
(:str_score:+:sameRow('2h_checkbox') ? (str_score):(0):+:mod_value:)

This line just calls for str to be the number of dice rolled and if the 2H checkbox is checked, add strength again.
When I just roll (:str_score:+:mod_value:) it works, and when I have ${sameRow('2h_checkbox') ? (str_score)}$ on a separate line it works on its own, calling 0 if unchecked, and your strength score if checked. But when I integrate it, it doesn't roll.

forest junco
formal goblet
forest junco
#

Oh ok, so do I need to make a separate formula on the sheet that's hidden and then call that formula?

formal goblet
#

Or rather create a temporary variable in the Roll Mesaage

forest junco
#

How would I create a temporary variable in the Roll Message? I'm unfamiliar with that process. Sorry, I'm not great with coding 😬

forest junco
#

That worked, thanks so much!

latent sorrel
#

I cannot get a fulfilled promise to return at return a. The code is in a label text, not the roll message. The returned value to main is correct. I have tried numerous variations to correct this without succes. Anyone have any ideas? Thanks

async function main(){
const type = "Skill";
const modList = "${fetchFromActor('attached', "modList ", 0)}$";
const out = await game.macros.getName('Add Bonus to Skill').execute({modList:modList,type:type,attribute:"${name}$"});
console.info("myout",out)  // indicates fufilled promise
return out; 
}
const a = main();
console.info("out",a)  //indicates a unfulfilled promise
return a;
latent sorrel
#

@formal goblet Thanks. But I dont think this is the problem. I am getting a fulfilled promise from the macro.execute. I have edited my original code, adding comments to clarify where the issue is actually appearing.

formal goblet
formal goblet
latent sorrel
#

Thanks. I think, at some point I tried that too. The final solution I used is to send the desired output to a text box.

pallid kettle
#

What would the formula for a fetchfromdynamictable be if I wanted :

All results in "Field 1" where the checkbox in "Field2" are checked?

grave ether
#

Its an if else statement

formal goblet
grave ether
#

There you go

#

I knew the checkbox is a true or false statement

main magnet
#

Hey @glad spade, I checked an older chat where you were trying to fix the quantity property issue with item piles but never wrote back. Any progress on this issue? Thanks.

uneven quail
#

I searched around, but can't find anything. I just updated my CSB and world from v10 to v11 and everything on my sheets seem to work, so I'm messing around with adding some new stuff to them. Right now I'm trying to add buttons for Resting to heal, but I'm having an issue with setPropertyInEntity not working. I'm working with a fresh _template right now before moving it to my main one for characters, but here's the code:
${setPropertyInEntity('selected', 'txtTest1', "selected.txtTest1 * 2")}$
I keep getting the error:

    at mathInstance.SymbolNode.onUndefinedSymbol (Formula.js:853:27)
    at math.js:26377:89
    at math.js:24320:51
    at math.js:25781:50
    at Object.evaluate (math.js:24162:45)
    at r.evaluate (math.js:24139:55)
    at Formula.computeStatic (Formula.js:858:27)
    at processFormulas (ComputablePhrase.js:259:29)
    at ComputablePhrase.computeStatic (ComputablePhrase.js:330:34)
    at ComputablePhrase.computeMessageStatic (ComputablePhrase.js:371:26)```

This happens whenever I have Selected, Target, Self, etc. in the formula argument (including token names), but if I remove it and just reference ``txtTest1 * 2`` then it actually runs, but instead of changing anything in the sheet it just does the math of txtTest1 * 2 and posts the result as a roll to the chat.
formal goblet
fierce harbor
#

How is it possible for a RollableTable rolled from a Label to result in ERROR like this? Label roll formula is ${[#tablename]}$ and Table roll formula is 1d2
It does the same inside an Item or as label in the sheet.

EDIT: it was the text inside table rows...it did not like text like Hey...you're dead! 🤦🏻‍♂️

glad spade
dense pine
formal goblet
vagrant hollow
uneven quail
lapis meadow
#

Anyone know why the attribute can't go to negative value?

silk lake
#

Is it for the bar only, or does it allow it to go negative on the character sheet?

glad spade
#

This time, I can confirm it works

silk lake
#

Question for whenever, is there a way to reference the label of a key for formulas so I can say what is selected jn chat. Or reference the label on which a dropdown list has selected?

main magnet
trail glacier
#

Hey, I’m totally new to using this, learning as I go. I’m trying to adapt the old palladium system to work with foundry, can anyone point me in the right direction of how to do this? And sorry if I’m in the wrong area to ask this

somber bay
#

Hi, is there a way to give players permission to alter other actors records within the formula?

#

For example as the GM I can damage a player in a roll, but players get alerts they cannot damage enemies unless given ownership

#

maybe a grant and remove ownership command?

fierce harbor
somber bay
#

So this has been me trying to use the update via roll in labels which was a way to avoid getting into macros...

fierce harbor
somber bay
grave ether
#

That sounds like an issue with the user ability

grave ether
#

I dont have any issues running them as trusted player, but you maybe able to grant permission via script.. just not sure

somber bay
#

(not just for my table I love and trust them but for publishing for anyone to use)

grave ether
#

Just adjust them in the config

#

ahhh

#

Yeah I see what your point maybe

#

hmm

grave ether
formal goblet
somber bay
#

that said you telling me about Warp Gate might be a game changer for our home game

somber bay
#

One more question... does anyone know how I can 'publish' a world for Custom System Builder? I've adapted Liminal Horror and I want it to be searchable so liminal horror players can download it (and custom system builder as a dependancy)

#

(or are worlds basically compendiums now?)

formal goblet
#

Or you just publish the templates in our template-library

hazy saffron
brave trench
formal goblet
brave trench
#

I've copy and pasted world data myself without any issues, but not sure if that would work the same on a different PC.

hazy saffron
#

Does /sheetRoll and actor.roll() support running the "Shift-Click" alternate label roll message on a sheet?

formal goblet
# hazy saffron Does /sheetRoll and actor.roll() support running the "Shift-Click" alternate lab...
/**
 * Add Chat command to perform sheet rolls from chat / macros
 */
Hooks.on('chatCommandsReady', function (chatCommands) {
    chatCommands.register({
        name: '/sheetAltRoll',
        module: game.system.id,
        description: 'Perform an alternative roll from a character sheet',
        icon: "<i class='fas fa-dice-d20'></i>",
        callback: (chatlog, messageText, chatdata) => {
            postCustomSheetRoll(messageText, true);
            return {};
        }
    });

    chatCommands.register({
        name: '/sheetRoll',
        module: game.system.id,
        description: 'Perform a roll from a character sheet',
        icon: "<i class='fas fa-dice-d20'></i>",
        callback: (chatlog, messageText, chatdata) => {
            postCustomSheetRoll(messageText, false);
            return {};
        }
    });
});
hazy saffron
#

that can be used in scripts?

formal goblet
#

actor.roll() comes from Foundry while the chat-commands are registered by CSB

#

actually, it also comes from CSB...

hazy saffron
#

I thought I saw it documented in the CSB

formal goblet
#
    async roll(rollKey, options = {}) {
        let { postMessage = true, alternative = false } = options;
        let refRoll = rollKey.split('.');
        let reference = null;
        let [filterMatch, parentProp, filterProp, filterValue] =
            refRoll.shift().match(/^([a-zA-Z0-9_]+)\(([a-zA-Z0-9_]+)=(.+)\)$/) ?? [];

        if (filterMatch) {
            let parent = foundry.utils.getProperty(this.entity.getRollData(), parentProp);

            let index = Object.keys(parent).filter((key) => parent[key][filterProp] === filterValue)[0];

            if (!index) {
                throw new Error('Roll formula not found in character sheet');
            }

            reference = parentProp + '.' + index;
            rollKey = parentProp + '.' + refRoll.join('.');
        }

        let rollType = alternative ? 'alternative' : 'main';

        // Recovering value from data
        let rollText = this.getCustomRolls()[rollType][rollKey];

There we go. alternative is the thing you´re looking for

hazy saffron
#

So I can call it as actor.roll(rollcommand, true, true) to use and display the alt-label roll message?

#

That's awesome! Thank you!!

formal goblet
#

Uh, the 2nd arg is an object. So it´s more like this:

actor.roll(key, {
  postMessage: true,
  alternative: true
});
hazy saffron
#

Oh perfect! Thank you!!

lapis field
#

Is it possible to set the default value of a number field to a number that depends on a choice made in a dropdown list elsewhere?

formal goblet
hazy saffron
#

Okay I have what I feel is very stupid question on my part, but how do I run the function fetchFromDynamicTable() within a script macro? I tried actor.fetchFromDynamicTable() but it said no such function

grave ether
#

Fetch works the same in a script as it would in CBS

#

Whats script you running? It could be the execution

formal goblet
hazy saffron
# grave ether Fetch works the same in a script as it would in CBS

Was just doing this piece of code in a script

let secondary_list = actor.fetchFromDynamicTable('secondary_abilities', 'sec_title');
if (secondary_list.length > 0) {
    console.warn("Number of Skills: " + secondary_list.length);
    console.warn("Skill List: " + secondary_list);
}```
shy tendon
#

Question. So im attempting to use a parent sheet now to pull values for bullets within my campaign

${fetchFromActor('Parent Bullets',"fetchFromDynamicTable('parent_modifier_dyntable','parent_dyntable_mod_one','parent_dyntable_name',sameRow('weapon_magazine_bullet_type'))")}$

Now, one issue here. The filtered name which is currently shown in the above formula as sameRow('weapon_magazine_bullet_type') does not pull the value from within the item sheet. So all those keys are from the Parent Actor sheet but the sameRow is from within the item sheet which I imagine is causing the problem. Any way around this?

Interestingly, I found by adding a snippet of code above this as name:=sameRow('weapon_magazine_bullet_type') combined with the original formula above and then replacing thesameRow('weapon_magazine_bullet_type') with the new key that is named name it is able to find the value that I want. However, it now puts the value in my Label as the combined literal name of name and the value that I want from this dynamic table.

Any way I can get this to work? I want to fetch from a dynamic table from an actor sheet but the key that I use to filter my results will be from within the item sheet

grave ether
#

Can you tell me how you are calling the script?

#

pulling up my instance, give me a second lol

hazy saffron
formal goblet
grave ether
shy tendon
#

As a point of continuation, I will say @formal goblet this is the same thing I was doing the other day when I was asking questions and ive taken your advice to using a parent sheet instead but now this filtering issue is a bit of a problem

hazy saffron
grave ether
# formal goblet Wdym?

He is assigning a variable that does something.. that call is in CSB format so it should work.. HOWEVER looking at the script I belive you need ${}$ around it

hazy saffron
#

Oh I didn't realize ${ }$ were used in scripts like that

grave ether
#

looking through my scripts to validate

#

Martin would know better, I am here learning as well but like to help where I can

#

I find it helps me learn new things

hazy saffron
#

I appreciate it. I have a 'fair' understanding of coding in general and I can look up things related to JS, but I really don't always understand how CSB/JS interact with scripts.

formal goblet
# shy tendon Question. So im attempting to use a parent sheet now to pull values for bullets ...

You have 3 things in a formula:

  • fetchFromActor
  • fetchFromDynamicTable
  • sameRow

When entering fetchFromActor(), the formula within will be executed with the context of the target actor. So fetchFromDynamicTable() will have a look at the table parent_modifier_dyntable of the target-actor. Same goes with sameRow(), which will obviously not work.

If you need a formula with the context of the source-actor, then don't use double-quotes for the formula-part.

shy tendon
#

I need a formula that can pull from a parent actor that is filtered by a key from the source-actor

hazy saffron
grave ether
hazy saffron
formal goblet
#

And well, you're going into stuff that actually needs some coding knowledge

hazy saffron
grave ether
#

Its not with fetch itself

formal goblet
#

Macros are pure Javascript, you cannot use the CSB-syntax there

grave ether
#

Its how the script is implemented and how your wanted to push it in.

hazy saffron
#

The code I linked is part of a much larger script where I use getProperty, setProperty, and other Foundry related functions to get values from a sheet and set values on the sheet and thought I'd be able to do the same with DynamicTables

formal goblet
hazy saffron
shy tendon
grave ether
#

Sorry I confused this situation

hazy saffron
#

I appreciate the help but this topic may be beyond me if I can't do it with functions

uneven quail
#

Is there a way to nest conditions? Like, make it so that anyone who's got the "Unconscious" condition is automatically "Prone" as well?

formal goblet
uneven quail
#

That's kinda what I thought. Thanks!

foggy oxide
#

Would it be possible to use an item value on the visibility formula of a label on an item container?
I have created an equippable item. From the template the item has a checkbox "CanMakeStunDamage".
Then I have placed this item on an item container on an actor sheet. This works a intended.
Now I have added a column on this item container with a new label. This label has a roll formula for making stun damage. But I would like to see this label only if the "CanMakeStunDamage" is checked on the item. So I have added item.CanMakeStunDamage on the visibility formula of the label but that doesn't seem to work.

lyric swan
#

Does anyone know if Monk's enhanced journal is compatible with CSB in regard of the currencies? I can't make money work whit this modules. I did the same settings as for Item Pile but it does not work.

vagrant hollow
lyric swan
#

Ok thanks, at least it's not a missuse from me

glad spade
#

What did you try with item piles?

vagrant hollow
# glad spade What did you try with item piles?

Your item piles now work perfect for me, thank you very much. 🫶
Set the item-price-attribute to “system.props.gmptown” and the currencies to “system.props.gold” / silver / cupper and so on.

lyric swan
#

Yes item pile works very good, amazing. I think monk's enhanced journal is just not compatible with CSB.

glad spade
#

Cool you just said it didn't work so I was curious

willow moat
#

Hello friends! I'm learning how to use the Custom System Builder. I would like to know if it is possible, perhaps with a little javascript knowledge, to make the Custom System Builder understand the card sheets, from the Foundry deck function, as equippableItemTemplate. So you can add them to item containers and return to the deck or hand. Is this possible, very difficult or completely crazy?

formal goblet
hazy saffron
#

I got /sheetRoll and actor.roll to work with Dynamic Tables. Before I spend too much time figuring it out, is /sheetRoll and/or the .roll() function usable on items attached to a character sheet? I didn't see any documentaton to imply item.roll() would work.

formal goblet
hazy saffron
foggy oxide
#

I have an item with a dynamic table. Then I have inserted this item on an item container on an actor sheet. The item container has a roll label to open an user input template. How can I fill a dropdown list on the user imput template with the values of the dynamic table from the item?
As an example:
I have an item "Dagger". I can use this item with different attributes: "Dexterity" or "Strength". The item template has a dynamic table to add the usable attributes to the weapon. So I have added "Dexterity" and "Strength" to the "Dagger".
Then I have added the "Dagger" to an item container on the actor sheet. The item container has a roll label to perform an attack. If I open the "Attack" user input template I would like to give the player the choice to select "Dexterity" or "Strength", as added to the "Dagger".

foggy oxide
# formal goblet `item.dynamicTableKey`

Thanks for your answer. I have tried to use "item." on the user input template but it looks like I have no access to the item data. The dropdown list on the user input template will be empty.

grave ether
#

Question: I am creating a race and wanted to push that to the character sheet. How would that be accomplished?

What is the best way to implament this?

Currently, I have a manual entry on the character sheet that tracks the stat mods for Race. My goal is either 1, to remove that table all together and insert just a container with the race in it or 2 leave the table and push the race stats to that table.

I would love to lean towards the first since I feel like its less it has to calculate but either would accomplish what I need.

Once the first is created, I am sure its similar for other things like weapons

grave ether
#

LOL meh, that answer says it all

formal goblet
grave ether
#

Cool, I will reload it then and take a look

grave ether
#

OK pulled the example template but not seeing how it interacts with the sheet

#

The item container race doesnt reference anything

formal goblet
grave ether
#

So if I understand correctly, we have a field that these get pushed to, in this case, the base stats will add the modifiers to create a final result

#

field/fields

#

So is the original sheet referencing the item(race) fields is that how it works?

formal goblet
grave ether
#

OK, how is that done

#

BTW there isnt a race template in the example sheet, only the container.

#

Sheet Lib that is

formal goblet
grave ether
#

I have several item templates

#

Lets use this as an example because it comes directly from the sheet-lib

#

So I convert this armor template to a item, so now I have all the fields here ready to edit and drop into a container in my sheet.

#

Once this has been converted to an item and dropped onto the sheet. How does Armor Protection Standard get added to my value on the sheet itself?

formal goblet
#

Take a look at the modifiers in the template

grave ether
#

OK so a direct reference to the item sheet by using the name IE

#

${item.Armor_Protection_Standard}$

#

correct?

formal goblet
#

Ok, yeah. That is the Item Container. That can show Item-stats without any issues

#

You can use item.itemKey in this case.

grave ether
#

Just validating before I start making things and then find out they dont work lol

#

gotcha

#

so just a direct reference using the item.itemKey

#

if its in a dynamic table can I still reference the table?

formal goblet
#

Yeah, that does only work within the Container

grave ether
#

hmm ok

#

What about outside the container?

formal goblet
#

Item Modifiers or Script

#

The resposibility shifts to the Item to handle that

grave ether
#

ok let me play with it, I may have additional questions as I start adding on.

#

I feel fairly confident in what I have created so far inside the sheet but items are a different story.

formal goblet
#

You can take the Inventory Template as a starter

grave ether
#

I would like to be able to at some point use an item to insert fields into a dynamic table.. but I think that will be in the future.

formal goblet
grave ether
#

Gotcha

#

that may make it difficult.. but I will think of a way around it.

sharp prairie
#

Hey all. Question: I might have misunderstood but I think I remember someone trying to do a similar thing a while back. I am trying to make a ‘GM overview sheet’ that pulls all important info from the player sheets into one place. I have never used dynamic tables or the ‘fetchFrom’ function before. I need to know what goes in place of ‘Kiki’ here in order to pull the individual stats from all players. I think it’s something to do with ‘same row’(?) but I don’t know the correct syntax here.

formal goblet
sharp prairie
#

FABULOUS!! Second question, this sheet doesn't update in real time or upon refresh, it only updates its info when I go into its template, pick a random component, hit its save button, and then hit the refresh button in the sheet. What am I missing here?

lethal flax
#

So how do i set up the roll label so that the labels on the side (Power, Speed, Range, Durability, Precision, and Learning) would roll a formula depending on selection option on their respective dropdown menus on the right?

hardy smelt
#

Hi, text formatting question: in a labels "Label roll message" I want to add an end-line / line break, but I can not for the life of me remember how to do so.

forest junco
hardy smelt
formal goblet
formal goblet
lethal flax
restive pawn
#

Hello ! Is there is an option in CSB to change the name and icons of active effects ? And if there is, how to do so ? If the option is not available within the module is there an alternative way ?

lethal flax
#

Okay i got it working with this madness ${switchCase(powerdropdown, 'standpower_a', [3d6], 'standpower_b', [3d6k2], 'standpower_c', [2d6], 'standpower_d', [2d6k1], 'standpower_e', [1d6])}$ It just it rolls with all 5 formulas instead of 1 of them.

#

at the very least the result shown on the side will correspond to the selected dropdown option

formal goblet
uneven quail
#

I'll try to remember to report this on the git when I get home, if it's an actual bug, but I figured I'd post it here in the meantime:

Pressing Enter while a User Input Form is open will submit that form, but it's not submitting the currently selected text field. Ex. If a user input form has two number fields, and you click on field1 and fill in "5" then click on field2 and fill in "10" then hit the enter key, the form will submit field1 as "5" but will submit the default value for field2 instead of "10".

formal goblet
# uneven quail I'll try to remember to report this on the git when I get home, if it's an actua...

Ehh... Well, it´s kinda a bug but also not. For more context:
Actors and Items are updated when you change a value and remove the focus of an Input Component. The reason why we also need a focus-change is because every update is compute-intensive (because the Actor / Item recalculates every Formula). If we remove the part with the focus-change, every key-stroke would perform an update, in which you cannot change values in the meantime. That would lead to horrible UX.

uneven quail
#

Gotcha, that makes perfect sense. Maybe it's less of a bug report and more of a feature request then? Since they're submittable forms and they usually aren't going to be as chunky as, like, a character sheet, it might be nice to have a little update check prior to submitting the form on the enter press. A small thing for sure, but just something I ran into.

formal goblet
uneven quail
#

Alright, I'll submit it as a bug just so it's documented. Thanks!

formal goblet
#

Hey guys,

I´ve updated the Wiki of CSB. These are the changes:

  • 1.1. Predefined values [NEW]
  • 3.1.2 Variables [NEW]
  • 3.1.8 Additional Syntax-Rules in Label Roll Messages [NEW]
  • 3.3.4. Calling macros [UPDATE]: Added additional example with a more-complex scenario.

https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System

I´ve also included the Script of the additional example in a new page of the Wiki: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Script-to-call-macro-from-compendium

lethal flax
formal goblet
grave ether
#

I cant seem to get the item stats to appear on the sheet. Here is what I got, what am I missing?

item has the following
_BaseRaceTemplate
base_mod_table
base_stat
base_race

this is used to call the above container - on the sheet ${fetchFromActor('attached', "getRefFromDynamicTable('base_mod_table', 'base_stat', 'base_race', 'fetchFromDynamicTable('base_mod_table', 'base_stat')')")}$

#

So the fetch should pull from the attached item from that table. Am I correct or do I need to replace attached with the location of the actual?

#

my guess is I am missing the pointer to the actual item

formal goblet
# grave ether
  • These are not Item Modifiers, these are just normal Item props.
  • As soon as you go out of the Scope of an Item Container, you either have to use Item Modifiers or a Script to get information from an Item.
  • fetchFromActor('attached', ...) can only be called within an Item.
grave ether
#

So if I take the stats and convert them to item modifers then I could use this to adjust?

formal goblet
#

You can leave these stats as they are and reference them in your modifiers.

grave ether
#

OK so use the item modifer as a helper cell .. That I can do

#

How would I call it on the sheet after its attached?

formal goblet
#

The Item handles the stat-changes on the character sheet

grave ether
#

OK, then I assume I need to tie the modifer to the stat it increases... I think I get it

#

Key is the key on the sheet that changes, formula is what I can use to pull the change?

formal goblet
#

The structure of your item modifier would look like this:

{
  "Priority": 0,
  "Key": "${fetchFromActor('attached', "getRefFromDynamicTable('dynamicTable', 'targetColumn', 'filterColumn', 'filterValue')", 0)}$",
  "Operator": "=",
  "ValueFormula": "${modifier}$"
}
grave ether
#

ValueFormula": "${modifier}$" = this would be what changes on the sheet right

#

Example ${STR}$ etc

#

Key is where the value is located on the item

formal goblet
#

The reference to the Item Sheet prop

#

Key is the Actor component key

lethal flax
#

how do i make it so this formula ${[:brawnsmod:d6]+[:roll_formula:]}$ only applies the roll formula on the right if a checkboxed is, well, checked?

grave ether
#

I promise I am not dumb, but this is causing my head to break lol

#

if statement

#

checkboxes are either true or false

formal goblet
lethal flax
grave ether
#

${ checkboxKey ? [:brawnsmod:d6]+[:roll_formula:] : [:roll_formula:] }$

#

something like that

grave ether
#

Oh?

lethal flax
lethal flax
grave ether
#

LOL I was just trying to give you an example

lethal flax
formal goblet
grave ether
#

OK I think I understand what Martin is saying,

concat() will combine both the [:brawnsmod:d6]+[:roll_formula:] together in 1 roll vs trying to combine them with a +

#

the eval assuming would be done before the roll happens right?

#

Wouldnt the eval still be if and statment tho?

${ checkboxKey ? concat([:brawnsmod:d6]+[:roll_formula:]) : [:brawnsmod:d6]}$

Something like that? I am guessing without playing around with it tho

formal goblet
lethal flax
formal goblet
#

What should be done instead:

${#roll_formula:= checkbox ? concat('+', switchCase(powerdropdown, 'standpower_a', '3d6', 'standpower_b', '3d6k2', ...)), ''}$
${[:brawnsmod:d6:roll_formula:]}$
formal goblet
lethal flax
grave ether
#

part of the concat

formal goblet
grave ether
lethal flax
formal goblet
lethal flax
#

it just durability instead of power.

lethal flax
lethal flax
#

yes

lethal flax
formal goblet
#

Checkbox

lethal flax
lethal flax
# formal goblet Fixed

so for the last thing on the last do i put the comma after the last string or not. I'll assume not but want to be sure.

lethal flax
#

@formal goblet also now the die can't roll for whatever reason

formal goblet
lethal flax
#

if it helps, here's the defualt label roll message. ${#roll_formula:= stand_checkbox ? concat('+', switchCase(durabilitydropdown, 'standdurability_a', '3d6', 'standdurability_b', '3d6k2', 'standdurability_c', '2d6', 'standdurability_d', '2d6k1', 'standdurability_e', '1d6')), ''}$ ${[:brawnsmod:d6:roll_formula:]}$

formal goblet
lethal flax
formal goblet
#

I see a \n in the Formula, that is a line-break

lethal flax
# formal goblet I see a \n in the Formula, that is a line-break

something like this? ${#roll_formula:= stand_checkbox ? concat('+', switchCase(durabilitydropdown, 'standdurability_a','3d6','standdurability_b','3d6k2','standdurability_c','2d6','standdurability_d','2d6k1','standdurability_e','1d6')),''}$ ${[:brawnsmod:d6:roll_formula:]}$

#

becauase if i did the above i jsut get the original dice again.

formal goblet
lethal flax
formal goblet
#

Try out ${stand_checkbox}$ and see if you get something.

lethal flax
formal goblet
#

Just a separate Formula

grave ether
#

Hey Martin, I am still confused.

You said earlier that the key on the item modifier was the key reference for the actor so in this case on the actor I have a test cell called ${testtest}$, then the value is what changes add or = so in this case it was I just did a direct override to 15 to see if it would adjust to the actor sheet. I am not seeing the change.

lethal flax
formal goblet
grave ether
#

ok let me try that

formal goblet
lethal flax
formal goblet
#

Returns the current value of stand_checkbox

lethal flax
formal goblet
#

A simple check if the specified variable returns a value

grave ether
#

Awesome thanks, that produced results, now to figure out the rest 🙂

lethal flax
grave ether
#

Last question for the evening, I noticed that modifiers on a templete doesnt follow the items created from them

formal goblet
formal goblet
grave ether
#

Nope

formal goblet
grave ether
#

LOL

grave ether
#

Indeed you are correct 🙂

#

hmmm

formal goblet
grave ether
#

Let me try then because that makes things funky

#

OK works like it should

#

Thanks Martin, I am headed to bed and will get stuff fixed tomorrow

lethal flax
#

even ad a +a before the roll formula and it didn't help

#

here's the screenshot with the stand checkbox thing in but without the roll formula. and yes, it is true.

formal goblet
lethal flax
formal goblet
#

Put the formula of the roll_formula in a Label_prefix without roll_formula:= . We use that for testing-purpouses.

lethal flax
#

and do i keep the og formula still in?\

formal goblet
#

Yep. If error, remove the switchCase-part and test again

lethal flax
formal goblet
lethal flax
lethal flax
formal goblet
#

No, remove the part with the switchCase()

lethal flax
formal goblet
#

You cannot use := outside of Label Roll Messages

lethal flax
formal goblet
lethal flax
#

i wonder if tis the questio nmark that sthe issue here?

formal goblet
#

Replace the last comma with : ...

lethal flax
formal goblet
#

Without the 3 dots

lethal flax
formal goblet
#

Yeah, you can put the switchCase-part back in it...

lethal flax
#

@formal goblet It reads as "+2d6Health" (2d6 being 'standdurability_c' option selected).

formal goblet
#

Purrfect, now Copy-Pasta

lethal flax
# formal goblet Purrfect, now Copy-Pasta

so this? ${roll_formula:= stand_checkbox ? concat('+', switchCase(durabilitydropdown, 'standdurability_a','3d6','standdurability_b','3d6k2','standdurability_c','2d6','standdurability_d','2d6k1','standdurability_e','1d6')):''}$ itno the label roll message?

#

@formal goblet i do be rolling 5 die rather then 4 so far (oddly it displays "+2d6" seperate from the roll itself shown here, which is weird but at least its not error).

#

its at bottom right.

formal goblet
#

Just add # again to hide it

lethal flax
#

ye

#

it worked

lethal flax
formal goblet
#

Nope, only testing

#

I'd advice to go through the Wiki & Readme to gain some knowledge

latent moon
#

Does anyone have a basic system with stats and hp implemented, i am trying to make the system Class 1-c using this module, and I work better tweaking existing material compared to building stuff from the ground up. Thanks in advance! 😊

hazy saffron
#

Odd Question: If I have an Item which contains a select dropdown that the user can make a selection from on the item (key: effect_select), should I be able to reference the selected value in that dropdown using a ${ }$ expression elsewhere in the item?

I was trying to have some content display somewhere else on the item based upon what was selected in the dropdown using the ternary operator

${(effect_select=="value to check")?"Display A":"Display B"}$

However I get ERROR where the content should appear on the item.

hazy saffron
#

I feel a little stupid. I have referenced the FAQ before but assumed this was such a weird niche question. My fault and thank you!!

#

Worked perfectly!

foggy oxide
#

How can I fill a user input Dropdown with values from an array?
Something like this:

${#MyWeapons:=fetchFromDynamicTable('MyMeleeWeapons', 'MyWeaponsName')}$
${#?{SelectedWeapon:'Attack with:'|MyWeapons}}$
So instead of a text field with "Dagger,Sword" I would like to have a dropdown with both options.

uneven quail
#

Does anyone know of a simple "If item is attached" formula I can use for a visibility formula? Nothing I'm trying is working. I just want a label to be invisible unless the item is in someone's inventory.

brave sapphire
#

Hello, for some reason I can't get status effects to work right. I have a label containing a number and referenced the key of the label in the active effect modifier (which simply adds another number to the value in the label). But whenever I activate/deactivate the status effect on the token nothing changes in the character sheet. Reloading the character sheet didn't fix it. Does anyone know what I did wrong?

uneven quail
brave sapphire
#

this looks exactly like what I did

uneven quail
# brave sapphire this looks exactly like what I did

Make sure the label contains a number and nothing else, not even spaces. Maybe try making the label default to ${0}$ instead of just 0 as well, if it's just a straight number.

These are things that I had to do when I was messing with condition modifiers.

uneven quail
formal goblet
#

👀

brave sapphire
vagrant hollow
brave sapphire
vagrant hollow
formal goblet
#

Double left-click the token (to open the token actor sheet)

brave sapphire
#

ok yeah that seems to have been the issue

#

thanks for the help

uneven quail
#

This was my latest attempt, but it's resulting in the label always being visible: switchCase(fetchFromActor('attached', "lblStr"), '1', 'true', 'false')

vagrant hollow
formal goblet
uneven quail
#

Hmm... I just tried switchCase(fetchFromActor('attached', "lblStr"), '1', 'true', '') and it didn't work either. It looks like, if the fetch returns an error due to lack of actor, it's just always ending up visible. Is there any way to, like, catch the error? Sort of ike the Excel isError() function?

formal goblet
uneven quail
# formal goblet `fetchFromActor()` accepts a default-value 😅

I think I have the default value in that one I posted set to '' as an empty string and it wasn't working.

I figured out a work around though! I changed the conditions to switchCase(lblAttached, 'ERROR', '', 'true') and created a label called lblAttached that is ${!fetchFromActor('attached', "lblStr")}$

formal goblet
uneven quail
#

Okay, having issues with that now...
fetchFromActor('attached', "lblStr", false) isn't working. I've also tried replacing the false with 'false', "", and '' and none are hiding the label...

formal goblet
uneven quail
#

Unrelated question, while I'm here: Performance-wise, would it speed up the recalculating time on a sheet if I turned some of my labels into Hidden Attributes? I am guessing not, but I do have some labels that are doing nothing but acting as global variables for the sheet, so I figured I'd ask.

formal goblet
# uneven quail Unrelated question, while I'm here: Performance-wise, would it speed up the reca...

Not really, especially if they do not contain derived data.

The system has multiple calculation steps, in which the values of the Components are calculated. What the system does is:

  • Calculate the values of Components iterative. If a value couldn´t be calculated (because it depends on a Component, which wasn´t calculated yet), save it into uncomputedProps and retry in the next cycle.
  • If the current cycle didn´t calculate anything (because uncomputedProps didn´t change), stop and log all uncomputedProps
uneven quail
#

Yeah, that was my assumption but I figured I'd check. I just didn't know how much of the recalculating time was actually, like, re-rendering? So I figured that there was a very small chance that making those variables invisible, or hidden attributes, might do something.

uneven quail
#

Another help question, if anyone doesn't mind:

I have a clickable label on some items called lblItemStrAtk that does some roles and adds to them and posts the to chat. Pretty basic. I want to create a column on an item container that contains a clickable label that triggers item.lblItemStrAtk when clicked. Am I missing a way to do this?

formal goblet
formal goblet
grave ether
#

What are group for in the item modifiers?

grave ether
#

I missed it

#

thanks

#

OK thats cool

uneven quail
#

%{linkedEntity.templateSystem.roll('lblItemStrAtk');}%

Just in case I messed that part up, lol

formal goblet
uneven quail
grave ether
#

Question, I have been able to add items and adjust fields using the modifier but when I unequip or remove said items the modifiers stay. How do I fix that

grave ether
#

NM, I fix it ..

#

it was something wierd acting up with my sheet

uneven quail
# formal goblet No, it´s just a bit trickier than I thought

I sorta made some progress? The following code in a label will do exactly what it did before, posting "undefined" to the chat, but then it will do what I wanted to do and effectively click the label:

    'lblItemStrAtk',
    {postMessage: false}
);

let speakerData = ChatMessage.getSpeaker({
    actor: entity,
    token: entity,
    scene: game.scenes.current
});

rollMessage.postMessage({speaker: speakerData});}%```
formal goblet
uneven quail
formal goblet
#

throw 'Done';

uneven quail
#

Awesome! Well, that works as a workaround, for now, haha! Thank you!

formal goblet
uneven quail
# formal goblet The current dev-branch has that already if you really want to.

I think I'm good for now. I mostly use CSB for fun, casual stuff so it's not a big deal. One of my goals for the whole day was to be able to add the clickable labels on an equipped item to my hotbar. Like, each weapon has an "attack with this weapon" button and you can't add it to your hotbar normally with the right-click options that CSB has(it creates a macro assuming the button is on a character sheet instead, so it doesn't end up working).

#

I ended up just going with:

let weaponName = "Dagger";
let rollMessage = await actor.items.getName(weaponName).templateSystem.roll(
    'attackRoll',
    { postMessage: false}
);

let speakerData = ChatMessage.getSpeaker({
    actor: actor,
    token: actor.getActiveTokens()?.[0]?.document,
    scene: game.scenes.current
});

rollMessage.postMessage({speaker: speakerData});

and I'll just have to swap out the weaponName for each macro I make.

kind basin
#

Anyone know how i can drop the decimal point value off a formula ? basically if its 1.2 i just want it to return 1.

hardy smelt
kind basin
#

Ok, so something like this ?
${floor((Armor_Durability / Max_Armor_Durability) * 100 ,0)}$

#

works beautifully. Thank you my friend!

hardy smelt
#

Question, any suggestions for a formula to calculate the distance between the selected token and the targeted token? I am trying to auto-calculate the range for a weapon attack to apply the correct range modifier automatically.

lyric swan
#

Does someone know how I can check if an active effect is active on a token? All I can return is the activeEffect list but can't find a way to test if one is active or not.

uneven quail
formal goblet
uneven quail
formal goblet
uneven quail
#

And I continue to not know what I'm talking about lol.

uneven quail
#

It's a bug I've had happen more than once with Tables. Sometimes, if you drag things too fast between the spaces, they'll disappear into the ether until you delete the table.

formal goblet
uneven quail
#

Will do, thanks

lyric swan
#

Thanks guys thxblob

latent sorrel
#

Bug or Feature?
I have created my own version of dropping items onto other items (ie item qualities and item attachments). I have found that, via JS, I can directly alter a keyed label (only tried with static values in a dynamic table). Is this intentional or a coincidental bonus. I ask because if this is unintentional, I will take a different tact in case this "feature" is written out in the future.

formal goblet
latent sorrel
#

this is via item.update so I am affecting the json. it is persistent

latent sorrel
#

I found it when I was using JS to update a text field. I changed the text field to a label, and quite by accident, found the code still affected the label as it did the textbox. The change was permanent across system reloads.

foggy oxide
#

Looks like the visibility formulare of a column label on an item container don't work with item values:
item.WeaponRange>0 hides the label of every item on the list, even if the items WeaponRange is greater than 0.

latent sorrel
#

Thats the its currently written to work. I think it will be updated when the next update rolls out (no eta). You will need to use a tertiary operator to hide and show values individually.

ornate junco
#

Is there a way to fetch the modifier value and apply it to a roll to hit roll in an item container?

ornate junco
#

Like if I roll let's say a hammer and that roll to hit is a 1d20. How do I have that roll add in my strength modifier?

hardy smelt
# ornate junco Like if I roll let's say a hammer and that roll to hit is a 1d20. How do I have ...

So, the way I do it (and there may be better ways) is that I create a column in the Item Container for the roll. From there you can access the item values with item.<key> and your sheet elements normally. So if you have your stregth bonus in a number component with a key of str, and your hammer item has a hit roll text component with a key of hit, you can use ${[:item.hitRoll:+:str:]}$ in the Label roll message of a label component in the item container on the character sheet.

ornate junco
#

You can dm me the screenshots as well, if you don't want to share here.

hardy smelt
#

So if the hit component has the value 1D20, and the str component has the value 3, it would roll 1D20+3.

#

Hammer item example.

#

Roll component in the item container.

ornate junco
#

How would I have different weapons use different modifiers?

hardy smelt
hardy smelt
hardy smelt
ornate junco
#

I see

#

And then that modifier calls back to the modifier in the sheet

#

Ok that makes so much sense

#

Thank you man

ornate junco
#

You ref(mod) is targetting the modifiers within the sheet?

hardy smelt
#

Without the Ref() function it would use the value in mod instead.

ornate junco
#

So I have this at the moment but its giving me an error every single time.

#

Got it

#

So sorry

#

I just saw the damn )

#

My co-dm added that when I was fucking with it thinking he fixed the formula.

hardy smelt
ornate junco
#

Seems to be

#

It could fuck up here at any moment so we shall see lmao

hardy smelt
#

Hehe, yeah that's how it goes.

#

One thing I do, is duplicate the sheet for versioning each time I get a new function / aspect to work.

ornate junco
#

@hardy smelt Hey man another question for you. Would you possibly have a way in your system already for ammo subtraction?

#

If so is there a way to have like each ranged weapon subtract a different amount from the ammuntion section?

main magnet
#

Any idea why this keeps pasting the whole formula into chat, not just the part I need (how do I remove the red parts from showing up in chat)?

<div class="chat-trait"> ${#concat( ?{effect:'Chosen effect'|string(item.power_basic_name1)|string(item.power_basic_name2)|string(item.power_basic_name3)|string(item.power_basic_name4)|string(item.power_basic_name5)}, )}$</div> <div class="chat-powerdesc1"><br>Chosen effect: ${!effect}$</div> <div class="chat-powerdesc2"><br>${effect}$ == string(item.power_basic_name1) ? ${!item.power_basic_name1_desc}$ : ""</div>

formal goblet
#

Unmarked parts are plain text

ornate junco
#

Is there a way to subtract within an item container? I am trying to go off the example in the wiki, but it seems to not be working.

ornate junco
#

Yup. That is the example I am trying to go off and I can't seem to get it to work :)

#

I am trying to subtract the uses after each time a player rolls to hit a body part.

main magnet
# formal goblet

Ok but it seems the if formula doesn't work at all it's just getting the reference and pasting it, not checking the actual 'effect' value.

If I put the whole if statement into a ${}$ nothing happens.

ornate junco
#

Can't see mto substract from there no matter what I do.

ornate junco
#

${#setPropertyInEntity('item', 'item.abil_uses', "item.abil_uses' - 1")}$

This is the formula I'm using for reference.

ornate junco
#

${#mod:=item.abil_mod}$
<table>
<th><h3>Roll to Hit with</h3></th>
<th><h3>${item.name}$</h3></th>
<tr>
<td><h3>Roll to Hit Head</h3></td>
<td><h3>${Damage_Roll:= ([:item.abil_head:+:ref(mod):-5])}$</h3></td>

${#setPropertyInEntity('item', 'item.abil_uses', 'item.abil_uses - 1')}$

Here is the whole roll formula.

formal goblet
#

And the console?

ornate junco
#

Console is blank

hardy smelt
ornate junco
hardy smelt
#

Oops, sorry, that one is from a dynamic table, just a sec.

hardy smelt
ornate junco
#

Hmm

#

Let me give this a try

#

I am stumped on why its not targetting it.

hardy smelt
ornate junco
#

That did it.

#

Thank you good sir.

ornate junco
#

Is there a way to have the subtraction occur for let's say another item container?

#

Like when a bow is fired it targets the quiver item container and subtracts one arrow from the quantity?

#

So I can target only one item within the container.

ornate junco
lyric swan
#

Hi guys, I'm trying to apply an effect to a token with a macro but I can't find a way to make it work, any clues?

#

I got this :
if (canvas.tokens.controlled.length === 0) {
ui.notifications.warn("Select a token !");
} else {
let token = canvas.tokens.controlled[0];
let actor = token.actor;

let effectData = {
    label: "Invisible",
    icon: "icons/svg/invisible.svg", // Remplacez par l'icône de votre choix
    duration: { turns: 5, startRound: game.combat ? game.combat.round : 0 }, // Durée de l'effet
};

actor.createEmbeddedDocuments("ActiveEffect", [effectData]);

}

But this does not apply any effect modifier or other expected effect (like make the token transparent is the case of invisibility)

uneven quail
#

Okay, I got this to work last night and erased it, and I can't for the life of me figure out what I'm doing wrong wrong this time!
${fetchFromDynamicTable(fetchFromActor('attached', "tableLevelFeats"), 'txtFeatName')}$
This is in a DropdownList "dropdown options origin" on an item. I'm trying to get it to be a dropdown list of all txtFeatName values in tableLevelfeats

formal goblet
uneven quail
#

THANK YOU! I was messing around with this last night and got it to work, but I couldn't remember what I did, lol.

#

Second question: I have an item containter in a dynamic table on a character. I want that table to filter out items by: If txtBagName on the item is the same as txtTableBagName in the same row of the dynamic table as the item container.

I thought that I could just add txtBagName is sameRow('txtTableBagName') to the filter list, but it's not working as I'd hoped...

formal goblet
uneven quail
#

Damn. Yeah, I thought I remembered them not even being addable to dynamic tables when I was using CSB like a year ago, but it does let you add them now. Thanks, though!

latent sorrel
#

I have a sheet with a item container for race, which has modifiers that update character attributes (works). I have an item container with skill items that use these attributes for internal calculations (works). These calculation results are displayed in the item container columns. If the race is dropped after skills (assumed PC creation flow), the skills columns dont update without a forced refresh. The same happens if race is deleted. This is a rebuild and this worked as desired before. Any suggestions?

formal goblet
latent sorrel
#

Ok. No errors. It seems that there is an update lag. I created a second race item with different stats. If I add race 1 (force update) and delete it, the skills dont update. When I add race 2, there is an update but its the "no race" values. When I delete race 2, then race 2's values appear.

formal goblet
#

Ok, that is indeed a typical update-anomaly. This one is harder to debug.

latent sorrel
#

Great. So no suggestions on what to consider?

formal goblet
#

You have to understand the entire data-flow to take measures against it...

latent sorrel
#

ok. thanks

formal goblet
lyric swan
#

ok thanks anyway, if I find how, i'll post it

lyric swan
#

Ok I figured it out :

// Apply an active effect to every selected token
// This effect will trigger any effect modifiers as long as the ID matches the actual effect ID in the system
let selected = canvas.tokens.controlled;
if (selected.length === 0) ui.notifications.warn("Select at least one token !");
else {
selected.forEach(token => {
let effectData = {
name: "Dead", // Actual name of the effect (can be changed as long as the ID is the right one)
icon: "icons/svg/skull.svg", // Icon of the effect (can be changed as long as the ID is the right one)
duration: { seconds: 60 }, // Duration of the effect in second (delete this line for unlimited)
origin: token.document.uuid, // ID of the source (selected token in exemple)
sourceName: "effect source", // Name of the source
disabled: false, // Is the effect active or not
description: "This does that...", // Description of the effect
flags: { core: { statusId: "dead" } } // The actual ID of the active effect (IMPORTANT !)
};
token.actor.createEmbeddedDocuments("ActiveEffect", [effectData]);
});
}

lyric swan
#

If you want to, you can event use Visual Active Effect + Core Settings Expanded + Effect Macro and do some cool stuff with effects that trigger macro when effect start, end, turn start... like this :

activeEffect.forEach(effect => {
effect.setFlag('effectmacro', 'onCreate.script', 'console.log("Dead effect created");'); // Macro onCreate
effect.setFlag('effectmacro', 'onDelete.script', 'console.log("Dead effect deleted");'); // Macro onDelete
// etc...
});

#

Btw Monks little details allow you to add and customize active effects too.

forest junco
#

I'm having a little trouble with attribute bars. For some reason it doesn't allow me to modify the bar's value via right clicking the token and typing in the box. It lets me highlight the attribute box, but not type anything. How do I fix this?

formal goblet
formal goblet
forest junco
formal goblet