#Custom System Builder

1 messages ยท Page 39 of 1

echo veldt
#

I don't think you need "estado==true" for the conditional I think you can just use "estado"

#

"estado" by itself should just return true or false with out needing to check. but I could be wrong on that.

high stag
#

ok, im gonna see

echo veldt
#

in the visability forumlas I have been doing I just write the key by itself or not(<key>)

high stag
#

its because the (i) button explanation

#

the double conditional here seens to be necessary

#

ok

#

i will make it with a radio button where i can change the numbers

#

Same

#

why setProperty only works for the first conditional

echo veldt
#

I just used this script and it worked to set and unset a checkbox. It does take a second for the sheet to refresh on its own though.

${is_awakened ? setPropertyInEntity('self', 'is_awakened', false) : setPropertyInEntity('self','is_awakened', true)}$

it seems you maybe using too many "${}$"

high stag
#

It's possible to change the actor image with setProperty?

echo veldt
#

Not sure I am inspecting the data on an actor I have and I am not finding a protperty for it yet.

#

it does not seem so. it looks like you can only set properties in the props of the actor and the image is likely stored elsewhere.

noble ibex
#

Martin, do you remember this one? I think the problem I'm having is that when the function calls the camp and it has no key, even with the empty option of the dropdowns that don't have default setted, it bugs the whole sheet. It will only work when I do some extra steps in a paliative solution, and as soon as I edit anything else in the sheet, it stop working again. Could you help me? Even if you tell me the CSB don't do what I want it to do.

echo veldt
#

alright, so I figured it out.

It seems that while the roll message scripts are running, it stores the variable in a localized scope of variables.

The concat querries are stored in the variable names provided and the customUserInput is stored in variables that are named the same as the keys in the template.

I could then call on those variables inside my javascript and use them as needed.

noble ibex
#

Also, the SameRow fallback is not working

crimson girder
#

is there a code formula that can automatically adjust a sum based on the largest of three variables?

#

like lets say i have a skill that can be based off strength, charisma, or luck

echo veldt
#

You could probably write a script for it using the Math.max JS function if it is available in the API otherwise, use a small bubble sort using if-else staements. then use the setPropertyInEntity function.

Sort using if-else:

if (num1 >= num2 && num1 >= num3) {
        return num1;
    } else if (num2 >= num1 && num2 >= num3) {
        return num2;
    } else {
        return num3;
    }

Math.max:

Math.max(num1, num2, num3);
crimson girder
#

would I need a formula to call the values or is it enough to use the component key?

echo veldt
#

the component key is how you will access the values in the script.

so you would write the script using %{}% syntax and put the component keys in ${}$ syntax.

%{
const num1 = ${strength_key}$;
const num2 = ${charisma_key}$;
const num3 = ${luck_key}$;

if (num1 >= num2 && num1 >= num3) {
        return num1;
    } else if (num2 >= num1 && num2 >= num3) {
        return num2;
    } else {
        return num3;
    }
}%

it will be something close to this, but the "return" will be wrong. You need to call the setPropertyInEntity function from in the script or pass the variable out once you find it. but I don't remember exactly how that is done off the top of my head.

it is possible it's just a matter of getting the right combination. someone more knowledgable could probably get you something more efficient but I think a script is probably the way to go.

lost wigeon
#

I'm ran into an interesting issue. I have some code in a Label Roll Message that is

A) Supposed to update an item.
B) Supposed to update some fields in an actor.
C) One of the fields in the actor updates based on the item.

It does A and B. However, C doesn't happen unless I refresh the character. I think that it's updating the character and then updating the item, but then not updating the character again until something else changes on the character sheet.

Any suggestions on how to force it to update the character again?

crimson girder
#

and how do you round down as a function?

#

i got it to round up but not down

echo veldt
#

use the floor function

so floor(MATH EQUATION)

crimson girder
#

thanks!

willow birch
#

So, my characters attribute bars are overflowing of old values that no longer exist (they created themselves, I hadn't touched the attribute bar button before) is there any way to clear it? Or am I just stuck, with a long row of clutter?

formal goblet
formal goblet
formal goblet
willow birch
formal goblet
fallen coral
#

Is it possible to create custom active effects from the character template? It seems it is but I'm not able to find where.

fallen coral
#

Is it possible to pass a condition to a checkbox so it toggles automatically? Or to achieve a similar result within csb? I know a simple label would hold a true/false value similarly, but in this case it would be more cohesive to the system if it is a checkbox.
Edit: This is a good way to achieve what I needed
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Checkbox-in-Item-Containers

brave trench
#

I have a roll message that just sends a skills description text to chat. That skill description is on an Item. I know I can do [[d10]] inside the text, and it will roll dice for the chat message. But is it possible to do something like [[${skillRank}$d10]] in the text, so that it rolls X d10 based on the skillRank number field on the Item.

echo veldt
# fallen coral Is it possible to pass a condition to a checkbox so it toggles automatically? Or...

you can set the property of the property of a checkbox in a script, if that is what you are asking.

this uses the SetPropertyInEntity function.

This was one I used a bit ago where the checkbox was toggled when I clicked a button.

${is_awakened ? setPropertyInEntity('self', 'is_awakened', false) : setPropertyInEntity('self','is_awakened', true)}$

If you want to do this whenever an event happens that would require some sort of event listener which is not in my knowledge base at this time but from what I understand it is still possible.

echo veldt
#

cause that is exactly what I am working on now and I may be able to help

brave trench
formal goblet
fallen coral
brave trench
#

Example... is there a way to add a formula to the d4 roll, or is this the limitation of rich text area?

echo veldt
#

ah, not what I am doing right now, my bad.

fallen coral
#

What key should I provide to fetch a value from a dynamic table using the item's name as filter? item.name?
${fetchFromActor('attached', "lookup('dynamic_table', 'desired_column')").includes(name)}$
in case someone needs this

half beacon
lost wigeon
#

I'm having trouble in a label roll that is supposed to update information inside of an item and also information inside of an actor. It will only do the one listed first in the macro. Though, the second will occur if the sheet is updated or refreshed. How might I get around this and force the sheet to update again at the end of the label roll?

#

I think what's happening is that the macro is only updating the actor once and only refreshing once, and for this niche instance, I need it to do this twice.

earnest imp
#

heey, so out of curiosity

earnest imp
#

how would you update a singular item across the entire game? so that tokens on board as well as every actor in the game is automatically updated as well?

#

say you want to have the Fire spell have +1 more damage

lost wigeon
earnest imp
#

but then you have to update:

  1. all the actors that use "Fire"
  2. all the tokens on canvas that has "Fire"
#

has anyone ever figured out a way to just, across-the-board update all of them without manually updating everything?

formal goblet
lost wigeon
#

I'm sorry!

formal goblet
#

And copy means new instance

earnest imp
#

That's definitely the issue I'm having

#

Any way I can do things by Reference instead of by Value/Copy?

#

A macro comes in mind where I can do a game-wide search of the name of an item and update the value to what I want but

Then comes the issue of dynamic table making the data complicated to update en masse

#

It would probably be easier to do a game-wide search of the name of an item and replace it with a whole new item

formal goblet
#

But you'd lose the context of the executing Actor

earnest imp
#

Oh that's also true

#

It would not be embedded to any actors or token

formal goblet
#

Then a link

earnest imp
#

I guess it works for items where it don't need any values from the actor/token but that's already under the bridge

formal goblet
#

You can look at the code of the Item Container on how to create a clickable link

earnest imp
#

Like in the documentation or in the source code?

formal goblet
#

Source code

earnest imp
#

ahhhh

#

I'll put that to consideration

formal goblet
#

Should be at the bottom

heavy elm
#

Hello CSB is giving me a strange behaviour again. I have this formular in a label:

${sum(lookup('Attributes', 'Costs_Bonuspoints'))}$

Which returns me se sum of an array: 0,0,0,0,0,0,10 = 10

But as soon as I enter a key for the label the sum returns me a 0 and the last value just vanquishes. Any idea what going on there?

echo veldt
#

I am no expert, but what other properties do you have set on the label and is the sum being applied to set the property or just doing the summation.

Could be when the sheet refreshes it is going back to the default setting of the label cause the sum was not stored in the instance of the label.

heavy elm
#

No other properties, just the summation. Actually when I remove sum and just show the array the one value is still missing when using a component key.

formal goblet
lament flint
#

How would I go about making a dropdown that contains options from two different dynamic tables?

untold eagle
#

Is it possible to create an item slot (Hexagonal Shape) where I can equip items by dragging them into it? The slots need to inherit item data, such as icons and descriptions, which can be used as modifiers or simply displayed illustratively.

sturdy mesa
#

I have items like potions that have a number field called "quantity".
I want to use SetProperty so that, when the player clicks on the actor sheet label, SetProperty removes 1 from "quantity" of the item in the item sheet. How do I do this?

cobalt mango
#

Hello. It looks like I don't understand parameters \ keys inside dynamic tables?

#

fetching directly from the actor attribute works as seen at the bottom of "TestWeapon", but it doesn't if it's inside a Dynamic Table using somewhat the same method.
I'm on the latest build detected by Foundry

formal goblet
formal goblet
formal goblet
cobalt mango
#

I'm not showing ${}$ in the label because it would turn blank (idk if there's an escape character or what)
but the actual Formula for that label's ${Key}$ is

#

${fetchFromActor('attached', "lookup('Attacks', 'AttackValue', AttackName', '${AttackSkill}$')")}$

#

If formula delimiters are something else then I apoligize but I don't understand ๐Ÿ˜…

#

AttackSkill from the formula above is the key picked from the DropDown -> Strenght

#

The first one prints as 2, the second one doesn't

#

It's probably because of that ${AttackSkill}$ now that I look at it closely ๐Ÿ˜› I'll try in a min without it

cobalt mango
#

Documentation says:
Get value of key Skill_Value from dyamic table Skills where Skill_Name equals Lock Pickingfrom the current target:

fetchFromActor('target', "lookup('Skills', 'Skill_Value', 'Skill_Name', 'Lock Picking')")
I manually added the skill name as 'Strenght', so the formula is now:
${fetchFromActor('attached', "lookup('Attacks', 'AttackValue', AttackName', 'Strenght')")}$
It's showing empty.
I'm assuming that "Skills" is the key given to the Dynamic Table, while Skill_Value and Skill_Name are two keys given to two different columns of said dynamic table

fading pollen
#

When i log into my game I can't se anything on my sheets and i can't create a template to make a sheet? seems like the world is broken or the system

#

just say

#

this also happens if i make a completely new world with your system. Please help!!

round badger
#

When making the template just check that when creating the new actor you select "Template" instead of "Character". If that options isn't available then the answer to your question is out of my depth. Sorry.

fading pollen
#

Iโ€™ll tryโ€ฆ thanks

formal goblet
crimson girder
#

trying to figure out radio buttons

#

so the radio button im trying to do has three choices, advantage, disadvantage or normal

#

adv and dis give bonuses, normal doesnt

half beacon
#

What you'll do is make three radio buttons, all with the same Group name. "Label" is what the player will see, and "Value" is whatever value that you want to assign to it (depends on how you use it in other scripts or formulas).

crimson girder
#

yea im just trying to figure out the part i put in the boxes since i didnt see an example on the site

half beacon
#

Group stays the same. Value will be the value of the Component Key when you use it in a formula or script.

crimson girder
#

ok so you dont give it a component key, instead its based on the group

half beacon
#

You do give it a component key. I was just rushing because I'm hosting a game :p

crimson girder
#

ah ok

#

so if i assign them each a number and then write a script to compare the component keys

#

that should work then?

rocky sable
#

Hello. I have an Item Displayer which doesn't consistently refresh.
The items have a checkbox component, and a column in the Item Displayer changes that checkbox from False to True. Another column in the Item Displayer displays the value of that checkboxโ€ฆ sometimes. If I refresh the sheet, the Item Displayer shows the correct values. If I click on the item name to open the Item sheet and then close the Item sheet, that also makes the Item Displayer show the correct values.
Is there a way to programmatically refresh the Item Displayer without having to do those things?

crimson girder
#

well iirc

#

items once added to a character exist independent of the source item

#

so if you make changes to the item displayer that should update based on the values of the items in them but if you make changes to the item or the template, that can break the item in the displayer

