#Custom System Builder
1 messages · Page 55 of 1
The actors in game.actors is an Array (actually a Map to be more precise). You can't use subsequent keys on Arrays.
You have to think from the perspective of a Token. That's where your relative path starts
Is Automatic Sorting in Item Containers broken, or is there something specific that I need to do in order to get it to work?
can you tell me how i can get the token path?
As you can see above, the sorting is set, but it isn't actually working on the sheet for some reason.
thank you
Which column is actionSorting?
actionSorting is the Column on the Character sheet in the top left that shows the numbers.
IE, 14, 8, 6. Etc. Right now, it seems to sort by name only any time I enable auto sorting.
Anything in the console?
There are some errors, but I think these are standard errors.
Yep, these don't concern us
I haven't seen any other odd behavior on the sheet. Basically, I'm trying to build a template for action orders, but when I duplicated a sheet, I found that the new sheet doesn't respect the manual order I set on the template sheet.
So, I'm just trying to find a way to not need to manually sort the actions every time I create a new Character Sheet.
no idea where to find the attributes in a token i can see them when i do _token.actor.getRollData() but i don't get the path
For drag ruler you need: actor.system.props.MOVEMENT
Thats the path that works for drag ruler in my world.
Is the MOVEMENT coming from a numerfield?
Works like a charm for years now
Does your property have a value for the token you try to move ?
Are you using the full path (with actor.system.props) ?
Ah, do you have like an x in the sprint multiplier or something? Because that's a drag ruler error that's showing in your error log, and I didn't see an x in your map from earlier.
I sorted my problem out anyways. Thankfully, it turns out that Duplicated sheets automatically sort by "Order Added" not by Name. So, that's totally managable for my purposes:) The fact that Autosort doesn't appear to work isn't an issue for me now, but thank you! 🙂
I did wish to share something with other CSBers, by the way. I was having a problem on my very complicated sheet for my own system, vG WoD, where the sheet wouldn't "Refresh" the Character sheet after running the roll macro, probably due to the time needed to recalc the sheet, and this was resulting in issues where the Sheet wouldn't be sync'd with the background values for the Actor.
I found a way to fix this very neatly. The following code at the end of the Label Roll Message code makes it function perfectly, and the time can be adjusted based on the size of the sheet.
${#%{function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
(async () => {
await wait(5000);
// The sheet is likely `entity.entity`, but here's a robust version:
const actorSheet = entity?.entity ?? actor?.sheet ?? null;
if (actorSheet?.render) actorSheet.render(true);
})();}%}$
Obviously, my sheet is quite large and complex. So, I give it a full five seconds to do its thing.
I have 0 in there
yes movement shows up in the token and yes i was using the full path
I wonder where it's getting that x from then.
Could you show me the configuration of the MOVEMENT field ? 🙂
even when using a different number field it doesn't work but i can show you regardless
i'll try changing the 0 to 1 i guess
hmm
From what I can see from the error message, this is not an issue with the movement property after all, but with Drag Ruler. Specifically, it seems the module is unable to get the destination's coordinates :/
What is your version of Drag Ruler ? And is your map Gridless ? It looks like Drag Ruler v1.14.0 does not work with gridless maps
i'm using a hex grid but maybe i have the wrong version of foundry
Can you tell me your Foundry Version and your Drag Ruler version ?
Foundry version can be seen at the top of the Settings tab on the right hand side, and Drag Ruler Version can be seen in the Module Manager
Yeah, I recommend updating your Drag Ruler module, it is compatible with Foundry v12 starting from 1.14.0. With 1.14.2 it should be okay
No problem, glad you could sort it out !
Yep, incompatible version
thank you guys very much for the help
Hey everyone, I was hoping you can help with something. I am trying to add my initiative rolls to the combat tracker. Ex: I want to click on my initiative roll on my sheet and tie it to the combat tracker. Is there a way you can do that?
apologies for ghost ping, was feeling a bit helpless and will do some studying on videos and see what else i can grasp before i try to ask through some things
Hello, I'm trying something in Custom System Builder. This works, but it rolls all 5D20, for all possibilities : normal roll, advantage, disadvantage. Is it possible to just roll 1 ou 2 D20, for the correct roll?
${#concat(
?{avantage:"Avantage"[check]|"0","Aucun"|"1","Avantage"|"-1","Désavantage"},
?{bonus:"Bonus / Malus"|0}
)}$
${avantage:=${avantage}$}$
${de:=${avantage}$ == 1 ? [2d20kh] : ${avantage}$ == -1 ? [2d20kl] : [1d20]}$
<br>
Bonus : ${bonus}$ Attaque : ${attaque}$
<br>
Résultat final : ${total:=[${attaque}$ + ${bonus}$ + ${de}$]}$
<br>
%{
const roll = ${de}$;
return roll == 20 ? "🌟🤩 Réussite Critique 🤩🌟"
: roll == 1 ? "💀 Échec Critique !"
: "Résultat normal";
}%
<br>
%{
if (!game.user.targets.first())
return "Pas de cible sélectionnée.";
let ennemyValues = game.user.targets.first().actor.system.props;
return ennemyValues.name + " : Esquive : " + ennemyValues.esquive;
}%
Every usage of [] will roll
Is there a way to avoid it? To have only the wright choice roll by changing the formula?
You create a string with the formula and pass that
I tried something like that, but I think I don't understand enough CSB and it didn't work. Is there something special in CSB strings?
You'll need a script for that. Try to ask in https://discord.com/channels/170995199584108546/699750150674972743, because I don't know it out of my head
Is there a way to conditionally stop a label roll message from completing? I want to add a kill switch to the attack roll if there isn't enough ammo. I tried %{throw 'Done';}% but I wasn't able to get this to run conditionally.
The condition must go inside %{}%
Because inner formula has prio over outer formula
I have one more question. I'm trying to debug some of the logic I have but I'm not entirely sure how to read the console. I know that I have a parenthesis issue but is there something in the console error that narrows down where the issue is occurring or do I just need to look at the entire data?
Do you have objects at the bottom of the error message?
Since everything inside [] is rolled, you can 'build' your roll formula outside the [] and then roll the correct one.
Instead of ${de:=${avantage}$ == 1 ? [2d20kh] : ${avantage}$ == -1 ? [2d20kl] : [1d20]}$, you can use 2 lines:
${FormuleDe:=avantage == 1 ? '2d20kh' : avantage == -1 ? '2d20kl' : '1d20'}$
${#de:=[:FormuleDe:]}$
First line build the roll formula, second line will roll it.
Oh, I didn't see that before! I found the formula but now I have to hunt to see where the heck I made that error.
Check the props. The name of the entity is in there
And if you want to be real fast, export your templates, open them with an editor and hit CTRL + F to search for it
I can at least tell, that it is a Label within an Item Displayer
Yup, I did what you said and found it instantly. It was a visibility formula. I accidentally added ${}$ when it explicitly tells you not to
It works, thanks a lot
is there a page that has all the variables for making formula?
I want to make a 10 + Con mod + prof formula
I might have come across a bug..?
I'm trying to roll a incoming damage roll, and when it gets pressed, nothing happens at all.
The main formula is:
"${round(${[:Incoming_Damage:] - [:Ammo_Type:] * ref(ref('Hit_Location')) - [:Body_Type_Modifier:] }$) }$"
I know that everything works if I remove "[:Body_Type_Modifier:]".
[:Body_Type_Modifier:] is from the Meter Component and has the formula: "${round(${([:Body_Score:]==1) ? 5 : (3-[:Body_Score:])/1.8 }$)}$"
[:Body_Score:] is a basic number field value (with a minimum of 1)
Any clue how to work around this?
Why are you using all the roll formula delimiters?
The formula in the Meter Component has an error. In there, using [] is not allowed
There might be an easier way to do this, but I'm quite new at this
The Meter Component shows the correct value, it just doesnt work when used for the roll
is it a static number, or something like a die code?
The Meter probably shows an old value. It can't compute the actual one without fixing the formula first
What he's saying is that inside a component (not a label roll message) you can't use the roll delimiter, so if you replace [:Body_Score:] with just Body_Score it should work.
If I have a collection of checkboxes, such as in the screenshot, is there a good way to see how many of them are checked at any given time and then adjust things elsewhere in the sheet if enough of them are checked?
So, those checkbook are just booleans, idr if they're considered 0 and 1 or false/true for the purposes of math, if the former is true, you could have a label where it just sums them up (like ${sum(check1, check2}$ etc) and then if you need more than a number go to conditionals or a switchCase() from there. If it's the latter, then you're kind of stuck with longer conditionals inside the sum(), like ${sum(check1?1:0, check2?1:0}$ (though you might have to make those sub formulae instead, I'm not at the computer to remind myself right now).
Hey! Quick question - is there a way to trigger macros through a Label Roll Message in CSB? Or at least to change stats like HP with it? Like, press one button to add some HP, press another to subtract?
Yes and yes, if you want to simply change a value on the character sheet by clicking a label you can use setPropertyInEntity(...) in a label roll message :
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Formulas/Functions/setPropertyInEntity
If you want to call a macro, you can do it by calling a bit of javascript with %{return await game.macros.getName("macroName").execute();}%
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Guides/Formula-System#calling-macros
thanks for the help!
so when should we expect custom system builder to be updated for V13?
quick question i want to get a value in the character sheet (skill value) based on a dropdown selection in an item the keys of the dropdown in the item are the same as the skill keys. i want to roll with a label in the item displayer how would i do that
ref(item.dropdownKey)
Currently no estimation. We have to refactor quite a bit of the code. See here: https://discord.com/channels/170995199584108546/807029112215830588
thank you very much i was going crazy i tried multiple versions of 'item.key' with [], :: , double ' ' and so on XD
another question ${#damage:=item.itemdamage}$ doesnt seem to hide the element in the chat box is the # not working or did i something wrong?
Is this enabled?
yes it was... i feel dumb 😅
thank you
now it works as intended
i guess i activated that because i thought private rolls where meant by that
Is it possible to get these panels to hide based on whether the PC has a spell of that rank? I've used rankx_spells.length > 0 for the visibility formula and that seems to work to hide them, but once the PC gains a spell of that level the list never disappears - even if they lose the spell.
Try out count(lookup(...))
So I am looking up options to checkbox something if another value = true. Slowly chipping away at these codes but if I want the formula to be invisable do I need to code it elsewhere and just have the code lookup the value? or can it all be in one place?
Basically trying to get my status conditions automated with fatigue stuff.
At which event should the value be set? Whenever the sheet is being updated? Or whenever you execute a Label Roll Message?
Whenever the sheet is updated. It would relay on the character's sheet not the over all world? If that makes sense.
Like if the character's Fatigue = 3 then the sheet would update to checkbox the statusCondition Restrained.
Well, either you use Labels to show the status, so these can be automated with formulas. Or you have to rely on a world script, which actually listens to your sheet updates and applies changes when needed.
Okay! So I should make a sperate Actor sheet just for all the status effect code/calculations? (still my first time really getting all this progress done. XD so apologizes. )
Pretty easy to do just wanna make sure I don't waste time working through something and handling it wrong. XD
Not really? I mean, every character has his own status effects, so these aren't shared.
So the template should have the code built in. Gotcha. Wanted to make sure.
So currently within a Label text I have this code, not sure if it will auto checkbox the restrainedStatus. Basically trying to code if this box is checked then effects happens else nothing happens.${restrainedStatus == true ? moveSpeed == 0 : none}$ ${(occInvSlots == maxInvSlots) or (armorSlots >= mitStat) ? restrainedStatus == true : restrainedStatus == false}$
Just realized I am missing something else. Will have to fix that code later though as it will take some extra reading. But will keep this up for now.
A label text is not able to change the values of other Components. You can only influence, what is being displayed in the Label itself.
Also, the == is a comparison operator, it doesn't set anything.
ah i see. Will need to re-read through some of the stuff to see how to code at least some kind of toggle effect. 🤔 Getting one step closer though. XD It has been fun coding and figuring this out slowly but surely.
I'll help you with some constraints:
- Input Components (Number field, Checkbox, Dropdown, etc...) cannot be dependent on other Components, but users can change their values
- Computable Components (Labels and Meters) can depend on other Components, but users can't change their values
😮 📝 I see. Hmm... probably need a visual to activate when the effects are active rather than relay on the checkbox being the visual. Just to see if it works with both of these kind of components. 🤔 Cause I do want the option for players to click to toggle the effect if an enemy causes it, or for the character sheet itself to auto toggle it if they become effected by something else within the code.
Will try to trouble shoot this idea a bit more.
I do have something similar with how Proficiency works with the check boxes so maybe I can play with that concept a bit more.
There's also one small edge case:
Let's consider, that a player toggles the effect manually to ON. Afterwards, a certain condition applies and the effect would be toggled to ON (but because it's already ON, nothing changes). But what should happen if the condition doesn't apply anymore?
I think I could use something with the true or false or the true nor false kind of code? Like if one of the list of things is true then it all equals true else the function equals false that is the idea anyway. Would that work? 🤔
Then you just use or, if at least one of the 2 cases should apply
Okay! Then I will play around with that and see where it gets me. :DDD Probably won't get another update from me for a little bit. But once I start messing around with this again, I'll be sure to post here of any results. ✨
is there a macro or console command that tells me the datatype (?) of a specific component or hidden attribute? Lets say i have a hidden attribute "INFO" and im not sure wether its an array, string, number, true or even undefined. How can i find out?
There's even a function in CSB: typeOf()
Hello, just a very quick question: There's no way I can run CSB with Foundry version 13, right?
Currently not supported
Hi, small question concerning dynamic tables and sameRow function.
Is there a known issue or limitation when the column is a label ? I have a dynamic table with several columns (Text fields, Number Fields & Labels). When I try to get the value of a label with sameRow I always get the fall back value.
It works fine when I change the column type to a number field, but labels won't work. There are no alerts or errors in the console.
I can change my column to a number field, but it will be weird to have a number fields where min & max value are the same.
Try it without the fallback value
It works. Weird but it works. Thanks.
With some html code this now give a nice effect.
Is there a way to call a sound to play when a condition is met? For example, can a blaster sound kick off if I make click the attack button?
I can't tell how, but you'll need a script for that
Hmm I was thinking so. I'm playing around with it but I might pop into macro polo to see if someone has already done it
Haha they sent me back here. I'll see if I can figure it out
Just ask them, how it's done via a Macro
Rest is just integrating into a Label Roll Message, which is pretty easy
Two more question! Is there a way to kick off a chat message x times? I have an attack roll button that works great but some of our guns shoot 2-5 times per action. Is there a way to have that roll run multiple times depending on a value passed or is that another JavaScript thing?
And last question, I have a macro built out but I'm not sure how to save it so that anyone can use it. Is there a place I'm supposed to save it or are there options that I need to enable to let others use it?
Thanks! I'll try this!
That is basically another script. Check this one here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Tips-&-Tricks/Handling-Dice-Pools
What dependencies does CSB have? I've updated everything to version 13 before realizing CSB isn't compatible so now I downgraded to 12 343 and I'm getting Incompatible dependencies on the Game world I've made with CSB.
Chat Commander
Perfect, thank you very much for your prompt help as always mr. Saint Martin, sir. 🥹
How exactly do you get an input prompt to display before I roll?
I'm would like:
Press the button to roll dice
Display a field where I can type in any modifiers
Output the roll with said modifier applied
You can find a bit of documentation under 4.8 User Text. This helped me get started so hopefully it will help you out too!
https://gitlab.com/custom-system-builder/custom-system-builder#48-user-inputs
${#?{modifier:'Bonus/Malus'[number]|0}}$ -> ask for a modifier
${#Roll:=[1d100]}$ -> Roll 1d100
Result ${Roll+modifier}$ -> should add the roll to the modifier and display "Result xxx"
Change the dice rolled as you see fit. You can also make a more complex result display without a scrip (just in the label roll area).
hello all
I will want to know why this code at the last past give me error
<table>
<th colspan="5" style="text-align: center; font-weight: bold;font-size: 15px;">
<p> Abilità: Armi da Fuoco </p>
</th>
<tr>
<th style="text-align: center; font-weight: bold;"><p>Dai che ce la fai !!!</p></th>
</tr>
<tr>
<td><p>Roll</p></td><td><p>${Roll:=[1d100]}$</p></td><td><p>Modificatore</p></td><td><p colspan="2" style="color:red;">${?{Modificatore[number]|0}}$</p></td>
<tr>
<td><p><strong>Risultato</strong></p></td><td><p><strong>${Risultato:=Roll + Modificatore}$</strong></p></td><strong><td>Vs </td><td><p style="color:red;">${lookup('abilit','abilitatetot','abilitate','Armi da Fuoco')}$</p></td></strong>
</tr>
<tr><th>${Risultato <= 2 ? 'Successo CRITICO!!!' :
Risultato >= 98 ? 'Mannaggia all'Apocalisse!!!' :
Risultato <=lookup('abilit','abilitatetot','abilitate','Armi da Fuoco') ? 'Successo!' :
Risultato>lookup('abilit','abilitatetot','abilitate','Armi da Fuoco') ? 'Niente da fare' : 'Errore'}$
</th></tr>
</table>
I had tried assign the lookup to a var but didn't work
why did not the Var 'Risultato' in the label roll can be reused ?
I tried also to showed it out without the condition formula and I saw it in the chat message
lookup() returns an Array. Comparisons with an array don't work.
You can use max(lookup()) to get the highest value returned in your array.
And since you are using the same lookup 3 time, you can add a line to declare the result as a variable.
${#VarNam:=max(lookup('abilit','abilitatetot','abilitate','Armi da Fuoco'))}$
You can replace the lookup by the VarName like when you used Modificatore.
I am going to try
I have used a sum() on an array, so the max should work.
It will transform the array in a number that can be compared to other numbers.
max() didn't work now I ll try with sum
otherwise there is also first(lookup()) that will get the first value. https://gitlab.com/custom-system-builder/custom-system-builder#425-first
it give me back like this now... but better than an error... and the number() function can help ?
I am tring in multiple ways
You've supplied a literal string to the max-function, which won't work. It can only take numbers or an Array.
but the result of my lookup is a number...how can I transform that in a number which I can compare into a condition ?
Here is an example : ${sum(lookup('CFI_ID_Equipment', 'CFI_ID_Equipment_ENC'))}$ will give an array of the weight of each item in my item displayer and make the sum. Lookup will give you a list of numbers (an array) even if there is only one.
The return of lookup() is always an Array
max() will give you the highest value of this array, sum() will make the sum of all the values in the array.
I changed like that just to try...
<table>
<th colspan="5" style="text-align: center; font-weight: bold;font-size: 15px;">
<p> Abilità: Armi da Fuoco </p>
</th>
<tr>
<th style="text-align: center; font-weight: bold;"><p>Dai che ce la fai !!!</p></th>
</tr>
<tr>
<td><p>Roll</p></td><td><p>${Roll:=[1d100]}$</p></td><td><p>Modificatore</p></td><td><p colspan="2" style="color:red;">${?{Modificatore[number]|0}}$</p></td>
<tr>
<td><p><strong>Risultato</strong></p></td><td><p><strong>${Risultato:=Roll + Modificatore}$</strong></p></td><strong><td>Vs </td>
<td><p style="color:red;">${#testdifficult:=max(lookup('abilit','abilitatetot','abilitate','Armi da Fuoco'))}$</p></td></strong>
</tr>
<tr><th>${Risultato <= 2 ? 'Successo CRITICO!!!' :
Risultato >= 98 ? 'Mannaggia all'Apocalisse!!!' :
Risultato <=testdifficult ? 'Successo!' :
Risultato>testdifficult ? 'Niente da fare' : 'Errore'}$
</th></tr>
</table>
but now doesn't die anymore also XD
How can I get that value from the array ?
even with the switchCase it won't work right ?
It looks fine now
'Mannaggia all'Apocalisse!!!' -> this might be an issue. You have a quote in the middle of the text.
Yeah, you have to fix that
aaaaaaah it could be !!!
You can use a \ before the quote inside the text
I am a jerk !!! fuck me
thank you so much guys!!!!!! thank you thank you thank you ❤️
ahahaha the quotesssss T__________T have a nice day guys !!!
hey is there a way to delete a item from the actor sheet if the value of a component called "uses" reaches 0?
If uses goes down by a Label Roll Message, then you can attach a small script in there, which deletes that. If not, you'd need a world script, which listens to changes in the Actor.
okay it would basically reduce by 1 everytime it is rolled for example a healing potion i have a roll label in the item container it rolls 1d6+1 and reduces the uses numberfield in the item by 1 . is there an example script somewhere in the wiki that i could adapt ?
ok before i fuck something up majorly would that work i havent used scripts yet?: ${item.uses = 0 ? %{linkedEntity.delete('item')}%}$
No, this will always delete
Because inner formulas are executed prior to outer ones
And the else-case in the ternary operator is mandatory
so would i write it this way? %{linkedEntity.delete(${item.uses = 0 ? true : false}$)}%
Also no. linkedEntity already represents the item in question. The delete()-function is called without any arguments.
This would be safer.
%{
const props = linkedEntity.system.props;
if(props.result == 1) {
await linkedEntity.delete();
} else {
await linkedEntity.update({'system.props.uses': props.uses - 1});
}
}%
Just keep in mind, that setPropertyInEntity() will defer the update until the end of the Label Roll Message.
ok so it would still sit in the inventory at 0 then? can i force setPropertyInEntity() before the script
No
You can however capture the result of it
with ...result:= ... correct?
I've adjusted it above
okay thank you very much
okay it deletes the item as intended but now the roll of 1d6+1 does not get trough before it is deleted
<h2><strong>${!item.itemname}$ Roll</strong></h2><h1>${![!:item.itemeffect:]}$</h1>
${result:= setPropertyInEntity('item', 'itemuses', 'item.itemuses -1')}$
%{
if(localVars.result == 0) {
await linkedEntity.delete();
}
}%
here is the code do i need to shift something around?
The order is fine. What is the error message in the console?
Adjusted
Just remove setPropertyInEntity(), it will be covered by the script itself.
ok i will try it
somethings wrong i guess result is not defined
ill try something
nope that didnt work i tried calling the itemuses but it calls them before the script
got it
<h2><strong>${!item.itemname}$ Roll</strong></h2><h1>${![!:item.itemeffect:]}$</h1>
${#%{
const props = linkedEntity.system.props;
if(props.itemuses == 1) {
await linkedEntity.delete();
} else {
await linkedEntity.update({'system.props.itemuses': props.itemuses - 1});
}
}%}$
needed to change if(props.result == 1) to if(props.itemuses == 1)
but thanks you were a great help#
Is anyone in here working on a Daggerheart system?
Question, could I use the Active Effect displayer for toggling or activating status conditions on a character? 🤔 Never mind I thought the action did something else my bad. Just trying to find a way to apply status effects similar to 5e's little status toggles.
Okay just one other question while I still work on that project on the side.
Where do I place my CSS file in maually? I know where some of the folders are located but it still won't let me select it. Sorry if I am missing some fine details.
Try right clicking the foundry tab and opening your directory from there
A good option is whichever world you are using
Okay its best to put it in the Data > worlds > world-name > data ?
Yeah, purely for organizational purposes
Ok, over the past few days I’ve been trying to piece together a working sheet for a pbta-like system
- It doesn’t use traditional stats, but instead has a series of tags which can by applied to rolls on a case by case basis
- I have elected to use check boxes and text fields for this for the time being
- rolls are done in a dice pool format, with a number of d6s based on the tags used
- It is going to need a compendium of moves and playbooks like a pbta style game
Any advice?
I am not sure why it still isn't allowing me to grab it through the CSS folder area. It is in there. Do I need to change the file type or something?
Oh, yeah, select the json file instead, then just change the file destination manually once you enter it
…I say with the confidence of someone that didn’t just learn this yesterday
It half worked but none of the additional details. But that could be a me problem but I now know that I can change stuff XDD
Thank you lots
One sec
This tutorial covers the basics to intermediate functions of CSB without the use of JavaScript. We cover item / actor templates and sheets, as well as what most of the components do at their core.
We do not cover CSB provided functions, or advanced uses of components (aside from the label), which will be left for another tutorial if there's en...
This is what helped me so far
I really need to save this video XDDD
Is it possible to modify a hidden attribute using an item modifier?
Is it possible to have an item modify a field within it based on the a value from the actor?
For example, I want weaponerror on the item to change if the proficient value on the actor is checked.
Yes, it is possible. I have items used for skills and the base value comes from the actor's attributs. I'll check the details later but you'll need to use fetchFromParent in your formula.
In the meanwhile you'll have more information here : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Formulas/Functions/fetchFromParent
Thank you - this site is what I was using as my inspiration to try it, but for some reason I am not getting any change based on when I check or uncheck the box on the Actor. Maybe my syntax is off.
Can you send the formula on discord ? Maybe someone can find the reason.
I am trying to use the Configure item modifiers option as I have a universal template and this effect will only happen on specific items.
Here is what I got:
Actor field is in an item displayer item.itemweaponerror
Actor checkbox: trainedswords
I want item.itemweaponerror to be 1 if the 'trainedswords' box is checked and 3 if not. I have a label called 'trainedswords' that will result in a 1 if the box is checked or 3 if not and this is what I want to use to populate the item field.
The default is 3 and the box is unchecked by default.
I put in the item modifier configuration:
Key: item.itemweaponerror
Op: =
Value formula: ${fetchFromParent('trainedswords')}$
The result is no change from the default of 3 and no errors on the log.
The issue is your key, because actor.system.props.item.itemweaponerror doesn't lead to a value. You can check your paths with fromUuidSync(uuid) in the console.
My apologies - I don't understand what to do for the check your path with... suggestion.
The value of a checkbox is False or True. Nothing else.
So you just need to make a IF-THEN to transform into your end value (1 or 3) -> ${fetchFromParent('trainedswords') ? 3 : 1}$
If the fetchFromParent give you True, you get 3 displayed, otherwise you get 1.
The console can be opened with F12. The UUID of the Actor can be copied with a click on the button on the top left corner of your sheet
I considered that so I created an extra field temporarily to help sort this out called trainedX this would result in a 3 if the corresponding box was unchecked and 1 if it was. I used that as my reference point. I am thinking it is using the item modifier to modify the item itself. I created a terniary formula to drive a similar result outside of the item modifier and it worked.
As long as it works. 😋
Is there a way to make certain rolls Private GM even if Public Roll is set as the default?
We only consider the default roll mode, there's no other setting
Hello fellow nerds.
Over the past few years I've written my own TTRPG system which I have been testing and playing in roll20 using HTML and Javascripts.
I've tried migrating it to foundry for a number of reasons but mainly its the ability to have custom compendiums to speed up character creation, and a less restrictive implementation of JavaScript for macros or scripts.
I'm working with the Custom System Builder first to see how easy it is to port this over.
I've been making an assumption which I guess is wrong.
In roll20 I'd define custom attributes (say if the Strength mod is attribute_str_mod) within the sheet's scriptworker sheet.
From what I've recently understood in CSB I need to instead define that as a hidden value and then call that value in a number field or whereever else I want it.
Is first defining it as a hidden variable the right way to do it?
Also how do I then call that hidden variable in a number field in a way that just displays the number but is uneditable?
From reading the documentation am I right in saying I don't call it as $[str_mod]$ because you don't want to call variables in a formula unless said formula is transforming the attribute/variable in some way shape or form?
I've just figured it out.
Labels labels are how I do that
You are right, you can use a Label for uneditable fields. As for hiding it in you character sheet, you can set any element as visible only for the GM or by a formula (just make it always false like 1 == 2).
95% of your derived values go into Labels, because Labels and Meters are the only Components, which recompute on every update. Hidden Attributes are handled the same way as Labels, just without any visual Component.
I was writing a script to edit the fields outside of their min and max to force a refresh 😆 knew I was doing it a weird way
Yeah, the typical Input Components like Number fields are just there to persist your values. They represent your base values of your system
How easy would it be to hook character creation in the CSB sheets into the compendium?
From what I'm reading I'm gathering I just need a script to parse the JSON files, which fields update what entries and then it should be good to go.
No complaints if its harder, this is already easier than making a custom HTML sheet with JS for the logic.
You mean the typical Foundry Compendiums? You just create a character sheet, adjust your values and drag the sheet into the Compendium
I mean for adding items from the compendium to the sheets themselves.
For example in my system there's already near 300 spells.
I'd like to be able to speed up character creation by having drag and drop from compendium to sheet
Yeah, that's possible
You just drag the Actors/Items out of the Compendium whereever you need it
I suggest to load the Templates into an Adventure Pack, so you don't get issues with different document IDs between different worlds or so. The other Document types (Actors, Items, Macros, ...) can be put in whatever type you like.
is there an easy copy paste hotkey for duplicate sections?
in the character sheet templates I mean
CTRL + Drag
Thanks, this is all shaping up to look like a much more custom friendly system.
Roll20 has served me well so far, but my god do scripts slowdown load times.
Also hardcoding an entire compendium in JS looked like a task that I'd rather die before doing
Yeah, you don't do that here. You simply just move the documents into the compendium collection and they get stored there
It will still take a lot of time to create 300 Items, because you have to set the values for each sheet. But that's natural
my player guidebook is pretty well formatted, especially for items and spells.
I'm just going to write a python script to convert the raw text separated by delimitators to a JSON file with the correct structure and then import them.
the on paper system is a good 80% done so I'm working from a good foundation.
Yeah, that should also work, as long as the schema is valid
might be a more generic Foundry question.
But would that be able to handle one item in the compendium filling multiple different field sections in the sheet.
For example I have a defined JSON structure for weapons, but also for actions. A sword would naturally come with an attack action for it. Or would I need to keep that seperated into the sword item and the action item for swinging said sword?
You could work with hiding/displaying certain actions or you actually itemize them for more reusability, that's up to you. Just be careful, that we don't support Items carrying other Items in Compendiums yet (the references will be discarded).
I think I can probably re-order my sheet design so that each item holds a hidden field for a roll if it needs it, and then show or hide that field based on if the item requires a roll associated with it.
Rather than separating actions out from items in two different tables on the sheet.
Yeah, that works
Would that work in table rows though? With the compendium essentially populating a blank row below the item to hold any action fields it may need?
Actually I've got full CSS control over the sheet so it'd make much more sense to have a pop-out panel open when hovering over items with the actions associated with said item if it had one, and then just use hidden fields for it that select based on the item ID.
Finaly! I finaly found how to remove those pesky boxes around the item names... (and yes, I know that many of you have already figured this, but there are still people who are new to CSS)
For those, who like me, have been looking for an answer : In you item displayer, there is a collapsed part called Advanced configuration. Inside you'll have Additional CSS classes. Just add a CSS class with the following code :
.BorderNone a {
border: none !important;
background: none !important;
}
'border: none' will remove the little black border & 'background: none' will remove the white background.
Here is the result before (check Professional Skills) & after (check Common Skills).
You might like this channel here: https://discord.com/channels/170995199584108546/1154507115172466810
Thanks, just reading a couple of posts made me like it. 👍
Hey, anyone's got a template I can study to understand 'Active Effects'?
I want to figure some way to tag a character as wounded, in a way that it would lower some of their stats. I imagine Active Effects is how I'd get around to doing something like that?
You either configure the effect change data in CONFIG.statusEffects itself or you use Active Effect modifiers
You can also start with an Active Effect Displayer. This one lets you create an Active Effect on the go without much effort
Would there be an example of this for me to look at?
Yeah, when I look at the 'Configure Active Effects' window I understand little of what I see, which is why I ask for a template.
They work like item modifiers. Once active, these modifiers will be applied
This one modifies VW_Mod by +1
Right. Still, when I look at this:
I don't understand what I'm looking at.
I know what keys are
and I can write formulas.
Key is the actor key you want to modify
I never used item modifiers because I don't know how to work with them
The value (formula) is just the value you want to modify by
Do I separate them by commas?
You could, but not mandatory
Okay, yeah, that's as far as I understand
I don't know what group is, or what op. is, or prio
I imagine 'prio' is priority.
I don't know how that influences anything, or how that would be written
Group and Description can be ignored if you don't use conditional modifier lists
Oh
Operation is selfexplanatory
yeah, it has a Dropdown
sorry, I had a glitch before and the dropdown of Op. was blank
now that I restarted the app it's not
I didn't realize it after taking the screenshot
Okay yeah, I was mainly worried about group and prio
Here's a brief description of all fields: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Items#item-modifiers
So, these take effect after I tag a token with the status effects on default foundry, is that how that works?
Yeah, only applied if the Active Effect is active
Oh, I shouldn't worry about 'prio' either, yeah?
You should, if you have multiple modifiers modifying the same key especially if they contain different operations. Then you want to controll in which order they are applied.
gotcha.
Perfect
thank you
I have a Tabbed Panel "Gamemodes" and inside of it i have a tab, named "Fantasia". Can i use something like ${Gamemodes == "Fantasia"}$ to see if a tab is open, or all interactions with the Tabbed Panel are client-sided?
Obviously, I'm asking because ${Gamemodes == "Fantasia"}$ does not work.
Could someone tell me, or tell me how to find, the data path to an actor's movement value in CSB?
I promise I looked in the wiki first.
What's a movement value?
A feild with a name "movement"?
Oh wait, this might be something I have to make actually. Nevermind, I just grasped what I was being asked.
Yep, it would literally be that simple in my case. I'm trying to use a module that is looking for the "Movement Value" and I thought it'd be something more complicated than it is.
I feel like everytime I need to know something, I ask someone, and then immediately after the question leaves my faceholes I figure it out myself... I need a rubber duck to talk to or something.
I hope you can solve it.
Nah, it's okay. I'm asking stupid things all the time)
I did, I'm a goofball. I just have to make a component named whatever "movement" and then tell the mod to look at that component.
I looked off the foundry to the discord and back. Now I'm lost)
my bad. 😄
No it's not. I'm just shocked at what I wasn't seeing in hyperfocus.
I am trying to follow this video so I can make a custom system, but I think it's out of date already because v13 just came out. When I try to download what he recommended I just get errors and I can't create a world.
Does anyone have a workaround or know what I can use instead? https://youtu.be/b2XcMGpjLiY?si=DHLKgbW5ORTPLgZM
This tutorial covers the basics to intermediate functions of CSB without the use of JavaScript. We cover item / actor templates and sheets, as well as what most of the components do at their core.
We do not cover CSB provided functions, or advanced uses of components (aside from the label), which will be left for another tutorial if there's en...
Csb doesn't work with v13, you have to be on v12 to run it.
I'm completely new to Foundry. How do I switch versions? I looked around a bit for it but couldn't find anything.
You would need to uninstall then install the last v12 available from the Foundry download page.
Ahhh cool. Thanks.
Same place you downloaded the v13 installer
No problem. It's great to use and the community here is nicely responsive.
Tabs and Panels don't create data in the properties, so formulas don't work with them.
So I am trying to use Dynamic Tables with the Dropdown menu making the values from 4,6,8,10 so that hopefully using '1d' in front of it will allow it to roll. Am I making something?
${DmgRollButton:= lookup('DmgTypesFormulas','DmgDice')}$ [1d${DmgRollButton}$]
Where does the formula reside?
I am storing it in the hidden attributes now. But it is still pulling from the dynamic table. It seems to be working alright now but there might be an easier way to handle this. XD
Just keep in mind, that lookup() will always return an Array (a collection of values)
Don't you need a "label roll messsage" for that? (not "label text")
Oh, sorry. I see it now on the right.
Another question.
How to make it look like a button?
I am sorry for being stupid. I'm asking the question and finding an answer a second later. Don't answer.
Hey hello! How would I write the 1.(key1+key2) to represent '1.2' if the value of the keys is '1' each, for example?
${(floor(6+(keyA)+(keyB)+(keyC)+(keyD)))/1.(key1+key2)}$
These keys are a number field somewhere else in the sheet.
The idea is that it would lower this whole value by 10%, for example, if the value it is divided by is '1.1'
Therefore, each point in the number fields should lower this value by 10%
For clarification 1.(key) does not work.
1 + (x + y) / 10
But is that the only way, though? Cause I planned to have more micro-changes that would break a bit with this calculation.
I was giving a simpler example for it to be easier to understand.
Well, maybe they would complicate things too muc anyway.
1.${x + y}$
Oh okay thank you! (sorry ment to reply the other day but lost power for a bit then forgot XD;;; )
Personally I am coding all the mechanics first before jumping into CSS cause I wanna make sure I have everything first before jumping into visuals. But it all depends on how you are tackling this. If you already have a game that you are refrencing off of it should be fine. 🤷🏽
Currently working on the Weapons of my system, trying to make it easy for GMs to make weapons, but not have so much bloat that the players look through. Should I use the hidden attributes more in this case?
Also with Dynamic Tables is it possible to still use those values for Item Modifiers? Like if I use lookup('DmgTypesFormulas','weaponSlotVal') to grab the value from that to add onto the occInventory value calculation on the Actor sheet?
Hello, is it possible to include a button within a rollmessage so I cant trigger an additional roll from my character sheet or a dynamic table?
Personally I do a mix of both,
I go page by page -> all elements on page, then css the page.
you can do section by section.
this helps me keep my workflow clear and visualizing what's going on post 'rough sketch' on powerpoint or photoshop.
but it's probably best to get all your elements on the page before styling them, or maybe even doing a 'quick and dirty css' (aka just colors by name rather than rgb, and general positioning/layout) before going back over it with a fine tooth comb later. But it's all up to whatever helps you get the work done.
The difficult bit i think is that the button would need to know who sent the command... which it's no longer issued from the sheet under the hood (i assume)
so you'd likely need some javascript? or maybe to hardcode the sending character into the message so if anyone clicks that button it sends for that character? Not exactly sure how you'd handle that...
But you should be able to just use <button> html tag and %{}% to nest javascript into it.
Disregard, this doesnt appear to work, i tested it on my end.
apparently JS nested in the ChatMessage.create isn't read by the system.
I think you're stuck with a plain HTML button and a worldscript solution.
something like:
<button data-findme>Click Me</button>
and
html.find("[data-findme]").on("click", () => {
console.log("hello world!");
});
});```
For that kind of things, I personally use a collapsible tab that can only be seen by the GM
That way players only get the relevant informations and the GM can easily go look through the tab if they want to change something.
Theoretically doable with a panel set with a z-index to be behind everything, a background-image / color, and a visability formula to choose which to show
personally i'd have a separate template for monsters.
Greetings ! Just wondering, is there a CSB build for Foundry V13 ( potentially unstable is fine ). No worries if not, just thought to come here and check 💙
No
Alright ! Thank you !
Okay will do that XD
How would I have a non unique key sum into a unique key.
So if I had multiple attributes impacting my con_change and my con score is base_con_score + con_change how would I sum up all the fields with con_change in them to get to that total, and would I need to have each con_change be a different key/variable? like con_change_1, con_change_2, etc.
On my current system working in roll20 your traits or character improvements can increase your base score, a character improvement essentially acting like a class ability
I’ll have to be able to replicate this system for multiple hidden attributes, for example, totals rolled for proficiencies might have multiple sources for their proficiency mod which sum together.
It’d also be good if I could handle this in a dynamic table so that people can drag drop from the compendium in the future, and so that I don’t need like, 100 hidden rows and values of xxx_change_1, xxx_change_2.
From what I currently understand I can achieve half of this with JavaScript scripts on refresh of any sheet, but I’m unsure how I can have two rows in a table have the same key for a value and both retain unique values
You probably want to use either Item or Active Effect modifiers, so that you can affect values in your sheet.
Otherwise, the paradigm is always to get values from other sources if you look from the perspective of a Label.
Yeah I’ll be using items in the item compendium for everything matching the sheet json once it’s done
Should I expect the table rows to all have the same keys? Or will it number them?
It won’t matter much either way as I’ll just direct the script to look for all the keys with the same name ignoring the number
The rows of a Dynamic Table have unique row indices
Okay but they will presumably all share a common prefix based on the column right?
So summing it won’t be difficult I’ll just take from the first n characters
You mean a sum across all rows in the column? That's easy with just sum(lookup(...))
The properties of a Dynamic Table are stored as an Object. The structure is dynamicTableKey.rowIndex.columnKey
Nice then I can just sumif based on the “modifier” and “mod” columns for what it’s adding to
Curious why my label roll messages for talent checks look different on my mac and my windows pc:
This is how it should look (mac)
Second one is weird (windows)
how can i make it always look like on the first screen by default
Thats a mater of the used Browser. You use on Mac Safari, on Windows Firefox?
It is nearly impossible to make it identically for every Browser.
You will need different css for every Browser.
Foundry is optimised for Chrome.
i use chrome on both
and it looks more like a setting in foundry, dont think its a browser setting
Is there a way to display data in a dynamic table in an item on a character sheet?
I created a backpack template and I want a list of items to display on the character sheet so you don't have to look inside the pack to see what's all in it.
I just scrolled up and saw someone asking about something similar but I'm not 100% how this translates to concatenation.
I used several item displayers and a dropdown for location on the items. With a filter formula, you can have an item displayer with the gear carried/worn/held and another for the backpack.
Maybe I went a bit overboard myself since I use half a dozen displayers or more (depending on the location).
Click on an item, change the location and it goes from held to backpack.
The two displayers filter formula (held/worn & backpack).
Oh, too easy. Use the template id as the class.
Is anyone else experiencing this? I have the most recent version 13 build 344 for Foundry.
I've uninstalled and reinstalled it, attempted to revert to a prior version of Foundry, and nada.
It must be Foundry V12. CSB is not compatible with V13
I went back to V12 and it still didn't work
Did you migrate the world data to V13?
Initially yes; however, I reverted to V12 and then created a new world and that also does not work.
What build do you use now?
I went back to V13 as it wasn't working on 12, but I don't mind reverting to V12 to use this if need be.
Your choice. I can only tell that V13 won't work with CSB
Is importing sheets with item containers supposed to not also import the filters?
Hello, currently trying to extend dynamic tables to be able to have something sort of like a primary key column
noticed that there's a folder named tests in the source code; was wondering how to use it and also add test cases?
thanks in advance :3
@brittle moth
Hello, I'm trying to figure out if there's a better way to stop item modifiers from stacking. I just want the highest value modifier of an item to apply. The modifier on the item itself is likely to be a formula that fetches data from the actor sheet. I've already got it working by calculating the modified value and using the ternary operator to update the actor's value if it's bigger. However, I really want to avoid that if I can, since I don't want to keep writing that formula for every item that needs a non-stackable.
anyone have an idea how to fix this?
Disable "Show hidden rolls" in the game system settings
that did it, thank you 🙂
Hi! I'm interested in creating an item displayer that allows only ONE SINGLE item. Is that possible? and if so, how?
Item Displayers can't limit the amount of items assigned to an Actor
That makes me sad 😔 Thanks for the answer.
You can, however, configure an item where it has a dependent field (say, an equipped checkbox) that will only allow a single item to have that status, and then set the item displayer to only display items with that status, which means you'll only ever have one item in that item displayer. I did that for an armor displayer on a sheet, and with some modification you could probably adapt it to your needs:
${item.Readied ? setPropertyInEntity('item', 'Readied', "false") : equalText(string(first(lookup('Armor', 'armorhidReady', 'armorhidReady', 'true'), 'false')), 'true') ? notify('error','You cannot ready more than one set of armor') : setPropertyInEntity('item', 'Readied', "true")}$```
This might not be optimal coding, I was still pretty new when I was playing with that, but it should give you a direction to check in.
That makes sense for natural equippables, but not for abstract concepts like a race, because there's no point having a toggle button for that. You just have 1 from the start and you stick with that. The only actual solution for this case is to intercept the creation of the Item, which can only be done with a world script for now.
Good point. Mine does assume that someone could be carrying more than one set of armor and prevents them from equipping it.
There's actually already a Feature Request for that: https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/358
Oh, that's a MUCH more expansive concept.
It would be a completely new feature at this point, with quite a bit to consider from our perspective. And making it as easy AND extentible as possible to use is also something we have to think about. And tbf there are some other features I'd like to work prior to this one
i am getting " Error: Undefined function fetchFromDynamicTable" . is fetch from dynamic table deprecated?
Yeah, it got removed with CSB V4. The alternative is lookup()
oh dang alright. let me try that out
The functionality is the same. We had to rename it though, because we introduced the possibility to fetch from an Item Displayer as well. And so the old name became unfitting.
oh damn i have been gone way too long LOL. will check out the item displayer as well
and thanks btw. lookup fixed it
And I also don't like long function names, but that's just a side fact
understandable
how do you add columns to the item displayer?
oh wait something is not right the item displayer is a renamed item container and old item container has the ability to add columns
Yep, same as before
ok nvm figured it out lol
Okay getting closer to a lot of my system progress. But I’ve been curious if it is possible to make the Class Levelup system similar to 5es with the pop ups and auto adding some of the class feature to the proper boxes?
I might be missing an options with the items or custom template so I just wanna make sure before getting too distracted.
You'd need to script your own advancement system. It would probably be too tough to introduce a system-independent advancement system.
Ah okay! Good thing I didn’t get too far into that XD Was hoping the compendium would help with that. Thank you!
Will just tell my players to drag the next level part for now. Till I learn how to code more cleanly.
in my system i have races that can be selected, they're gained by a radio button during character creation - when you hit the 'next' button it gets which radio button is selected and then gives the player that item.
it also checks if an item with that template (_race) already exists in the character sheet, and if so, deletes it - this means there can only be one during creation and i dont plan on dragging more in manually.
however if you need to be more secure than that for some reason -> create a world script that checks a character sheet for more items of said template and delete them EVERY TIME a item is added, or of that template.
if it's item based like 5e, you can use user input templates to select options, and use js to fetch the item with that name and template to add to their sheet based on selection 🙂
That, or you can do what i did for my character builder, and place your whole sheet in a panel that can be hidden when 'advancement' mode is on -> if it's on, hides the main panel with your actual sheet, and shows the advancement panel instead, where you can have the full range of CSB editing.
so normally the enableCC button is hidden, but i revealed it to show more about how it works, -> when a sheet is created it is checked by default, and finalizing creation or ending advancement unchecks it.
Err.. These are end to end tests, manipulating a browser via CodeceptJS
I use them to make sure the basic functionality is still functional before releasing a version, but they really are janky :/
omg wow! Thank you! Will have to figure this out a little more but your character sheet looks amazing btw. And the health/mana bars. 10/10 🤩 👌🏽
Hidden panels are the key to life in csb!!
And thank you! They took a looott 🥲 I had to make a custom meter in a label and build out additional spans to get the shielding
Or I guess grey healt in the case
Okay that helps a lot. I am using Item based stuff to help along, but the classes also do not have to worry about Sub Classes. So having the perks auto add and then pop-ups for saying to add additional perks was the idea so far. But this helps a lot.
I bet!! I haven't gotten into my CSS diving yet, as I wanna make sure the mechanics work first before doing all the ribbons. Also cause I know if I do the CSS code (which is the code I am most familar with) it will defeat the purpose of this projects. Me learning more about JS XD;;;
Oh, that's quite good! Thanks! 👌
Definitely hidden panels with conditional visibility.
You can probably write a condition if some item exists but I'd just have if a checkbox that gave it to them is checked, #lazy
😮 📝
Okay I see. Yeah those hidden panels are very helpful. I am using them for the item creation part for GMs to make custom items in the system easier. Hopefully coding everything to just be toggled then add the value with drop downs and number fields.
Yeah I have panels that are just inputs for items for myself 😅 then the other panel is the player view and displays all that info in an orderly way
Input d input mod input type input -> 4d6+2 slashing
😅😅
XDDDD It works for me! LOLOL I am also doing something similar to just help stream line all future item creation while keeping it within the system rules (for the most part.)
ohhh icyicy; will see if I can try it out :3
if not there's always manual testing
just wasn't sure if updating tests in the folder is also expected when trying to add functionality
It's absolutely not expected ^^
Is it possible to have an Items check box be clickable inside an Item Display?
Not directely, but you can add a label that when clicked will change the state of the checkbox via setPropretyInEntity().
Is there a way to use sameRow() to get a dropdown's label text instead of its value?
Not that I aware of, IIRC it is just for display. Usually I put the same value in the dropdown text and in its key.
Yeah problem I got is I got other parts of the sheet that need to reference the dropdown to fine values.
So I you cannot change the dropdown key, then you can use a formula to display the right text.
Looking into the objects I can see the values are set next to the keys so they should just be grabbable.
Ahhh I got a fix using a switchCase()
Hello there. I'm trying to use a Label Roll Message to post a button in chat, and when you click it, it should run a function (like rolling dice or something). I think I figured out how to get the button to show up, but it doesn't actually do anything when clicked. Can you help with this?
Hello 🙂
Sadly this is not possible yet in the system. It is planned, though I don't know when I'll be able to add this feature.
Alternative solution is to use the renderChatMessage-Hook to inject the script into the HTML-element.
Is there any clean way of passing text to the initiative chat card? I'm modifying the effective roll numbers in a macro on certain results, but I need to reference the original roll numbers because it matters for degree of success adjustments. I'm probably just going to end up creating a 'ride-along' ChatMessage specifically for initiative rolls, but it'd be slightly neater to me to just tweak the flavor of the initiative card that already gets generated.
You mean something like this here? https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Tips-&-Tricks/Handling-Dice-Pools
I already have a similar thing to that for everything that's not the initiative formula set in the CSB game settings. It's that I want to alter the message flavor of.
I see. Then probably nope. You'd have to override the functionality of how the initiative values are set if you use one of the buttons in the combat tracker: https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/src/module/custom-system-builder.js?ref_type=heads#L252
Doesn't seem too difficult to leverage in my use case, thanks
Hi all, Is there a way to create a new line in a dynamic table frome a rollmessage ? I'm trying to implement a log system to let my players track there XP expenses and was thinking of using a dynamic table.
You have to use a script. The content of it should look similar to this: https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/src/module/sheets/components/DynamicTable.ts?ref_type=heads#L614
Hi folks, how do I put a hr (horizontal line) between my labels for example? it's not a component
Another Label with <hr>
it just creates a line break area, likely has 0pt size. can't click on it too, have to undo
I guess css is needed to make it have size
or inline style attribute maybe?
You can do both, there's no restrain for that
is it possible to dynamically add checkboxes to a character sheet? I don't like HP, wanna use hits with different severity, and checkboxes to mark them as the character gets hit, but the number of checkboxes depends on endurance...
Only with a Dynamic Table or Items, if it has to be truly dynamic. Otherwise you have to work with visibility
so I could hide some if the endurance is not high enough? cool 🙂
Yeah, every Component supports a visibility formula
The hidden items make their slots available for following items in the panel with columns 😦
4th and 5th are hidden in two first rows, as well as 3rd and 4th in third
is there way around it? a table instead of a column panel?
okay, got it, thx!
Okay so, I am sure it has been asked here before but I've been trying to trouble shoot ammo usage. Not coding the use of ammo part just layout wise. Do I really have to make each checkbox for the amount of ammo a player can have or am I missing a significantly easier way to do this?
Or should I just use number field and give up on that idea to do boxes? XDDD
if this is for firearms with clips or other weapons that use a similiar resource, you could maybe stack them in clips and track each clip value as a hidden parameter and only mark clip as empty when the last piece of ammo is used? This way the players wouldn't know how much ammo they have left in the clip- realism increases 😄
Damn. Is there any way to let players edit each other’s character sheets? Like, I set up a Label Roll Message that rolls for damage and automatically subtracts the result from the target’s HP. But when a player tries to use it, it says they don’t have permission to edit the target's character
I like the idea of it going 'click' but that might be for more veteran players XD but I do like this idea.
I'm trying to hide the location selector when the corresponding checkbox is not checked, but it just won't hide regardless of what I have in the visibility formula 😦 Ideas?
I checked and the key in the formula is identical with the key on the checkbox
I have panel layout set to vertical and for some reason its slotting in horizontal
That's a limit by the Foundry permission system. The update must go through a GM if the player doesn't own the Token/Actor he wants to update.
2 issues:
=is not a valid operator. If you want to compare by equality (strings excluded), use==- The values of Checkboxes are of type
boolean(true,false), notstring('true','false')
Is it possible to implement this using Label Roll Message? Or maybe through some kind of macro?
And checkBoxKey == true can be shortened to checkBoxKey, because true == true => true & false == true => false
API documentation for the Socket functionality available to packages.
If I have 3 or more selectors like this, do the keys for options in the dropdown need to be unique as well? they should mark essentially the same thing regardless which selector marks it
also, after correcting the formula the selector won't show up no matter what I do 😄
not even refreshing the sheet after checking the box helps
Option keys should be unique within the same Dropdown. The constraint doesn't apply across other Dropdowns or Component keys
thank you!
Hey all! I just want to say i am super grateful for CSB! I am not experienced in scripting so to have an ability to do majority of stuff though CSB is a blessing.
That being said, i am wondering about how to do specific thing. Its for the Step-Dice that i have in my system. I have multiple variables:
- Attribute: number that player can control
- Dice: is connected to attribute and its going to be the number you roll. (pure calculation)
- Max Die: is just a maximum number that ill use for some other calculations. (pure calculation)
- Cost: this is for point system that will also be included into calculation on how many attributes you can have and how many do you get per level. (pure calculation)
I was wondering if Dice, Max Die and Cost is something i should put into Hidden Attributes since they all come from changing the Modifier?
Thanks for any help!
I'd use a Dynamic Table, because that's what you actually have
Like this? I set Number Field for everything except Dice, which is Text Field.
Yeah
Cool, now i got to figure out how to connect all the variables so when i change attribute, the dice also changes.
find('Dyna_Table_Attributes', 'Dyna_Dice', 'Dyna_Mod', 5). Examples:
I am following the example but i am not sure what i am doing wrong.
I have dynamic table (names changed to be easier)
I have new component that is label (where i want to show the numbers from Dice column.
Ultimatelly i would want to read from Power Modifier a number if its equal to Mod from table, return the Dice and make it rollable.
${find('Attributes', 'Dice', 'Mod', PowerModifier)}$
you could also try using the requestor module (https://foundryvtt.com/packages/requestor)
label roll message could be something like this
%{
await Requestor.diceRoll({formula: "2d4+2", flavor: "Healing Potion"});
}%
or if you want for the buttons to be as if you clicked an actor button, you could make it call chat commander stuff
(provided you have a selected actor token or a configured player character in the user configuration)
%{
await Requestor.request({
title: "Rolling",
description: "in the deep",
buttonData: [{
label: "click me",
command: async function(){
return actor.roll("buttonSTR");//or some other button (key to a label) in the actor
}
}]
});
}%
Requestor, an Add-on Module for Foundry Virtual Tabletop
yes.
used to have a section on the wiki, as a trick --but it seems to be missing
Here's mine for the label text
<i class="fa-regular fa-${item.isEquipt ? 'square-check' : 'square'}$ " style="color: ${item.isEquipt ? 'red' : 'green'}$; background-color: white;"></i>
Roll message:
${setPropertyInEntity('item', 'isEquipt', "item.isEquipt ? false : true")}$
this is a in-item displayer checkbox toggle for the 'isEquipt' checkbox.
@formal goblet the wiki section on this is missing, unless i'm just missing it in this new organization ^^
Stupid question but how do i add condition to calculation
e.g. STR is 0, but if I pick a Specialization STR from the dropdown menu, it gets +1
i am trying to do it like this:
${Specialization == spec_spd ? 'Yes' : 'No'}$
But its giving me an Error
if i change Key of the Power to 1 and i use the same formula but i put == 1, then it works. I guess i just cant use ==, but i dont know what to put in.
If you want to compare strings in CSB you have to use ${equalText(Specialization, "spec_spd") ? "Yes" : "No"}$
I am not sure if this is the bug or i am doing something wrong. But i have a Field with the Key called spec_spd that i deleted, and now when i want to create it again with the same name, it gives me error that i need unique name (like its already being used, but i deleted it).
i restarted the Foundry and now is ok.
Good time of the day! I have a question. Is it possible to implement dice values from a Dynamic Table using the lookup command? Or do I need another command? I understand that lookup works on numbers, but with a text field - an error is returned.
I want to make it so that when choosing a dice, it is used in the cube roll. Is it possible to do this?
Open the console with F12 and look for errors there
Because only ${ref(dropAttribute)+10}$ is a formula, the rest is a static text
Surround the whole phrase with ${}$:
Hello people, it's been a while !
**Beta version 4.5.0-rc1 is now available, with the following change : **
[DEPRECATION] Deprecated Item modifiers and Status Effect modifiers, to be removed in CSB 6.0.0 - Foundry 14
Features
- Added button to open Documentation in Settings Tab
- Added possibility to use formulas in the classes-field of every Component (conditional formatting)
- Added
imganduuidto the standard-properties of every entity - Added variable
thisfor self-references - Added russian translation (thanks to Друманин Дрин (Drumanin Drin))
- [#446] Added indentation and removed Template History for Template Exports
- Added progress bar for Template reloads
- Added more Template reload options (e.g. Tokens in Scenes)
- Added Custom Active Effects feature : (the big one - Documentation : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/beta/en/Guides/Active-Effects)
- Added Active, Origin and Description columns to Active Effect Container
- Added buttons on active effects to manage a predefined list of Active Effects
- Added a Dropdown in the Active Effect Container to optionally select a predefined Active Effect to add
- Added full integration of now-recommended module DFreds Convenient Effects
- Added full integration of now-recommended module Status Counter
- Items can now be modified by an Active Effect
- Added Status Effect Customization
Fixes
- Fixed an issue with sub templates and user input template not saving correctly
- Changed requirements for module
Chat Commander, making it optional
Please refer to the Beta Wiki for instructions on new features : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/beta/home
FYI, Manifest URL for the beta version is https://gitlab.com/api/v4/projects/31995966/jobs/artifacts/beta/raw/out/system.json?job=build-beta
If you want to switch an existing world to the beta version, you can follow this guide : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Switch-to-Beta
If you encounter any issues with the beta version, please open issues on gitlab and specify you are using the Beta in the issue title !
https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/new
Enjoy !
Is there a formula that checks how many lines there are in a dynamic table? i want to create a burden modifier: for every burden you get -1 to rolls
i fugured I could secretly create a number column with the number 1 and have formulas refer to that but Idk
count(lookup(<tablename>, <name column>)) could do that.
let me try!
Theres a lot of stuff that math.js can do, you just leave the math. part of the expression off in csb.
i have tried looking into math.js but i couldn't grok it
Looks like there'd be full support for status counters as well; could potentially be the count of the burden status
I really just pay attention to this page in the math.js api https://mathjs.org/docs/reference/functions.html
Math.js is an extensive math library for JavaScript and Node.js. It features big numbers, complex numbers, matrices, units, and a flexible expression parser.
quotes around your keys in lookup
thank you, that did it!
My last question for now is whether I can make a label component into a button that creates or looks up a journal
I would like players to be able to create an item and, if they wish, create a journal page to detail that item
I could use the item component instead though
When CSB formulae interface with the core functions of Foundry you're entering js scripting.
But then the deal would be to make a button that creates a new item
same deal then, they're comparable tasks from foundry's viewpoint.
Maybe I would like the journal better
Because then items will have a history or something
Catalogue style
Well, what do I do? Is that something I ask in macro polo instead?
Essentially, yes. You need a macro that creates a journal entry (or item), and then you create a label button that executes the macro.
Yeah, or you execute it in the Label directly. There's basically no difference at that point
True.
Thanks!
Hello all. I am having trouble with a roll formula:
Current Reputation: ${reputation}$<br>
${#?#{Reputation}}$
Spend: ${reputationspend}$<br>
New Reputation: ${setPropertyInEntity('self', 'reputation', reputation - reputationspend)}$
${equalText(reputationselection, 'Renown') ? setPropertyInEntity('self', 'renown', renown + reputationspend) : ''}$
Everything works except the last part of updating the component renown. I even simplified the formula to give a hard number and I see it show up int he result, but it doesn't update the component renown.
Any ideas?
What kind of Component is that?
renown is a Label
reputationselect is a dropdown
You can't change labels
could I make a hidden number field, have it change that and then have the label just display whatever is in the number field?
I Solved this problem and there is an other question. Is it possible to add the dice from Label or Dynamic Table to the formula for throwing in chat?
yeah, that works
Just made it 5 minutes earlier with a combination of 2 different modifiers, thank you ;D
Hello All. I was wondering if I could request help on what seems like a simple roll formula. I'm using a dynamic table for players to input their own damage for a spellcrafting and weapon enchantment system. I want each individual spell or enchantmant to have it's own roll option that will output the formula the players input in the WENCHANTDAM field (As a string). If I use the formula ${[sameRow('WENCHANTDAM', '0')]}$ nothing happens. But if I remove the square brackets it outputs the string into chat. But I want it to actually roll.
${[:sameRow('WENCHANTDAM', '0'):]}$
Hi! Is there a way to get the profile picture of an item inside an Item Displayer? Something like the "item.name", but with the image? Also, how do you print it on the chat? Thanks
Okay quick question. If I wanna show the dice result with the true false, do I need to just repeat :alchCdValue: or do I need to do additional code? Basically I wanna see the result for a success be # Effect Persist I see that the dice rolls again unless I am missing something else.
(second screenshot)
I am trying to see if making the value something saved but I am missing something. It rolled the first code fine, but now not working with the second one. Trying to see if I'm just blind to the one thing I am missing. 😵
You need to save the result of [:alchCdValue:] in a variable. You do that with the assignment-operator :=. Once done you can use the variable in formulas down below.
Okay thank you! I knew I recognized parts of this. XD I just used the wrong finding key words while searching. THank you again!
I got it working! Thank you again!
Hi, new to CSB, is there somewhere I can find tips for building templates and making rolls or linking labels for calculated values?
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Guides/Formula-System#execution-context Been finding a lot of the helpful stuff in the wiki here. With some help about arrays here. https://mathjs.org/docs/expressions/syntax.html Not sure exactly what you are looking for. But these two wikis are where I started.
Math.js is an extensive math library for JavaScript and Node.js. It features big numbers, complex numbers, matrices, units, and a flexible expression parser.
Hey all, i have a noob question. Lets say i have:
STR modifier and i want to add to it from different sources. Is it possible to do that inside of Formula of thoes sources instead of taking STR modifier and inside formula to reference those sources.
E.g. I have 10 different items that add +1 to STR modifier.
Instead of STR Modifier having +1 from each one of them.
Can I have so each Item gives +1 to it.
If so, how would that be inside of formula of the item. I guess i would reference "key" of STR Modifier and add to it, but how to do that?
Item modifiers can do that. When the item is on the sheet it can apply the mod to designated existing keys.
y'all, something is up: i made a button for a dice roll and so every time I roll it increases the current value of the stat?
${setPropertyInEntity('self', 'strengthTotal', 'strengthTotal+7')}$
you know
i should not be using set property 
I am feeling super silly, how do I remove the extra number 4. I just want the dice number not the extra one. 🪦 I am not sure if I am just being very clueless.
Try putting the die roll in its own line in the Roll message and prefacing it with #, so ${#[!1d6]}$ that should hide the line from the Roll message but still display it.
🤔 It removed the dice over all. Trying to solve this problem.
Very troublesome XD cause I wanted a specific look but that is my fault in the end for not knowing enough code. XD
The only thing that made it work is making an IF ELSE statement that only shows the text. Not sure if this is the cleanest way to deal with this but this is what I got.
folks, for dynamic tables, i wpould like to have a roll that checks a dropdown option and chooses the ability to roll based on it
how do i reference the dropdown key for same row rolls?
I believe it is loockup(...) code? If I remember from when I also was trying to do this. Um... (looking for link)
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Formulas/Functions/lookup
There is also something called find but I still am learning so i don't know the difference just yet.
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/stable/en/Formulas/Functions/find
but something that I've been told a lot is the dynamic tables are always Arrays so it might need a little extra code to get the value stuff you are looking for.
Seeing that the beta for Active Effects has released ! Thanks for the great work !
I have approximately half a million macros that I can now consolidate into one 🙂
Hello All
I am trying to make a button that when pressed set to true a checkbox in the same dynamic table...but something doesn't work
${first(lookup('radiazioni_livello','Livello1')) ? true : setPropertyInEntity('self', lookup('radiazioni_livello','Livello1'), true)}$
I made once before I messed up but now I don't remember how I made XD
I can use well the setPropertyInEntity with a normal static key but when using a dynamic table here the mess...
I know is the array problem. but there isn't a way to jump over this issue ?
You need to use lookupRef : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/beta/en/Formulas/Functions/lookupRef
${first(lookup('radiazioni_livello','Livello1')) ? true : setPropertyInEntity('self', first(lookupRef('radiazioni_livello','Livello1'), true))}$
Thanks mate !!! I did not think for anything to that
I am trying to find the best way to do a specific thing:
I have specializations in my game: its currently a drop down menu with multiple choices. When you seletc one i would like to add some bonuses to stats. Do i need to go to each one of those stats and reference a condition and bonuses, or is it possible to have a list of bonuses in one place like:
+1 to STR
+5 to SPEED
+DEX to ACCURACY etc.
And when I select specialization, all of those are added.
If so, how do i do it?
I think the best way would be to have an Item that is the specialisation with all the modifications to the different stats as Item Modifiers. Then, the players can simply drag and drop the specialisation they want on their character sheet.
That is an interesting approach and it might work for this example. But is there no way to just add a number into another formula? More specifically, i have a number field (that player can manipulate), its got min and max values. But i would like to add to that value some other stat's value. Like here in the screenshot. Lets say player set this to 2, but if HP is FULL, it give it 1 more to it, so it would be 3 and player can still move the number up or down.
You can do it by modifying a third Label with a formula in it. Something like ${speed_modifier + (hp_current == hp_max) ? 1 : 0}$ then you can use this label for other calculations.
or if your value of HP is literally FULL, then ${speed_modifier + (equalText(HP, "FULL")) ? 1 : 0}$
Input Fields (like Number Field in your case) cannot be directly modify by a formula. There would be conflicts between the value set by the formula and the value set by the user, so you have to go through a Label.
@broken pumice Sorry to bother you, i have not done any items so far, but i made a simple template where I have put what attributes i want to add some numbers to. But when I made an item and dragged to the character i didnt get any bonuses. What am i doing wrong?
You have to set the Item Modifiers. It's the button on the top right.
Sorry for stupid questions, i started using Foundry like 3 days ago, and i also dont have any experience with coding.
No problem ! People are here to learn and to help other learn.
You should see something like this. Put on the left the key of the field in the actor sheet that you want to modify and on the right the formula or value that you want to add.
So, for example, if you want a Specialisation to add 1 to STR and 2 to SPD. You would put STR on the field key, choose the + as the operator and then put 1 as the value.
Then, you can add a line and repeat the process : Key : SPD, operator : +, Value : 2.
i made this, but its still not working for me. I assume dragging it just into the Item Displayer is not enough, maybe i need to set it somehow to be equipped?
Dragging it should be enough.
You don't need the ${}$ on the left side.
that was it
thanks
now i have an errors for my Dice Roll connected to mod_pow_final. I have a step-dice system, and i am reading the values from the dynamic table. It looks like me adding an item impacted how the formula is calculated, resulting in error.
It seems that the system is finding nothing in the Table named Attributes that has a Mod equal to mod_pow_final and therefor returning null. How does your Attributes table look and what is the value of mod_pow_final ?
remove the double quotes "" from the 1 and 0 in mod_pow_final. It's adding them as string and not numbers. (I think)
(ie. "1" + "2" => "12", but 1 + 2 => 3 )
The +-operator here has no overload for strings like in JS, so that's fine.
oh, my bad then. Good to know !
With the information I have I am not really sure of what is going wrong. All I can say is that, probably mod_pow_final has a value outside of the -1 to 7 range.
Noob question: is there a way to trigger a roll inside a Label from somewhere else?
actor.roll(componentKey) if from a script (given you know the actor)
I see. Is there a way to do that from another Label roll? Let's say I have a Label roll with the attack roll, then another Label for the damage. The idea is to click on the damage label and trigger the attack first, then do some more stuff. Sorry if the question is silly; I'm still a noob on CSB (and Foundry programming in general).
${#%{
await entity.entity.roll(componentKey);
}%}$
// Your damage roll
Thanks, that worked! It triggers two chat entries, though. Is there a way to merge the two?
That involves quite a bit more scripting
Ooook, I see now. That's a little bit too fiddly for me at the moment, but I'll keep this in mind. Thanks! ^^
thank you!
i am open to suggestions to simplify this
Another question:
${#%{
if(<checkbox_test>){
await entity.entity.roll('ex_attack');
}
}%}$
How can I substitute the <checkbox_test> bit for the actual value so the roll only executes if the checkbox is checked?
Either ${checkboxKey}$ or entity.system.props.checkboxKey
ref(sameRow('dropdownKey'))
] needs to be after )) I think
Open the console with F12
And nope, that's not necessary
ok, so i made it point to the correct stat as text in a label
just not the die roll
i don't know what changed but it worked this time
oh i know
i wrote the incorrect keys in the dropdown
like
each dropdown element has to be the same correct key as the atribute it is referring to
look, strength works because the stregth ability key is strengthTotal, but endurance should also be enduranceTotal, not traitEND
thank you for the support!
Thank you all for the support, I have another question!
I' doing carry weight limits, and I'd like them to be calculated Dynamically. I ahve two item viewers, one for weapons, one for armor, called WEAPONINV and ARMORINV respectively. The item templates for all items accepted by these viewers all have the ARMORWEIGHT or WEAPONWEIGHT field. I want to add a label field to each item viewer that will show the total of all those fields, but I can't find a way to do that without calling the uuid directly. unless I'm misunderstanding something this won't work since I want it to be dynamic (As in plyers can add things to their own inventory and the field will be auto-updated, no matter which player it is).
I'm thinking the "fetchFromUuid" or "fetchFromActor" would work best, but I can't figure out how to use this. Is there some way I can dynamically call the actor's uuid and set it as a variable?
You can either use sum(lookup()) if the Item Displayer itself contains the current value or you use Item Template Modifiers, which modify your Label
I guess what I'm asking is how do I get the item displayer itself to contain the value from the items in it.
Just item.ARMORWEIGHT
Good evening today, working on the dropdown menu in the concat menu and received a bit confusion on a problem.
`${#concat(
?{Advantage:"Преимущество?"[check]},
?{Disadvantage:"Помеха?"[check]},
?{CharacteristicHit:'Попадание?'|"Лёгкое Оружие","Лёгкое Оружие"|"Среднее Оружие","Среднее Оружие"|"Тяжёлое Оружие","Тяжёлое Оружие"|"Особое Оружие","Особое Оружие"|"Древковое Оружие","Древковое Оружие"|"Огнестрельное Оружие","Огнестрельное Оружие"|"Рукопашный Бой","Рукопашный Бой"}
)}$
${Roll:= Advantage ? [2d20kh] : (Disadvantage ? [2d20kl] : [1d20])}$
${modWeapon := CharacteristicHit == "Лёгкое Оружие" ? PM_PreSe1MOD :
CharacteristicHit == "Среднее Оружие" ? PM_PreSe2MOD :
CharacteristicHit == "Тяжёлое Оружие" ? PM_PreSe3MOD :
CharacteristicHit == "Древковое Оружие" ? PM_PreSe4MOD :
CharacteristicHit == "Особое Оружие" ? PM_PreSe5MOD :
CharacteristicHit == "Огнестрельное Оружие" ? PM_PreSe6MOD :
CharacteristicHit == "Рукопашный Бой" ? PM_PreSe7MOD : 0}$
<table>
<tr>
<th>Проверка <strong>${CharacteristicHit}$</strong></th>
</tr>
<tr>
<td>Бросок</td>
<td>
${Roll}$<br/>
<strong>${Roll == 1 ? "Критический провал" : Roll == 20 ? "Критический успех" : ""}$</strong>
</td>
</tr>
<tr>
<td>Тип броска</td>
<td>${Advantage ? "С преимуществом" : (Disadvantage ? "С помехой" : "Обычный")}$</td>
</tr>
<tr>
<td>Модификатор<br/><small>${modWeapon}$</small></td>
</tr>
<tr>
<td>Модификатор Рассудка</td>
<td>${PM_SanityBuDe}$</td>
</tr>
<tr>
<td><strong>Результат</strong></td>
<td>
<strong>${Roll + modWeapon + PM_SanityBuDe + PM_Insp}$</strong>
</td>
</tr>
</table>`
modWeapon:= without whitespace
my last one is that i want the die button to roll whatever i write in the text field but i am not managing
in this case 1d6
i tried this ${[ref(sameRow('itemDMG'))]}$ and this ${[sameRow('itemDMG')]}$
it's a text field component
things can be anything from idk 1d4 to 2d6+1d8+2 XD
Got it, but there is a problem that I still do not understand, because of lack of knowledges ;^
in other words, how do i tell csb to roll the contents of a text field
This should work.
${[:ref(sameRow('itemDMG')):]}$
You needs to surround variables with : in a roll.
Understood! I'll try, thank you!
Small thing! I'm trying to connect a Number Field Component Key called 'str_number' into a macro for calculation. How do i use Component Key's as a variable for macro scripts? Cant wrap my ahead around how to do that in the tutorial.
It's probably really easy and im just being a goober
From where is the macro executed?
From a lable ^w^
%await void game.macros.getName('YourMacro').execute()%
Script and the Macro works from the lable, its just that i need to connect Component Key values into the macro uwu
It didn't, no
I removed ref
World's now!
Thank you!
I'll post the macro as well!
//I want to put in the component key strength or 'str_text' in numDice or other values i decide.
const numDice = 4
const fixedSuccesses = 0;
const roll = await new Roll(${numDice}d10).evaluate({ async: true });
const results = roll.dice[0].results.map(r => r.result);
const baseSuccesses = results.filter(r => r >= 5).length;
const criticals = results.filter(r => r === 10).length;
const failure = results.filter(r => r === 1).length;
const extraSuccesses = criticals;
const extrafailure = failure;
const totalSuccesses = baseSuccesses + extraSuccesses - extrafailure + fixedSuccesses;
I figured out a problem with this using Rich text editors. I would rather use the in sheet rich text editor because I think it looks better. However, when using it this way it passes the <p> and </p> to the formula, rendering it invalid. Is there a way to strip those so I can use the rich text editor? It's functional without it, this is purely cosmetic.
I'd say either regex or replaceAll(). It's a RTA, so it's expected to have HTML to be fair
Ahhh knew I was missing something, gonna check it out when I get home.
Beta time !
**Beta version 4.5.0-rc2 is now available, with the following change from 4.5.0-rc1 (#1037072885044477962 message) : **
Features
- Added Active Effects on Templates, copied to the Actors or Items on refresh
- Added Manager Active Effects button even if Convenient Effects module is active
Fixes
- Fixed Convenient Effect integration - Predefined effects object is now compatible with the module
- [#441] Added the id of the entity to its default props
- [#439] Fixed Rich Text Area left alignment
- [#448] Fixed Number Field wrongly triggering relative modification when its value is a negative number
Other
- Updated Verified Foundry Version to the latest v12
Please refer to the Beta Wiki for instructions on new features : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/beta/home
FYI, Manifest URL for the beta version is https://gitlab.com/api/v4/projects/31995966/jobs/artifacts/beta/raw/out/system.json?job=build-beta
If you want to switch an existing world to the beta version, you can follow this guide : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Switch-to-Beta
If you encounter any issues with the beta version, please open issues on gitlab and specify you are using the Beta in the issue title !
https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/new
Enjoy !
Folks, how do you set up a github Repo for this?
I wanna share my sheet (and other things I make for the UVG system)
General overview of setting up a git repo is in my guide in the #module-development pins. Stuff specific to CSB content I’ll leave to the experts in here. 🙂
Awesome!
Nevermind what I typed XD;;; I realized that hidden attributes can't be edited once it is turned into an item. So that helps.
Hi all,
I'm trying to fill a text field in a dynamic table using SetPropertyInEntity. It works fine when I try to enter a number, but not with text. I feel like SetProperty can only write computable values (numbers, true/false). Is there a function to update a field with text data?
y'all, this might be complicated: i would like to add an option to a dropdown list that is read as armour
like, if i add an entry that says ARMOUR, the defense bonus in a different label component gets updated when that entry is selected
i assume this is something i add in the "defense" label component?
like
that physical defense bonus at the top updates from 8 to 9 if an item has the ability "armour" and the mod is 1
Use quotes in quotes and you can set a literal string
equalText(dropdownKey, 'ARMOUR') ? 1 : 0. And that must go into the Label, that wants to capture the change of the Dropdown
I already tested with quotes, quotes in quotes, double quotes, and even with string(). The formula only work with number, not with text. I always have the same error in the console:
Show what you've got
Here with quotes in quotes
I need the formula
oh sorry, here it is:
${setPropertyInEntity('self' , 'text_field' , ''testage'')}$
You can't use the same quotes if you want quotes inside quotes
Otherwise they aren't nested
You are awesome. So after some tests, it works with double quotes outside and simple quotes inside (but not the other way around for some reason). Thank you very much !
Thanks I'll try!
i would have said 'navigating the wiki' 😉 but the new one is so much cleaner
I would say wait for the Items and modifiers, because the beta introduce Active Effects and Item Modifiers will be removed in version 6. So you are probably better starting with an other topic then come back to Items and explain the Active Effects with them.
Do i understand this DEPRECATION Text correctly - Items will lose the ability to modify actors?
Yes and no 🙂
In CSB v6.0.0 (Foundry v14), the modifier system will be deleted entirely, in favour of Active Effects
Active Effects can be used as modifiers, using the "effects" tab of an Active Effect Configuration. By default, the Active Effect modifies the current entity it is assigned to, but in Items you can set it to transfer to the parent entity, which is the Actor or the container Item.
Using this, you can recreate these modifiers with a more powerful system than modifiers ever were 🙂
Is there a way to " preload " an item displayer so that when creating a new actor from a template a few items are already present ? Like the common skills from Mythras.
If not, i'll just create a blank character and duplicate it when needed.
Nope, not with CSB itself. But you can create a world script, which does that
Thanks. I still have a lot to learn before writing such a script. In the meanwhile I'll just cheat with blank characters. 😋
I'm messing around with the beta and I'm trying to reproduce some of my Item Modifiers with Active Effects, but I'm not able to make them work conditionally. I use to have a modifier that would add a value to a key only if the Item is equipped with ${equipped ? 2 : 0}$
But Active Effects don't accept formulas. Is there an other way to achieve the same result ?
I think they actually do for both keys and values
ok, I've probably messed something else up, then. I'll keep trying.
It's a fresh feature, so stuff can miss. Better finding and fixing it now instead of later
I think I know what my problem is.
Formulas works, but the Active Effect is looking for keys on the Actor and not on the Item. Since my equipped field is on the Item, the system cannot find it.
I don't know how to access a key in the Item. I tried item.equipped but it's not understood either.
And the AE is coming from the Item?
Yes
@brittle moth might be the wrong trigger-entity in this case
I have to go very soon, but I can open an issue later if needed.
That looks like an issue, I might have overlooked that. Please log it into gitlab, and I'll fix it soon 🙂
How would one save a macro for ALL players to use?
In a compendium if you want to be safe
Ah, so the players will have to pull it from the compendium in order to use it? So if I create a button that triggers a certain macro it won't work if the user hasn't downloaded it from the compendium?
It can even stay there, no need to download it
Oh, awesome!
You basically want to use something like await return fromUuid('uuid').then(doc => doc.execute())
Is there a way to conditionally run a macro? I'm trying this as a test before I add more stuff but it's not working.
%{return await game.macros.getName('Grenade').execute()}%
</span>```
Nevermind. I just did it with JS
Just hiding it is obviously not enough 😅
I'm a bonehead! But, I'm learning! haha thanks for your patience
Will CSB get an update for Item Piles since all further versions will need for system creators to add the compatibility themselves?
IP is one of the most known and necessary modules for Foundry and a great addition for CSB since we cannot drop items or create item piles without the module
And I don't think this compatibility can be added on the user's side
i think i am messing something up here
${agilityTotal + 7 + (equalText(itemAbility, 'physicalarmour') ? 1 : 0)}$
F12 will help you
what am I looking for?
Errors and Warnings with uncomputable props
doesnt look like any of the errors are related unless i am looking in th wrong spot
Switch to the console-tab. The rest is just in the way
without any operations, only as a label, it shows 0
(the one right under "defense"
let me look
console tab
Right, so no concrete error there
You could try fromUuidSync('uuid').system.props with the UUID of the Actor and inspect the values created
where do i do that?
In the console directly
At least I have a year to work on that
fromUuidSync('Actor.OGnNzCOEZCcz8QTu').system.props
like that?
for the record, this is what my dropdown looks like
and i am looking to have the "defense" label add the value i input here:
in the "mod" field
defense is outside of the Dynamic Table, where you want a value from. So you have to use either find() or lookup() (for Arrays)
maybe that's the issue?
first of all, i did type this correctly, right?
${agilityTotal + 7 + (equalText(itemAbility, 'physicalarmour') ? 1 : 0)}$
Syntax is correct
Now you should find out, if your dependent values are there and contain the value you'd expect
That's why the command in the console, so you can inspect them
i couldn't read anything useful though?
what am I missing?
In this case, you depend on agilityTotal and itemAbility
Check this guide here: https://github.com/GamerFlix/foundryvtt-api-guide/blob/main/macro_guide.md
yes, i want 7 + agilityTotal + item mod, if itemAbility is selected as armour
That's why you have to check their current values, to validate if they contain what you'd expect
I may be overlooking this in the documentation, but is there any way in formulas to pull the uuid of the actor that has the templated loaded and save it as a variable to use in the formulas?
The UUID will be part of the standard-props in the next patch. Until then you can use %{return entity.entity.uuid;}%
imma continue later tonight since I am at a sub optimal computer that doesn't help haha
Okay so I am having trouble applying the slots my armor is taking up. I want the item's slot value to show up in the Occupied numbers when it is in Inventory.
used_slots is part of the actor's hidden attributes while in the Item Moddifiers I also have
used_slots but also a second code that I am trying to allow the value to be ignored when equipped checkbox is toggled.
Any tips?
OH and I just relized that the checkbox isn't checked so the characters armor should NOT be activating. I think the equipCheck formula is what is causing the most issues. Do I need to put it in its own lable and then have the value formula refrence that??
Is used_slots a property of the Item? Keep in mind, that all formulas in item modifiers are resolved with the properties of the item
Okay so I have to have it part of the armor_temp before it picks it up too? Or just part of the actor sheet?
I think you have to be more precise. Let's do it one step at the time.
Do you use a Conditional Modifier List?
Do you mean the hidden attributes or the item modifiers?
None of those. It is a Component
Trying to understand what you are asking for sorry. I am not sure if that is a completely different template that I haven't used yet or if it is already a part of the templates I've already made.
It is literally just a Component like Label, TextField, Dynamic Table, etc...
OH yes. I have that then.
The used_slots is part of a label in both Actor and Item template.
Ok, that Component is important if you use the Group-column in Item Modifiers. Otherwise the modifier will never work if you have a specified Group
Ok, next. equipCheck is either a Label or a Meter in the Actor. Correct?
Yes, it is going to follow the checkbox in Item Displayer to ask if it is equipped or not.
Does equipCheck contain a numeric value?
That might be my issue. Let me double check.
I'm really beating my head here.
Are you not able to pass variables when calling a compendium? I was able to get it to work when calling a macro name but not the compendium.
Specify what you mean by calling the compendium
Okay that was not added to the character sheet. Going to see if that fixes things. I still need to apply the checkbox to the Item Displayer (been trying to find it on my own XD; Cause I know it is here somewhere)
The wiki dosen't have it anymore sadly.
Sorry, I saved the macro to the compendium and tried calling it like you suggested earlier. I'm just not sure how to pass a variable this way. I put it in the execute()
Do you have an example?
Because I can guarantee that it works
The example module has such an example on how you can simulate a Checkbox in an Item Displayer
This is what I tried
if (${animation}$ == 1) {
const macro = await fromUuid('Compendium.JB2A_DnD5e.jb2a-sequencer.Macro.4bbpyZxPo9fSY3e7');
if (macro) {
await macro.execute({ fxValue: ${item.fxValue}$ });
} else {
ui.notifications.error("Macro not found!");
}
}
return "";
}%
%{throw 'Done';}%```
Do you need the throw at the end?
I just have that so it doesn't submit to chat during testing
%{ return await game.macros.getName("Blaster Shot").execute({ fxValue: `${!item.fxValue}$` }); }% This worked for me
But I can't get other non-GM players to execute it
I've used this link to get to it and it saids it is not found. https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Checkbox-in-Item-Containers
I have to restore it, it got lost somehow
Then I will hold off for now till it is restored XDD and try to trouble shoot another way. Thank you!
How can i quickly find what an item name is based on it's uuid?
i'm getting an error from console about an item not being defined but have no clue what it is and i checked the obvious ones manually
fromUuidSync('uuid').name in the console
thank you ^^
But like I said, the example module has the exact example about this
Are they allowed to execute macros at all?
The error message would help
Yeah, I'm able to get a shield, swap artwork, and make a big explosion. The only thing is none of those are passing through variables but this one is needed.
Yeah let me run it again and see the error
Crud. There is no error. Hmm
Okay so i tracked down the error to a specific item
but after deleting the item from the char sheet, readding it, deleting the main item - and rebuilding it from the template, checking the template i cant root out this error
[Detected 1 package: system:custom-system-builder(4.4.2)]
Caused by: ReferenceError: item is not defined
[Detected 1 package: system:custom-system-builder(4.4.2)]```
Do you have an example of something passing a variable to a script saved in the compendium? I'd be happy to try to reverse engineer it. I just am not sure what the structure should be
It's basically like how you have it. You can log the scope-variable in the Macro to see what is passed to it.
I think I need the full error message at this point
that is the entire error 😅
No stack trace?
those two are causing the other errors i should say
oh you mean all the stuff under it saying 'foundry this foundry that?
[Detected 1 package: system:custom-system-builder(4.4.2)]
at Hooks.onError (foundry.js:654:24)
at 🎁Hooks.onError#0 (libWrapper-wrapper.js:188:54)
at CustomActor._safePrepareData (foundry.js:10801:15)
at Game.initializeDocuments (foundry.js:9168:18)
at Game.setupGame (foundry.js:9054:10)
at async Game._initializeGameView (foundry.js:10432:5)Caused by: ReferenceError: item is not defined
[Detected 1 package: system:custom-system-builder(4.4.2)]
at eval (eval at processFormulas (ComputablePhrase.js:216:34), <anonymous>:3:1)
at processFormulas (ComputablePhrase.js:216:121)
at ComputablePhrase.computeStatic (ComputablePhrase.js:242:34)
at ComputablePhrase.computeMessageStatic (ComputablePhrase.js:270:26)
at TemplateSystem._prepareEntityData (templateSystem.js:208:61)
at TemplateSystem.prepareData (templateSystem.js:139:14)
at CustomActor.prepareDerivedData (actor.js:89:29)
at CustomActor.prepareData (foundry.js:10824:12)
at CustomActor.prepareData (foundry.js:15863:11)
at CustomActor._safePrepareData (foundry.js:10799:14)
at Game.initializeDocuments (foundry.js:9168:18)
at Game.setupGame (foundry.js:9054:10)
at async Game._initializeGameView (foundry.js:10432:5)```
Yeah, this one is the stack trace
never leard how to read those.
just looks like a lotr of 'computablephrase' and 'foundry.js'
🤣 thought only the header was useful for error tracing
That is the call chain when the error was throw at that time
Okay I have done the thing 🤩 Thank you again!
.enableEquip .fa-square::before {
content: "\f132" !important;
color: black;
}
.enableEquip .fa-square-check::before {
content: "\f132" !important;
font-weight: 900;
color: black;
}```
❤️
Does CTRL + F5 fix the issue?
no, and i restarted the node.js server
it's an item displayer referencing a label in the item referencing a number field in the item. (to prevent player mod) changing to ref the numberfield directly doesn't solve it.
there's really nothing in there that should be causing that...
Unlucky. Well, I need the PC to investigate further, so not for today
all good.
thanks anyway martin
i'll try deleting a few more things out and hope one of those clue me into where the error is sourced.
What is this for? the CSS? I am still messing around with just getting everything functioning before working on CSS but thank you!! ✨
it changes the square to a shield
that's either hollow or filled out to show 'equipt' or not
I am guessing I have to remove the CSS part in the lable itself first. one sec.
It dosen't seem to change anything atm when I put it into the CSS raw. Will figure it all out later unless it is an easy fix XD so sorry.
did you add the classes to the item displayer column lol
ope i forgot some of the css too 🤣
margin: 0px;
}
.enableEquip i {
background-color: unset !important;
max-width: 30px;
}
.enableEquip .fa-square::before {
content: "\f132" !important;
color: black;
}
.enableEquip .fa-square-check::before {
content: "\f132" !important;
font-weight: 900;
color: black;
}```
still should have worked without the first two lines ( should have put the item beside the square)
updated info:
i deleted every component out of the template and refreshed the item sheet 1 at a time and the error still occurs - im unsure of how to continue testing from here.
the error only seems to occur in the actor too - the error will not occur with the template or the item from the item menu - only when the one in actor is refreshed.
Gotcha thank you!
did that work?
Haven't tried it yet. But will in a moment. Just trying to do one more silly thing with the inventory before I get too distracted with CSS XD
it's way too easy to get stuck editing css endlessly
Okay fixed it I put in a typo
Now I am trying to figure out how to make items that can't be equipped grayed out / unclickable. XD That is the last step for my inventory so far.
personally i dont have a need for that since my items are built on different templates and displayed in different displayers (thus no equip button on unqeuiptable items)
i think you'd have to put the <i> tag making the checkbox conditional logic, and move the class from the column itself and into the code
is item equiptable ? dispaly checkbox with class (making shield) : display grey shield
Hmmm okay do you think I can already use the checkbox that is in the Weapon and Armor templates as the condition? Or should I make a different condition that is only in Weapons and Armor templates that apply the true/false condition? (So sorry if this is complex)
But I do see how the gray shield ? : works. I will play around with that while trying to think of how to have the items communicate with the actor.
i mean like...
isEquipable ? <i class="isEquipt fa-regular fa-${item.isEquipt ? 'square-check' : 'square'}$ " style="color: ${item.isEquipt ? 'red' : 'green'}$; background-color: white;"></i> : <i class="fa-solid fa-shield" style="color: grey"></i>
I was typing that up but within ${}$
reading more into how the code is structured you may even be able to get by without the css...
they built the logic into the class right here
class="fa-${item.isEquipt ? 'square-check' : 'square'"}$
so
class="fa-shield" style="font-weight: ${item.isEquipt ? '' : 900}$"
that should work
similarly,
class="fa-shield" style="font-weight: ${item.isEquipt ? '' : 900}$; color: ${isEquiptable: black : grey}$;"
wait do I need to remove the CSS I added earlier? lol Sorry i've been typing up my own code before seeing any of these. XD
i mean if you go this route
you can either do it this way, or with a css file tbh, should be the same result
Where dose the <i></i> go? Just wanna make sure before I start deleting code.
Nevermind I think I figured it out lol
Wait no I didn't 
It removed the shield from the armor which dose have the checkbox in the items.
lemme see the code/
I hit undo as I don't wanna loose my progress so far with the shield.
<i class="fa-regular fa-${item.isEquipped ? 'square-check' : 'square'}$ "style="color: ${item.isEquipped ? 'green' : 'red'}$; background-color: black;"></i>
I tried to pu the code like so
${isEquipped ? <i class="fa-regular fa-${item.isEquipped ? 'square-check' : 'square'}$ "style="color: ${item.isEquipped ? 'green' : 'red'}$; background-color: black;"></i> : <i class="fa-regular fa-shield" style="color:grey;" }$
so that isEquipped at the front is wrong
"is the item equipt"?
if so -> create an i tag, with the class (is the item equipt? if so ...)
if not -> create a grey shield
rather than
is the item equiptable
-> make the toggle shield
-> make the grey shield
aka if the item is unequipt the grey shield appears, rather than simply being unequipt
the condition "it's unequiptable" is never checked
Okay, I might be tired as I'm trying to understand. LOL so sorry. Just give me a moment.
so if you haven't figured it out yet.
you're checking if it IS equipt before checking if it can be equipt...
Hmmm the check keeps disappearing though if I tried that. So I am seeing if adding a different condition in my item will allow me to make the correct true/false value for this to work.
I must be putting the <i> part in the wrong place or something stupid. 😵 If I do it one way it is Errors, if I do it the other way the boxes disappear. It must be a me thing.
Yep I am just tired. I had a typo somewhere with the differences between Equipped and Equippable LOL just give me another moment
So sorry, man. Today is not my day. It worked the way I had it....I had the animation button disabled which is why nothing was printing to the console...thanks for all of your help!
<i class="fa-regular fa-shield" style="font-weight: ${item.isEquipped ? '' : 900}$; color: ${Equippable ==1 ? 'black' : 'grey'}$;"></i> Still trying to make the shield even change gray I think I need to sleep on this cause I can't seem to make my brain click dispite all the help. So sorry to have failed yeah @sinful spade LOL XDDDD;;;
Happy to at least have the equip system working with the AC and the Inventory. Still feeling very accomplished.
try this:
<i class="fa-regular fa-shield" style="font-weight: ${item.Equippable ? (item.isEquipped ? 900 : '') : 900}$; color: ${item.Equippable == true ? 'black' : 'grey'}$;"></i>
hmm one sec i need to revise something
if it is equitable, and equip it should be black and filled in;
if it's equitable and not equip it should be a black outline
if it's unequitable it should be grey and filled in.
Okay that worked!! At least stylistically. But I need to make sure the gray isn't clickable or it disappears from the sheet and can't be retrieved. 😅 Should I just make a sperate inventory box for "trashed items?"
i mean i think the multiple invi system is the most intuitive.
but
it wouldn't be hard to do this
in the class=" "
${item.Equippable ? 'EquippableClass' : 'UnequippableClass'}$
then in your css you can define on-hover and pointer-click events
Well, I kind of don't want my players to gain a bunch of random items in their character sheets that just "disappear"
just to show what i mean.
??? not sure how disabling hover effects and on click effects for unequiptable items would add or remove items
Let me see if I can add those in. I might need a sleep before I can tackle more of this XDD
pointer-events: none;
stops the mouse from chaning to a pointer when you hover over it.
unequiptableclass:hover { }
can be used to stop find and stop all the hover effects to indicate it is clickable
actually pointer event should also make a click ' pass through' the item, as if they clicked empty space since nothing is behind it
Oh yeah! Cause I don't want any accidental clicks. 😮
right and since we're targeting the class given IF an item is unequiptable > it only targets grey shields, meaning black ones can still be clicked
Yeah! Exactly. Let me see...
so do you think we can fit another IF statment that IF grey then not clickiable?
or would that break the <i> ?
that's sorta what i did with the classes
if it's not equiptable give it this class, if it is equiptable give it that class
you can then edit the css in the css file
but if you really want it in the style tag then you could do it, it's just getting messy
Yeah for sure.
style="pointer-event: ${item.Equippable ? 'auto' : 'none'}$;"
i don't believe you can modify the :hover pseudo selector inline though, so you would be stuck adding the class anyway
and if that's the cass i'd move as much of the logic the css as possible
Update --- the error seems to have resolved itself?? I didn't change anything but it's gone and I can't recreate it...
Okay I've noted down what I need to do tomorrow. Going to have to re-type a bit of this but basically make sure the link and hover interaction is not apart of the gray shield at all. But that is tomorrow Key's problem. XDDD I sleep
Hey Folks, I have created a character sheet for Cosmere RPG using CSB
https://igorteuri.itch.io/cosmere-rpg-fvtt-sheet
I'm back at this, I am seeing a lot more this time
i am struggling to locate the label i want to check the values from
physical defense shows "undefined"
and these are the errors i'm getting
but it doesn't look like they are related to the issue
alright, not showing an error anymore
turns out i had unwanted extra text in the label messing up the calculation
however
the bonus up there should be 11, it's not adding the modifier from the armour
the current formula in the defense label is this: ${agilityTotal + 7 + (equalText(itemAbility, 'physicalarmour') ? 1 : 0)}$
hmmm
equal text would point at the text in the "ability" column
i'm supposed to use ´find()´ or ´lookup()´ right?
${agilityTotal + 7 + (lookup(itemAbility, 'physicalarmour') ? 1 : 0)}$
somthing like that?
wait, how do I tell it that i want the result of the mod field?
lookup("itemAbility", "physicalarmour", "itemMod", "??????")
ugh
i don't know
if itemAbility is physicalarmour, then i want the value from itemMod, otherwise 0
fallback(find('dynamicTableKey', 'itemMod', 'itemAbility', 'physicalarmour'), 0)
In SQL it would be: SELECT itemMod FROM dynamicTableKey WHERE itemAbility = 'physicalarmour'
so ${agilityTotal + 7 + (fallback(find('items', 'itemMod', 'itemAbility', 'physicalarmour'), 0))}$?
got an error
Then F12 and check, which error