#Custom System Builder
1 messages ยท Page 37 of 1
there are times where every success adds a wound, but they're rare and mostly power related (Also siege weapons)
Ok, then a small hint: This will get complex and I won't help you with that for now because I have to sleep. But I can refer to this article here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Handling-Dice-Pools
Any idea whats going on here and how I can proceed? In some cases everything works fine but its Like random what value I get here from several Items. Some return me two values one 14 and another one the correct value. Even when I use just a Copy of the requested item and dont make any changes. Its complete random what I get here.
Well, randomness is pretty hard to debug, so I'll need to know on which occasions this issue appears
๐ฎโ๐จ
Maybe the console has some input
I'll check at home
And you could check your props in the console too
Hello, is it possible to make items that bring other items along when added, such as "Fire elemental" species item that has "Fire Resistance" piggybacking on it?
You'll need a World Script for that, because you have to listen to certain Hooks (createEmbeddedDocuments, deleteEmbeddedDocuments) of the application
It seems that after the Update to V12 / CSB 4 tehz following Label Roll Message of a Button stopped working:
${
setPropertyInEntity('self', 'MUT_base', 15)
setPropertyInEntity('self', 'KLUGHEIT_base', 15)
setPropertyInEntity('self', 'INTUITION_base', 15)
setPropertyInEntity('self', 'CHARISMA_base', 15)
setPropertyInEntity('self', 'FINGERFERTIGKEIT_base', 15)
setPropertyInEntity('self', 'GEWANDHEIT_base', 15)
setPropertyInEntity('self', 'KONSTITUTION_base', 15)
setPropertyInEntity('self', 'KOERPERKRAFT_base', 15)
}$
anyone have a clue why? Had no issues with this before
it updates the first value and then stops
One thing I really want to try to do is have a chat message for an attack roll list all of the player's selected targets, highlighting the target on hover similar to combatants in the combat tracker, and include a button that allows them to make a defense roll. I'm not entirely sure how to do that, though,
These should be in separate Formulas, not all in one
Me neither ๐
._.; It may not be doable at all, then.
I could figure out how to get the targets of a user, but highlighting is completely out of my scope
That may have to be an optional part, then.
Try out game.users in the console and see if you find any useful functions in the prototype
All righty.
If you find nothing, then you can consult the Foundry API or the macro-polo channel for the first 2 topics
For the defense roll...
My idea would be to store all necessary data for the defense check in the data-attr of the HTML-Element (Button) and then call a Macro in the onclick-event
Hmm...the only issue I have with using macros is not knowing if I can easily export them along with the JSON data to other GMs I'm sharing the system data with.
The solution would be a module with a compendium, where your Macros are stored
Oooooh. I don't know why I hadn't thought of that. Thank you!
Thank you! ๐
As for the game.users thing, I do see that each user in that list has a targets array.
Perfect. That'll probably do
Each holds a token.
...Okay, maybe that isn't the only problem with using a macro...I have no idea how to write a macro with this system.
EDIT: Never mind, a search helped.
Okay, that didn't help. All I want is to be able to save the below to a macro and call it whenever I need it. Can I even do this? Or do I have to convert the whole thing to a Javascript script?
?{rollModifier:"Edges/Obstacles (positive is edge, negative is obstacle)"[number]|0},
?{attributeMod:"Modifier"[number]|0})}$
${#rollFormula:=concat(string(2 + abs(rollModifier)), 'd6', switchCase(sign(rollModifier), 1, 'kh2', -1, 'kl2', ''), '+ ${attributeMod + stat_ACV}$')}$
${#modSeverity:=switchCase(abs(rollModifier), 0, '', 1, 'Minor', 2, 'MAJOR'can, '${abs(rollModifier)}$x')}$```
You'll even need custom HTML (and some JS)
So I can't save it in CSB formatting...
Wait, derp, ComputablePhrase is a thing.
I'm really just looking to use the macro to pre-emptively set some variables. Is there really no way to do it with just CSB formulas?
Never mind, I'm just going to include all that in label roll messages. It's too complicated for me to try to do it as macros when I'm still stuck in the CSB mindset.
Can we dive in?
Heya, wanted to ask if it's possible to create these side tabs you also have in DnD5e?
I just found out the last value of the array is the correct value. Is there any chance I can pick that?
I don't play DnD, so I don't know what you mean ๐
Doable with a little bit of JS
Nope, splitting a Label Roll Message would require JS
Which I dont speak. I still would prefer to debug it, but I dont know where to start. So both I would appreciate Help.
Then you should take a look here first: https://github.com/GamerFlix/foundryvtt-api-guide/blob/main/macro_guide.md
Is this for JS or debugging it?
That's primarily for debugging
I can take a look at it later on after work. You can either send me the templates or give me access to your world and I'll try to find the issue
the DnD5e sheet looks like this:
and i was wondering if it's possible to create these sidebars or even also the texture of the sheet itself?
I see. I don't think you can do something about the Tabs without your own Component-Implemenation.
Regarding the texture, everything that involves styling, requires the use of CSS. You can either suply your own CSS-file or use the CustomCSS-module.
alright, thanks.
will the tabs at some point maybe be an option tho?
Dunno, nobody requested this so far and I don't know if it's worth the effort
ah, yea. fair point
All right...then I'll have to keep putting all the logic inside the label roll message, or start over from scratch.
If you want to know how splitting can work: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Handling-Dice-Pools
Thanks.
Well, I got this far.
<p><strong>Roll:</strong> ${[%{return await game.packs.get(`world.macros`).getDocument(`1eyuUXQfSrcKAJvO`).then(m => m.execute({ rollMod: ${rollModifier}$ }));}%]}$</p>
I see. The return of %{}% is wrapped with '' if the return is of type string, so you'll end up with an invalid string
It would be easier to save the result in a variable and use that in the Roll Formula instead
Not sure I understand. Maybe it would help if I posted the macro.
let keepMod = ``;
switch(Math.sign(rollMod)) {
case 1:
keepMod = `kh2`;
break;
case -1:
keepMod = `kl2`;
}
let rollFormula = `${2 + Math.abs(rollMod)}d6${keepMod}`;
return rollFormula;```
${result:= %{...}%}$
${[:result:]}$
No whitespace between the variable and the assignment-operator allowed (at least for now)
...I...did not know that. ๐คฆ๐ผโโ๏ธ
Oh! That fixed it! Thank you so much!
Now to see if I can modify it so that the macro also returns an edge/obstacle announcement string.
I think I'd do that by turning the return rollFormula; to return { rollFormula: rollFormula, eoString: eoString};, and change ${[:result:]}$ to ${[:result.rollFormula:]}$, and then doing whatever with result.eoString...right?
Can I DM for this?
Sure
Might work
Going to give it a try now.
You might need to edit options.localVars within the Script
Possibly. Doing it the way I tried just resulted in "object" being called an uncomputable token.
Well, my thing for adding a list of targeted tokens to the chat message was working, until I actually tried to add the list of targeted tokens. I honestly don't understand what it is about this system that I'm just not getting. I know the problem is between the keyboard and chair, and it's frustrating the crap out of me.
...Okay, hang on, there's one thing I haven't tried yet.
No, that didn't work.
What's even more frustrating is that it works just fine in the debug console, but not when placed in a script thingy in the chat message.
...Never mind, I figured it out.
How do I phrase this? You know how with labels, you can click them, and it can do a dice roll and send a message in chat. How can I add something like that to an individual item without effecting its template?
I have a template for "abilities" that I want to be able to drag and drop onto character sheets, so I made them an "Item". But each ability will have different rolls and macros and what not. I wish I could edit the item sheets individually, and just have the template act as the baseline.
Cause I would rather not have to make a template for each individual ability or item
It's kinda seeming like this system doesn't play well with template strings.
@formal goblet yo trying to do this formula ${switchCase(InitiativeStatDropwdown, 'brainsinitiative', brainsmod, 'brawnsinitiative', brawnsmod, 'braveryinitiative', braverymod)):0}$, which depending which drop down option listed returns a value of a choosen number field, however all i'm getting from it in vewing the hiiden attribute is ERROR.
closing parens too much and :0 has no meaning
closing parens?
)
okay now its just retuning a blank value (not even a 0) and now showing the actual value it should have.
@formal goblet note that this is from the formula ${switchCase(InitiativeStatDropwdown, 'brainsinitiative', brainsmod, 'brawnsinitiative', brawnsmod, 'braveryinitiative', braverymod)}$.
syntax is correct, so you don't have a matching case
OK, quick question. I'm sure there is a simple answer to this.
I use macros inside of labels to allow people to spend experience by clicking on a Label text.
Example for Strength:
const { strength, experience, rank } = entity.entity.system.props;
if ( ( ( parseInt(strength) + 1 ) <= (rank) ) && ( parseInt(experience) >= ( ( parseInt(strength) + 1 ) * 4 ) ) ) {
await entity.entity.update({"system.props.experience": parseInt(experience) - ( ( parseInt(strength) + 1 ) * 4 ) });
await entity.entity.update({"system.props.strength": parseInt(strength) + 1 });
return "Strength increased!";
} else {}
return "Strength already at maximum for rank or out of Experience!";
}%```
However, I have a table of Specialties in which I wish to use a similar method.
For the table called "specialtyTable", I want to increase the value of "specialtyValue" in the same row as the Label that you click on to perform the macro in the roll message. How do I specify this in the above? Thank you! ๐
options.reference has the path, so you can traverse from there.
So, I'd say options.reference.specialtyValue ?
It's a string (something like 'specialityTable.0.specialityValue')
Got it. Obviously, it's dynamic using the same row, and the players can add more to the table by selecting new specialities to add, etc, etc.
So, the label has to dynamically update the value on the same row as itself.
On the good note, I think this is the final mystery that I need to solve to get my sheet to 100% ๐
The 0 is the row index, so you can use that to get the row data. The row data itself is just an object with the properties of the column
Got it! Perfect:) Thank you!
And...I just noticed that you guys already implimented inherently a simpler way to do all of this. ๐คฆโโ๏ธ
You could add a text area, visible to GM only, containing the roll formula, and the label roll message defined as "recalculate(<key of your text area>)"
This won't handle dice rolls however... Recalculate only works with static values, the same as a Label Text
can i make a conditional that checks a string instead of a number? or do have to go to js for that?
equalText() it is
Ooc, how do people set up Hit Boxes?
Wdym?
Something that shows you have
x/y health or wounds remaining so that I could then work on making something that could remove wounds when damage occurs
I guess I don't really know how to describe it
Like, currently I have 2 seperate boxes for Current and Max "Wounds"
The way I have mine set up is, in my template I have a separate tab called GM which players do not see (set to minimum Assistant GM role) where I have Number Fields set up that I can enter the character's starting/current stats - I only have Body Points and Mind Points.
Then, under the Prototype Token's Resources tab, I set up Bars 1 and 2 Attributes as the Keys for those two Number Fields.
This way, when you drag the character's token onto the mat, it should display those stats as bars that you can then adjust with a right click.
If you need screenshots for clarity, I'd be happy to assist.
Yeah, I think i'd need Screenshots to understand. Sorry
No worries. Each of the next paragraphs will reference each of the screenshots here.
So my actor sheets have a tabbed panel at the top. So I have added an extra tab called GM, which has a minimum role as Asst GM so the players don't see it.
In that GM tab I have two number fields which correlate to a character's BP and MP. In my case, I set the maximum to be a formula taken from another number field section, so players can't accidentally add more health than they are allowed when they heal themselves.
Then, on the Prototype Token box, under Resources, I set two attribute bars, one for each of the resources I already set.
Finally, when I drop the token down, it will show the bars for each of those attributes correctly.
I hope this helped.
Was thinking of doing a project with this but before I started, was curious about the ease of sharing it for others to run - I see the manual says something about being able to export templates in the settings and then import. Easy as that or any pitfalls?
It's that easy, yeah
#package-releases message
Hi everyone ๐
**Version 4.1.0 is now generally available, with the following changes : **
Technical Features
- Added mandatory
getTechnicalNamemethod for Component classes. This will output a warning in the console until Foundry v13 compatibility version. - Allowed Component Registration to only take one argument : the Component Class
Features
- Added the ability to drag and drop rolls to the Macro Hotbar
- Added translation support
- Added french translation
- Added german translation
- Reworked various texts, notably renamed Item Container to Item Displayer
Fixes
- Fixed Dynamic Tables wrongly allowing any type of component as a column - Restrictions are back in place
- Fixed Tabbed Panels not accepting dropped component
- Fixed Macro rolls from ItemContainer
If you encounter any issue with this new version, please post an issue on Gitlab : https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/new
is there a module or an easy way to track experience on a character sheet and automatically level them when they hit certain numbers?
Dynamic tables allowing any type of component? ๐
This should be good
You can probably do it with scripts, but that depends on the complexity of your system. For example, just increasing stats based on level will be a lot easier than adding new abilities or the option to multiclass at each level.
No that's the opposite ^^"
Dynamic Tables should not be able to allow anything as a Column, specifically Containers do not work. An issue made its way in and allowed unauthorized components to be added to Dynamic Tables, but this was not intended
Sorry the changelog was not clear :/
how can i convert a string "str" into the value of the property str?
exist a function like getProperty(myProp) ?
found it
ref
_>
Does anyone know why this little button appears at the bottom? And how to remove it?
Under name Jimbo
// Rola trรชs dados de 6 lados
let roll = await new Roll('3d6').roll({async: true});
let roll1 = roll.dice[0].results[0].result;
let roll2 = roll.dice[0].results[1].result;
let roll3 = roll.dice[0].results[2].result;
// Cria um array com os resultados e os ordena
let rolls = [roll1, roll2, roll3].sort().join(",");
// Define a mensagem com base nas combinaรงรตes
let message = "";
switch (rolls) {
case "1,1,1":
message = "รNICO 1, 1 ,1" ;
break;
case "2,2,2":
message = "SUPER RARO 2, 2, 2" ;
break;
case "3,3,3":
message = "SUPER RARO 3, 3, 3" ;
break;
case "4,4,4":
message = "SUPER RARO 4, 4, 4" ;
break;
case "5,5,5":
message = "SUPER RARO 5, 5, 5" ;
break;
case "6,6,6":
message = "LENDรRIO 6, 6, 6" ;
break;
case "1,3,5":
message = "SHINY 1, 3, 5" ;
break;
case "2,4,6":
message = "SUPER SHINY 2, 4, 6" ;
break;
case "1,2,3":
message = "RARO 1, 2, 3" ;
break;
case "2,3,4":
message = "RARO 2, 3, 4" ;
break;
case "3,4,5":
message = "RARO 3, 4, 5" ;
break;
case "4,5,6":
message = "RARO 4, 5, 6" ;
break;
default:
message = Rolagem: ${roll1}, ${roll2}, ${roll3};
}
// Exibe a rolagem e a mensagem no chat
roll.toMessage({
speaker: ChatMessage.getSpeaker(),
flavor: message
});
this is the script
let roll = new Roll('2d6');
await roll.roll({async: true}); // Executa a rolagem com animaรงรฃo
let result = roll.total;
let message;
if (result >= 10) {
message = "Sucesso Total";
} else if (result >= 7) {
message = "Sucesso Parcial";
} else {
message = "Falha";
}
// Exibir o resultado no chat com a rolagem animada
roll.toMessage({
flavor: Resultado: ${message},
});
the same thing happens here
Untick the option to send a message to chat in the Label config
holy crap! it's work, thankyou so much
the players dont have permission, how to fix it?
What kind of permission?
Go into the permission settings and allow your users to execute Macros
Hey, is there a better way to create radio buttons in a dynamic table?
Rather than having 5 columns for 5 buttons, can it all somehow fit in 1 column?
I suppose a table in a table could work if there's a way todo that?
alright, and to the other ways of doing this? having 5 columns of radio buttons without a lable is a bit crazy
But... you actually can specify a Label for each Radio Button
when I said label i meant the column name, my fault.
I think you should be able to adjust the size of the column with CSS (or even by specifying a non-auto size for each Radio Button in the column)
I can probably force the spacing with css...
Can you think of a better way to do something like this?
I'm probably going to do the up and down arrows on each side of the radio buttons since I (dont think can) can't stack them.
(probably going to have to change the dropdown to a label as well)
It depends. You can always stick a Label-Component with your own HTML, so it might work that way
๐ค you mean like... create two divs in the cell that controlls the up/down functionality?
Yep. Quite a bit of work, but I think it's handleable
I think for that amount of work splitting thre arrows on either side of the radio is my best bet ๐ค should way simplify the process.
Not sure if this is a bug, but I have a tooltip for the panel tab that's a few levels above this table, and it shows the tip not only when hovering the tab itself but any content within the tab
visual:
the tooltip (TT) is set to the social tab but shows all the way down in another panel (no tt set) into a table
Interesting one. I think it's worth a report in Gitlab
I've never actually done that before lol
Not the most technical of people if you can't tell..
I'm over here trying to figure out how to make my up down buttons function lmfao
i actually dont even have a gitlab account, only github
So if I set the downarrow to a label and put this in the roll message:
${#notify('info', 'test')}$
It still outputs this to chat and makes a roll sound, can I disable that?
what is the internal css name for the background of the character sheet?
try using the inspector tool:
i think it may be : custom-system-actor-content
using a formula for label text, how do i return an output to be displayed?
I also need to figure out how to set the group of a radio button to be different PER ROW in the dynamic table
I have a question, I'm using the custom system builder, and i'm not really well versed in the language used for it and i wanted to know how i would reference one component to answer another. For example say i put the number 20 into a component where i track Dexterity and I have a formula of (dexterity-12)/2, how would I make it so another component would take the 20 and put it through that formula to get an answer.
i think that depends on how you're formatting the sheet.
For example if you're using a Dynamic Table and 5th edition you can:
${floor((sameRow('dexScore')-10)/2)}$
where dexScore is the Component Key of either a label or number field within the same row.
Note the math there is boiling down to ((input - 10) / 2) THEN round down.
so if i wanted to take the number put for Str and use it in a formula to output a number in the tiny box to the right what code would I use and where would would I put in in the component.
say the number for Str is like 15 or something
make sure the box next to STR is a number field.
Where the box on the right is, set it to a label
in the label text set it to ${(floor(STR)-12)/2}$
where STR is the component key for the number field.
it worked but I;m getting a -6 with a 15 in Str
what formula did you put? parenthesis matter.
is this right?
yeah you copied what i did exactly lol which was a half conversion from 5e to what you said.
change up the parenthesis to be in the right order of operations.
floor((STR-12)/2)
should I keep the ${ before and after?
absolutely.
that's telling the system that it's a formula and not just text.
thank you been stressing about this for like an hour ๐
trust me i know
i've been fighting with getting radio buttons to have per-line grouping,
and getting arrays to work and output in a dynamic table for about 5 hours now
the wiki is absolutely no help.
this is a out of date tutorial but it covers the basics and isn't horrible, most of what's wrong you can figure out: https://www.youtube.com/watch?v=yGVOj_iqiKg&t=123s
The new Custom System Builder for Foundry VTT (was Modular System)
Custom System Builder: https://gitlab.com/linkedfluuuush/custom-system-builder
Sandbox: https://gitlab.com/rolnl/sandbox-system-builder/-/tree/master
Sandbox Video: https://www.youtube.com/watch?v=V9IXafKPK2I
GRPGA: https://gitlab.com/jbhuddleston/grpga
Using Foundry without a...
aight thx
is there any way to change the color of the meter component, i wanna change it to blue
custom css file โค๏ธ
It was already on, but it still isn't working.
Hi! After the update Custome System Builder stopped working on Forge. It won't even show up among the installed systems, and when you try to install it, is says ok, but nothing is changing. I tried to uninstall, tried to upload through the Importer as well. Local version is working perfectly.
Head to the macro directory, find your macro, open the permission setting for this macro and grand at least viewer rights to the persons you want to be able to use tis macro.
Hello ๐
I just released a 4.1.1 version to fix this. Can you tell me if the issue is resolved ?
dang that was fast
mr creator man ๐
heads up there is a bug with the tooltips carrying into items beneath the panels, into other panels and tabels if no other tooltip is set โค๏ธ
I had trouble building the package for this version, I think the Forge had downloaded a faulty version. The new version is nothing other than a new number to force the Forge into redownloading the package ^^"
But since I don't use it, I can't make sure it worked as intended :/
And the default Foundry Version for a standard User is v11, so the versions aren't even displayed in the bazaar :/
i currently have my css file set to /charactersheet_css_custom.css in the settings.
the wiki just says to set it to the file path starting from the data location - yet there are multiple data folders...
since im using node JS my dir looks like:
FoundryVTTServers\v12\data\Data\worlds\worldName\data
I've tried a few options but nothing seems to be working to load the css.
to test I have it set it * { background-color: red; }
opp -- nvm
worlds/worldName/data/charactersheet_css_custom.css worked... wild.
It's the path inside FoundryVTTServers\v12\data\Data
yeah on my linux OS it had worked with just "/style.css" which is why i was confused why it didnt work, and i tried the first and last data dirs... it was the middle one lol.
Heads up everyone:
when setting a meter color you need to add the !important css modifier as there appears to be a green overlay from the default element styling
.additionalCSSClass .custom-system-meter-fill {
background-color: #8d0621 !important;
}
Can someone ping me in the reply so I can get to it when I wake up?
But is there a way to change css coloring of a meter based on a dropdown value?
It'd be super dope to change the meter to a darker redish purple as you're more disliked and a lighter greenish blue as you're liked
I really think the visual distinctions would really help organize and quickly relay information
@sinful spade Not sure if it's what you want exactly, but you can change the colour of the meter based on the optimal, sub-optimal and sub-sub-optimal values.
I managed to make it work for firefox browser, but not for chrome. Here is what I currently have :
.custom-class-name {
--background: rgba(180,180,195,1);
--optimum: rgba(150,150,220,1);
--sub-optimum: rgba(100,100,155,1);
--sub-sub-optimum: rgba(50,50,90,1);meter{
background: var(--background);
}
/Firefox/
meter:-moz-meter-optimum::-moz-meter-bar {
background: var(--optimum);
}
meter:-moz-meter-sub-optimum::-moz-meter-bar {
background: var(--sub-optimum);
}
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
background: var(--sub-sub-optimum);
}
I'd say you have two solutions :
-
Use a dropdown for the liking level, with numbers as key (a liking rating from 1 to 5 for example) and a meter with that dropdown as a value and min:0, max:5, low: 3, high: 4
The meter will be red on 1-2, yellow on 3, green on 4-5 -
Use a dropdown for the liking level, with numbers as key (a liking rating from 1 to 5 for example) and a label with an html element and custom styling based on the dropdown's value
this issue was coming up exactly after i was updated to 4.1.1 yesterday
Impossible. Yesterday was the release of the 4.1.0, probable the culprit of the issue you have been experiencing
Version 4.1.1 was released this morning ๐
Did you rerun the update after my message ?
Sorry for the confusion. i'll check right now and get back to you
gosh, my bad! The 4.1.1 solved the problem! Thank You and keep up the good work!
Glad this is solved ๐
Enjoy the system, don't hesitate to message again if you have any issues ๐
how would i make this code round the number down, ${floor(Str-12)/2}$
I didn't consider using the levels of the meter to change color... that's could be a cool thing for as vital stats get lower the bar turns darker. BUT what i'm talking about is a "progress bar" toward the next reputation tier...
consider an xp bar and it's relation to level ๐
The floor function already does that ๐ that's why its there.
if you want to round up change floor to ceil (for ceiling)
yep, i got a drop down to signify the degree of which they like you - and a meter to show progress between reputation tiers.
So basically "xp bars" and levels.
Already have a dropdown containing all of the reputation tiers (1-11 as the key, so 5 pos 5 neg 1 neutral)
I have zero clue how to use the key as a HTML selector though... Is there a way in CSB to identify the key as a css class? and how would i port that information to sameRow(meter)? I'll be playing around with it for a few minutes here...
Sorry to always be in here asking questions but I've read the wiki on gitlab up and down about 6 times and frankly am at a loss for how to do most of what I want to do, at least the more advanced side of things
when a number like 15 goes in it stays 1.5 it doesnt round down
more parentheses, I think
look at your parenthesis and follow the order of operations
${floor((Str-12)/2)}$
you are div by 2 after the rounding
thx
there's not a function in CSB that lets me change the css class in advanced settings is there?
Like I cant put a formula in the css class section right?
${sameRow('reputationTier')}$ and just style the resulting .Neutral class?
didn't work ๐ฆ
No, additional CSS classes are not formulas ^^"
The Key is already used as a CSS class in the component ๐
You should look at the HTML source by pressing F12, you should find your component in there and see which tag holds the Key as aCSS class ๐
correct, I've found the keys within the select -> options elements
what i'm stuck on is using that information to alter the meter in the same row.
if I just did say .reputationTier select option[1] {background-color: red;}
I'd have effectively changed the color of my dropdown menu and not the meter fill.
i have no clue how to uh...
.reputationTier select option[1] { sameRow(meter){ background-color: red;}} ??? lol
You can set a Key on your meter ๐
But indeed, you will Target every meter in the Dynamic table
im sorry i think we have a disconnect here lol
I'm okay with targeting every meter so long as it's all key 1 meters are red. all key 2 are orange (example).
but how in the world do i use the key to target the meter elemet? it's not under the same path
if i just target the key, it will change the dropdown, not the meter.
how do i use the data from the options element to impact the meter-fill class
.reputationTier select option[value="1"]{
background-color: red !important;
}
like i said, selecting the key only changes the color of the dropdown menu (suprisngly not even if it is the selected item, just the item in the menu)
You won't be able to change the meter's color for each value using just CSS. You won't be able to target each value, you will be able to target the meter as a whole but that's it
so what im doing is impossible ?
There may be a way
If you know all the percentages the meter can take, you can target the colored part with .meterKey .custom-system-meter-fill[style*="30%"] (Example with 30% fill)
Then you can turn it red (for example) with background-color: red !important;
huh?
im not trying to change the fill color based on the %
the fill color should be red if they're in a blood fued from 0-100%
so at 25% or 75% the green bar should be red, untill it fills up and they are no longer in a blood fued then it's 0% for say... "hated" status and should be... orange?
oh, I didn't understand that, sorry ><
If you don't need more than 3 colors that may be doable. Otherwise no, this won't be possible in the current element, and you should maybe use a Label to create your own meter-like display ๐
is it possible to transition to the three colors based on distance from the key?
E.g. a gradient from red yellow green?
not with the basic meter component
is there a beter suited component then?
there's already a numberfield controling the meter's progress
${sameRow('reputationProgress')}$
Like I said, you can use a Label
Something like
<div class="custom-system-meter" style="width: 100px;">
<span class="custom-system-meter-fill" style="width: ${floor((sameRow('reputationProgress')*100)/6)}$%; background-color: ${switchCase(sameRow('reputationTier'), 0, 'red', 1, 'orange', 2, 'yellow', 3, 'green', 'blue')}$;"></span>
<span class="custom-system-meter-content">${floor((sameRow('reputationProgress')*100)/6)}$%</span>
</div>
This is assuming :
- reputationProgress goes from 0 to 6
- reputationTier goes from 0 to 4, 0 being the worst tier and 4 the best
You put this as your Label text and it should display correctly
Warning though : this won't automatically resize, you'll need to adjust the width parameter in the first div
hold on, you can inject html directly into a label?
i've done... so many workarounds...
Into label text, prefixes, suffixes and roll messages
Hell, you can even start an HTML string in a prefix, add to it in the text and close it in the suffix
sorry
when i tried doing an array in a ${}$ earlier, it just output an error
before doing a dropdown i was trying to make buttons to control the selected value... but it would only output an error...
Why?
The code was SUPER simple
${const arrayName = ["value", "value2"];}$ and even that output an error
the logic was
${ const array
IndexedNumber = 1
currentRank = array[IndexedNumber]
}$
So the buttons could theoretically just changed the indext number condition...
but even removing everything but just the array was an error and i checked it with my dev friends for syntax errors.
That is because CSB language does not support arrays. You can do this in a Javascript script, by replacing the ${}$ with %{}%
Then inside the brackets, you write Javascript and must return a string, which will be outputted to the chat
Here is the doc for that :
https://gitlab.com/custom-system-builder/custom-system-builder#45-scripts
(You may have to search the section yourself, GitLab is janky with those links... The section is 4.5. Scripts)
yeah i read the scripts section i didn't understand what it meant by "outside the system"
i figured that was a usecase for accessing other module's api or something... didn't realize that it was just to use native JS
figured any native js would be compiled by math.js just fine
It's both ^^
And no, math.js is pretty picky
if you cant tell by now, i'm not a developer. i'm a power user lol
it's me, i'm the wetware problem
There appears to be an issue with the math logic though ๐ค
i tweaked what you sent from *100/6 to:
${(sameRow('reputationProgress')-1)*25}$%;
as its a scale of 1-5
so (1 - 1) * 25 = 0, and (5-1)*25 = 100.
Yet for some reason i'm getting odd incriments I've double checked the parenthesis and logic checks out yet i'm getting uhh
op there's a second span conflicting
The formula is in two places ^^
yeah i dindt read that low in the code yet ๐ค
trying to figure out what the second fromula is for
a content class? is that for the ceiling?
The first is the width of the colored part, the second is the text printed in the meter
oh that's an interesting approach
dude seriously thank you for your help
you're a lifesaver
it's god damn beautiful
Hi, I literally downloaded the custom system builder today, and I'm checking the Deathwatch sheet. Does anyone know if there should be some kind of button here or something? Maybe I forgot to download something? Im very new to this and not sure what to fix if something is not ok
Does the label have text or an icon ? If not, you may be lacking a world setting called "roll icon"
i dont think it has any
You can go to Foundry Settings, under Custom System Builder and set "Roll Icon" to "dice-d20"
This should highlight all rolls in the sheet ๐
Beware though, the Deathwatch sheet is pretty old, it may be non functional with latest versions of CSB :/
its here many thanks
so im trying to use this to create a working sheet for the fire emblem roleplaying game, but I could use a few pointers
so in the game, you can carry several weapons, but only one can be equipped, how can I tell the system which item is equipped for the purpose of it being factored into calculations of attack
How might you use the refresh button's function (the one beside the template dropdown on actor sheet), from a macro? I update a lot of values on the sheet but it's not very responsive to update itself for the players.
You could use a Dropdown (with options-origin: Dynamic Table) to select which Weapon should be equipped. With that, you can either perform a lookup() on the Table or you use a little Script to fetch the value of the Item, which is not present on the Container: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Scripts/Scripts-for-Items#1-scripts-for-fetching-values-of-specific-items-in-an-actor
await <actor>.templateSystem.reloadTemplate(); // <actor> must be replaced with the actor context
I have math errors (I think? ERROR or NaN) all over my sheet after updating from 4.0 to 4.1.1, had no issues in 4.0. What changed?
Check console to see which kind of error
not the whole thing, and there are like 500 of them so not sure if all the same but I think they are.
That one is derived from another error. See if you can spot the source (different error message)
Well, that one straight forward
fetchFromDynamicTable() doesn't exist anymore. It got renamed to lookup()
You might want to export your templates and replace all old functions with the new one (with search/replace)
whats the best way to do that? Export then open where? I never edited sheet stuff anywhere but from CSB
or foundry i mean
Any kind of text editor, that supports searches (usually CTRL + F)
Notepad++ is ideal for most small time configuration IMO, especially since its free.
Well, that was easy. ^_^ Thank you.
suddently my sameRow functions seem to not want to work
I'm getting "cannot convert attributeValue to a number" but it just refernces adding modifiers to bonuses?
the codee for attributeValue:
${sameRow('attributeModifier', 0) + sameRow('attributeBonuses', 0)}$
there's also a new warning:
Error: The {{select}} handlebars helper is deprecated in favor of using the {{selectOptions}} helper or the foundry.applications.fields.createSelectInput, foundry.applications.fields.createMultiSelectElement, or foundry.applications.fields.prepareSelectOptionGroups methods.
Deprecated since Version 12
Backwards-compatible support will be removed in Version 14
@formal goblet sorry for the ping but i think CSB broke '-'
so far it appears that it can no longer get a number from a label? but i'm not even certain
You can ignore that. Just a warning, that something will be removed with V14. Until then we have enough time to change it.
What does attributeValue return?
other than errors in the console? it only seems to return the value of the Bonuses without the Modifer
whats weird was these exact cells were working for weeks lol
and all the sudden i realized their math was off because i tried to reference them later and the console threw a fit
deleted the new addition and now they're entirely broken
You can inspect the props with game.actors.getName('actorName').system.props in the console. Maybe there's something suspicious.
anthing i should be looking out for specifically?
undefined, 'ERROR', values that don't fit
nothign standing out
Where do you use the value of attributeValue?
Split the formula of it and validate each part
Try without the fallback
removing the fallback gets the correct numbers BUT
Custom System Builder | Cannot convert "attributeTable.1.attributeValue" to a number Error: Cannot convert "attributeTable.1.attributeValue" to a number
this reappears in console
You're using sameRowRef() somewhere, right?
the code in the referenced cell works just fine -
no errors in console, correct output; just a label that converts into 5e modifers as a placeholder ${floor((sameRow('attributeBase')-10)/2)}$
not Ref, just sameRow
But that string can only come from sameRowRef()
i mean - idk waht to tell you lol this is the code for attribute value currently, and it's outputting that error:
${sameRow('attributeModifier')}$
I don't think that attributeValue is actually the source of the problem. I suspect, that you use lookupRef() on that column somewhere else instead of lookup()
uh, I had it set to lookup earlier but did change this function to use lookupRef:
${lookupRef('attributeTable', 'attributeValue', 'attributeName', sameRow('abilityBaseAttribute'), "==")}$
This will output a path, which will always be a string
i just changed that a while ago because it was sending errors related to that function that I hadn't touched since pre 4.1.1
and by a while ago i mean 20minutes or so lol, ๐ค but changing it back no errors are coming back... that's really... weird.
It seems that all contracts are satisfied then
i wonder if the new things i added somehow broke that old cell...
even more weird is that table wasn't referenced at all
but either way for now there's no errors, thank you so much and again sorry for piniging
hmmm ok so heres a new problem
i need to import a variable from the enemy target
then i need to compare it to the roll
this is what i have so far but its not compiling
basically the result of the roll needs to be equal to or lower than the sum of the player's accuracy minus the enemy's dodge
i think i need a string to check the result?
Do we no longer have those "mini-templates" that can be put into main templates?
Yes, they are items of type "Subtemplate"
This is not possible using Foundry's core dice system, but with CSB functions it is !
You need to do :
Hit: ${roll1:=[1d100 <= (:Accuracy - fetchFromActor('target', 'Dge', 0):)]}$
Crit: ${roll2:=[1d100 <= (:Crit - fetchFromActor('target', 'Avd', 0):)]}$
Cf. https://gitlab.com/custom-system-builder/custom-system-builder#4211-fetchfromactor
it's work! thankyou
I was going somewhere else
so when i click the button its assigned to, it doesnt roll so i think that means theres a compile error
from what i can see the syntax looks right
if it would be easier, i can dm you directly
Do you have an error i the browser console (F12) when doing the roll ?
Can you send me exactly what is in your roll message ?
I put the formula you posted
Ah damn, it's my bad, I brainfarted...
FoundryVTT's roll API does not do comparisons, so you need to do it outside the roll :
Hit: ${roll1:=[1d100] <= (Accuracy - fetchFromActor('target', 'Dge', 0))}$
Crit: ${roll2:=[1d100] <= (Crit - fetchFromActor('target', 'Avd', 0))}$
Is the intent that only item rolls can drop onto the macro bar? Because on my sheet this is the case. Rolls from the sheet don't drop to the bar, but rolls from items do. Unless I'm doing something wrong. Looking for feature documentation currently but haven't found it yet.
Any roll with a key should be able to be dropped on the macro bar
Does your other roll have a key ? ๐
Out of curiosity, what Pokemon System are you making?
Can anyone help me? I'm using CSB and I have a dynamic table with a dropdown menu that retrieves all the items from an Item Displayer. I'm trying to access a field inside that item called item_effect and I want to display it in that dynamic table (not in the Item Displayer). I would like to know if it is possible to access that field directly only looking for the item name or id, without storing the field value in the item container and then using that value in the dynamic table, if it makes sense
Heya! I have a problem with Griddy not being able to detect item quantity.
I'm using item.Quantity in the respective field, given the variable is named "Quantity", but it doesn't seem to work
Is Griddy a module?
Then you have to discover, how that module actually detects the quantity of an Item. I can only tell you, that all properties are stored under <context>.system.props. In case of an Item (with the variable name item), it would be item.system.props.quantity
Oh, lemme try that
I always get lost in those
Nope, nothing..
I don't know how to find that out
Visit the project page of the module and read through it. Ask the module owner. You can also take a look at the code of the module if it isn't too big.
Also make sure that the module does NOT DEPEND on specific systems. It must be system-independent
It is system independent. And I was asking in Module Troubleshooting, hopefully to find the creator, but they told me to seek help here :P
Still hoping someone more familiar with the module pops up there. And the project page doesn't have anything on it. My best shot is reading a code I mostly don't know how to read. But I'll try when I have some time available.
Thanks!
Hello, I actually don't even know if I can call it a system lol
Basically and briefly, I took the original Gameboy attributes, did some calculations that made sense, and added some dice.
Coincidentally, I was typing his rules to put in the diary inside the Foundry, because almost everything is in my head lol
The initial calculations are
HP/2 + level
Attributes /10 + 1 per level in each one, that is, level 5 would have +1 in all (except HP) and then repeat the process.
2d6 + this value. There are other little things but in short this is it lol
Oh, so it's more original than anything. Neat!
Yes, I use the original attributes as a base. But in the game I gave it a different taste, with my way of mastering ahha
can anyone give me direction on this error?
@formal goblet ,
This macro of yours:
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Scripts/Scripts-for-Active-Effects#4-world-script-for-adding-custom-status-effects-in-the-config
You mention that the macro should be added in the World Scripter Compendium.
I didnโt understand that. Where should I add this script? I already have mine ready, but I donโt know where to put it!
Oh, I get it now. The module was missing!
Sorry for the question. It's my terrible English! XD!
Hi! How can I make it so that the key value of a dynamic table shows the value of a numberfield?
The idea is to use a drop list set to dynamic table ti change the result of a formula. Currently I have it working with:
${ref('alqudl')+alqumod+alqubon+alqunvl}$
And the dynamic table has some integers at the key column. It works fine, but I need to change those int from key column to a ref for another numberfield... So far I haven't been able to do so
So you have to map numbers to keys and get the value of that key?
I think so... Not completely sure if I get you by 'map numbers'
This would be a Map:
0 => 'str',
1 => 'dex',
2 => 'con'
So with the number 1, it would map to 'dex'.
A simple input/output - example
Ok... Right now I have some formulas to show the total value of the atributes. I need to get the final value of those labels into a dynamic table so the drop list changes the value it's using for another formula. The formula is working with this table, but I need the atrval values to mirror the value from a numberfield
So just ref(dropdownKey)?
Does that work with the regular drop list?
Oh boy... so simple XD
I'm pretty sure I did something like that, but messed up anyway somehow XD
Thanks a lot!
Thank you! ๐ In case someone tries to accomplish the same thing and have a hard time understanding how that first part works, here is the guide:
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System
@formal goblet did you see my error image a few posts above? I've never heard of that... ".replaceAll" It's not even on my sheet, and this is another new error when changing from 4.0.1 to 4.1.1
As it states on the wiki you can uses data from an actor or item in userInputTemplates.
The template will be displayed using the actor or item data, if you want to use this data in Labels in the template.
When I call an userinputtemplate in a label roll message of item container how do you reference something in item because item.[key] does not work.
It comes from fetchFromActor(). Can you check the formula inside it?
The OR is an either ... or ... depending on from where you roll
It is coming from a label roll message in a label an item container . I can reference data from actor in userinputTemplate but not from the item.
This is a reference from the actor ${strength_perm}$ and works
If I reference a key in the item use ${item.skill_specialty}$ I get
If i remove the item. I get.
We didn't include the properties of the linked entity (aka item). So you won't have a chance without a change in the system
I setup a variable in the roll label message but I could not reference that in the userInputTemplate either.
Yeah, local vars are also not considered ๐
And yeah, I know, dialogs could have some improvements
Should the read.me be changed then stop people from torturing with questions about it.
You're the first
This is the formula.
equalText(sameRow("operator"),'Auto') ? sum(autoPilot,sum(lookup('damageTableSoft','integrityLoss','location',sameRow('stationName')))) : fetchFromActor(sameRow("operator"),sameRow("attSelect"),0)
unless its an error in the roll message, that above formula is just the label.
${#?#{User Input Sheet}}$
${#bonus:= equalText(sameRow("operator"),'Auto') ? autoPilot : fetchFromActor(sameRow("operator"),sameRow("attSelect"),0)}$
<table>
<tr>
<th>${sameRow('stationName')}$</th>
</tr>
<tr>
<td>Operator</td>
<td>${sameRow('operator')}$</td>
</tr>
<tr>
<td>Total</td>
<td>${Roll:=[:diceModSelect2:+:bonus:]}$</td>
</tr>
<tr>
<td>Buffer</td>
<td>${sameRow('buffer')}$</td>
</tr>
<tr>
<td>Limit</td>
<td>${sameRow('limit')}$</td>
</tr>
</table>
You forgot to specifiy the target-actor
A wait, I see
What does your sameRow('attSelect') return?
There is at least one other
#1037072885044477962 message
@formal goblet
The actor is the "operator"
attSelect seems to work, I did a test field in the dynamic table, it returns the chosen attribute of the actor name plugged into the "operator" field.
@formal goblet Also want to add that I had no problems up until this recent update. To 4.1. did something change on how actor data is accessed?
Hi, is there a bug that makes some rolls not to roll? I've got a able with the same formula but diferent values and some just don't roll, no matter what I change
Hi guyss
How do I get the number of lines from a container item, without the items needing to have an attribute quantity = 1
4.1 actually removed the fetchFromDynamicTable and getRefFromDynamicTable which had been forgotten in 4.0 (but said to be removed)
Does your executed Formula use any of those fonctions ?
I replaced all fetchfromdynamictable stuff via notepad, control+H/ find and replace all method, so I don't believe so.
I think I fixed this particular error though by telling it to just roll a label (which was a copy of the same formula and was working fine). I don't know why I didn't do this in the first place, I think there was an issue at some point rolling the label so I put the formula in the roll as well. Now it works this way and not the other. ๐ค
However.... I have another error that I found though. Many of my calculations on this sheet are looking for values on a dynamic table that may or may not have rows added. They calculate fine when there are no rows. when I add a row, they all come up with Error "uncomputeable token" undefined values. Then, when I change any field in the table, the sheet rights itself and all the errors go away. Any clue what is going on with that?
I already have a bug report on that, default values in Dynamic Tables not being used for computation right after row creation :/
The underlying question is : what is the contents of sameRow("attSelect") (an example)
Oh okay, and no work around for the bug at the moment?
There is an image that shows all attSelect is. This whole sheet is a vehicle sheet. this particular section is a dynamic table with combat stations. a player puts their character name into the "operator" field. the roll (or label now at this point) looks for the operator's attribute based on attSelect. As I said, I think that problem is solved via just rolling the lable. I'm not sure why the roll formula didn't work anymore but the label did but if it works it works lol.
Oh well if it's fixed then... Huzzah I guess ^^
Hey guys, I managed to get my roll macro into CSB character sheet, however, besides the desired result, it also give me an undefined error. When executing the macro there is no error. Is there something wrong with the way I'm doing it? I just copied it from the documentation:
%{return game.macros.getName('rolagem_bl').execute()}%
Is there an error message in your browser console ? (F12)
There is actually!
<span class="custom-system-roll" data-roll-data="{"raw":"undefined","result":"ERROR","parsed":"undefined","hasDice":false,"tokens":{"children":[]},"rolls":[],"hidden":false,"explanation":true}" data-roll-mode="publicroll" data-hidden="false"> <span>ERROR</span></span>
Maybe this makes it better to read lol
You can disable Chat Message creation in the Label config. The error comes from the undefined return of the Script
That solved it! Thanks!
%{return await game.macros.getName('macro').execute({name: '${str}$'})}%
Is this correct if I want to input my STR score into the macro before executing it?
Yeah, but you'll need to access the value under the name name with your current Script
I see. Thanks!
Similar to Guashnim's question, but I want to have my Roll Label fire off both a visible message including dice rolls and text, as well as IronMonk's /timer command (which I have set up as a chat macro since I can't seem to get it to work within the roll label directly). Since I can't just disable 'send roll message to chat', is there some other way I could work around it? Can I fake a return value in a chat macro?
This should hide the result of a script:
${#%{...}%}$
I've been poking around the internet trying to find an answer, but I suppose I'll just ask here directly:
So I have my own system, and I have a character sheet that goes with it. Is there any way to get CSB to work with that character sheet, like adding buttons/inputs to a PDF?
No, not directly to your PDF. You can recreate your sheet in Foundry, but it will be "from scratch", you won't be able to just add fields to a PDF ๐
Dang. So without some HTML/Java footwork, I won't be able to use the design
Righto, thanks ๐
${count(lookup('table', 'column'))}$
I'd need more details for that:
- Your Formula
- All dependencies of the Formula
Trying to add roll to macro bar
So my roll is in Dynamic Table. A have click right button on the roll, copy the chat message and put it to macro bar
/sheetRoll ic_combat_skill(@rowId=cs2ThWCX1HMmp90H).roll
when I have modify macro up to official doc - macro stops working
/sheetRoll ic_combat_skill(name=Eels).roll
Doc
To trigger dynamic table rolls, you must use a filter like the property reference, for example : /sheetRoll skill(name=Lock picking).score to trigger the roll associated with the label in the score column of the dynamic table skill, on the row which name is Lock picking.
Error
[Detected 1 package: system:custom-system-builder(4.1.1)]
at mathInstance.SymbolNode.onUndefinedSymbol (Formula.js:435:27)
at math.js:26377:89
at math.js:24320:51
at Object.evaluate (math.js:24162:45)
at r.evaluate (math.js:24139:55)
at Formula.computeStatic (Formula.js:439:27)
at Formula.compute (Formula.js:366:21)
at processFormulas (ComputablePhrase.js:103:35)
at async ComputablePhrase.compute (ComputablePhrase.js:157:34)
at async Label.js:480:13```
How can i use a math.js function on a CSB function?
i specifically want the math.sign(sameRow())
but wouldnt math.sign require %{ and sameRow ${
I think you need ${}$ as well..
in a later point in the wiki it mentions using a macro;
4.10. Do not include explanation in chat message
When using formulas in chat-messages, you can use the Formula's result as is, without it being enclosed in the clickable box with the explanations. This can be useful if you want to call a macro with parameters calculated from Formulas. To do so, prefix your formula with !, for example :
/myMacro ${!target - roll}$
You wont need the ! unless you want it silent but the example should apply
but this is work
/sheetRoll ic_combat_skill(@rowId=cs2ThWCX1HMmp90H).roll
and only when I change @rowId=cs2ThWCX1HMmp90H to name=Eels, according to the doc - it start Fail
๐ค i mean.. it sounds like foundry is having a hard time referencing a given name rather than a document ID.
have you tried it with the ${}$?
i found a simpler formula to approximate the same result in a more transparent way to the players...
But still struggling with the implimentation of:
%{Math.trunc(${sameRow('attributeBase')}$/20)}%
Hello, i'm new to Foundry and while trying to setup my homebrew (from scratch) system for my friend, i'm trying to setup something that would passive regen their mana and stamina every turn but can't seem to do it, i saw the active effect on the gitlab but can't seem to make it work, nor trigger it, could someone help ? Thanks
@barren skiff
if this is to be believed - you'll need some other macro, script, or module to handle that.
Though if it's some 5 hp per round healing... i'd just have people do it manually tbh
yeah it's something this easy but i'd like to automate this if possible, most of the player being very new to this, so i could try a macro or script but what i dont get is how would this work ? Should i use the macro every encounter ? I heard about world macro, could this be a thing ?
honestly not sure ๐
Im an awful coder and only decent at messing with foundry, though i hope to get better.
Documentation for Foundry Virtual Tabletop - API Documentation - Version 12
foundry has some built in APIs you could possibly hook with a JS macro that senses the end of a turn
something along the lines of...
on new turn
get combatant...
if combatant is player
regen 5hp
oh nice, i'll give a look, thanks ๐
ofc, but hang out for a minute and maybe one of the system devs will come along, they're fantastically helpful
well it's 3am here i was about to go to sleep, but sure thing tomorrow ! ๐
Judging from the message, this is a macro from an Item Displayer ๐
The modification you make will not work there, the macro needs the item ID to work correctly in that Case
Why do you want to edit the macro ?
Link kind friend :I
is it possible to reference outside of a table using a sameRow name?
e.g.. to reference 'physicalBonus' and put it into the table as a label in the Physical row?
I've been playing with this concept to see if it'd work
${ref(${sameRow('attributeName')}$FlatBonus)}$
or, i guess the inverse would also be fine - have an empty label and use an item to modify the value based on the name?
How about lookup()
to access it from outside the row, but then would it change the contents?
Which content?
If you need to fetch a value from a table and the source-component is outside of the table, use lookup(). The alternative is item modifiers if we're working with an Item Displayer.
so any of it i guess haha.
I have a base physical score of 80, say I get the fatigue debuff - how can that debuff go in and change the bonuses (3rd column) to -10 for example.
If I can get one of these working, I can extrapolate the rest of this table out pretty easily
this specifically is me trying to get the same attribute and search up the '<name>FlatBonus' key outside of the table and autofill it in, should it exist (using 0 as a fallback would be a later step)..
That way items could modify the value outside of the table which would then be ported in..
IDK if this is even possible thouhg
Ah, you need to modify values within a table.
With modifiers, you need to use lookupRef() in the key-section (item modifiers have to use fetchFromActor() additionally)
im sorry, I'm not following?
Item modifier key: ${fetchFromActor('attached', "lookupRef('table', 'targetColumn', 'filterColumn', 'filterValue')")}$
sure, that'd let me modify their hit once it's rolled i suppose
i guess what i'm trying to do is map out the table the be inclusive of items and bonuses to impact generic modifiers in real time so that players can easily see totals and values in row based on skills.
The tricky bit is I'm using dynamic tables to do this all to be able to add skills mid game similar to a 'fudge' system
e.g. player declairs a skill he wants to be really good at, and I'd have no way to know in advance to just add it in... so this way he can click to add a new row and just... bam!
Am i potentially missing an intermittent step? Using a dynamic table to house all potential skills and port them outside of the table for items to modify?
You can use any of these functions directly in Formulas : https://mathjs.org/docs/reference/functions.html
And sign is one of them !
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.
โค๏ธ i saw sign was one, my issue is with syntax of the %{ and ${ for that...
since the lookup? ref? i forget what i was doing at that time is within the Math.sign function, I cannot close out of one before the other and was getting errors with every way i tried
oh, it was sameRow
%{math.sign(${sameRow()}$)}% wasn't working
You don't need %{}% to use sign, just do ${sign(sameRow(''))}$
oh, so I can drop the Math. as well since we're using that compiler. that was probably my issue
sorry i moved off that problem and am having trouble remembering what i was using that for at this time.
Currently trying to figure out how to let items modify a dynamic table
oh right, i was trying to modify the dice pool ...
I needed to separate the sign to notify the roll of KH or KL conditionals
@formal goblet was giving you the right answer for this ๐
In items (and active effects) you can define modifiers which will modify values on the actor sheet. The modifier is applied passively as soon as the item is added to the player.
The Key must be the Key of the value to modify. It can be a Label key, a Meter Key or an hidden attribute key. The Field can contain Formulas.
The operation defines the operation you want to do on the Field
The value defines the value of the operation. For example, if operation is - and value is 10, the modifier will decrease the field by 10.
Now to your specific issue, you need to target a cell in a Dynamic Table. To do do you need the lookupRef function, which will return the technical Key of a Field in a Dynamic Table.
i'm following so far.
I've been playing around with the functionality, and made a Ring that gives +5 to max HP.
but currently my attempt to make that ring give a +1 to physical bonus isn't going great lol
setPropertyInEntity('attached', 'lookupRef('attributeTable', 'attributeBaseBonuses', 'attributeName', 'Physical')')
Can this lead to foundry hanging for everyone?
And maybe hanging becomes longer the more persons are connected?
Get a very strange behaviour of adding or deleting dynamic tables rows yesterday while having the first game after updating from 3.0 to 4.0
Replace the setPropertyInEntity with fetchFromActor ๐
Omg... i figured since it was fetch it would just... get that information to be utilized elsewhere
what a misnomer โค๏ธ thank you so much
sorry for doubting you martin
This should not
Does it happen only when adding Dynamic Table rows or on every sheet update ?
I have two things in mind : I saw an object merge in the code that may cause issues, and a Foundry bugfix in v13 which can help, stating that the prepareData step was called multiple times on entities by mistake, which in CSB case can be very time consuming, and exponential depending on how many items an actor has.
That's what it is though, the key Field just has to return the Key of the field to update, not update it itself
i think i understand
can i use switchCase for conditional logic?
because I tried:
${switchCase(sameRow('attributeDiceMod')+sameRow('attributeDiceBonuses'), >0, test)}$
and it's throwing cannot convert "error" to number.
(both dicemod and dicebonuses are lables containing only number values)
I didnโt had much time to research the behaviour via the game seasion.
There where no error, but it seams foundry was recalculating every item and actor in existence and doing so once for every connected person. So in this situation multiplied by 5.
Happened only while adding/deleting a row. Every other change to the sheet reacted normally.
I will run updates now and test later if it still occurs.
Nope, switchCase only checks equality ๐
Looks like the Foundry issue tbh, but that's concerning :/
I see.
'-' so I should use %{ and use standard JS, correct?
every time i've tried that i've had issues with the %{ and ${ conflicting.
even outside of the math.js functions
You can make conditional checks with this syntax :
condition ? value if true : value of false
For example : sameRow('attributeDiceMod')+sameRow('attributeDiceBonuses') > 0 ? test : 0
is there a specific way i should chain these?
The values are also executed, so they can be conditional too..I recommend using parenthesis to ensure the order of execution ๐
today i learned that: ' and โ are not the same.. ๐ฎโ๐จ
thank you tho
Oh yeah, that will cause some issues ๐
i just want to say, as someone who doesn't develop things...
coding is like having an argument in a language i dont speak against a grammar ... enthusiast.
Yeah, that's the spirit !
๐ i'm currently in a 30 minute long argument about adding two strings
it keeps trying to convert to a number
got it! ๐ฉ
well.. sorta
this is a csb question so:
If i modify my table value using the item method martin suggested earlier, is there a way to display a + sign if it's positive?
You can use string() to force it to a string.
@brittle moth I think we should just override concat() or provide our own function for string-concatenation, so that numbers won't cause an issue
sbecause right now my output is
5d62 rather than 5d6+2
yes my issue was i was wrapping both a string and a number up in the string function when i had to uh...
${concat(sameRow('attributeDiceQuant'), string(sameRow('attributeFlatBonus')))}$
^ that
You have to check that manually
so another column converting it with conditionals?
Or is there a way to conditional the cell that's being modified without mucking it up?
Yeah, we should, it is indeed a pain
i just want to say that you guys are absolutely wonderful and i appreciate all your patience with me
it (finally) works.
(just noticed my + didnt carry over... gime 2minutes lol)
okay no? my code is correct???
i think the built in string function uh... ate it?
okay i've been playing with the roll function for over an hour, am i missing something obvious?
This is my latest attempt:
{$[sameRow('attributeFinalDice')]}$
- but I've tried pleanty others such as concatting in the additional ${}$ or ${/${/}$}$
${[:sameRow('attributeFinalDice'):]}$
Your dollar was misplaced
Any script call inside a roll must be enclosed in ':'
(Confusing, I know, there is some rework needed there)
Oh, my bad.
this is Item Displayer.
Is any possibility automatically take icon form the item to the Macro Icon on HotBar?
If you drag / drop the roll from the sheet in the macro bar, the item name & icon will be automatically taken from the item ๐
Oh, my bad 2))))
I need drag ROLL itself and not the item ICON))) form item displayer
Dragging the item creates a macro to open the item
Draggin the roll icon creates a macro to make the roll ๐
yes - now I know it) it was not obvious for me
And how to put ALT roll to the hotbar? or I need modify call directly in hotbar?
@brittle moth So due to UNIQ id from itemDisplayer there now way use 1 button on HotBar for the SAME skill but different Tokens?
Uncaught (in promise) Error: Unresolved StringTerm 2
requested for evaluation
i honestly dont even know what that means
It doesn't like your Roll Formula ๐
๐ฆ i didnt even write that one
it's just like link posted:
${[:sameRow('attributeFinalDice'):]}$
the code it references is a little gnarly but the output should be ok
Test what samerow outputs
huuuuh
${sameRow('attributeFinalDice')}$
outputs .... squares?
wait im dumb
i left it in the role formula lol
here's the output of a regular label
its red because of some css styling i was trying to get the roller icon to be red
but it came out perfect
I need it in the Roll Message. But from the first glance, it seems valid
you mean like this?
Then:
${#roll_formula:= sameRow(...)}$
${[:roll_formula:]}$
Uncaught (in promise) Error: Unresolved StringTerm 2
requested for evaluation
[No packages detected]
What the fuck?
๐คฃ im glad its not just me
consoleLog(sameRow(...))
Uncaught ReferenceError: consoleLog is not defined ?? eh
oh .
Uncaught ReferenceError: sameRow is not defined
?
was i not supposed to plug that into console?
Ah, no. It's literally a formula
But you get a log in the console
I suspect a suspicious character in it
Do it in the Label Roll Message to be safe. You don't have to put it into a Roll Formula
And what's the error?
Error: The {{select}} handlebars helper is deprecated in favor of using the {{selectOptions}} helper or the foundry.applications.fields.createSelectInput, foundry.applications.fields.createMultiSelectElement, or foundry.applications.fields.prepareSelectOptionGroups methods.
Deprecated since Version 12
Backwards-compatible support will be removed in Version 14
only a bunch of those
no red errors
It means you have an undefined return for some reason
And without an error message, it means it was able to find the column, but the value in it was undefined
? ๐ค
i mean
the cell we're referencing is a merger cell based on concats
but since it came out with sameRow ...?
Just to make sure...
Try out game.actors.getName('actorName').system.props.dynamicTableKey in the console
And check the props in the entries
Uncaught (in promise) TypeError: this.function is not a function
[No packages detected]
oops lol
do i need to put the table key somewhere in that?
yeah i got actor name haa
attributeModifier: "ERROR"?
wait that's long been deleted.
attributeFinalDice: "1d6\n"
interesting there are \n at the end of them
whats weird is.... i dont think i did? '-'
i dindt put any formatting into it just incase either
so it's all one line
No, indeed the way it works means the macro will only work for the original character :/
Did you add a newline after the Formula in the label text ?
tentititavley no?
I copy and pasted the entire label text just now.
I never really use \n - i prefer <br> lol
You create a \n by pressing enter
im gonna be honest i got no clue what im doing ๐คฃ
? the entire code is on one line tho.
The question is : is there a blank line at the end of the "label text" Area in the label configuration form ?
no
but i just opened NP++ and ran the joinline function
no idea how or why but it appears to be working
.... so i just spent two hours tearing this apart for... an invisible bug that came from ...?
how you people became coders, i'll never know o3o
You could export the actor and search for \n
lol i think in this case joinline was easier
i dont even want to think about how many lines there are in this character sheet
it's kinda out of control
but again i'd have actually never figured this out
so thank you
oh and before it gets too burried: this gentleman was looking for some help
Hello ๐
This will not be possible from CSB only. You'll need to craft a custom module for that ๐
You can maybe ask in #macro-polo for help on a macro, or #module-development for help on a custom module creation ๐
Oh ok, thanks ! ๐
Is this possible to update a key value with a macro ? For exemple my player have 0 out of 10 mana, and with a macro i could run when need he get 2 mana to bring him at 2/10 ? When i run the macro, i don't manage to correctly update the key value and instead of going from 0 to 2, it goes to 02, then each time i hit the macro it add another 2 behind like 02222, any idea ? Thanks
The +-operator can do different things:
- If both values are numbers, they will be added together
- If at least one value is a string, they will be concatenated together
Maybe it's sleep deprivation, but I can't for the life of me get dropdown filtering to work on a item containers.
I've got it to put out (object obj), error, and just blank lines lol
That's because it's supposed to work on Dynamic Tables only ๐
I thought you could output an item container to a drop down?
Shouldn't the option population still work because the table-data-structure is now more or less the same?
Only if you use column data, you won't be able to use the name or the image of the item, since it's not saved in the data structure :/
Name and Id are saved, I agree with the image
I don't have the code in front of me right now, I trust you ๐
Me neither, but that's what I have in my mind
What are you trying to do exactly ? populate a dropdown with the items in an item container ?
Yes
I'm trying to get a list of all titles the character has unlocked and display one
You lost me. Are the titles items? If you're trying to display a list of item names into a dropdown, ${lookup('key','column')}$
I tried the item container keeu and column 'name' for sure.
And yes, titles are items
I think that the one that spat out error
I'm pretty sure I read this here but I can't seem to find it anymore. Is there a way to display the Label value of a dropdown menu instead of the key?
Tested right now, you need to configure it like this :
The Dynamic Table Key must be your Item Container key, option keys must be id and option label must be name, both all lowercases
It depends where you fetch the options from.
- If they are custom options, no, there is no easy way, except making your own translation script
- If they come from a Dynamic Table, you can use
lookup('yourDynamicTableKey', 'yourLabelColumnKey', 'yourKeyColumnKey', yourDropdownKey) - If they come from a Formula, then you must already have the translation script ๐
since all the options start differently, it would be easier to use a switchcase right? or is there a simpler solution?
I guess switchCase is the best, since all keys are different ๐
thanks ๐
so... not the lookup, ref, fetchfromactor.. any of that?
Specifically in this configuration, no need ๐
๐ฉ alright. i guess im glad its easier than i thought
well i say that
whats the synax for "column to use as option key"?
just the key of the column. This should be unique data, every row should have a unique value for this column. In your case, since you want to display items, you should use id, which will use the id of the item as a key
This is not something you're going to see on the sheet, it is technical data to remember which option was selected
ok, cause i only have the default name column in there right now and uh this configuration isn't working lol
you can see "the Duke" title in the bottom left as my test
no errors in console, just a blank dropdown
As I said
The Dynamic Table Key must be your Item Container key, option keys must be
idand option label must bename, both all lowercases
You entered 'Name' with an uppercase N, it should be lowercase
i tried that first
then i changed it to Name to match how its displayed on the table as a test
my bad
changing it back and no go
is condPrestigeTitle the key of your Item Container ?
yes
do i need a component in the item?
because right now its just a blank template for testing
No, I mean the actor template
And a screenshot of the character as well ๐
It seems I'm messing the syntax up, do you mind taking a look? I'm trying to nest the value of the dropdown menu inside the switch case, it looks something like this (btw it is written in a label) ${switchCase(dropdown, 'str', Strength)}$ what am I missing?
you need '' around dropdown and strength โค๏ธ
those are singles btw
anything you're looking for specifically? or do you just want screenshots of everything
Your formula tries to display the contents of the field with the key 'Strength' if the dropdown 'dropdown' has the key 'str' selected
If you want to print 'Strength', you need quotes around it : ${switchCase(dropdown, 'str', 'Strength')}$
not arround dropdown as well?
Specifically the parts around the Item Displayer
Nope, dropdown will resolve to the dropdown's selected value, if you put quote, then it's just the string 'dropdown'
Nope. You need the value of the dropdown component, not the static value 'dropdown'
Thanks, I'll try to correct it
good luck mate ๐ฉ
Congratulations, you spotted your first bug in CSB :p
wait so you're saying for once it's not me? ๐
andd hey this is my second bug ๐ฆ
To make it simple : the solution doesn't work because the name and id of the item are not computed unless there is at least another column in the Item Displayer
yepppp ... adding a second column works
As a workaround, you can create a new column, give it a key and no text or anything, and it should work ^^"
Really ? What was the first one ?
... would you believe me if i tried everything i could think of for about 3 hours before even messaging y'all?
I believe you ^^
uh tooltips carry down
i messaged you and martin about it a couple days back
here
carries through tabs, tables, pretty much anything until a different tooltip is set
That did the trick thanks!
Didn't see it, I bookmarked the message to fix this later ๐
Well the Item Displayer issue will be fixed in the next version ๐
yeah haha i tagged you in it a bit after that,
martin had asked me to report it in gitlab but i havent had the willpower to break my fixation on this sheet to make an account haha ๐คฃ
I think the wildest bug we have right now is this one: #1037072885044477962 message
y'all honestly have way too much on your plates with this ๐คฃ
I know its the last thing on your minds but cleaning up the wiki would seriously help the less technically inclined like myself stay outta your hair better.
I feel bad coming to you so much but after 3-5 hours on a problem that I can't find on the wiki or screening the past message is about all i can take haha.
if its easier, maybe updating that tutorial on youtube with the most common things would at least screen the common answers out
Do you know this page? https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/home
also the wiki button on gitlab appears to be broken, i stumbled into a whole new section that i couldnt click because i clicked on martin's link when searching for someone else having issues with dropdowns
annnd that's the second
๐คฃ
yeha i found that this morning / last night
Yeah, the REAL Wiki has a bit more details in some aspects ๐
yeah when i went looking specifically for that after your link sent me to it
i found it in the initial message, burried as a {here} link lol
but the wiki button on the side is broke so i had (when i read it the first time) assumed it was a link to the page i was already on
The Wiki-Button on the sidebar has the same URL...
Your net then
At one point, I considered making a video as a quick breakdown of how to use CSB. I'm not that knowledgeable, but some starting point for visual learners isn't a bad idea. There's a video out there already, but it's outdated from what I recall.
extremely outdated - i still have linked it a few times in this chat but yeah lol it's only applicable to the extent of "here's how to organize a page" or bare bones labels
Also I have no idea how to use macros and I'm terrified of them. I run to javascript every time I think I might need macros.
Yeah, that one was from V8 or V9 with horrible UX, because Components weren't draggable ๐
omg felt.
i have so many use cases for macros and custom scripts but...
I can't actually code! ๐คฃ
i can like script with html and css, and even change someone's code to kinda do what i need but lord help me if i need to make something from scratch
This one is good to start with Foundry coding: https://github.com/GamerFlix/foundryvtt-api-guide/blob/main/macro_guide.md
Is that m-macros!?
i've seen a number of tutorials but i'm not sure they'd be helpful because they all rely on JS... which agian - i cannot code!@
i cannot code in any language (yet)
I encourage you to follow Martin's recommendations if you find your game ever needs something more than just bare bones.
i've actually learned (what I feel is a lot but is probably nothing) just from working with CSB ๐ฌ
my background is configuring minecraft servers lol i dont have a technical job, or degree this is just hobby
both him and link have been insanely helpful lol
link showed me how to add html direclty into a label the other day, i had no idea!
Concepts like data types, variables, operators, functions are practically in every coding language (even in simple algebra). You'll see many things, where you'll think "Oh, that seems familiar" or "Ah, makes sense".
im starting to see that ๐คฃ but there are none of those things in HTML or CSS haha
my friend just had to explain to me that a matrix is the same thing as an array... fml
Technically it's not actually ๐
dont do this to me
An Array is a 1-dimensional Matrix
To the devs, may I make a small request for a future update? Just to have Number Fields have an optional prefix so that using it for "Health: 5/10" doesn't require two or more components. I thought to do it myself, but got confused looking at the code for the Label and Number Field components when I wanted to use them as reference.
It has?
It... does?
Yeah, Label
i thought so?
Let me go make sure I'm not just blind, as usual
It's not called 'prefix' to be fair, just 'Label'
mood
Yeah, could be added
Yeah. I use two Panels, one to align the Number Field to to right and the other to align the Label to the left.
i used tables for the same thing, since they're a bit more riged for dividing evenly ๐
Obviously a very small and unimportant thing in the larger scope of the project
I considered that
i love your css tho - very scifi
Thank you! I think I spent a week or two learning CSS for my game? I don't remember.
thankfully i was already familiar with css before coming here but i've had to dive deeper to get things done... had to learn about nth child the other day to get my table columns formatted properly
I've done more since then, but I posted a video of what I did a while back. This is what it was a couple months ago.
my playes (those masochists) specifically asked to see the breakdown of all the numbers so I unhid them all and just... css made the uhm "eye pathing"? visually intuative
please send that my way, that's not next but 3-5 items down the line, once the character sheet is functional lol
Example sheet btw: https://foundryvtt.com/packages/custom-system-builder-example
Custom System Builder - Example, an Add-on Module for Foundry Virtual Tabletop
I have a player like that. Collapseable panels are my new best friend.
havent found a horizontal collapse yet haha
but even so there's 4 players, and 3 wanted the data...
keep in mind 1s and engineer, 1s a physicist, and 1 is in forensics, so they're uhm... data lovers to say the least
Oh boy, forensics...
I replied to my older post showing it. Check that one out, if you'd like.
I don't envy you ๐คฃ
but with a big of css tomfoolery i got it easily legable without collapsing
its okay haha - i'm also a datamonkey.. just not the same type as them.
my jam is qualatative data and statistics ๐ฉ
Oh that's so much easier on the eye than I expected!
lol thanks :p
Mine is addition and subtraction with single digits 
You guys are leagues ahead of me
dude ... jesus christ... what?
how even
I thought that was a sarcastic response to single-digit math
oh dude if you think this is bad aha
that's the dumbed down version after i got tired of dealing with sig figs and standard diviation i made a formula that approximates the same critical areas but is just rooted in a base number instead.
it's wayyy less accurate but i feel it was worth the fact that without doing any kind of math you can just know when your next spike is coming
settling on a -100-100 normal distro with base 0 and +20 diviations is MUCH easier haha
nah you have fun how you have fun!
i just love qunatifying this kinda stuff, and my players enjoy using it so - i allow the adhd to carry me into so many random rabit holes of design.. probably why i have so many bugs lmfao
My brain stopped
sorry sorry haha i build those kinds of tests irl for work ๐คฃ
but seriously how did you get that automated system working, that's fantastic!
make that a YT tutorial ๐ฉ
It's not very complex. I hid everything except for the character creator (tabbed panel) in the character sheet. Then once the box is checked, hide the character creator and reveal everything else.
CSB is extremely flexible, I love it, and this is not a sponsored message
so wait that's done IN the sheet?
Yep
i figured it was a secondary template modifying the created sheet ๐ฎ
yeah my "whiteboard" plan was going to be use inquiries
the ${? Name:
Popup prompts
That'll work too!
i will say the one major downside of my system is that it's based heavily on GURPS and Fudge so i need a lot of real time modification to skills, attributes, bonuses etc as players declare and discover ways to express their characters so dynamic tables are my best friend - its just... man are they hard to use!
like tables based on data from tables and item modifications galore lol
you ever played with FATE?
Yes
gurps was what fate is based on
๐ Oh! Hmm that kind of flexibility is hard to predict
which is exactly why i dont predict, i build systems that use player input to approximate what they want to do easily
and if one of them want to do something that's somehow way too far out of bounds... we add a new system lol
like in that last screen shot, you can really get good at any "ability" and just base is on any "attribute"
why not base your athletics on your dex mod if that's how your character wants to do it.
Never heard of a dancing skill but sure, base it on your dex lol
When using fetchfromactor when no target is selected I get this error
Uncaught (in promise) Error: Entity "target"
is there a way to get it to 'keep going' despite the error? Sometimes my players are not really attacking a target, they just wanna get some damage for an object they are striking or whatever
The function has 3 args
ah Ok so I have a fallback the first time it is called but not the second... let me try
if the fallback is a string is it in 'quotes' or "quotes" or alone? This is if it fails to grab a target's name
Doesn't matter (quotes if you want a string ofc)
I'm now realizing it was my 'setpropertyinentity' causing the problem... trying to figure out how to get it to move on if there is no target
setPropertyInEntity('target', 'lastdamage', "newdamage", 0)
Well... Maybe if you check with fetchFromActor() first.
Small hint: Players won't have permission to update sheets they don't own.
Yeah I had to give them permission to damage monsers which they can do fine. I think I need to nest 'setPropertyInEntity' inside a query that skips it if the target is the default like if default name is 'name' then if it sees name it returns ' ' otherwise it writes the damage to the creature
(thank you for walking me through this)
How do you check if a dropdown inside a dynamic table has any option selected, or if it has the blank option selected?
Honestly, arbitrary code execution in the system is not an issue for me at all, not in a Software which encourages it by the way of macros ๐
There is nothing you can do in the various fields of CSB that you can't do in a macro ^^
The blank option has a blank value, you can check for that ๐
${equalText(dropdownKey, '')}$
That worked, thanks!
Hey everyone, how's it going?
I would like to know if there's a way, either in a label roll or a macro, to have three rolls, and when executing it, the rolls wouldn't all happen at once. The result of the first roll would determine whether the second and third rolls continue. Is there a way to do this? If so, can you guide me?
I tried tweaking the settings of the Dice So Nice module. There was an option to uncheck simultaneous rolling, but it didnโt seem to change anything!
It is possible to have the result of a roll determine the formula of the second one. With Dice So Nice, if a roll formula does not contain a roll, no dice animation will happen. But I think if multiple rolls are to happen, every roll will trigger at once...
Here is an example message :
${#roll1:=[1d6]}$
${#roll2Formula:= roll1 == 6 ? '1d6' : '0'}$
${#roll2:=[:roll2Formula:]}$
${#roll3Formula:= roll2 == 6 ? '1d6' : '0'}$
${#roll3:=[:roll3Formula:]}$
${roll1 + roll2 + roll3}$
This rolls at most three 6 sided dice, rolling a dice only if the previous one rolled a 6
Great!
But the simultaneous rolling continues! Is there a way to do this without the rolls being simultaneous?
No, I don't think it is possible with just one chat message. I'll try some tweaks in a macro to be sure ๐
This macro "works"
You can see a delay between rolls, but everything is still pretty much too fast... You'd need to hook onto Dice So Nice's APIs to wait for a roll dice to end before making the next one, and before posting the last message
const chatMsg = "${[1d6]}$";
let lastResult = 6;
let rollSum = 0;
for(let count = 0 ; count < 3 && lastResult === 6; count++){
let phrase = new ComputablePhrase(chatMsg);
// Computing phrase
await phrase.compute({});
// Posting phrase to chat
phrase.postMessage({});
console.log(phrase.result);
lastResult = Number(phrase.result);
rollSum += lastResult;
}
ChatMessage.create({content: 'Final result : ' + rollSum});
Oh my God! You are amazing!
It's still relatively fast, but I'll take a look at the Dice So Nice API.
I found this macro in the Dice So Nice documentation that delays the rolls perfectly:
attack.dice[0].options.rollOrder = 1;
let directDamage = await new Roll("d6").evaluate({async:true});
directDamage.dice[0].options.rollOrder = 2;
let aoeDamage = await new Roll("d4").evaluate({async:true});
aoeDamage.dice[0].options.rollOrder = 2;
// Merge rolls
const rolls = [attack, directDamage, aoeDamage]; // array of Roll
// Post directly to chat or create your own ChatMessage
// Here we post directly to the chat
const pool = PoolTerm.fromRolls(rolls);
roll = Roll.fromTerms([pool]);
roll.toMessage();
I just donโt know how I would put a CSB script inside each roll!
Iโm trying to figure that out!
You won't be able to in the current state, I'm afraid. But you can fill out a feature request for CSB on Gitlab to make this happen naturally in CSB's roll messages
If you can link this doc it would be even better ๐
(The request on Gitlab is to make sure I don't forget it, since it stays logged in one place ๐ )
Alright, I'll make the request there. Thank you very much!
I created it, but I apologize if I didnโt follow the proper request layout or posted it in the wrong place. I donโt understand English very well, and even with translations, I sometimes get a bit lost!
https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/401
Perfect, thank you ๐
Hi, this has probably been asked before but I've been going through some old messages here and couldn't really figure it out. Is there any way I can store a formula in a Dynamic Table field so I can just call that field elsewhere and get the result?
Exmple: I have this formula stored in a Value field in the dynamic table: ${10 + first(lookup('traits_dtable', 'attr_value', 'attr_key', 'attr_agility')) + first(lookup('traits_dtable', 'attr_bonus', 'attr_key', 'attr_agility_bonus'))}$
And then I want to get the result in a label: ${first(lookup('secondary_traits_dtable', 'attr_value', 'attr_key', 'attr_evasion'))}$
How can I store the formula and then call that field somewhere else?
recalculate() lets you use arbitrary formulas
how do you change an item to only give benifits if it's "equipped" not just in the inventory?
You put in a condition into the value formula
Something like ${equipped ? weight : 0}$
OMG THANK YOU
would you then have to make a checkbox to "equip" it? I'm only aware of how to organize item containers, not how to add a way to "equip" them
thanks for the help
The state would usually be saved in the item.
How you define the state of 'equipped' is up to you.
For things, that have only 2 states (true or false), a checkbox is generally the best choice
ok, so if a weapon had a checkbox on the item such as "equipped_weapon" what would I have to do to make it so when its in the "bag container" it goesnt grant benifits, but when it is clicked to "equipped" via the checkbox it switches to the "weapon" item box and grants item benifits?
Item modifier are granted, whenever they're attached to an Actor. Items do not care, whever (or even if) they are displayed in a Container or not
ah ok, so there's no way to limit them to "equipped" then?
if so thats ok, is there a way to change item containners based on the component key?
You can still apply values conditionally. Your value formula in the item modifier has access to the properties of the item
ok, so the "checkbox" would have to be modified in the item itself wether to grant benifits?
Yep. You could change the properties of an Item from the Container with a little trick, but the Item would be the one holding the equip-state
so if the checkbox was "equipped_weapon" where and how would I implement this to apply item mod's only when the "equipped_weapon" is checked?
And you can configure filters for your Containers, so that they only show Items, that bypass the filter. So you could make it also dependent on the equip-state of the item
and do you mind giving a quick example of how to format the "equipped_weapon" into the filter formula? Sorry I'm still very new to the syntax of all this.
In the value formula of the item modifier: ${equipped_weapon ? mod : 0}$
Either item.weapon_equipped or not(item.weapon_equipped)
it's now only showing in the "bag" when unequipped which is great, but doesnt change when the checkbox is clicked.
the "Equipment" item container has the item.weapon_equipped formula
nevermind, I found the error
it was just supposed to be "equipped_weapon" not "weapon_equipped"
so is this correct for the item modifier? ${equipped_weapon ? mod : 5}$
wait a second... it's working in reverse
it's granting the benifit to unequipped and not when equipped.
This one means "If equipped_weapon is true, then mod, otherwise 5"
ah ok, got it
thanks for the explanation. So I would make that 0 again. and where would I place the 5 so it was added only when equipped?
The conditional (ternary) operator is the only JavaScript operator that takes three operands:
a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy.
This operator is frequently used as an alternative to an ...
amazing, thanks, that's extremely helpful 
and last question, I promise, to future proof the container with not(item.equipped_weapon) with other checkboxes, for example a equipped_armamanet for a different template, how would I add multiple options?
and thanks again, you're the best ๐
Chain them with and, or, xor or whatever: https://mathjs.org/docs/expressions/syntax.html#functions
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.
thanks again, you're the best
Hello, i'm still new to this so this may be a stupid question but, i'm trying to create an item (any, just to understand how it work), and by reading the gitlab i get that i have to create a template (same way it's create for the actor), then an item using this template, but when it come to the modifier i can't get it to work, i do a simple thing like that (screen), but the item when add to the actor didnt modify the value i want. I already try with this key and the same one with "actor." before but no luck, any help ? The value i want to modify is from a label and a number only, the number being on the "label text" thing. Thanks ๐
ok i get it it's was stupid
You don't need the 'system.props' part, just enter the key ๐
yeah i figured, thanks ! ๐
is there a way to type icons into the rich text editor? such as "fa-solid fa-fire-flame-curved" If so whats the correct syntax?
Did CSB update to version 12?
<i class="fas fa-fire-flame-curved"></i>
Yeah
Thanks, I tried it that way, but it seems to just display the text, and not the icon.
Try it in the HTML-editor. The special chars are getting sanitized with the normal editor
i'm getting the grasp of item but now i'm stuck on trying to make an item a consummable for a one time use such as a potion, is there a way to make a item run a script for more complex use or i can only use the item modifier tab ? Or, how can i make a item not a passive thing once in the inventory but more like a "use" item my player have to activate to run a script ? Thanks
I also dont get how to link a quantity to an item once in the player inventory, i do have a "quantity" column but i dont know how to fill or empty it automatically through the item script or even manually
hummm, so i'm suppose to run the script inside the item in a label roll message as a formula ?
oh i got that, but i still dont understand how to define a quantity in the item container
so how would i be able to display a roll in the item Displayer Columns. right now it only displays a error for the damage output on the sheet
the formula that is in the label text is "${item.RDamage}$"
this is supposed to be displaying 4d6
nevermind Figured it out, i had to put [] in the autocomplete formula of the item template
It's been a hot minute since I've touched the system, is it possible to have a value determined by a drop down key like this?
${psy_alpha ? 8 : psy_beta ? 6 : psy_gamma ? 4 : psy_delta ? 2 : psy_epsilon ? 2 : psy_none ? 0}$
Basically so if one of those is selected in a drop down another key (psy_rating in this case) would be one of those numbers?
Do we have a list of UI modules that are compatible with CSB?
ok new question, why does the damage output as this instead of a roll?
i simply have "${item.RDamage}$" in both label text and label roll text with 4d6 as the value on the item
Use [ ] to roll, $[4d6]$, in case of using formula ${[item.RDamage}]$, if the value needs to be translated : : ${[:item.RDamage:]}$
Perhaps translated isn't the better word to describe it... if anyone has a better definition, feel free to correct it ๐
got it outputting correctly thanks
After updating foundry 12.331 and CSB 4.1.1 the messages of foundry recalculating items and actors are gone โ but time delay is still the same.
I found this error when adding a new row:
Logger.js:33 Custom System Builder | Uncomputable token "lookup('treffer', 'trefferp', null, null, '===')" UncomputableError: Uncomputable token "lookup('treffer', 'trefferp', null, null, '===')" at lookup (FormulaFunctionImporter.js:84:27) at math.js:26523:52 at math.js:26516:66 at Object.evaluate (math.js:24162:45) at r.evaluate (math.js:24139:55) at Formula.computeStatic (Formula.js:439:27) at Formula.compute (Formula.js:366:21) at processFormulas (ComputablePhrase.js:103:35) at async ComputablePhrase.compute (ComputablePhrase.js:157:34) at async ComputablePhrase.computeMessage (ComputablePhrase.js:257:9) at async Label._getElement (Label.js:107:26) at async Label.render (Component.js:143:25) at async Tab.renderContents (Container.js:43:25) at async Tab._getElement (Tab.js:43:33) at async Tab.render (Component.js:143:25) at async TabbedPanel._getElement (TabbedPanel.js:56:36) at async TabbedPanel.render (Component.js:143:25) at async Panel.renderContents (Container.js:43:25) at async Panel._getElement (Panel.js:97:33) at async Panel.render (Component.js:143:25) at async TemplateSystem.getSheetData (templateSystem.js:337:41) at async CharacterSheet.getData (actor-sheet.js:49:19) at async CharacterSheet._render (foundry.js:5838:18) at async CharacterSheet._render (foundry.js:6572:5) at async CharacterSheet._render (foundry.js:7158:5)
โtrefferโ is the dynamic table i added a row to and โtrefferpโ is the only otherwise used value in this table. The other values in the table are just notes.
But anyway calculation of โtrefferpโ works fine.
Is this the โnot accepting the defaultโ bug?
Looks like it ๐
The Foundry issue is said to be fixed in the v13 preview :/
This should work ๐
Oh, that means no hope of a fix in v12.
Sad โ I have to find a work around for me.
Thank you
You have a full explanation here : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#334-calling-macros
Oh, that's awesome! Thanks!
How can I set a value to a field of an item that is already added to an item displayer?
Is the value only available in the item or also in the item displayer?
I'm displaying it in the item displayer as well yes
Then you can do a lookup()
It will point to the reference itself instead of the item displayer field? I assumed it wouldn't work this way ๐ am gonna try that thanks
lookup() will fetch the value in the Item Displayer, because you said that the field is also there
Yes it is but I assumed it wouldn't work because that item displayer column is retrieving the value from the item, it is a label
Sorry, i could not get this to work, this is too complex for me. All I want is to call a macro amed HP when I hit the label roll button.
Should be fine. Labels also hold values
You literally only have to replace the name of the Macro in the example to get it working
It isn't working... is it possible to asign variables to things like sameRow, lookup etc? I find it easier to mess up when there are a lot of fomulas inside each other
This was the previous failed attempt:
${setPropertyInEntity('${lookupRef('dynamicTable', 'fieldToBeAltered', 'Name', '${sameRow('Dropdown_with_name')}$')}$', 'fieldToBeAltered', "fieldToBeAltered - 1"}$
The value doesn't change... How would you achieve this if the field wasn't in the Item Displayer?
Wait, are you trying to change (instead of fetch) a field in an Item?
yes
Is it possible?
%{
const itemName = '${sameRow('select_muni')}';
const item = entity.items.find(item => item.name === itemName);
if (item) {
item.system.props.item_quantidade -= 1;
} else {
console.log('Item not found');
}
return item?.system.props.item_quantidade ?? '';
}%
I tried adapting the script you pointed to me
but this didn't work either
You must call <Document>.update, otherwise changes won't persist
Thanks I'll have a look then!
Yup that worked! Thanks! Took some reading to understand ๐
Hello, i've progress a bit since yesterday about the item creation process but i dont get how to run a script from an item because, the script should be in a label, but i obviously dont want to put the script in the template, so how does this work ? And once the script is in an item, i dont get how to run it from the item container, by reading the label key ? i miss something but i dont understand what, help would be appreciated, thanks !
Select Label for the column type in the Item Container and use the field Label Roll Message instead, every entry will become rollabe, if your formula is compatible with rolls
yeah i get that but putting a script here would make every item use the same ? Shouldnt the script be in the item ?
If you use plain numbers yes. The idea is to reference somewhere else. $[1d4]$ would make every entry a 1d4 roll, where (example) ${{item.item_damage}}$ will retrieve that field from each item individually
Hum, but how do you deal when different item have different effect ? I could call "item_effect" for exemple in the item container and each item have it's own define of "item_effect" ?
%{${!item.richTextAreaKey}$}%
like, i can put formula in the rich text area of my item and call those from the item container with this ? i though i had to use linkedEntity for that or anything from the item in the container
You could also do it with linkedEntity, but you'd need some sort of eval() if you do it this way
hum i'll have to look what it is, but i'll give a try with your way to begin with ๐
well i can't seem to make this work even for a basic function
i use setPropertyInEntity('attached', 'Vie', 20) in the rich text area of my item with %{${!item.richTextAreaKey}$}% in the item container of the character sheet (with the right key) but it dont work
i dont even try to use a "+" function for the value, i just want to set it to anything to understand how it work for now
That is not a Script, that is just a formula. Arbitrary formula execution is possible, but with limitations (such as no rolls or setPropertyInEntity())
Or actually... Try out ${${!item.richTextArea}$}$
Greetings, good people of Custom System Builder Land. I have a puzzle I have spent entirely too long attempting to solve on my own. Perhaps you can help me. I'm trying to subtract the result of 1d6 from the value in a number field. It's a consumable resource called "Will." Whenever a 1 is rolled on a wound die (d6), another d6 must be rolled, the result of which should be subtracted from Will.
You can store roll values in temporary variables if you use variable_name:= before the roll, like ${roll:=[ 1d6 ]}$
then you can use that "roll" to subtract or add or whatever, there seems to be no limit to how many variables you can asign
Roll formulas don't work in setPropertyinEntity, do they?
If I were to guess, no. you can asign the value you obtain in the setPropertyInEntity, wouldn't that work as well?
I'll give it a whack. I've tried so many different ways I don't remember if I've tried that one or not.
I've put my test character, Beef, through a lot. Dude's tired.
Just to add to the previous answer, I'd use a ternary to check the values and perform the operations needed
I've used ternaries before. It's kind of 50/50 whether the formula breaks if I add a ternary. What would you recommend?
roll and store the roll, check with the ternary if the value is 1, if it is roll again and store that number in a second variable, if it is not asign the value 0 to the same variable, then subtract that last variable from the Will
subtracting 0 should do no harm haha
I'm coming back here if my formula explodes. ๐
Seriously though, sounds good. Thanks for the assist.
has left the chat
Unfortunately it is not. I have made a dropdown with the various dropdown keys I need, and make a hidden attribute for psy_rating, however I just get ERROR back
You're missing an else-case in your final part
What if we don't want/need an else case? What would be the best practice?
make psy_non your last case then
what if it is a single case? like an if without else? cause I feel I've been using ternary for everything
nono
like if eps, then 2, if not psy none.
or if that's not possible for what you're doing:
if none, 0, 'error'.
In this case you have no other way. The else-case is mandatory for the ternary
nono I mean like a simple if statement without else, how would you do it?
Yeah, I know, I'm trying to overcome a similar problem
I assume you'd just make the else case the same as your last entry? Or would I cut the "psy_none" part entirely for 0?
i have a conditional that
if positive then add +, if not
if 0 then add '', if not
if negative then add -, if not 'error'
You can do that
Nice, thank you
I guess what I'm asking is, how to check a condition without the else case or how to skip it if it falls under that case
You can't with the ternary, but that shouldn't be an issue at all
hmm is it possible with formulas? The only time I recall being able was in visibility formula.
setting it to 'error' basically is skipping it since it shouldn't come up as your last option is "none = 0"
is there any other possibility other than a, b, g, d, e, or none?
Perhaps you're thinking I made the original question? ๐ค
Hey, still me about the item, i cant understand why it dont work, i try to modify the health of my player, with this : %{${!item.effect}$}%being put in the label roll message of the button in the item container so they can use their item directly from their inventory, and this :
const currentHealth = getProperty('attached.Vie') || 0;
const maxHealth = getProperty('attached.viemax') || currentHealth;
const newHealth = Math.min(currentHealth + healAmount, maxHealth);
if (currentHealth < newHealth) {
setPropertyInEntity('attached', 'Vie', newHealth);
return `Vous avez รฉtรฉ soignรฉ de ${healAmount} PV.`;
} else {
return "Vous รชtes dรฉjร ร vos PV maximum.";
}```
In the richtextarea of my (first) item (not the template) with "effect" as the key, any idea ? Thanks ๐
i know you didnt, but i replied to you since it was your message I'm answering?
You don't have direct access to the functions of CSB-Formulas in scripts. So setPropertyInEntity() won't resolve. Use await <documentInstance>.update()
getProperty() is also not a known function
do you have any link about the document function please ? and ok i though as i see some comment talking about it
That would be the general Foundry API
oh ok, thanks ๐
Evening! I need someone to tell me why the setPropertyinEntity formula at the bottom doesn't work. It just returns an error. My intentions are as follows:
Step 1: roll a number of d6 equal to the number of wounds a character has. Step 2: roll another d6 for each wound die that rolls a 1. Step 3: subtract the sum of step 2's wound dice from the character's will (a number field).
${woundroll:=[:wounds:d6cf=1]}$
${willdmgform:=[:woundroll:d6]}$
${setPropertyinEntity('self', 'will', "will - willdmgform")}$
I don't get an error anymore, but I'm also still not getting a number