half beacon
#

I believe I misspoke in my rush. What you'll use is the Group name for the formula. For example, with this, having advantage adds 5 to your roll, but disadvantage takes away 5. Normal rolls have no change. I have normal checked by default, since that's what will be used most often. This is the formula for the roll:
${[1d20] + rollAdvantage}$
rollAdvantage will apply the value of whichever option was chosen at the time that the roll button is clicked.

crimson girder
#

Hmmm that should work,

#

Thanks

obtuse birch
#

hi guys doe anyone know if anyone have done something for panic at the dojo?

fallen coral
#

I'm having a very strange behavior happening in my system and I can't figure it out. I have three fields that are supposed to become gray-ish in case no ammunition was spent. The problem is that in my own client one of the fields behave in the opposite way, where in a test session as a player using the web browser this works as expected. Any clues? The fields on the bottom share the same dynamic table and the field on the top is located in a tabbed panel, and the 'ammunition' check retrieves that value from a checkbox. It seems like a reload issue, cause it corrects the color once I change another field or when I reload it manually

fading pollen
fading pollen
dusky mauve
fading pollen
fading pollen
formal goblet
fading pollen
#

Thanks, man!!! very much appreciated!

fallen coral
rocky sable
#

Is the Import JSON still working? I used it quite a bit a while ago, to learn from what others had done. Now the import completes, but nothing appears in Actors or items. CSB 4.1.1

vagrant hollow
rocky sable
night wraith
#

Hey again. After taking a break, I tried to do what you've suggested. Sadly, I cannot get the specialisation chosen in the field to stay on the character sheet. What am I doing wrong?

echo veldt
#

where are you trying ot display the specialization? in the dynamic table or on the item container?

night wraith
#

In the item container. The dynamic table is just showing how I would like the item container to display everything

echo veldt
#

Ok so the button colum fo rht eitem container should be seperate from the view into the item container

night wraith
#

Sorry, I misunderstood. I thought you were referring to the roll

echo veldt
#

if you want I have time this morning and we can voice chat in one of the dev channels so we can work through this. I planned on working on my system all day today anyway.

night wraith
echo veldt
#

oh it is morning now for me I am in central US

night wraith
#

Ah I see. Central Europe here ๐Ÿ˜‰

echo veldt
#

my bad

#

oh so you are 7 hours ahead of me. I am available now if you wish

echo veldt
#

I have a radio button group to determine which initiative the character is using. When I click on one of the buttons it selects the radio button, but when I close the character sheet the button no longer visually looks like it is selected. using my data inspector that value of the selection is still there so all the formulas work but the button just visually looks like nothing is selected.

Is this fixable?

formal goblet
echo veldt
#

yes

charred spire
#

Good afternoon. How do I make it so that when a player makes his roll and after the other makes his, the difference in the result is automatically calculated in the damage?
Example: Player 1 rolls 2d6+3 and gets 10 and Player 2 rolls 2d6 and gets 7, so this 3 difference I wanted to be automatically calculated in the damage. Is it possible?

Another thing, is it possible to have a question box when making a dice roll, to kind of have some options?
Example: x2, x1.5, +1d6 and etc?

echo veldt
# formal goblet That's the first time I hear about that. Are your values within the group disti...

each one takes its value from another Text field so that the initiative for the sheet rolls correctly in the encounter Tracker.

so the initiative formula in Configuration is set to:

[${selected_initiative}$]

Each radio button has a group of "selected_initiative"

and then the value of each button is set with:

${$physical_initiative}$
${astral_initiative}$

and so on.

so the system when I roll my initiative allows the player to click the type of initiative they want and this radio button grabs the correct initiative from a text field and rolls it through the system roller.

All of that works, but the radio circle itself stop display what is selected when the sheet is closed and reopened. The data value is still set correctly but it just doesn't display as selected.

echo veldt
#

I don't know about the first one.

charred spire
formal goblet
# charred spire Good afternoon. How do I make it so that when a player makes his roll and after ...

There are 2 ways to achieve this (each with pros and cons):

  1. You save the attack roll in the Chat Message in a data attribute of a Button, which can be used to roll a reaction. In this case, the contextual data can be used to calculate the difference. But this approach requires knowledge about Javascript and a bit about the CSB-API.
  2. You save the result in the targeted Actor. This way, the targeted Actor will have all needed information to calculate the difference. But the big flaw is that Foundry doesn't allow players to change stats of Actors they don't own. So you have to work up a solution with Scripts of you want to have that for players
formal goblet
echo veldt
#

yes every time I open the sheet they are all unselected.

#

but the variable that stored the selection is still set to the last radio button selected before closing the sheet.

formal goblet
echo veldt
#

it now displays the selection. then when I close and reopen it is back to being blank.

could it have been a rendering issue.

#

though thte data is still set so it may be something i just have to live with.

#

so I tried restarting the server and now it won't come off of one of the selections and keeps refreshing to that selection.

formal goblet
echo veldt
#

The values need to be able to be updated by the player though as they may change iniative based on what equipment they are using or if they take combat drugs or not.

Static value could only be set by me correct?

formal goblet
echo veldt
#

so it then looks up at execution of the initiative roll instead of evaluating on the sheet, correct?

formal goblet
#

But yeah, it would be resolved somewhere else and not in the Radio Button anymore

echo veldt
#

well that seems to have fixed all the issues, thanks you

sonic marsh
#

I'm looking for some help on formulas.
Inside a label roll message, I'd like to use the := assignment operator to save the result for later.
For example, something like this

${(AttackRoll == 20) ? CritDam:=[:DamageDie:]: ''}$

When I try to do this, I get an error. Is there any way to make this work?

(Note, I don't want to precompute the variable CritDam because I want to display it as a rolled result)

formal goblet
echo veldt
#

so now for a new issue it seems to have now broke rolling for initiative from the encounter tracker.

echo veldt
#

it doesn't roll as it throws an error that iniative needs to be a finite number and then just displays ref('physical_initiative') in the chat box.

formal goblet
sonic marsh
formal goblet
#

ffs, internet in germany...

sonic marsh
#

Yup. I'd looked at this. I think the key suggestion is this: "To circumvent the issue of
rolling unwanted dices, you should build a Roll-Formula before executing it (so doing 2 steps instead of
only 1)."

#

Unfortunately, I'd hope to avoid doing this because it means displaying a single roll, not two rolls. i.e. my current code says something like ${DamageRollFormula:= (AttackRoll == 20) ? concat(DamageDie,' + ',DamageDie): DamageDie}$, then evaluates DamageRollFormula later.

#

This is then displayed as a single roll, regardless whether it is a critical damage or normal damage.

#

I'd hoped to figure out a way to make that critical damage roll display two little dice icons. Alas it doesn't look like its possible

clear leaf
#

I just started getting this error trying to open four different NPC sheets (some NPC sheets are working)from canvas or Actors tab: foundry.js:655 Error: An error occurred while rendering ActorSheet5eNPC2 27. cls is not defined
[Detected 1 package: system:dnd5e(4.1.0)]
at Hooks.onError (foundry.js:654:24)
at ๐ŸŽHooks.onError#0 (libWrapper-wrapper.js:188:54)
at foundry.js:5795:13
Caused by: ReferenceError: cls is not defined
[Detected 1 package: system:dnd5e(4.1.0)]
at npc-sheet.mjs:77:31
at Array.map (<anonymous>)
at npc-sheet.mjs:76:100
at Array.reduce (<anonymous>)
at ActorSheet5eNPC2._prepareItems (npc-sheet.mjs:59:43)
at ActorSheet5eNPC2._prepareItems (sheet-v2-mixin.mjs:280:13)
at ActorSheet5eNPC2._prepareItems (npc-sheet-2.mjs:162:11)
at ActorSheet5eNPC2.getData (base-sheet.mjs:187:10)
at ActorSheet5eNPC2.getData (npc-sheet.mjs:24:33)
at ActorSheet5eNPC2.getData (sheet-v2-mixin.mjs:136:35)
at ActorSheet5eNPC2.getData (sheet-v2-mixin.mjs:96:35)
at ActorSheet5eNPC2.getData (npc-sheet-2.mjs:75:33)
at ActorSheet5eNPC2._render (foundry.js:5838:29)
at ActorSheet5eNPC2._render (foundry.js:6572:17)
at ActorSheet5eNPC2._render (foundry.js:7158:17)
at ActorSheet5eNPC2._render (sheet-v2-mixin.mjs:76:19)
at ActorSheet5eNPC2._render (npc-sheet-2.mjs:61:17)
at ActorSheet5eNPC2.render (foundry.js:5793:10)
at Token5e._onClickLeft2 (foundry.js:61477:17)
at MouseInteractionManager.callback (foundry.js:30834:17)
at #handleClickLeft2 (foundry.js:31057:15)
at #handleLeftDown (foundry.js:31016:83)
at #handlePointerDown (foundry.js:30981:58)
at vh.notifyListeners (EventBoundary.ts:1454:26)
at vh.notifyTarget (EventBoundary.ts:662:18)
at vh.propagate (EventBoundary.ts:299:14)
at vh.dispatchEvent (EventBoundary.ts:210:14)
at vh.mapPointerDown (EventBoundary.ts:683:14)
at vh.mapEvent (EventBoundary.ts:231:28)
at ra.onPointerDown (EventSystem.ts:373:31)

formal goblet
formal goblet
echo veldt
#

do the values of a radio button group have to be different?

echo veldt
#

in the [] of a roll formula can you add text to be output to the chat?

formal goblet
#

But I don't think you'll get it to display text

echo veldt
#

couldn't get the ref to work no matter what I threw at it so I went back to the original system I had that worked. made sure that the values would always be unique and going to just deal with the rendering issue. so long as they can roll initiative.

charred spire
#

Thanks for your help, I'll study what you said later.

How do I hide a result from a macro? And then show.

formal goblet
charred spire
# formal goblet That's too unspecific, do you have more details?

So, I made a macro where it runs the 151 Pokรฉmon randomly, but when I run it, it already shows which one it is. I wanted to rotate the NPC trainer's number of Pokรฉmon beforehand, so he could organize himself in the battle order, and then I would show the roll to the players.

fleet pilot
#

Does anyone know if there's a way to refer to the component key of the component which is executing a formula? For example, if clicking a Label component executes a formula, can I refer to that label's component key dynamically?

formal goblet
fleet pilot
#

Damn. Unfortunate. Was hoping it was possible to avoid having to rewrite certain references for every single button using the same formula

fleet pilot
#

${value:=ref(concat('number_', 'force'))}$
Force:
${value == 0 ? [(2d6kl)cs>=4] : [:value:d6cs>=4]}$
For some reason, this formula is evaluating the result of :value:d6 before the 'cs', rather than computing for example 1d6cs. Any idea why?
Example error:
Uncaught (in promise) Error: Unresolved StringTerm 3cs>=4 requested for evaluation

#

This was working before, seemingly only if I don't utilize the conditional

fleet pilot
#

The error came from the else in the conditional, not the one with parenthesis

[:value:d6cs>=4]

#

Value in this case is equal to 1, and so it seems to be rolling 1d6, taking the result, and then trying to cs it.

#

Causing the error

#

This only occurs if using conditional ? :, otherwise it works fine. For example the following formula works:

${value:=ref(concat('number_', 'force'))}$
Force:
${[:value:d6cs>=4]}$

formal goblet
fleet pilot
#

Thanks for the help, got everything working ๐Ÿ‘

fading pollen
#

Now your game did it again... It breaks until i reset the browser cache. It's a little bit annoying as it also resets some of the settings in the other systems i have. Why is it doing this? and it's not a module error as it also do it when all modules is disabled.

formal goblet
fading pollen
formal goblet
fading pollen
#

Ok thanks for your time. Maybe itโ€™s a Forge thing.

fading pollen
formal goblet
fading pollen
#

Maybe it's when modules are updated or something

formal goblet
#

But I still don't get why it would have issues with cookies...

echo veldt
#

I am using forge currently for 24/7 uptime.

#

and I have seen some weird interactions, but all of them have been from me doing something wrong instead of a forge interaction.

That is not to say there won't be a forge interaction coming for me in the future.

#

One thing that I am trying to figure out currently is how to do styling for my module with the forge file structure as I can't seem to add it to the directories at the moment or point CSB to those styles

fading pollen
formal goblet
echo veldt
#

do you have a link to this?

fading pollen
formal goblet
#

Uhm, nope. But should be that name in the package manager

echo veldt
#

thank you I will look into that when I get to that point.

I have been wanting to add some classes for styling but didn't have a way to do it. hopefully this will help.

formal goblet
#

Yeah yeah, it works. That's what I'm doing

echo veldt
#

great to hear

#

I have currently been using inline styles, but my inner web dev is screaming at me. lol

left osprey
#

I made a system to show some checkboxes that are stand-ins for charges/spell slots depending on the class that my players choose. However, I can't get a way for it to not reset after every re-opening of the sheet. I have tried everything that I can think of, here is what I have been trying;

Hooks.on("closeActorSheet", (app, html) => {
    const actor = app.object;
    if (!actor || !actor.system || !actor.system.props) return;
    updateCharacterCharges(actor, app);
    console.log("Charges for ${actor.name} have been saved on sheet close.");
});
formal goblet
left osprey
#

I have two, one that handles if they change levels/classes, and one that changes if they hit a button "Long Rest".

Hooks.on('updateActor', (actor, updateData) => {
    if (updateData?.system?.props?.pc_class !== undefined || 
        updateData?.system?.props?.pc_level !== undefined || 
        updateData?.system?.props?.proficiency_bonus !== undefined) {
        updateCharacterCharges(actor);
    }
});```
and 
```// Function to handle Long Rest logic
function handleLongRest(actor) {
    if (!actor || !actor.system || !actor.system.props) {
        console.error("Invalid actor data structure.");
        return;
    }

    // Reset all used slots and charges
    let charges = actor.system.props.charges || {};
    
    if (charges.usedSlots) {
        for (let slotLevel in charges.usedSlots) {
            if (Array.isArray(charges.usedSlots[slotLevel])) {
                charges.usedSlots[slotLevel] = charges.usedSlots[slotLevel].map(() => false);
            }
        }
    }

// Hook to render the Long Rest button functionality
Hooks.on('renderActorSheet', (sheet, html) => {
    const actor = sheet.actor;
    const button = html.find('.long-rest-button');
    button.on('click', () => {
        handleLongRest(actor); 
    });
});
formal goblet
fading pollen
left osprey
# formal goblet I'm interested in `updateCharacterCharges(actor)`. Also, what type of Component ...

Here is what I go;

    if (!actor || !actor.system || !actor.system.props) {
        console.error("Invalid actor data structure.");
        return;
    }```
as for as for charges;
```// charges based on the class, level, and proficiency
    const charges = game.getCharges(characterClass, level, Number(proficiency));
    const mainModInfo = game.getMainMod(characterClass);```

```   //chargeData or initialize it if it doesn't exist
    let chargeData = actor.system.props.charges;
    if (!chargeData) {
        chargeData = { usedSlots: {} };
    }```
formal goblet
#

Do you persist the changes of the charges via Document#update()?

#

Only mutating the Actor will not save changes in the Database

summer crane
#

I found this in a previous post, but when I use it it doesn't roll 3d dice from dice so nice. Any way to fix that?

${#concat(?{Type|'1d20','Normal'|'2d20kh','Advantage'|'2d20kl','Disadvantage'}, ?{Modifier|0})}$
${Roll:= [:Communications:] + [:Type:] + Modifier}$
plucky canyon
#

I have an actor with multiple hit points (a squad of infantry to be precise) and I'm trying to conceptually figure out how to handle damage.

I get damage as a lump sum and I want to apply this to my individual HP values one by one. Filling up one before jumping to the next with any remaining damage and so on, until all damage has been applied or all HP values are full.

For example:

Incoming Damage=25

HP1=10
HP2=8
HP3=9

I want to apply 10 to HP1, 8 to HP2 and then the final 7 to HP3.

It's been way too long since my I studied programming so my ideas on how to tackle it are very fuzzy. Could I make the Damage into an array, loop 1 point of damage from it until HP1 is full and then skip to HP2 etc?

willow birch
clever patio
#

Hi guys, I am thinking of set up a milestone system for the characters. Which is once a character achieve certain achievement, the character can reach a milestone and get some bonus points for attributes.

I am think about puting a list of milestones in the character sheet so players can update themselves.

Does Checkbox is a good way to do it? If so, how do I write the code?

Thanks a lot!

boreal hull
#

Hey I am trying to use the item piles module, and use the currencies I have made using this module but it doesnt seem to be working... any ideas?

#

but not sure how to attach custom ones to it, though it does say that is possible

timid marten
#

How can you edit the "limited" user role?

#

like allow it to use checkboxes for example

formal goblet
timid marten
#

I want my user to be able to use the inventory system and use checkboxes, but not everything else

#

so no text editor

#

no number/text field

formal goblet
timid marten
#

in which folder?

formal goblet
#

There's no folder, it's in the settings directory of Foundry when running a game

timid marten
#

wait you mean this?

formal goblet
#

Yeah

timid marten
#

so this is not possible?

formal goblet
#

Yep

timid marten
#

alright, how can I disable modifiers access to players then? :(

#

it breaks my CSS

#

(shoud look like that)

formal goblet
#

Check the settings of Custom System Builder

timid marten
#

is it a 4.x+ settings?

formal goblet
#

No, that was also present in v. 3.2

timid marten
#

I'm in 3.0.0

formal goblet
#

Ahhh

timid marten
#

(for now)

formal goblet
#

Well

timid marten
#

alright, another reason to update

#

it's sad I can't prevent users to edit items they have in their inventory :(

formal goblet
#

Not at that version, yeah

formal goblet
timid marten
#

But yeah, I did that for a lot of values

#

(mostly because of modifiers tho)

sturdy mesa
#

Can someone share a simple macro for the CSB where the user enters an amount, and that amount is applied as damage or healing to all selected tokens?

echo veldt
#

is there a way to set the actor window size?

every time I reload an actor it resizes the window to smaller than I would like, so I would liek to change that.

formal goblet
boreal hull
#

how do you make items stackable?

formal goblet
formal goblet
# sturdy mesa

All user-defined values are stored under system.props. If you have a Component with the key Health, it should be system.props.Health

sturdy mesa
#

For some types of items, I have a text field that is sent to the chat when the player clicks the label button. However, when I put a formula in this text field, itโ€™s sent to the chat without calculating the formula.

For example, if I put ${[1d6]}$ in this text field, thatโ€™s exactly how it appears in the chat.

Is there any way to make this formula be calculated when it's sent to the chat when the player clicks the label button in the sheet that shows the field in the chat?

#

**
**This would help me, for example, to create items that send different messages to the chat without needing to create a new item container with different messages in the label button each time. This way, I could write the additional line of code (and text) in the text field, and it would be sent to the chat more easily.

sturdy mesa
#

Another question: is there a way to "reload" the template for all items at once that are already in the players' sheets? Normally, reloading the template only works on items that are displayed in the system and unequipped. Is there a way to reload all items equipped by the players?

half beacon
#

I'm trying to display text from a Rich Text Field into the chat window as part of a Javascript, but any time I try, it doesn't work. Even if it's something like %{return "${itemEffect}$"; }%

boreal hull
#

do number boxes have attribute paths?

#

do components have them

formal goblet
formal goblet
formal goblet
half beacon
sturdy mesa
formal goblet
glad spade
fallen coral
#

How can I get the index of a chosen option of a dropdown menu?

formal goblet
fallen coral
formal goblet
fallen coral
#

How would I translate the existing active effects? Is it possible to achieve this in a non destructive approach?

formal goblet
fallen coral
formal goblet
fallen coral
#

Am I missing something?

#

Nevermind, is it localized. Turns out there are two ways to set the language. One in the main screen configuration and another in the world configuration

fallen coral
elder raft
#

Man, I am so inept when it comes to syntax, especially with scripts.

For the life of me I cannot get the Dice Pool Wiki example to work for me.
Even changing it over to getCustomRoll() I must still have some of the parameters wrong and can't get it to perform.

Scripts are JavaScript right? Is there a good tutorial for how to define the (), ... options, etc for that call?

formal goblet
# elder raft Man, I am so inept when it comes to syntax, especially with scripts. For the li...

There's a little change for that method, it now expects some arguments. The signature is the following:

function getCustomRoll(rollKey: string, options: ComponentRenderOptions): SendToChatFunction | undefined;
type ComponentRenderOptions = {
  source?: string;
  reference?: string;
  customProps?: Record<string, JSONValue>;
  linkedEntity?: CustomItem
};
type SendToChatFunction = (postMessage: boolean, options?: ComputablePhraseOptions) => Promise<ComputablePhrase>;

Old

const phrase = await entity.getCustomRolls()[labelKey]['main'](false, {
   ...options,
   explanation: false
});

New

const phrase = await entity.getCustomRoll(labelKey, {})['main'](false, {
   ...options,
   explanation: false
});
formal goblet
elder raft
#

Thanks for everything you do here Martin!
I appreciate the guidance

willow birch
#

Okay, I have fully removed all errors even warnings but CSB still throws an increasing number of loops on me

#

Example: Custom System Builder | All props for Share Memories (xRyBeiinslHJvsbu) computed in 1 loops.

#

It increases each time I reload something, and it's now up in the hundreds making the game freeze for multiple seconds

#

What can/should I do?

#

Even going +1 on the freaking healthbar kills the game!

formal goblet
willow birch
#

Explain further, what is a "Circular dependency"?
Do you mean a value depending on itself indirectly? If so, no.

formal goblet
#

Do you use setPropertyInEntity() somewhere, which is not a Label Roll Message?

#

Otherwise I have no idea, what would increase the amount of computation loops after each update

willow birch
#

Okay, so I found a workaround at least. It only seems to happen on "old" characters. As in if I changed some part of the template after their creation.

New ones work as expected

#

(On beta branch fyi)

half beacon
formal goblet
half beacon
#

It's a script from an item being used on an item sheet, not from the actor sheet

formal goblet
#

Should still be defined. What do you get with console.warn(entity) in the console when you use this in the sheet?

elder raft
#

Is the best way to pass any variables to a script by "const"ing a new variable to equal it?

Say for instance, I need to modify the "crit" filter on the result to match the highest face on the die rolled (say they roll d20s and d10s, and both can crit), is there a way to reference that dice size in CSB? or do I need a 'const dicesize = 'skilldie';' (where skilldie is either 20 or 10, in this example.)

Also partially relevant to the same question:
If I'm using the script-roll for a custom dice pool, if I'm using a sameRow() in the Label Roll Message to grab some parameters do I need to have that (hidden) Label with the actual message in the dynamic table too? Or what's the best way to interact with CSB&scripts in a dynamic table?

formal goblet
elder raft
#

Ahh, okay, so I was kinda close!

Is labelKey just special in that it doesn't need the ${}$ like weight does in your example? (sorry, I'm like 2 hours deep into learning the scripting and still way over my head ๐Ÿ˜‚ I feel like I should be paying you and recording my class credits here, haha)

formal goblet
elder raft
#

I think I understand!

#

I got it working! (mostly)
I can get it to run through pretty well normally, but if I'm trying to run it from a label inside a dynamic table it's throwing up an error
I think I need to... better define the speaker entity so it looks for that stuff in the right spot, it seems? ๐Ÿค”

timid marten
#

Just updated everything to V12 and added back all my little CSS/HTML edits here and there

#

still got a couple things broken

#

I'm not gonna work on it today but tomorrow I will may need help, just saying this to prepare yourself mentally

formal goblet
elder raft
#

Yeah, there's gotta be something that grabs just fine when both labels are on the sheet, but doesn't parse properly when I shove them into a Dynamic table,
does sameRow() or lookup() work inside of scripts to make sure I'm grabbing the right stuff?
Hmm, or I wonder if it'll be easier to keep the roll label outside the table and the script inside.

#

If I move the label out of the table I'll have to change some things around so I can still grab the data currently being grabbed by sameRow()

formal goblet
#

I think it's best if you show what you've got

elder raft
#

Haha, fair!

#

<!--Mind Roll Action-->

        ${#skillname:= (sameRow('player_mindskill_name'))}$
        ${#skilldie:= (sameRow('player_mindskill_status'))}$

<!--Rollcard-->


<h3 style=font-size:20px;padding-top:10px;padding-right:10px;><i>${!skillname}$</i></h3>
</tr>
<table>
    <tbody>
        <tr>
            <td style="color:MidnightBlue"><b>Successes:</b></td>
            <td style="text-align:right">${[${player_mind}$d${skilldie}$cf=${skilldie}$cs<4]}$</td>
        </tr>
        <tr>
            <td style="color:Green"><b>Criticals:</b></td>
            <td style="text-align:right">crittext</td>
        </tr>
        <tr>
            <td style="color:DarkRed"><b>Failures:</b></td>
            <td style="text-align:reight">failuretext</td>
        </tr>
    </tbody>
</table>
%{
const labelKey = 'Mind_Roll';
const phrase = await entity.getCustomRoll(labelKey, {})['main'](false, {
   ...options,
   explanation: false
});

const rolls = Object.values(phrase.values)[0].rolls;
const results = rolls[0].roll.terms[0].results;

const crit = results.filter(function(result) {return(result.result == 1);}).length;

const diemax = '${(sameRow('player_mindskill_status'))}$';
const failures = results.filter(function(result) {return(result.result == diemax);}).length;


phrase._buildPhrase = phrase.buildPhrase.replace('crittext', crit);
phrase._buildPhrase = phrase.buildPhrase.replace('failuretext', failures);

const speaker = ChatMessage.getSpeaker({
  actor: entity.entity,
  token: entity.entity.getActiveTokens()?.[0]?.document ?? null,
  scene: game.scenes.current
});

phrase.postMessage(speaker); 
}%

So, the actual variable still need cleaning up, but this interaction works when I've got both labels just sitting fine in a sheet, (well, except the sameRow()s, obviously)
Its when I add them into a dynamic table to get those sameRow() parameters that the script then breaks in the getSendToChat

#

ohh, I messed with the Script there, I was using a passed-through ${skilldie}$ down in the diemax but started messing with it when it didnt work to test if sameRow() worked in scripts

I feel like I'm trying to do two things a specific way that only one works.
If I move the skillname/skilldie off onto a lookup() with a User Input Prompt, I feel like I could get them to talk to each other

formal goblet
elder raft
#

That... filter was stolen from RadLad's dice pool, ๐Ÿ˜… it seemed to work well enough so I didn't start messing with it

#

Cause I was trying to set the exact parameters to filter, and his was pre-composed for exactly that, lol.

#

and it did work... under very specific situations ๐Ÿ˜‚

#

but I see where it can be cleaner, maybe better

formal goblet
#

And you can keep the roll template outside of the table. You'll need only 1 instance of it anyway

elder raft
formal goblet
elder raft
#

I do, but I need some way for the player to choose which skill they're rolling, because the size fo the dice in their pool will change.
Originally, sticking both the roll and the script in the dynamic table seemed best because then every skill just has a little roll button, triggering the script to trigger the roll label which can just sameRow() that info.

if I'm moving the roll label outside the table, there needs to be some way to select the right skill to roll... I'm seeing user-input?

Unless... the script label inside the table can pass that information out to the roll label...? ๐Ÿค”

formal goblet
elder raft
#

... yes...

formal goblet
#

The Label with the content of the Roll is literally just a blueprint, there's no reason to roll from that directly

elder raft
#

Correct, but you gotta have that label hidden somewhere to trigger right?

And that label is grabbing a variable from a dropdown in the dynamic table to determine the dice size. Which it uses to make the roll, and passes to the script to use to determin crits/failures...

right? ๐Ÿ˜…

formal goblet
elder raft
#

mmmmmmmm

#

Martin, I love you.
Never before have I been so turned on by being made to feel like an uneducated child ๐Ÿคฃ

I think I'd be better served to just continue pushing on actually learning the language rather than trying to find what I need and piecemeal some kind of gibberish spanglish out of it just to get what I want done.
I'm running into walls I don't even know exist, lol

formal goblet
#

Well, you picked the hardest example of the Wiki ๐Ÿ˜…

elder raft
#

Hehe, yeeeeeah

#

I just want some really complex but individualized dice pools!

formal goblet
#

You might be better of starting simple and trying to progress one step at a time

elder raft
#

Maybe my need would be better served finding a way to roll 1dX and looping it as many times as I need for the pool ๐Ÿ˜‚

elder raft
formal goblet
#

Suuuure. You could also try to adjust our parser, so that it can handle custom asynchronous functions. That might be a real challenge ๐Ÿ˜‚

sick plinth
#

is there a way to make initiative roll a d10 plus whatever would add to that instead of a d20

willow birch
vagrant hollow
balmy orchid
#

Hello everyone!
I'm trying to make a button, that will add +1 to the Skill. How I do that?
Trying to setPropertyInEntity, but that not working much.

formal goblet
#

How did you do it?

balmy orchid
# formal goblet How did you do it?
setPropertyInEntity('self', lookupRef('attributes', 'base_value', 'name', 'dexterity'), "min(first(lookup('attributes', 'base_value', 'name', 'dexterity')) + 1, 0)")
formal goblet
#

See if lookup() and lookupRef() return something. You can wrap them with consoleLog() and spectate the log when executing the Label Roll Message

balmy orchid
brave trench
#

I'm using item piles and filtering out CSB items that are skills/spells etc. The easy way to do this is to create a label and give it a name. (example filter, system.props.lableKey:abilities) is it possible to just do the same thing in the hidden attributes? I tried but didn't seem to work.

heavy elm
#

Hey, can I update to V12 and then just update the CSB, keep my worlds or how is it gonna work?

formal goblet
glad spade
brave trench
# glad spade What is your item filters with the hidden props?

Everything works fine with item piles. The question is more about how hidden attributes work. In the image, the left circled is what I'm doing now. Its a label hidden to players that item piles filters perfectly. Mostly curious if it was possible for the hidden attributes (right circled) to be configured similarly, just... hidden lol. I don't know how to set up the formula box because there isn't a formula really. or maybe there is and I don't get it.

No big deal either way, was just curious if it was possible.

formal goblet
brave trench
formal goblet
#

A formula is optional

brave trench
# formal goblet Yours is already correct

Ok it does work. Sometimes I have issues with a script that is supposed to mass update items/tokens/actors etc. i think that was actually the issue. Redropped a fresh copy of a token(item pile) and works fine. smh thank you for helping to clarify that lol.

balmy orchid
#

Is there any way to script all values from dynamic table to show them on other page? Or I need to create them by hand?

formal goblet
balmy orchid
formal goblet
balmy orchid
#

Undestand. Thanks!

formal goblet
formal goblet
timid marten
#

I'm facing a wall right now, how can I edit the CSS of this particular input text?

#

I just wanna apply a simple margin-left

#

there's no places to add a class

#

and using .perktechnique or .perktechnique input doesn't work

formal goblet
timid marten
#

I added "test" and then added in my css:

.test input { margin-left:10px !important;}
#

didn't detect my class when I inspect it

#

nevermind it works now

#

Why is it always like this

#

๐Ÿ˜ญ

#

Thank you

formal goblet
#

np, Kohai

timid marten
#

Just saw you can sort table categories, how do you reset this?

timid marten
#

? :(

timid marten
#

is it not possible ?

formal goblet
timid marten
#

nooooo

#

is there really no way to reset it?

formal goblet
#

Possible with a script and it's client-side only, so others won't see it

timid marten
#

any way to make the sort server-side?

formal goblet
#

uh, no

timid marten
#

:(

timid marten
#

<p>${setPropertyInEntity('item', 'Equipped', '${item.Equipped ? 0 : 1}$')}$</p>

this doesn't work anymore since v12 and 4.1

#

I checked and it's not deprecated

#

any idea why?

#

it's a check

formal goblet
timid marten
#

oh 0/1 doesn't work anymore

#

I see

#

I'm coming from 3.0.0 so lots of things to learn

formal goblet
#

Yeah, many things changed

timid marten
#

Doesn't seem to work ๐Ÿค”

#

%{throw 'done';}%```
formal goblet
#

I see, remove the throw-part ๐Ÿ˜…

timid marten
#

oh right there's a button for that now

formal goblet
#

Updates with setPropertyInEntity() are deferred, until the whole phrase is parsed

timid marten
#

I wanna sort items based on if they're equipped or not, making equipped item on top, I set this but it doesn't seem to work

#

it's the component key

formal goblet
#

And I spend several days to ensure that it works that way ๐Ÿ˜…

formal goblet
timid marten
#

well it works to check it/uncheck it

formal goblet
#

Yeah, but the state is saved in the item, not in the column of the Item Container. The column data contains an HTML-tag

timid marten
#

which value should it be then?

formal goblet
#

And yeah, that is technically a value if that is inside the Label text

#

If you want it easier, just select ASC or DESC-sorting. You have only 2 distinct values anyway

timid marten
#

What does it change?

#

I tried <i class="fa-regular fa-${item.Equipped ? 'square-check' : 'square'}$ " style="color: green;"></i>

#

doesn't work :(

formal goblet
timid marten
#

I tried <i class="fa-regular fa-square-check : 'square'}$ " style="color: green;"></i> too

formal goblet
#

That's still not completely resolved

timid marten
#

it's green tho

#

๐Ÿค”

formal goblet
#

Whatever, just use ASC/DESC-sorting. Easier anyway and you don't need to specify a value for those 2

#

Only a column-key, but that seems to be correct already

timid marten
#

it still asks for a value tho

formal goblet
#

It shouldn't?

timid marten
formal goblet
#

Doesn't ask

timid marten
#

i've set this but it still doesn't react when I check

#

oh

#

I get it

#

it's not asking for the component key

#

it's asking for the checkbox key

#

๐Ÿ˜ญ

formal goblet
#

Ah yeah, I forgot that ๐Ÿ˜…

timid marten
#

it works now

#

thanks!

formal goblet
#

Sorting came before Item Containers even had their own data like Dynamic Tables

fallen coral
#

I have a meter meter_life I want to reference its Value and Max fields in another module, is it possible to achieve this with props.meter_life? Something similar? Or should I create individual fields to hold those values? I imagine this would work as well

fading pollen
#

Some weeks back my 'Custom system builder' system worked like a charm - now suddenly it only show this on all sheets and it seem that the system is not correctly installed as it doesn't show up in the configure settings. I have tried to delete browser cache and cookies and it worked the first time, but now it doesn't work. Need some help to get this system back online/delete my system settings on the server so i can import my back up or something. Please help, my players are about to string me up in the nearest tree ๐Ÿ™‚ It also happen if I create a blank world with 'Custom system builder'.

formal goblet
timid marten
#

when players own an item there is something in the page that changes that adds itself and breaks a little the css, any idea why?
(left is owned, everything is ok / right is not owned, css is a bit too high)

formal goblet
timid marten
#

this is everything broken when not owned

formal goblet
#

Dunno, I don't even know where I should look after

elder raft
#

If you're making a ? statement based on a dropdown, what's the parameter for if they didn't select anything in the dropdown (empty)?
is it 0? 'False'? I had it on the tip of my tongue and knew it like 4 weeks ago but have totally lost it, lo

#

so like for "false" here:
tool_use:= tool_choice == False ? 0 : 1 or similar

formal goblet
elder raft
#

ahh! lit, that was it. Thanks.
I just could not remember and it felt like I needed something like 0 or whatnot in there

#

And just to confirm, since it's been like a year since I last asked,
There is currently no way to display dice faces in CSB like the default Foundry Multi-Roll cards?

elder raft
#

Haha, I was just pulling up that page!

elder raft
#

Mmkay, if I'm passing CSB variables to a script to build a dice,
const t1 = new Die({number: 4, faces: 8};
if I want to reference those variabes for the number and the faces... How do I get that data in there?

Would it be better to come at it with a fromData rather than constructing it for a fromTerms?

#

Okay, I got that working, now to get it to actually roll properly ๐Ÿ˜…

normal ore
#

Why doesn't this work?

formal goblet
#

Or the little Script

normal ore
#

Thank you

glossy lodge
#

I am a bit at my wits end and hope that someone is able to help me with this. I am currently using a Item Displayer where the final field calls a macro like so:

%{
  return game.macros.getName('Get Action Summary').execute({
    isCollapsed: linkedEntity.system.props.mcdm_action_collapsed,
    title1: linkedEntity.system.props.mcdm_action_extra_effect_title_1,
    text1: linkedEntity.system.props.mcdm_action_extra_effect_description_1,
    title2: linkedEntity.system.props.mcdm_action_extra_effect_title_2,
    text2: linkedEntity.system.props.mcdm_action_extra_effect_description_2,
    attack_type: linkedEntity.system.props.mcdm_action_attack_type,
    description: linkedEntity.system.props.mcdm_action_description,
    tier1_melee: entity.entity.system.props.mcdm_kit_melee_low,
    tier2_melee: entity.entity.system.props.mcdm_kit_melee_mid, 
    tier3_melee: entity.entity.system.props.mcdm_kit_melee_high, 
    tier1_ranged: entity.entity.system.props.mcdm_kit_ranged_low, 
    tier2_ranged: entity.entity.system.props.mcdm_kit_ranged_mid, 
    tier3_ranged: entity.entity.system.props.mcdm_kit_ranged_high,
    rollType: linkedEntity.system.props.mcdm_action_roll_type,
    tier1_extra: linkedEntity.system.props.mcdm_action_low_text,
    tier2_extra: linkedEntity.system.props.mcdm_action_mid_text,
    tier3_extra: linkedEntity.system.props.mcdm_action_high_text,
    tier1_type: linkedEntity.system.props.mcdm_action_damage_low_type,
    tier2_type: linkedEntity.system.props.mcdm_action_damage_mid_type,
    tier3_type: linkedEntity.system.props.mcdm_action_damage_high_type,
    tier1_damage: linkedEntity.system.props.mcdm_action_low_damage,
    tier2_damage: linkedEntity.system.props.mcdm_action_mid_damage,
    tier3_damage: linkedEntity.system.props.mcdm_action_high_damage,
    cost: linkedEntity.system.props.mcdm_action_cost,
    distance: linkedEntity.system.props.mcdm_action_distance,
    target: linkedEntity.system.props.mcdm_action_target,
    keywords: linkedEntity.system.props.mcdm_action_keywords,
    type: linkedEntity.system.props.mcdm_action_type,
    trigger: linkedEntity.system.props.mcdm_action_trigger,
    use_kit: linkedEntity.system.props.mcdm_action_kit,
    })
}%

You can see the result of the macro in the image. However, this results in 3 'some props were not computed' warnings, with all the uncomputed props being this field in the Item Displayer. In the end, it takes 3 whole loops to compute all the props. Which all in all results in a rather laggy experience using the character sheet whenever anything changes.

I thought it was because the macro itself is rather complicated, but the same occurs if I make the Macro immediately return a preset value. Does anyone have any idea what can cause this?

formal goblet
#

And execute() is async

glossy lodge
#

It script is placed in the Label text field, as as far as I understood, the Label Roll is specifically for putting things in chat, although I could be wrong.

...I just realised I did indeed completely read over the warning in the Guide that says execute is indeed async... darn. I hope there is a way to make them execute synchroniously

formal goblet
#

I mean, you could place the content of the Macro into the Script. That would work

#

But you also have to take into consideration, that certain values are potentially undefined, because they didn't go through the computation yet. With entity.throwUncomputableError(message, source) you could instruct the system to wait for the next loop if you spot undefined values. Or use nested Formulas, which handle that automatically

glossy lodge
#

Good to know, I indeed saw that in the wiki. Got to be careful with null checks. The fact that I was returning a promise was indeed the issue, as just placing the entire script in the field did fix it. Bit of a bummer as it makes it less reusable between different sheet types since I now got to remember to place the newest version of the script in each one every time I make a change, ah well. I am already happy it isn't frantically looping until the promise is ready anymore.

#

Thanks for the help ^^. I was afraid I was being a bit to extreme with having a big script run inside the Item Displayer and had to scratch the entire idea.

formal goblet
#

But don't ask me about the details, would also be my first time in this direction

glossy lodge
#

Smart idea, I could probably experiment with that a bit. I am already running a personal module to extend functionality where CBS can't so I can just add a global function in there.

formal goblet
#

Actually, I think you can just append math-js with your custom function and you would be able to use that even in a normal formula

glossy lodge
#

I just got one question left. Does CBS recalculate/recompute all items an Actor has when the Actor's props change? Say I move the script logic to display the item summary to the item template itself in the Item Displayer and remove any logic that requires some actor fields and just do the old ${item.summary}$, would that result in the item script not being re-run whenever I edit some fields in the actor as the script now doesn't require fields from the actor?

formal goblet
glossy lodge
#

Alright, then I won't bother doing that, it would be quite an undertaking ๐Ÿ˜…

#

Thanks for all the help ^^

formal goblet
#

Np

bright pond
#

Helloo, I am using CSB to make a new system, and I was wondering if there is any way to attach behavior to both start of encounter and on player turn start?

#

I found the custom initiative formula, and I have that set, but that's all I could find

#

To give context, I am making a 5e-esque system and I have actor properties detailing actions, bonus actions, reactions, and I would like to set these to full on the start of initiative and start of turn. I currently have a button that does the same thing but would like to link it to Foundry's inbuilt encounter system

bright pond
#

thanks! Where do I register the hooks? Just anywhere on the actor page?

willow birch
#

Thank you so much for this! It should seriously be pinned.
As an addendum though, the components on items and actors need to be Number fields. (spent two days figuring this out ๐Ÿ˜ญ )

bright pond
#

Ok following up on this, how do i access the CSB component fields from the foundry API?
Trying to achieve behavior where 'current_stamina' and 'max_stamina' are both component keys (see pseudocode below)

formal goblet
wise torrent
#

Hello i would like to know, how i can program 3 buttons on my charctersheets
the buttons should contain:
Disadvantage Roll: 1d6 a 5 or a 6 on the die is a success
Normal Roll: 2d6 if a 5 or a 6 is on one or two dice its a success
Advantage Roll: 3d6 a 5 or a 6 on one or two or three dice is a success
The rolls should get transferd to the chat.
thx for your help

brisk finch
#

Hi. I have issue with using number field and setPropertyInEntity . If i change number in field then setPropertyInEntity command just dont work. But if i change another template and change it back then all starts working

round badger
# wise torrent Hello i would like to know, how i can program 3 buttons on my charctersheets the...

The way I'm doing it its to formulate the roll, count the successes then do something with the result. IE: Disadvantage ${myRoll:= [:1:d6:cs>=5]}$ counts successes on a 5 or 6 on one die. ${myRoll:= [:2:d6:cs>=5]}$ or ${myRoll:= [:3:d6:cs>=5]}$ then test for the number of successes needed. So for Normal and advantage you are good as long as one success is rolled. Should have added that your buttons would be labels and the code goes in the label roll message.

#

I hope this helps ๐Ÿ™‚

round badger
wise torrent
round badger
#

if I understood you correctly ๐Ÿ™‚

wise torrent
#

Nice, thanks alot, we are really close, i would like that the text 1d6cs=5 isnt visible, is there a way?

#

or isit only visible for the gm?

round badger
#

what is the code you have for the roll?

wise torrent
#

${!myRoll:= [:1:d6:cs>=5]}$

round badger
wise torrent
#

now i have only a 0 for failure and a 1 for a succses, i would like that it shows the dice

#

sorry for the complication and thanks for the patience

round badger
#

Unfortunately , that's beyond me at the moment. I'm doing something similar with exploding dice and I just live with not using ! or # so players can click the icon button and see the dice.

#

sorry

#

it works for what I need and I just tell the players to ignore the gobbledygook and look at the little squares ๐Ÿ™‚

wise torrent
#

ah okay, thank you alot you brougth me a lot further ๐Ÿ™‚

round badger
#

Glad to help!

echo veldt
#

in the same vein, how would one keep a JS roller form outputting to the chat window.

To implement my rolling method I have to use a JS script to build the roll as it needs to build an array of exploding dice. each die has to explode individually and then check against a Target number to determine successes. This is the code I am currently usinng to do so.

const val = html[0].querySelector("#num-of-d6").value;
const target = html[0].querySelector("#target").value;
const formula = `{${Array.fromRange(val).map(i => "1d6x").join(",")}}cs>=${target}`;
return new Roll(formula).toMessage();

This outputs to the chat the array. I would like ot have that look less technical or not output the array at all.

round badger
solid umbra
#

I searched and couldn't find the answer here (based on keyword search) and in the documentation as far as I could tell, but I'm sure I missed something. How do I reference a dropdown list choice in a visibility formula? What does it return? I tried 'choice' is true but that didn't work.

formal goblet
solid umbra
bright pond
#

or should it work regardless of where the component is

formal goblet
#

You can log the actor to make sure, that you target the right props

bright pond
#

ok cool after looking into how to debug got everything working, ty

round badger
#

I'm trying to pop up a dialog for some user input containing 2 fields as follows ${#concat( ?{testval:maxpump[text]|"0"}, ?{luckyD:"Use A Lucky Dice?"[check]} )}$ wich generates the following error when the dialog is closed (see pic). If I separate the 2 elements out as in ${?{testval:maxpump[text]|"0"}}$ ${?{luckyD:"Use A Lucky Dice?"[check]}}$ it works without the error, but I get 2 dialogs. Anyone know why the separated elements work, but the concatinated throws the error? Thanks in advance. Edit: maxpump is a string which is built before the dialog, but replacing it with a fixed string still generates the error.

formal goblet
round badger
formal goblet
round badger
#

Thanks! doing ${#concat(string(?{testval:maxpump[text]}),string(?{luckyD:'Use A Lucky Dice?'[check]}))}$ seems to have worked (putting it here for anyone else meeting this error).

wise torrent
#

I wanted to know if its possible to get rid of the "see hidden attributes" and "see attributes bar"

formal goblet
wise torrent
#

and where do i put that CSS?๐Ÿ˜…

#

AND what even is CSS ๐Ÿ˜‚ im sorry ๐Ÿ˜…

echo veldt
# wise torrent AND what even is CSS ๐Ÿ˜‚ im sorry ๐Ÿ˜…

This is a free website for learning CSS and how to use it. I highly recommend that anyone starting to learn take this course. You don't have to go past the first module, Responsive Web Design- to learn what you need to learn. You can go further if you want to learn more about other technologies like JavaScript and so on, but I only recommend module one if you wish to know HTML and CSS.

https://www.freecodecamp.org/learn

Learn to Code โ€” For Free

cinder fox
#

Say I have a label with the key 'roll_arcana', is there anway in its roll message formula to retrieve the key ?

formal goblet
cinder fox
#

any suggestions if I have a skill list but I do not want to manually enter the roll formulas for each them?

cinder fox
#

ok

formal goblet
#

You only define column-data, so that each row is handled the same way

cinder fox
#

is there any way to pre-enter data in the dynamic table?

formal goblet
quasi summit
#

Hi.
I want to use the fallback value of the fecthfromactor:
${equalText(fetchFromActor('target', ref('latt_cib'), 'QUED'), 'QUED') ? 'ko' : 'ok'}$

In my case, latt_cib is set to empty string ('').
So i except the fetch to return 'QUED'.
Which i compare with 'QUED'
So i should get ko, no ?

formal goblet
quasi summit
formal goblet
quasi summit
formal goblet
quasi summit
#

When i test ${equalText(fetchFromActor('target', "name", "pouf!"), "pouf!")}$

  • if i have a targeted token it says true.
  • if not it says false.
sick plinth
#

Is there a way to use a custom character sheet for players

quasi summit
# quasi summit When i test ```${equalText(fetchFromActor('target', "name", "pouf!"), "pouf!")}$...

My 2 cents with my test-gatling:

${#a_une_cible:=not(equalText(fetchFromActor('target', "name", "notarget"), "notarget"))}$
${a_une_cible ? "true" : "false"}$
<br />

Test: token selected ? 
${#est_selectionne:=not(equalText(fetchFromActor('selected', "name", "noselected"), "noselected"))}$
${est_selectionne ? "true" : "false"}$
<br />

By reference:
${nom:='name'}$ 
Test: is there a target ? 
${#a_une_cible:=not(equalText(fetchFromActor('target', nom, "notarget"), "notarget"))}$
${a_une_cible ? "true" : "false"}$
<br />

Test: token selected ? 
${#est_selectionne:=not(equalText(fetchFromActor('selected', nom, "noselected"), "noselected"))}$
${est_selectionne ? "true" : "false"}$
<br />

Test: variable exists ? 
${#variable_existe:=%{return entity.system.props.mavariable !== undefined;}% ? true  : false}$
${variable_existe ? "true" : "false"}$
<br />

Test: the field exists on the target or on the selected token ? 
${nom:='name'}$
${#champ_existe:=or(not(equalText(fetchFromActor('target', nom, "nofield"), "nofield")), not(equalText(fetchFromActor('selected', nom, "nofield"), "nofield")))}$
${champ_existe ? "true" : "false"}$
<br />```
timid marten
#

Hi, would it be possible to change an item's color based on a "rarity" label set in their sheet?

#

I tried using the "rarity color" module but it doesn't work with CSB

summer crane
#

I have this for a label roll message but it's not hiding the the prompt result. In chat I get 1d200 when I give modifier of 0 then below I get the actual roll. Any fixes?

${#concat(?{Type|'1d20','Normal'|'2d20kh','Advantage'|'2d20kl','Disadvantage'}, ?{Modifier|0})}$
${Roll:= [:Type:] + Modifier}$
round badger
# summer crane I have this for a label roll message but it's not hiding the the prompt result. ...

I think something else must be adding in the extra zero somewhere else. Perhaps a module or some code elsewhere? I say this, because I just plopped the code you gave into a label roll message and it worked fine. I also tried initializing Modifier before your code and it also worked fine just to ensure Modifier had a value going into the pop-up like:${#Modifier:=0}$ ${#concat(?{Type|'1d20','Normal'|'2d20kh','Advantage'|'2d20kl','Disadvantage'}, ?{Modifier|0})}$ ${Roll:= [:Type:] + Modifier}$

#

Note: using Foundry 12.331 and CSB 411 with Dice So Nice. I can enter 0, negative and positive values or nothing at all into the Modifier field and the math works.

crimson girder
#

so i need to call values from an item displayer table. What line of code would i use to do that and is there a way to select a specific item using this code as a qualifier?

<i class="fa-regular fa-${item.Active ? 'square-check' : 'square'}$" style="color: ${item.Active ? 'green' : 'red'}$; background-color: white;"></i>

charred spire
#

Can I create a kind of Fate Point? Like Bene from Savage and such, for the players?

timid marten
timid marten
#

found out using html code can affect name color but I can't find a way to hide the html code on the name of the item

timid marten
#

Made it work with chatgpt's help

#

๐Ÿ‘

summer crane
rapid hare
#

Hello, a stupid question - I created a very simple way to make an actor auto-roll a saving throw using a chat extension, which is:
[[ceil(1d20 + ((@{target|con}- 10) / 2) + @{target|con_mod})]]
The issue is, if a player attacks an actor that they have no ownership (Not Limited/Observer), the system cannot see the "con" stat and the calculation is simply pasted into the chat instead of calculating the roll. I don't want to give Observer ownership to actors that my players haven't met yet, but I know I will forget to give them visibility later and it will create issues in the long run.
Is there a way to go around it, or will I need to experiment with fetchFromActor?

tawdry pendant
#

Trying and failing to do a simple roller for Jackals, a great Osprey game which suffers from the same lack of VTT stuff as other print-only publishers. I've got "craft" set as a Label which gives the roll message Craft <p>${roll:=[d100]}$</p>. But I'd like that to lookup the "craft number" field and see if the d100 is lower than the value, in this case 30. Can I do that with Number Fields or am I barking up wrong tree?

formal goblet
formal goblet
rapid hare
tawdry pendant
formal goblet
rotund mason
#

Hello. I'm starting a new campaign and think is a good moment to upgrade to new versions. Does the last version of the Custom system builder work with the new foundry 13? Is there any potentially breaking changes since version 3.2.5?

vocal sorrel
#

Hello, I am still on 3.2.5 and have encountered an issue where the character sheet progressively has a harder time to update values. What I mean by 'progressively' is that this is my 5th iteration on my character sheet, and somehow the formulas update worse and worse.
For example, I have a very simple link between my item's weight (using an item modifier) to connect to a label on the sheet. That works fine, however as soon as I extend the link by using the value of the label in a different label (which I have to do because a modifier only takes the one key) it does not update until the sheet is manually refreshed, which is also impossible to do from the player's side.
Thing is, it didn't use to be like that and I was previously making even longer chains of labels and other components. Does FoundryVTT or CSB use some kind of caching of sorts? Its the only explanation I can come up with for this issue.

#

Here is a demonstration of my issue. (Also, not sure if its relevant, but each item on my character sheet takes 2 loops to compute, plus another loop if an item's value is updated, and my character sheet itself only uses 1.)

formal goblet
formal goblet
vocal sorrel
#

Dang so I have to transition my project again? Oh well, thanks for your hard work by the way.

rotund mason
#

I have one last error in what is probably a design mistake from my part
In a item template, I have these formulas

#

They throw an error since there is no Actor yet until the template is used in an item and the item dropped in an actor sheet. Is there a better way to do it?

plucky canyon
#

Couple of quick questions - do we know if Active Auras work with CSB? When trying it now nothing shows up in the token settings.

Also, is it possible to add a status effect icon to a token when equipping a certain item? I can see how to do it in a slightly roundabout way of it updating keys in the actor that then triggers a script for the icon, but thought I might be missing a simpler way to add the effect to an item by itself.

#

Ah, one more: is it possible to add actors to a sheet in the same way as an item list? To have passengers in a vehicle for example.

formal goblet
rotund mason
plucky canyon
#

Ok, thanks! Might try out a custom component in the future perhaps. But good to know for now.

Something else just occured to me - can I define the duration of an active effect in CSB somehow, or would that be a script with a hook to disable/remove the effect?

formal goblet
plucky canyon
#

Hmm... but where do I define the duration? I can't find it in the Configure Active Effects window.

rapid hare
# rapid hare Hello, a stupid question - I created a very simple way to make an actor auto-rol...

Turns out I am stupider than I thought
I've created this incredibly simple fetch:
[[ceil(1d20 + (${fetchFromActor('target', "wis")}$ - 10) / 2)]]
What it should do is roll a 1d20, then add the targeted token's "wis" attribute + math.
However, no matter what I do, it doesn't. It either rolls a 1d20 and nothing else or it outputs a flat 0, regardless of the dice roll.
I really don't know what to do with it, can I ask for help?

floral crater
#

you could test this
${dice:=[1d20]}$
${wisd:=fetchFromActor('target','wis')}$ (if you thrown dice from token) or ${wisd:=wis}$ (from caracter sheet)
${Result:=ceil((dice+wisd -10)/2)}$

#

if is from caracter sheet you could use directly wis without ${wisd...}$

#

@rapid hare

rapid hare
floral crater
rapid hare
#

Still the same thing, just outputs a chat message, but I think I figured out what the isuses
My attribute is a number field, but the ${formula}$ is a Text Field instead of a Label. I made it a Text Field so that I could easily swap the "wis" to any other attribute I wanted, on a per-item basis, but it doesn't pull a thing. If I put it directly into the cast, it works as intended.
Is there a good way to go around that and have an easy, selectable "attribute picker", or am I doomed to make a thousand templates?

floral crater
#

maybe (not sure) ref(label text)

#

@rapid hare

rapid hare
#

I'll be honest, my knowledge about all this is really low, I'm still trying to figure that ref() out with the wiki documentation

rapid hare
formal goblet
#

Then open your console with F12 and check the error message. That's better than trying stuff blind

rapid hare
#

If my console gave me any errors, I'd be REALLY happy. The issue is, it shows "All props for X computed" and nothing else.

timid marten
#

${fetchFromActor('attached', "first(lookup('inv_munitions', 'AMMO', 'name', '9mm Magazine'), 0)")}$

still doesn't work in 4.1.1

formal goblet
formal goblet
timid marten
formal goblet
timid marten
#

I don't really get where I'm supposed to place this

formal goblet
#

In the console

#

And replace actorName

timid marten
#

is it because the value is named "muns" in the inv_munitions tab wherehas it's noted as "AMMO" on the magazine sheet?

#

it was that

#

I thought it could retrieve the data from the item sheet itself

formal goblet
timid marten
#

I can only retrieve column data this way?

formal goblet
#

This way, yeah. Otherwise you need a script

timid marten
#

alright

#

I'll figure out something around that

#

thank you!

#

also I tried the "item_id" but it sent an error, is there an easy way to get the ID of an item automatically directly from their sheet? (like retrieve it from a label)

#

I tried this

#

${fetchFromActor('attached', "first(lookup('inv_munitions', '${item.id}$', 'name', '9mm magazine'), 0)")}$

#

oh "id" worked

timid marten
#

how could I add a condition that the item has "loaded" as true? (it's a checkbox)

#

I tried this:
${test_load ? ${fetchFromActor('attached', "first(lookup('inv_munitions', 'muns', 'name', '${ammo_type}$'),0)")}$ : 0}$

and then adding this at the bottom called "test_load" :
${fetchFromActor('attached', "first(lookup('inv_munitions', 'loaded', 'name', '${ammo_type}$'),0)")}$

#

but it did not work

formal goblet
timid marten
#

the typo wasn't in the label

#

mb

quasi summit
#

Hi.
Is it possible to make the roll in a chat message private or blind, as selected in the chat options of the player ?

quasi summit
rapid hare
# formal goblet How about this? ```js [[1d20 + ${!fetchFromActor('target', "wis", 0)}$]] ```

Still nothing, but now that I'm a bit less frustrated, I'll briefly explain how I wanted it to work - maybe I made a mistake elsewhere.

  1. There is a button called "Use" that triggers a Label Roll - it's just flavor text and image 1
  2. c_roll is "Caster Roll", a text field that uses the simply "Fetch stat from caster" - it works
  3. e_roll is a label on the bottom - it takes data from "e_roll_calc", or the "Enemy Roll" text field. I remember that Formulas like Labels the most, so I made this "hack" of sorts
  4. When I press Use, everything works as intended, except for the e_roll, which just outputs a chat message
runic oyster
#

Fresh to the Foundry server and already diving straight in; currently working on building up a CSB template set for Celestial Bodies: Titan Edition, despite the fact that any code/function beyond Microsoft Excel's =SUM fries my brain at the mere sight

#

Any shortcuts to get number cells and checkboxes to interact with each other with minimal code? The current stage is to have a number cell to increase its maximum value by 1 if the checkbox adjacent to it is indeed checked

formal goblet
runic oyster
#

Oooh, quicker response than I ever expected

#

Will give it a go when I'm back at the computer

granite iris
#

Hello i'm trying to setting up hp for the character, they have like 4 stat (from 1 to 100), the hp is the value of the stat divide by 10 round down + other formula for each stat. I tought about using the hidden attribute to calculate the hp, its my first time using a custom system, how to you use the value of a number field?

granite iris
#

And is there a way to make a label clickable? Like one the the stat is Body, and i want to make it that if someone click on it then it roll a d100 and if it is under the body attribute it pop up a success message

brittle moth
#

#package-releases message
Hi everyone ๐Ÿ™‚

**Version 4.2.0 is now generally available, with the following changes : **

Features

  • Added new Component ActiveEffectContainer
  • Added function find(), which does the same as first(lookup(...))
  • Added more Icons in component config for easier indication (e.g. if a field allows formulas)
  • Added Effect Change Data-handling of Active Effects

Fixes

  • Fixed a bug, where 'See hidden attributes' was missing in Items
  • Fixed deprecation warnings
  • Fixed Label message style to In Character
  • Fixed Item Displayer computation system to compute name and id even if no other column is present
  • Fixed performance issue in function importation

If you encounter any issue with this new version, please post an issue on Gitlab : https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/new

formal goblet
# granite iris And is there a way to make a label clickable? Like one the the stat is Body, and...

Whenever you define a Label Roll Message in a Label, the Label becomes clickable.

For the Roll-Formula part:

${roll:= [1d100]}$
${roll < body ? 'Success' : 'Failure'}$

Check the Wiki to see how Formulas work: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System

formal goblet
# rapid hare Still nothing, but now that I'm a bit less frustrated, I'll briefly explain how ...

I see what you did. Remove the [[]] from your Text Fields and make sure, that only Roll Formulas like 1d20 are surrounded with []. And also make sure to not use @, the key name is enough in formulas. You should also remove ${}$ from the Text Field.

c_roll

ceil([1d20] + (dex - 10) / 2 + dex_mod)

e_roll

[1d20] + fetchFromActor('target', "wis", 0)

Label Roll Message

<br>
Caster's Roll: ${${!c_roll}$}$
<br>
Enemy's Roll: ${${!e_roll}$}$
<br>
fallen coral
#

I created a table roll from a compedium (which I created from a folder of items). When I roll it, although the dice roll works, it displays null as result in the chat. Is there a way to fix this?

formal goblet
runic oyster
#

Thinking, what I ought to do is diagram out the functions I want to implement

normal ore
normal ore
#

I think it would be the data. To include it in my global scripts.
I'm not sure if I made myself clear!

#

exemple:

{
    id: 'fogoabsorcao',
    name: 'Fogo Absorรงรฃo',
    icon: 'worlds/legend-of-lost-rings-csb/assets/icons/fogoabsorcao.png'
  }

If I built this active effect in the component, Iโ€™d like to know where I can view it in this format.

formal goblet
#

Check the prototype chain of the Actor to make sure.

runic oyster
#

Wish I were better at this but here's all the essential boxes down for just the Pilot

#

It'd probably be smarter to move Premonitions and Rage out from the Attribute table to make it a dynamic table, but I can't wrap my head around dynamic tables

earnest imp
runic oyster
#

Two versions of the same table. Is there any major benefit to using the Dynamic Table that isn't merely streamlining of setting up functions?

austere lava
#

Hey hey. could someone explain to me how the item filter formula works. I have been through the README and cant find a fix.

I am trying to use a drop down table to set the slot the item is supposed to be sorted into but I cant seem to get it to do anything.

austere lava
#

Also this seems to resolve as true but I cant work out why.

#

it appears that most everything defaults to true unless the result is specifically false.

austere lava
#

I think there is a bug here that causes the last radial button to always be selected regardless of the one picked as when I close and open an item window or an inventory item window the item's radial button resets to the last slot.

dense pine
rapid hare
violet orchid
#

How can I programmatically create an item and attach it to a token's actor?
The behavior I want to achive is that when conditions in my module code are met, I want to simulate opening a tokens actor sheet, drag&dropping an item on it (I know the item's id and name). Ideally I would want to first modify that items default props and then attach it to the actor.

formal goblet
dense pine
formal goblet
formal goblet
potent fossil
#

Hello !
I'm using
game.actors.forEach(actor => actor.items.forEach(item => item.templateSystem.reloadTemplate()));
to try to reload all the item of my world. But it doesn't seem to work unfortunatly. Is this macro depreciated?

formal goblet
#

It will only update Items inside Actors (within the Actors-Tab), it won't actually update all Items

potent fossil
#

Yes, that's what I meant. It's odd cause I have like several instances of items that were not updates inside my characters' sheets

#

and that's hours after executing the macro

formal goblet
# potent fossil Yes, that's what I meant. It's odd cause I have like several instances of items ...

Try this one here:

const documents = game.actors.filter(actor => !actor.isTemplate);

for (let i = 0; i < documents.length; i++) {
  const items = documents[i].items.filter(item => item);

  for (let j = 0; j < items.length; j++) {
    SceneNavigation.displayProgressBar({
      label: `${i + 1} / ${documents.length + 1}: ${j + 1} / ${items.length + 1}`,
      pct: Math.round((i * 100) / documents.length)
    });

    try {
      await items[j].templateSystem.reloadTemplate();
    } catch(e) {
      ui.notifications.error(`Couldn't reload Item with UUID ${items[j].uuid}`);
    }
  }
  
  try {
    await documents[i].templateSystem.reloadTemplate();
  } catch(e) {
    ui.notifications.error(`Couldn't reload Actor with UUID ${documents[i].uuid}`);
  }
}

SceneNavigation.displayProgressBar({
  label: 'finished',
  pct: 100
});
potent fossil
#

seems like it always gets stuck around 7%

formal goblet
potent fossil
#

let's give it a try

patent dust
#

Hello guys! I'm trying to build a character sheet with this feature. In a tabbed panel I have a checkbox on tab 1 and an item container in tab 2. I'm trying to create an automation that shows to the player the item container when the checkbox is checked and when the checkbox is unchecked the item container should disappear. I tried a lot, but I fail every time ๐Ÿ˜ฆ can you help me?

raven seal
jaunty sundial
#

Hi. I made a primitive button that deals damage to the target token. This button changes the target's health to a number, and can lower the value below zero. How to prevent the number from decreasing below 0?

Some code ๐Ÿค“

${
setPropertyInEntity('target', 'HP', "target.HP - [1d:DMG*2:]")
}$
raven seal
jaunty sundial
austere lava
#

Do the radio buttons work for everyone else because mine seem to be bugged? Open an closing the item window seems to always result in the last option being selected.
I checked the read me and it says that it would happen if you have more than 1 default selected but in my case I don't have any set to default. I have tried it with 1 set to default but its the exact same issue.

formal goblet
austere lava
#

Amazing thank you

atomic wedge
#

Quick question. I see that there is a Replace function that I can use in the Custom System Buider. Are other string functions available, too? Looking for basic stuff like substring, instr... stuff like that. Any idea where to look or what they are?

formal goblet
atomic wedge
#

O.k. I haven't used scripts yet. Lemme give it a try.

formal goblet
runic oyster
#

Full disclosure I only understood maybe half of that ๐Ÿ˜”

raven seal
#

Also dynamic tables can be expanded more easily, good if you characters may be picking up extra skills down the line depending on your system

runic oyster
#

Alas, not an option here

#

(I say 'alas' like it's not sparing me the headache of having player-defined custom variables)

#

...Suspecting there has to be a better way

formal goblet
runic oyster
#

The question is whether or not that would even work here, and how, as this nightmare table is supposed to reflect the system's base 'to hit target' mechanic

formal goblet
#

But in most cases, Items and Item Displayers have more options than Dynamic Tables.

#

You can also download the example-module in the package manager. It contains solid examples of how you can structure your system.

runic oyster
#

I have indeed done that, and it's been a major help in setting up the basic attributes table!

cloud dust
#

so i'm using this with sheexcel and when i do /r @sheexcel.AV it gives me the correct result, but if i put [@sheexcel.AV] in the initiative formula box, it's always 0. what am i doing wrong?

runic oyster
#

Looking at the items, the only way I see it working in this case is if I make 36 different items for each character, including NPCs

#

I'll explain after I shower

formal goblet
cloud dust
cloud dust
#

this is what i could find on it

formal goblet
#

Try the approach for Macros and use that within script-delimiters:

%{return entity.entity.sheet.getSheexcelValue('AV').value}%
cloud dust
#

...eh?

#

i think i get it?

formal goblet
#

You do? ๐Ÿ˜…

cloud dust
#

... no

formal goblet
#

Create a random Label and copy-paste the content and see if you get something out of it

cloud dust
#

"oh cool so this lets me use spreadsheets i can link them together instead of rebuilding them and save time"
takes a step into a puddle and starts drowning

raven seal
formal goblet
#

I think it's more complex trying to get your system work with Excel instead of building it entirely within CSB in the long run

cloud dust
#

when i click AV test nothing happens ๐Ÿ˜…

formal goblet
#

Check the console for errors

cloud dust
#

every click gives me this

formal goblet
cloud dust
#

i found this

formal goblet
# cloud dust i found this

It's good to know but not what I was looking for. I literally mean the functions in the prototype of this instance.

cloud dust
#

oh hey

#

i moused over value and used what it said in the pop up for %{return entity.entity.flags.sheexcel.cellReferences[2].value}%

#

and it worked

formal goblet
#

Yeah yeah, that will work, but is not a clean way to be fair.

cloud dust
#

is this what you were looking for ๐Ÿ˜…

#

i'm not quite sure what you mean

formal goblet
#

The top-level one

cloud dust
formal goblet
#

Yep, looks better

cloud dust
#

i'm sorry i'm not good at this ๐Ÿ˜…

formal goblet
#

But that's the prototype of the PrototypeToken. I need the prototype of the sheet (the top-level one, probably ActorSheet).

cloud dust
#

i see a CustomActorSheet with an ActorSheet inside it

formal goblet
#

Should also be fine. Show me that

cloud dust
formal goblet
#

Ok, I don't see the getSheexcelValue() anywhere, so the module fails to inject the function into the prototype of the Actor Sheet.

See if the second macro code works for you:

%{
return game.sheexcel.getSheexcelValue(entity.entity.id, 'AV').value;
}%
cloud dust
#

it does!

formal goblet
#

Then work with that

cloud dust
#

thank you!

#

i'm sorry if this was a headache

formal goblet
#

Not really, it was one of the easier issues ๐Ÿ˜…

cloud dust
#

i applaud your abilities

runic oyster
#

Back, system explanation time.

The way Celestial Bodies works is that every character in combat is represented by a 6x6 grid, with a portion of that grid being a 'valid build space' determined by the class of that character. In this provided example, the valid build area is 3x5. Within that valid build space, parts may be installed, with each part having a listed set of dimensions on top of their listed functions.

When attacking a character, you roll 2d6, determining column (10s) and row (1s) in that manner. After applying modifiers to the roll, the remaining co-ordinates is the square that's being targeted. From there, these checks follow in order:

  1. Is the attack within the build area? If not, the attack misses.
  2. Is the attack targeting a space covered by a shield (cyan area, generated by the blue Shield Generator)? If so, check if the Shield Generator is also in that space; if so, double the damage, otherwise/then apply damage to the shield. If the shield is destroyed and there is remaining damage, move to 3
  3. Is the attack targeting a space covered by armor or reinforced armor (brown-red area, standard armor)? If so, reduce damage by 1 for armor or 3 for reinforced armor. If there is remaining damage, move to 4
  4. Is the attack targeting a space that is damaged or a part that is disabled/destroyed? If so, activate Critical Hit effect.
  5. Apply remaining damage to target's HP total

This is a rough outline and isn't perfect, but I do hope it outlines the mechanical crunch the system has

#

All this considered, I don't know how using items to represent the grid itself would work out

#

Using CSB's item system to represent the items in this game is something I definitely want to do, as that can be used to easily store range/damage values, weapon tags, etc - hopefully even the grid dimensions but that might be going even further beyond my capacity to make this work

formal goblet
runic oyster
#

So, for now, I think I'll drop including grids in the character sheets and we'll just draw them out into the vtt play area

sharp vortex
#

Hello! I am, completely new to CSB and in need of some help making a character sheet that is probably more then a tad complicated to compile. Would anyone be available for me to drop a lot of questions?

fallen coral
#

Is there a macro to create a character actor using a predefined template? ๐Ÿค”

formal goblet
obtuse birch
#

hi, just one question
i did not understood how to put the text in the middle (example trauma)

#

the trauma text is a label btw

formal goblet
obtuse birch
#

i'm a bit of a newbie, can someone explain why this two sheet are not synced?
the one on the left is the one that open when i double click on the token
the other is the one that i open from the actor tab

formal goblet
#

Go into the Prototype Token and change that

formal goblet
obtuse birch
#

thx

#

i'll not enter too much in detail but i have a problem in this macro, the problem is that i cant fetch the DEX value, i dont know what's wrong honestly, it keeps reading 3 for some reason

formal goblet
novel pilot
#

Okay, I have (probably stupid) question - if I want to use value from sheet in initiative calculation in Settings, how should I write it. I tried [1d10+KEY], din't work.

novel pilot
obtuse birch
fallen coral
#

Once the character is created

formal goblet
formal goblet
#

You'll probably need to write your own mapper, which can take up a lot of time

fallen coral
#

I see... in this case, sounds like it would be easier to structure from the exported actor json and simply import it normaly...

#

thanks

last narwhal
#

Heya everyone. New to the club, currently trying to create an acteur sheet for Cities Without Numbers since the stuff on Foundry doesn't work with v12. It's been ages since I last coded something and I'm probably stumbling in way head over heels.

Currently I am trying to create a simple stat block that returns certain modifiers when you enter attribute values.

You can find the modifiers in the attached image.

Now I've created a dynamic table (attached as the second picture). The third column of the table should output the correct modifier for the corresponding row. I've tried some switchCase shenanigans, but I guess my code just is wrong.

$switchCase(sameRow('attribute_base'), 3, -2, > 3 : <= 7, -1, 8 : <= 13, 0, 14 : <=17, +1, 18, +2)$

(It's okay to laugh, I gotta learn. ๐Ÿ˜„ )

plucky canyon
#

I'm having trouble with an item container and a formula in an item modifier. For some items the desired effect works (to change 'working' to 'destroyed'), like for ECM for example. But for some it doesn't work. When I change the name filter to for example 'Backup Fire Control', nothing happens. I can't figure out why some are working and others aren't. What am I missing?

This works: ${fetchFromActor('attached', "lookupRef('perks', 'perk_destroyed_actual', 'name', 'ECM')")}$

This doesn't: ${fetchFromActor('attached', "lookupRef('perks', 'perk_destroyed_actual', 'name', 'Backup Fire Control')")}$

formal goblet
formal goblet
plucky canyon
#

Am I missing a filter?

formal goblet
plucky canyon
#

Good idea! I'll have a look. Thanks!

#

Hmm... it doesn't show up at all. Weird.

cobalt mango
#

Hello. I'm getting the error above when choosing an option called "Test" from a dropdown.

#

The dropdown is configured as such: (it's from an item owned by the character)

#

And this is the dynamic table 'Attacks' on the actor:

#

It's getting the attack label instead of the attack value like I thought it would

#

what am I misunderstanding please? ๐Ÿ˜…

formal goblet
cobalt mango
#

Sorry, I was trying to be concise

formal goblet
#

So I assume you want the value of Test instead of the string 'Test'. Use ref(dropdownKey)

cobalt mango
#

I thought that the option that says "Column from the dynamic table to use as option key" (in the dropdown element) meant that it should get that value

#

but it was my own guess not based on much

#

Do those two option just mean that it's either one or the other based on what I fill in? and not both

#

I wanted to show on the user end the Attack Label, and get the Attack value inside the key of that dropdown

#

does that make sense?

formal goblet
cobalt mango
#

So the attack value is numeric (it's a 9 in the screenshot) while the label is a character

#

but it's trying to transform the attack label into a number instead of using the value

#

the dropdown key let's say it's "Attack_dropdown" I wanted to set Attack_dropdown to 9 instead of setting it to "Test" and I thought that's what those two options in the dropdown element would do

#

I'd rather not show the keys on the front end because they get uglier than what's shown here

cobalt mango
#

Alright at least I'm doing something right if you say that. I'll try making new sheets from scratch to see if there's something else messed up idk

#

the error is happening because I'm using Attack_dropdown is a formula (by adding it to other numbers) but it's trying to add the label

formal goblet
#

You can try to verify your values with game.actors.getName('actorName').system.props & game.actors.getName('actorName').items.getName('itemName').system.props

cobalt mango
#

is it possible that dynamic tables that have labels in them don't quite work?

#

because it's not showing the attack value but it's showing every other row in the dynamic table here

#

just guessing because it's the only row that's a label in there

formal goblet
cobalt mango
#

I changed it to a text field and it started working... however the result was showing correctly when it was a label (9)

#

ugh I'll stop for a bit and triple check everything else because I don't want to throw you for a loop when maybe I missed something else obvious

formal goblet
#

You also have warnings with uncomputed props. Are your labels present in there?

#

Because that would be a valid reason

cobalt mango
#

Ooh silly me. yeah the label formula for that field wasn't going off correctly

#

๐Ÿคฃ
I apologize

formal goblet
#

Btw, you have to make sure, that all Dropdown option keys are distinct from each other, otherwise they will be treated as the same selection

cobalt mango
#

option keys as in "Test" not being duplicate?

#

btw the above was my fault but it's weird that it was showing me the result even if it wasn't computing everything that's part of the formula, isn't it?

#

like, decide if the label is good or bad ๐Ÿ˜„

cobalt mango
formal goblet
#

option keys shouldn't be duplicates, while the labels are... it doesn't care about labels at all

cobalt mango
#

so this is good

formal goblet
#

Yep, doesn't care at all. But your users will be confused ofc ๐Ÿ˜…

cobalt mango
#

of course lol

#

Now that I think about it

#

of course if the keys are the same it's as if they're the same selections..

#

right?

#

because it is.

formal goblet
#

Yep, technically it is

cobalt mango
#

I mean if they get to 9 by a different formula it's still a 9

formal goblet
#

But that could result in displaying the wrong label

cobalt mango
#

Ohh ok

#

That's fairly inconvenient if I was making a product

#

but I'm not ๐Ÿ˜›

#

Thanks for the warning. I'll keep it in mind. Dunno how to solve it atm to be honest but it's for another day

#

I'm back to working on the system. thanks again ๐Ÿ˜„

formal goblet
cobalt mango
#

I wanted to leave it open because the system I'm working with is a bit open ended so new stuff might come up where you have to make your own custom attack for example

vagrant hollow
#

I am trying out the brand new, all exiting feature of active-effect-displayer and ran into some points I do not understand:

When I drop a fresh token on the canvas and via status-effect submenu add its first effect, this is not sowing up on the token. I need to ad a second effect, then the first one shows up as well. Seams to happen only once with every token. Bug or old man stupid?

I donโ€™t understand the function of the โ€œActive Effect Reference Column Labelโ€. What other possibilities beside โ€œNameโ€ exist? Can several be placed beside each other (divided by , /- or similar)?

When I hit an effect shown inside the displayer, a new window pops up I have never seen before and I was not able to find any description for this inside the CSB or foundry Wiki. What are itโ€™s possibilities?

If I change some values in this last window, this will not used by an other token if it gets the same effect and the changes will be reset once the effect is closed?

cobalt mango
#

I'll concat the end value with the row line number * 0.001

#

then round down the result

formal goblet
# vagrant hollow I am trying out the brand new, all exiting feature of active-effect-displayer an...
vagrant hollow
tribal tapir
#

Hi, is it possible to insert an item modifier that give you back a text on a label on the player sheet?
For example, i have insert a label under "Professione" and i want that when i put an item in "Professione", it will show the text i can set on the label.

#

@formal goblet

formal goblet
tribal tapir
tribal tapir
#

for example when i put a profession on the item container and it shows something like that: TEST - Congratulation, you have a profession.

formal goblet
tribal tapir
#

Thank you very much Martin! The more i go deep into CSB more things i discover โค๏ธ

atomic wedge
#

Yes... this is amazing. Thank you.

tribal tapir
formal goblet
tribal tapir
atomic wedge
#

I have a complicated roll formula... and rather than writing a version of it for every attribute in my system, I wrote the following:

${score:=AWR}$

${[${switchCase(ddRollMethod,'Default','${switchCase(score>=12,true,'${floor(score/3)-1}$d6kh3+${score-(3floor(score/3))}$+2','${floor(score/3)}$d6kh3+${score-(3floor(score/3))}$')}$','Straight Up','${floor(score/3)}$d6kh3+${score-(3floor(score/3))}$','Remove d6','${floor(score/3)-1}$d6kh3+${score-(3floor(score/3))}$+2','${floor(score/3)2}$+${score-(3floor(score/3))}$')}$]}$

So far so good. But the assignment of AWR to the score variable causes Foundy to output AWR in the roll output.

#

I am not expecting the 10... just the 16. What am I doing wrong?

formal goblet
atomic wedge
#

That was it. Thank you.

formal goblet
#

Otherwise, everything, that is not hidden, will be shown

atomic wedge
#

It was a mother to write... glad I don't have to do it again. ๐Ÿ™‚

#

Is there a different method for inside a label?

${#score:=PUNCHscore}$

${floor(score/3)}$d+${score-(3*floor(score/3))}$

#

Once again... not expecting the 3.

formal goblet
atomic wedge
#

NaN.... I think the script doesn't like converting numbers to strings....

#

In case anyone else is trying to do this:

%{ const score = ${PUNCHscore}$; return Math.floor(score / 3).toString() + 'd+' + (score - (3 * Math.floor(score / 3))).toString(); }%

#

Just had to do a couple of explicit datatype conversions....

Thanks for your help!

formal goblet
atomic wedge
#

I kinda thought that, too. I am a programmer, but this is a new language to me... so I figured it was just some syntax-thing.

formal goblet
atomic wedge
#

I cannot believe how far I have been able to take CSB... it's pretty damn cool.

jaunty sundial
#

Hello everyone. I'm trying to understand the syntax and make a hit button whose damage is equal to the value from the number field.

Some code ๐Ÿค“

${
setPropertyInEntity('target', 'HP', "max(target.HP - sameRow('STAT_VALUE', 0), 0)")
}$

But I want to output sameRow('STAT_VALUE', 0) separately to a variable. Help please :3

formal goblet
formal goblet
jaunty sundial
#

TT_TT

#

Well. We have a problem.

#

What should I do then?

#

if I just have a number and need to subtract it from the target's health

formal goblet
#

Well, either you adjust the stats manually after an attack or you write your own script, that lets the update go through the gm-client

#

I've never stepped into the 2nd path, so I can't assist there

jaunty sundial
#

I remembered one way

#

In SWADE system damage is dealt only after the GM clicks on the button in the roll message

#

player generate, gm approve

formal goblet
#

Yep, like I said, the final update must go through a GM

#

Because players simply are not allowed to

jaunty sundial
#

Well. Now I need to make a button :/

#

But how? Panic...Panic...Panic...

#

I'm still sorting through the options, I'm getting scared.

formal goblet
jaunty sundial
#

๐Ÿซ 

formal goblet
#

Are you familiar with Javascript?

jaunty sundial
#

๐Ÿค

#

I made a character template in obsidian based on the plugin

#

there are a lot of lines, not very good code, but it's an honest job.

formal goblet
#

Well, this would be my concept:

  • HTML-Button with data-attributes (target-uuid, changes-array with key-value-pairs, that represent the changes) and an onclick-handler
  • The onclick-handler fetches the target-uuid from the data-attributes, fetches the Actor according to the UUID and then updates the props of the target according to the changes in the Array
jaunty sundial
#

I'm not sure what exactly an array is needed for the changes. Or maybe it's worth it anyway. It looks very specific. in my opinion

#

it would be possible to simply add more buttons for each change and press the necessary ones

formal goblet
jaunty sundial
#

The time for talk has passed. It's time to press the BUTTONS!

#

I also realized that right now my damage calculation button only works with 1 target.

#

That's not good

formal goblet
jaunty sundial
#

arrays of arrays ๐Ÿคฃ

formal goblet
#

Nah, we're not that deep yet

jaunty sundial
#

fetchFromActor get 1 target, yep?

formal goblet
#

Yeah, that's always 1

jaunty sundial
#

That's not good

#

ok

#

1 means 1

formal goblet
#

Check game.user.targets in a script

jaunty sundial
#
actor = game.user.targets.values().next().value?.actor;
#

It's time to modify it

#

๐Ÿ˜ˆ

formal goblet
jaunty sundial
#

I just copied it from a file in a folder

#

Well

#

what do we end up with

jaunty sundial
# formal goblet That's our source code, I can recognize this ๐Ÿ˜‚
  • no array of targets from fetchFromActor (which is not very pleasant, but it is not necessary as long as there are no buttons)
  • no buttons for roll message (which is certainly difficult to implement [for me])
  • but stats buttons work very well on my character (because I began to understand the syntax of the system even better)
  • I'm tired after the game and it's time to sleep

What do you tell me about this, friend?

formal goblet
jaunty sundial
#

but it's already 3 am for me. And something inside says it's time to stop

spark nimbus
#

Hey all, working on a project and I'm trying to use dynamic tables for some automation and I'm unsure how to have the options but not have them editable when it's suppose to be used. Thank you for suggestions and direction.

tribal tapir
#

Hi again, i'm trying to manage the "weight" of an item in an inventory (in this case 3 items with 0.1 value each) but when i put 3 object of the same type the measurement of weight goes crazy. How can i solve this?

formal goblet