#Custom System Builder
1 messages · Page 42 of 1
You modify one Label, pull the data from the first Label into a second Label and do whatever you need.
Glad thats the answer because Im already doing that as a work around lol
And thank you, Im terrible at asking question so I dont blame you
to be fair there's probably a lot of context im missing
im only half paying attention rn
getting my ass kicked in elden ring
so... the header has a specific width here that doesn't take up the entire sheet which is cool. But I just changed my panels there to tables like I did below for the same reasons. but...
then it broke the header width
😛 bro same solution as always, maxwidth
Can you check what the value of a drop down list is in a formula?
Well a script. Like if X doesnt equal Y then etc.
equalText(dropdownKey, 'a') ? b : c
Is this at all possible
Because the % is allowing me to use JS correct? Im not being dumb there?
well I gotta go to sleep anyway, I'll return to this, thanks for all the help y'all!
Unsure what value locationList is returning
Yeah it does, although a bit unneccessary for this case
There are if statements further down, I had to do some weird checks for how the weight in my system works
${locationList}$ will return exactly the same barewords as in a Label. That means you lose the quotes for strings e.g.
Which will make the script interpret it as a variable instead of a string
You simply wrap ${}$ in quotes
You know with a CS degree you figured Id get there
This may be an incredibly dumb question but what language is the ${}$ syntax even from
A custom language of the mathjs-library
Like custom as in you made it or someone did and you found a niche use here
An external library we use
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.
Is it the same library that foundry already uses for other things?
Nope
So you imported this library into the module to allow custom syntax you then wrote guidelines for?
It's a bit more complex, because we mixed it with our own stuff. But we rely on the expression parser of the library
alright got to something I'm relatively happy with, but god damn is it frustrating to get the spacings to work the way you want to
goodnight!
So you essentially frankensteined your own language just to make a module for people to DIY systems in?
The core comes from mathjs, we simply added a few things. But yeah, it should help you to do some calculations
I wish I was half as knowledgable in understanding all of that
If you're curious, you can check these 3 files: https://gitlab.com/custom-system-builder/custom-system-builder/-/tree/develop/src/module/formulas?ref_type=heads
lol bird complaining about not understanding stuff with a cs degree
imagine how i feel with actually 0 technical background
I honestly have no clue how most people manage any tech without a tech background
My current job is helping people in IT and its just.... rough
That sounds about right from what I experience lol
i learned everything i know from making minecraft servers for my friends :I i dont understand how anything works. things just sorta work through trial and error lol
i still cant code 🤣
Fair enough, thats how it all starts
lmao that was over 12 years ago
i've tried to learn to code probably 3-4 times in earnest.
brain hurty
scripting is no issue whatsoever
but syntax... fml
I don't get how this makes what I sent wrong
`%{
const namefield2 = ${sameRow('namefield')}$;
const abacus = fromUuidSync(namefield2);
return abacus?.system.props['KG_fixed'] ?? 0;
}%`
this still returns an error
I've noticed attribute bars aren't editable, is that fixable?
@formal goblet any idea for this?
What does namefield2 return?
You forgot quotes around ${}$
Interesting. The Attribute Bar created from that should be editable
Ah yeah, that should do it
yeah it's editable now, thanks!
I have this gold trim around the sheet, what's the easiest way to get it to show up above the ability scores panel?
right now the trim is defined together with the background image as such:
.custom-system-actor-content {
padding: 50px 20px;
overflow-y: auto;
overflow-x: hidden;
background: url("assets/ff14-maps/sheet-foreground.webp"), url('assets/ff14-maps/sheet-background.webp');
background-size: 100% 100%;
background-repeat: no-repeat;
background-attachment: local, fixed;
}
I don't know if it's possible from there or if it's in the wrong place in the html structure for it
Hi everyone, i'm looking for some help on CSB (awesome module by the way). I want to have a clickable button inside the chat message, wich would compute a roll and add the result of a previous formula (wich I already had put in a variable).
That is a pain 😅
can't get logs with this:
`%{
const namefield2 = ${sameRow('namefield')}$;
console.log(namefield2);
const abacus = fromUuidSync(${namefield2}$);
return abacus?.system.props['KG_fixed'] ?? 0;
}%`
I think it's undefined
Well, i managed to have a clickable button using this in the chat message:
[[/roll 1d6]]{Cool}
But I would like to add my variable to the roll
(if it is even possible)
%{
const namefield2 = "${sameRow('namefield')}$";
const abacus = fromUuidSync(namefield2);
return abacus?.system.props['KG_fixed'] ?? 0;
}%
Martin o3o
I had a probably stupid question.
When making items, say a ring that gives +5 hp for example. I need to put a number field within the item, and then configure the item modifiers within the "ring" template. This means that 1.) players can modify the number field, and two for each new template I need to manually add the item modifiers? can i not add the modifiers to the sub template and have them auto added to a regular template?
Try out [[/r ${!var}$]]{Cool}
you have it set to a background image... you'd need to ... not 🤣 as in import it as an image through HTML, and use the css to set he positioning.
Each Item (not Template) can have its own modifiers
Awesome, it works! Thanks a lot ! ❤️
Templates can also have modifiers o3o
really what i'm getting at is I want to create a massive modifiers sub template that has all the possible things that I can modify, have them all set to 0 by default, auto have the item modifiers linked to those number fields, as well as labels that import and display the value of those number fields to the players.
This way every item that has a modifier, instead of writing it in custom - i just drag the modifier subtemplate over -> and change the fields of what i want to modify.
Don't think that is a good idea. Each modifier adds a computation step
ah 😦 that's lame.
I figured. Is there an easy way to import my own html?
manually adding a number field, label, and item modifier for each stat and each item sounds... 😭
you can code html direclty into a label 😛
that's how we were doing the <BR>s yesterday
I don't even think that that is even good. I'd just go and add a static modifier for the special ring
I hear you but player can modify item modifiers unless they're coming from the tempalte
also it's not convient to display ^^
You can revoke the permission in the settings
son of a ..
😮💨 well that fixes a number of issues lol.
I suppose I should also ask if there's a better way to display the modifiers rather than players just opening the item modifier tab
Hmmm... Maybe with Active Effects? Because they can be displayed through the "Visual Active Effects"-module
I didn't know that was a module, but that looks fantastic.
However that doesn't work for what I'm using most of the items as.
Things like the character's race and class have stat modifiers and what not for example. I haven't even actually got to making magic items yet 🤣
Hell, I still don't know how I'm going to make a basic sword yet haha
Well, it's up to you what you pick
Can I edit player's permission to edit item names as well?
They can always edit the name
I assume the same goes for text fields within the sheet too, eh?
my players are adult enough to not use it to cheat.
i just know that they're gonna meme this hard lmfao
oh yeah they can change the image too 🤣
All normal Components can be hidden from players
Not looking to hide information lol. just lock it from modification.
I give them approximately 3 sessions to figure out they can do this, and one of them reskins a long sword to be the penetrator from saints row the 3rd.
How about a Checkbox, which toggles the visibility between Input Components and Labels?
That's what I do for a read-only sheet
🤔 youd be conferting rich text areas to label formatting.
Eh. honestly like i said, they're mature enough not to cheat.
they're just also immature enough to reskin items to be wild as hell haha.
that does bring up though, since they can change item skins, and open the file browers, that's a lot of ability to view all the images i have uploaded and potential spoilers.
I think you can hide parts of the file browser natively
But don't ask me how
i've never heard of such heresy - in 5e they just dont have access to anything that opens the browser so i'm unfamiliar
maybe not a per-image basis, but i did find this which disables them being able to change the item's image and thus access to the browser.
at least i've spared myself the dildo image 🤣 even if not the name and description ha
There was also something in the file browser itself to block certain paths
Hellooo!
So, I have quite a few to insert into my template sheet. I saw that the Custom System Builder has an API, but I must admit I didn’t quite understand it (my own shortcoming, of course!). I need to perform a bulk insertion, for example, of multiple checkboxes. Does anyone have an example using the API that I can follow?
Not sure if this is something that can be truly described as a bug, or just how css works, but if you place a label in a panel that's aligned right, the label floats right (as it should)
but if a number field will only float the text right rather than the container itself. This isn't noticeable when the container is set to auto and takes up all available space - but rather when you set the size to something such as small.
mana overflow set to label:
vs numberfield smaller.
General question,
But how is everyone handling equipt items and inventory?? I realized what I had wasn't going to work, and 5e's system seems too complicated to make in CSB. 😩
could you make an item modifier do lookup() on the "Equipped" column of the inventory item displayer table, then make that equipped column a checkbox? Then basically do the item modifier on let's say the armor as "if(checkbox) {}"
I just store all predefined Items in a Compendium with their modifiers.
the getting a modifer to only work if equipt is the difficult bit, no idea how that would be accomplished
I meant within a charactersheet.
how can i distinguish the leather armor they're wearing from the leather armor they looted?
Both use armor tempaltes so using an armor item container (what i did) is out
hmm I can't even get item modifiers to work at all 😄
i've been playing with them for a bit if you need some help? I can only do always on or off ones currently
I have a checkbox with equipped in the Item, that determines, if an Armor is actually equipped or not. If not, you can make it display in the Inventory Displayer instead
So are all items in your inventory actually items? and I assume the container just takes all item types that aren't like a race or something?
Yeah
i haven't messed with conditionals within items yet - got any leads on how to make it 1.) have stats apply when equip and 2.) change it to the equipt tab rather than just inventory?
Copying from the readme, you'd want to use na equipped checkbox and use this conditional:
You can add conditions to your formulas using the ternary operator : <condition> ? <value if true> : <value if false>.
You can directly use the key of a checkbox to test it is checked
Example : ${ checkboxKey ? 'Checked' : 'Not checked' }$
On another note from a newbie, are radio buttons not supposed to be sticky? I have one on a sheet but whenever I open and close it or change anything else it resets to default.
I see so build the condition in to check if the checkbox is true... 🤔 i can try and see what i get after a bit. I've used something similar for a visibility check, though that's simpler than item mods
Are your values in your Radio Buttons distinct from each other?
The Item Filter Formula in the Displayer decides, which Items should be displayed there. The formula has access to the properties of the Item, so a simple item.checkBoxKey is usually enough (or not(item.checkBoxKey) for the negation)
oh sweet!
Admitting my computer skillz suck I turn to community to help. I need simple roll button to take a skill value (number) from the same row, ask for skill modifiers and apply them to the skill value, roll d100 and if it is same or under the modified skill it is a success, otherwise a failure.
If you are able to point to a downloadable sheet with similar functions that is also appreciated very much.
${[1d100] <= sameRow('skillValue') + modifiers ? 'Success' : 'Failure'}$
Heyo! Im new to Foundry and was trying to implement my game system through CSB.
My question is: Is it possible to fetch a checkbox and label component key that are under the current panel?
Im trying to automate my character sheet but it is tedious to keep copy and pasting all the time
The panel is irrelevant in terms of property data
it is because i have a lot of panels with the almost exact code, and i wanted to get the specific for each one
example:
so, instead of writing the checkXXX and modXXX everytime, i wanted to get it from that panel check and label component keys directly
I see what you mean, but meh. I'm sure you could get the children of each panel with the CSB-API, but that's a bit tedious
wdym?
Something along the line like %{entity.componentMap['panelKey'].content...}%. Can't tell the specifics right now, but it should be achievable with JS.
could you explain like you are talking to a 5yo? I'm a newbie to coding related stuff
Well, you won't come far without coding to be fair
i know the basics and a some c#, but anything beyond that is far from my reach
Because this functionality is not directly available in normal Formulas, because Panels are not part of the system properties normal Formulas have access to
so I would have to look up some JS to implement what I what thinking?
i get the gist of this, like, searching for the components inside the entity with the panelKey id. correct?
Yup
The child components should be in the content property, which I think is an Array.
But there might still be an issue because of the missing self reference
if this were to theoretically work, where would this JS code go, inside the formula as usual?
%{}% instead of ${}$. That's it
what do you mean by self reference? like, where it is searching?
would like to create a party actor template to track HP and Wounds of my players. Wounds are created as items in my world. is it even possible to fetch+display items from different actors?
I was about to ask the same question! This would also be useful to invoke assorted centralized tables
Either with fetchFromActor('actorName', "lookup(...)") or with a Script
Ooh, nice
so if I'm doing a quickbuild thing for NPCs I can just have a table of stats for different levels
you can't add checkbox elements as a column on item displayers. How would you go about making it display on the item displayer?
Does this answer the question? https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Checkbox-in-Item-Containers
Good news everyone ! Insert Futurama gif here
**Beta version 4.3.0-rc1 is now available, with the following change : **
Features
- Added ability to add items to other items
Please refer to the README BETA for instructions on new features : https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/README_BETA.md
FYI, Manifest URL for the beta version is https://gitlab.com/api/v4/projects/31995966/jobs/artifacts/beta/raw/out/system.json?job=build-beta
If you want to switch an existing world to the beta version, you can follow this guide : https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Switch-to-Beta
If you encounter any issues with the beta version, please open issues on gitlab and specify you are using the Beta in the issue title !
https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/new
Enjoy !
Spoiler alert : There are no new instructions for this feature, this is supposed to work exactly like adding an item to an actor, so... no changes in the docs
so is this so you could say add arrows to a quiver or?
Arrows to a quiver, sleeping bag to a backpack, enchantment to a sword, 4x scope to a rifle... you name it :p
oh -shit o3o adventuring packs!
that's friggin awesome
thanks link 😄
(and martin <3)
Don't thank me now, thank me after testing it and discovering the bugs that are surely hanging around :p
How many ghouls were sacrificed to make this work?
Something like 155 ghouls, 1650 doves, 2 or 3 ant colonies and a dozen virgins
actually i have a weird question
i've been ripping appart the 5e charactersheet for how to make certain elements look good
and they've used SVG borders around their skills - that's something I'd like to do as well - but how could i inject that html around a dynamic table?
a panel cant house html right?
a snapshot of what they did:
it's a filigree box tag (that i didn't know existed) with 8 svgs - one for each corner and wall
What the actual f is a filigree-box?
That seems to be a custom tag
.. that's possible? 😱
i mean i understand waht it's doing
i just dont know how to recreate it.
Basically makes 4 corners of SVG images, and 4 walls - the walls stretch as the character sheet scales so you get a consistent decorative border
I think the standard allows that, although the use cases for that are... uh... usually for frameworks?
the gold border around the skills, tools, and saving throws
Framework or bypassing classes for CSS I guess
I think you can achieve the same kind of thing by using CSS after:: or before:: pseudo-classes, and setting a custom HTML content in these
But I have no example for you
You can set HTML in CSS? What the hell?
wonder if it's possible to build an entire website within a stylesheet
i've seen css in html 🤣
ive beaten my head all day trying to figure it out, i guess ill go for the hard way, typing
it's possible, and it's been done ! I believe some people even made full games with only CSS (a little bit of HTML but no JS)
no JS sounds like music to my ears
That sounds like a nightmare to me 🤣
a large part of why i'm avoiding making items is because i know macros will be after.
i'm terrified. I've never once made a single functioning JS statement lol
even copying from online - always broken 😦
well I'm officially out of CSS styling I can reasonably do 🤣 I guess it's really time to suck it up
You misspelled "Shield"
🤣 thanks
i'm shocked that you're the first to notice that too - i've had the players come in and do input rounds 3 times now.
i'm cleaning up some of my unused templates after reorganizing how items will be handled - and i accidently deleted one before removing an item that uses it in the character sheet. Now I keep getting warnings about it - how can i delete the item from the character sheet if I can't see it?
Use a Displayer without any filters
i ended up having to use a console command 😩
had GPT generate it using the wiki - seems to have worked
how could i import item data for the sheet?
So like, if an item gives me 2 Cha and then i have this item Equipped (checkbox), how would it be like?
can these new "sub-items" modify variables from their parent item or only from the owning actor as before? or maybe both?
An item can only modify values of its direct parent. For instance, an enchantment on a sword would only be able to modify the sword's stats, not the actor's
How do i fix the default value is not working?
Everytime i create an new actor it just doesnt get the default value that it should get
Default value based on the key
that looks great! Looks very well put together and aesthetically pleasing. Here's my work in progress:
Thanks 😩💀 spent most of yesterday getting ready for items to be added.
Hey it looks like you're almost done already
idk I think yours looks way better tbh, plus I have to wait for the system to release, right now I don't know what the character sheets look like, nor what items and stuff works like, so I can't implement everything yet
Wait is ff14 going to release a ttrpg rule set?
yeah that's why I'm doing all of this, I figured no one's gonna make a real foundryvtt system for the system (definitely not an official one seeing as how restrictive squenix is with the license), so I'm doing this instead
it releases february
I think you're massively underrating the foundry community haha. It probably won't be quick but it'll be out in a year or so
well yeah but I want to play it right as it releases
fair enough lol
Is it possible to have a dropdown in the query for a roll message chatcard? As in, I have: ${#?{Modifier:'Skill Roll Modifier'[number]|0}}$ but I'd like to have a dropdown in the prompt to select a (static elsewhere) key used for determining which attribute would be used for the roll.
This is probably really simple, but if I want to reference a key from an active character sheet in a macro, how do I do that? I managed to get it to work from a token, but I don't want be using tokens
What exactly would be an active character sheet?
The character/actor sheet that the player clicks the button on to activate the macro.
Basically had to build a dice roller macro as the foundry dice don't support the ruleset I'm using. Now I'm trying to make a version of it that references the character sheet, rather than entering every variable manually
Just to make sure I understand, in the example, the formula will execute the macro, and the macro will recognise "strength" to be whatever the strength key points to on the actor sheet?
There are 2 Formula types
%{}%-> Script${}$-> regular Formula
The innermost is executed first an passes the result to the outer one
There's also the entity-object in Scripts, which holds all relevant contextual information (e.g. the current actor)
But yeah, these passed arguments become available in the Macro
Hi Martin, ich habe auch eine Frage zu einem Würfelwurf als switchCase abhängig von einer Dropdown-Box
Das funktionert, aber er rollt immer alle 5 möglichen Würfel
Ist korrekt, da die inneren Formeln (in diesem Fall Roll-Formeln) immer vorher ausgeführt werden
Wie kann ich es lösen, dass der immer nur entsprechend der ausgewählten Option (1,2,3) würfelt
Also ohne Vorteil - 1 Würfel geworfen, Mit Vorteil 2 Würfel geworfen und den Max
Müsstest hier im Verlauf nen Beispiel von mir finden, wie man am besten normal, advantage und disadvantage einfügt.
Ok, danke dir
Ich such mal
Ich denke ich habe es gefunden.
${#roll_formula:= concat(string(2 + amount), 'd10', switchCase(style, 'a', 'kh2', 'kl2'))}$
${[:roll_formula:] + str}$
${#roll_formula:= concat(string(2 + amount), 'd10', switchCase(style, 'a', 'kh2', 'kl2'))}$
${[:roll_formula:] + str}$
Vorher die Formel zusammen stellen?
Im Grunde genommen ja
Dickes Doppeldanke für die irrsinnig schnelle Reaktion!!!!
${#wuerfelanz:= switchCase(wuerfel_option,'1',1,2)}$
${#roll_formula:=concat(anfuehren_wert,'+', string(wuerfelanz), 'd20', switchCase(wuerfel_option, '2', 'kh', '3','kl',''))}$
${[:roll_formula:]}$
Das funktioniert
Took me a bit, but I worked out this out. Thank you for pointing me in the right direction
This meas, that if i want to reuse functions, etc. I need to write macros that i can pass parameters from scripts or formulas?
Macros, or you import the functions into the math-object: https://mathjs.org/examples/import.js.html
Math.js is an extensive math library for JavaScript and Node.js. It features big numbers, complex numbers, matrices, units, and a flexible expression parser.
Hey Martin
I copied this code right out of the wiki
changed the item.ComponentKey to match what i'm using
but when i click the checkbox it just sends 'true' to chat no matter how many times i clicked it.
Console shows a NS_ERROR_UNEXPECTED
I hope you also have a Checkbox Component in the Item itself
Looks fine. Which version?
of csb? 4.2.0
Sorry sorry!
i fixed it
the roll message setPropertyInEntity 'equipped' needed to be the key
that's on me lmfao
Hey, it's my first time using CSB and I'm having a problem (it's probably something silly that I don't know about). I would like to get a cell in the table with the player entering a value in a number field
lookup(${dynamic_pate}$, ${dyn_pate_name}$, ${dyn_pate_value}$, ${pontosdeprestigio}$, '>')
${lookup('dynamic_pate', 'dyn_pate_name', 'dyn_pate_value', pontodeprestigio, '>')}$
Ok, thanks
Merry Christmas,
is it possible to add an key to a Itemmodifier with a lookupRef? I dont understand why
${fetchFromActor('attached', "lookupRef('Skills', 'Mod', 'Name', CustomKey')")}$
isnt working. Of course the component CustomKey is within the item-sheet.
Change CustomKey' to '${CustomKey}$'
Everything within "" runs in the context of the target-Actor, that's why you have to "bail out" with a sub-Formula to be able to fetch props of the Item instead (or you concat your formula together beforehand)
Hi! I'm trying to figure out a good way to build a function within a character sheet that allows a player to enter in a trait value and a hazard level and then percentile dice would be rolled and compared to relevant percentage value from the chart below would be referenced and a success or fail result returned. I know how to have players enter in the values and how roll the dice and output the results. What I could use help with are ideas on how to translate the table into CSB. Anyone have any suggestions? Any ideas would be appreciated.
I'd use a Dynamic Table in a global Actor (which acts as a configuration point for lookup-tables and such). Then in the target Actor I'd use a script to fetch the right row with the right column (because CSB doesn't have a range-lookup atm).
Thank you! This is very helpful. I was stumped on a starting point and this helps.
Hi there! I need some help from someone experienced with Custom System Builder.
I’m trying to set up a system where the roll changes based on the number in the "external_score" field. Here's the formula I tried:
${[
{external_score: 0, roll: "2d10kl1"},
{external_score: 1, roll: "2d10kh1"},
{external_score: 2, roll: "3d10kh1"},
{external_score: 3, roll: "4d10kh1"}
].lookup(external_score).roll()}
(ChatGPT helped me with this, but unfortunately, it doesn’t work.)
What I’m aiming for:
- If the external_score is 0, it should roll 2d10kl1 (two dice, keep the lowest).
- If the score is 1, it should roll 2d10kh1 (two dice, keep the highest).
- For score 2, roll 3d10kh1 (three dice, keep the highest).
- For score 3, roll 4d10kh1 (four dice, keep the highest).
:external_score:
This is the component key for the number field.
If anyone has suggestions or has tackled something similar, I’d greatly appreciate your input. I’ll make sure to update this post if I find a solution. Thanks in advance!
${#roll_formula:= external_score == 0 ? '2d10kl1' : concat(string(external_score - 1), 'd10kh1')}$
${[:roll_formula:]}$
ChatGPT can't really help without context btw, because this is not written in Javascript
I just changed the "- 1" to "+ 1" and now does it perfect
thanks
Ah yeah, slight mistake
Hello! I have a question about the Item displayers.
For context: I have created a section in the character sheets where the players can add the weapons they will use with an Item displayer. The thing is, only one of those weapons can be in use at any time, so only the selected weapon will apply the item modifiers to the character sheet while all the others are ignored.
Is it possible to add a check to the item displayer or any other way to achieve this result?
Thanks in advance!
You need a Checkbox in the Item itself, that indicates, if it is equipped or not. By that, you can apply your modifiers conditionally.
You can simulate a Checkbox in the Item Displayer, but the single source of truth is still the item: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Checkbox-in-Item-Containers
Ah, sweet! So it was actually easier than expected. Thanks!
Guys I have a problem, I don't know what to put in the big blank space in the centre
A Chocobo
just a picture of a chocobo looking right at the camera, judging you
I settled on expanding the hp mana space
Question, can you specify a specific type of sheet in your css? I'm trying to edit the profile picture of the character sheet but the image in the item sheets has the exact same path. Can I specify only actor sheets or only item sheets somehow?
or maybe use the template used as a class?
You could potentially just check if the sheet has certain classes in it.
.character {...} - if you want it to be all character sheet.
.character:has(.specific-class) {...} - if you want to select a character sheet that has this class.
I even have a special field on my character sheet that gives the sheet a "type". Its a label that is defined by a text-field, so the only thing I need to do is write:
.character:has(.Type_Selector [value="1"]) {...} - it will limit it to the one I have this type in.
Its a really jank way, but it works.
good shout that worked
css is always jank
Agreed. But without CSS my sheet looks like spaghetti.
If you are using the ".character:has(.specific-class)" method, I recommend taking a look into CSS Nesting, if you don't already know what that is.
can you add an image tag into the label content of a dropdown somehow?
Is it possible to use formulars with conditions in itemmodifiers formular? Like:
${fetchFromActor('attached', "LP_Mod") > 1 ? 2 : 0}$
Because this doesnt work for me and I cant figure out why.
nvm I just figured out that my values are smaller than 0 and thats why they didnt work 😅
how can i change a meter color?
I wouldn't mind knowing too... if it can be.
My tokens won't use this for their hp meter bar. It's available to select, but doesn't even show zeros. Is it because both values are contained in Labels?
The Token should have a read-only bar if you have selected the ressource
CSS is the key to basically every styling-question
So, there 'should' be a non-manual bar above this token then?
Yep
What about the fact that both labels' values are calculations could that be causing issues?
AbsCurHP(Label) = hpCur + hpTemp - hpIncurable; hpMax = hpNormMax + hpTemp;
Dunno, would need to look at the code. But you can test that by using non-labels instead
So I made AltAbsCurHP as a Number and tried to make attributeBar.hp_Meter work, but no change, however... Basing the resource on AltAbsCurHP (With the Max Value set) worked. I'll have to make a script that lines up AltAbs... with Abs... that I can run periodically, but it's a good band-aid.
Hey Guys! Its been a bit since I've used CSB and I need a refresher on how I'd make a dropdown attribute skill selector.
"${ClassSkillName}$ Test: ${[2D6]+AttributeSTR}$" is what I have now, but I want a dropdown to change "AttributeSTR" to whichever attribute I have selected in the key "ClassSkillStat"
I know you can do conditionals but I cant remember how they work or where they are in the documentation.
As far as conditional things goes, I believe this works:
... (LogicalTest?ValueIfTrue:ValueIfFalse) ...
If it was a dropdown with 4 options what would that look like?
I tried this and it wasnt working (ClassSkillStat ? "DEX" : "AttributeDEX" , "STR" : "AttributeSTR" , etc...)
Theorhetically.... (ClassSkillStat == "DEX" ? AttributeDEX : (ClassSkillStat == "STR" ? AttributeSTR : (ClassSkillStat = "next" ? AttributeNext : AttributeLast)))
Don't loose count of your closing parentheses at the end...
If there's ever only the four options you can save yourself a logical test for Last.
Yea this a simple game Im prototyping, its only got 4 Attributes
Wound up finding a simpler solution: ${ClassSkillName}$ Test: ${[2D6]+${concat("Attribute",ClassSkillStat)}$}$
I tried debug drawing and it kept creating drawings with no Points. How can I delete them? And how do I properly debug draw in an area to make sure the points I have are correct?
Ah, there's a delete drawings button lol, so that's one problem down
Now I'm trying to access the "#fixedPoints" I don't want to change them, I just want to use them as reference for other shapes, but because they're private, code can't even see them- unless there's a method I can't find (I've been looking for the past half hour)
Unless there's a cleaner way, gonna have to make my own class with the shape in it, huh? This'll be a fun learning experience
${ref(concat('Attribute', ClassSkillStat))}$
Can someone offer some insight regarding a weird situation I´ve encountered?
I have the following code inside a "Label roll message"
${round(pc_totalmagicpower*item.item_damage*damageModifier)}$ ${#currentMana:=pc_mana-item.item_manause}$ Mana left: ${setPropertyInEntity('self', 'pc_mana', "currentMana")}$ ${#setPropertyInEntity('item', 'item_usesleft', "item.item_usesleft-1")}$
Essentially, this casts a spell from an Item displayer subtracting some mana from the character and reducing the spell uses left by 1. This works as expected.
However, originally I had the statements reversed, meaning that I first reduced the spell uses and then subtracted the mana and after using it sometimes it didn´t subtract the mana. Any idea why that happened so I can have it in mind in the future?
Welp, in the end it was that I didn´t link the sheet to the token
Mystery solved.
How are y'all going about making abilities and spells that can be used to deal damage etc... ?
is anyone else having issues trying to roll in the example character sheet? I try to roll the dice in the skill tab but I get this error
This issue doesn't seem to be related with CSB
Which versions are you using?
Hi, is it possible to limit the amount of items on a sheet by type? Either by which template they are or anything else? Lets say I have class trait (that is made from an item template) that the player can only have one of on the sheet and the sheet won't accept any other class traits, is that possible?
Only with a World Script, which listens to the createEmbeddedDocuments-Hook
Thanks a bunch! I don't know JS at all but I'll figure it out probably :D
latest stable release
Alright its definitely something on my end. I was able to roll it fine when Foundry is running on my Windows PC but its not working on my Raspberry Pi setup
There's more than that. I'm also running a server on a Pi. But yeah, not directly related to the system itself
Deleted my Foundry directive and reinstalled and its working now for reasons that will never be explained
how can I make a visibility formula that checks for a custom key inside a dropdown?
equalText(classe, 'lutador')
thx!
Sorry to bother, but i could use some knowledge.
I have a mana refinement mechanic, and I wanted so that the when 'Mana Refinada' went up, 'Atual' went down at real time, but it only update the MP (first bar) when i pass the mouse over 'Atual'.
That's due to the nature of Input Field values, that simply cannot depend on other values
Labels would auto-update, but cannot be changed by users
I think i could place a label visible only to moderators
nah, that wouldnt work, i need Atual to go down too
Maybe you could script something. You'd need to listen to the changes-event and fix your values based on certain conditions. But that requires some work ofc
I'm not 100% if this is doable, but: what's the method (if any) to use a sheet roll with parameters? E.g. have a macro that rolls the "attack" label from a sheet but sets a local variable of the rollmessage to a certain value beforehand
The 2nd argument defines the properties, that should be used for the computation. You can simply merge your own props and you should be good. Just don't forget to call postMessage() afterwards (see here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Handling-Dice-Pools)
Documentation for custom-system-builder
Actually, forget the first link. Everything should be doable just with the second link
Im trying to change the meter fill bars, but it doesnt seem to work, anyone has an idea why?
.custom-system-meter-fill {
background-color: red;
color: red;
}
Maybe a collision with our class-definition? Does it work with important?
no as in
.custom-system-meter-fill {
background-color: red !important;
}
individually as in each bar?
yep
give the bar a component key and then do
.mybar .custom-system-meter-fill {
background-color: red !important;
}
and if you have more:
.mybar .custom-system-meter-fill, .mybar2 .custom-system-meter-fill, .mybar3 .custom-system-meter-fill {
background-color: red !important;
}
if you want to change the style of the entire bar and not just the fill section then it's .custom-system-meter
Reading about it, I think you could simplify this with something like
:is(.mybar, .mybar2, .mybar3) .custom-system-meter-fill {
background-color: red !important;
}
Though I'm not certain that it'll work
yep, it sure does work
Anyone got any tips about this question from earlier?
I was thinking I could make a label with just a roll icon as a column in the item displayer table that players can click in order to use the weapon / ability / spell but I'm not sure how to write the roll message
The example template has such a feature
where do I find the example template
You can install it as a module: https://gitlab.com/martin1522/custom-system-builder-example
ah, thanks!
%{let roll = await new Roll('${item.damage}$').evaluate(); await roll.toMessage({flavor:'${item.name}$'});}%
%{let directroll = await new Roll('${item.directhit}$+${item.damage}$').evaluate(); await directroll.toMessage({flavor:'Direct Hit'});}%
So I have this roll message looking up item damage and the damage for a direct hit, written like this it results in two chat cards like so:
is there anyway to have that written in a way that consolidates it to one chat card?
Documentation for Foundry Virtual Tabletop - API Documentation - Version 12
Struggling with getting this visibility formula right. I want it to show if ClassName is ClassMage OR ClassCleric
Currently this works but I dont know how to add the OR
or() (2 inputs): If one of both values is true, it will return true, otherwise false
how do you separate the inputs?
With a comma ,
Ah I capitalized OR and that didnt work. Thanks!
%{
let roll = await new Roll('${item.damage}$').evaluate();
let directroll = await new Roll('${item.directhit}$+${item.damage}$').evaluate();
ChatMessage.create({
rolls:,
flavor:'${item.name}$'
});
}%
I've been at it for a bit but just can't figure out what I'm supposed to be doing. I don't know if you could perhaps point me in the right direction?
I can't figure out if it's possible to send several rolls to the same message
You didn't pass anything to rolls. If we look in the API, it says that it expects an Array of strings. The description says:
Serialized content of any Roll instances attached to the ChatMessage
I don't know which function is needed to serialize a roll (maybe a simple toString() is enough). If you need further help, ask in the https://discord.com/channels/170995199584108546/699750150674972743 - channel, because this here is related to the core-functionality of Foundry and doesn't really involve CSB (except the Script delimiters %{}%, which is CSB-specific)
okay I've given up on the foundry chatmessage styling for now as I'm getting nowhere with it and am trying to follow the example template instead. In the example template for weapon attack rolls they use this
${#?{Dice_Modifier:'Attack Modifier'[number]|0}}$
to execute a dialog popup before rolling with the roll message but I can't find any documentation on it. How would I write that if I want several rows within the dialog?
in essence this but in one dialog popup instead of two:
${#?{Dice_Modifier:'Attack Modifier'[number]|0}}$
${#?{Damage_Modifier:'Damage Modifier'[number]|0}}$
${#concat(string(?{Dice_Modifier:'Attack Modifier'[number]|0}), string(?{Damage_Modifier:'Damage Modifier'[number]|0}))}$
I see, I'd never even heard of the word 'concatenate' before
thanks a bunch
I'm also actually wondering about adding image elements to the roll message, is there a way to make the img tag read the datapath string from this?
<th><img src='${item.img}$' width="48px" height="48px"> ${item.name}$</th>
I thought the ${}$ would do it but nope
<th><img src='${!%{return linkedEntity.img;}%}$' width="48px" height="48px"> ${item.name}$</th>
yeah ok I would never have gotten to that conclusion, thanks
img is not part of the standard props the system provides, so you have to refer to a script. And you also have to use ! at the beginning to remove the <span></span>-wrapper
oh is that what the !does, that makes sense!
Can you change Controls Style using simple promts for dialogs like above, or does that require a custom user input template?
Custom Input Template
thanks for all of the informed answers, I'm really trying to figure it out on my own but there's a lot to learn
If anyone is able to provide assistance, it would be great. I would like to get the hit location from the "ones" die of a d100 roll (0=head, 1=left arm etc) used to make the attack roll.
I was able to copy/edit/paste from other systems the basic of the attack roll as follows:
${#?{Difficulty|0}}}$
<h3>Hangdguns</h3>
<table>
<tbody>
<tr>
<td>Target score:</td>
<td>${target:=handgunsValue+Difficulty}$</td>
</tr>
<tr>
<td>Roll :</td>
<td>${roll:=[1d100]}$ -- ${roll <= target ? (roll == target ? 'Critical!' : (roll % 11 == 0 ? 'Critical!' : 'Success')) : (roll % 11 == 0 ? 'Fumble!' : 'Failure')}$</td>
</tr>
<tr>
</tr>
</tbody>
</table>
So doubles are fumble or critical but I would like to get the hit location as well.
Any help appreciated!
switchCase(roll % 10, 0, 'Head', 1, 'Left Arm', ...)
Hi Martin, das mit dem Makro wie bei euch beschrieben, funktioniert einwandfrei. Damit kann ich ja den Code, den ich ansonsten dupliziere, reinpacken.
${#roll_formula:= %{return await game.macros.getName('VorteilNachteilWurf').execute({fertigkeitswert: ${wert}$, wuerfelOption:${wuerfel_option}$});}%}$
${[:roll_formula:]}$
Ich habe jetzt so ein recht einfaches Sheet für ein neues Rollenspiel gemacht (Midgard 6). Kann ich das jetzt denn anderen interessierten zukommen lassen?
Und wie kann ich den gewürfelten Schaden nun auf einen Gegner anwenden?
Am besten erstellst du ein Modul dafür. Kannst dir ein Beispiel hieran nehmen: https://gitlab.com/martin1522/custom-system-builder-example. Oder hier: https://gitlab.com/custom-system-builder/custom-system-builder/-/merge_requests/80#note_2219021940
Added the Brazilian RPG system Ordem Paranormal (https://ordemparanormal.com.br). The system is including the sheet(original version + expansion surviving the horror) plus all items...
Mit setPropertyInEntity() (darf aber aufgrund von Berechtigungen nur der GM)
Aber wie komme ich an den gewürfelten Schaden ran? Muss ich da die ChatMessages abfragen?
Gibt da mehrere Optionen, aber kannst auch direkt in der Chat Message speichern und abfragen. Nur wie du das machst, ist dann deine Sache. Da hab ich jetzt keine vorgefertigte Lösung parat
aaah, ich kann das Würfelergebnis ja direkt wieder verwenden:
${result:=[:roll_formula:]}$
Damit kann ich dann in das nächste Makro und rum wursteln
Anyone know if there is a way to set a template so that it's svg image is always set for any item made using the image?
Using the template rather.
You need a world script, the template itself has no functionality for that
Is that something I add to the css? Or something else?
No, real Javascript
Ah gotcha...I'll just keep doing it manually then.
By the way, thank you for being so responsive. My Ashes Without Number setup is almost ready to go, and modding it to Cities Without Number afterward will take little work.
This looks so cool.
It's pretty basic, but with no module working on the current version of Foundry I had to make my own. Thankfull Custom System Builder is really, really good.
I just started to use it today, im gonna try to make the custom system of my own, hope i can finish it soon.
Hello there!
I’ve been working on creating a dropdown menu connected to a label in my application. Here’s how it’s supposed to function:
When no option is selected, the label should roll 1d20.
When the number 1 is selected, it should roll 2d20 and display only the highest result.
When the number 0 is selected, it should roll 2d20 and display only the lowest result.
The formula I’ve implemented works as intended for the logic. However, when I try to use Dice So Nice!, I notice that it rolls 5 dice instead of only the necessary ones.
Could someone help me refine the formula so it rolls only the required dice for each case? That would be amazing!
Thanks in advance for your help!
<p><span style="font-size: 20px; font-weight: bold;">O valor do dado foi:</span></p>
<p><span style="font-size: 25px; font-weight: bold;"> ${switchCase(destreza_nivel,'vazio',[1d20],'um',max([1d20],[1d20]),'zero',min([1d20],[1d20]))}$</span></p>
Check this: #1037072885044477962 message
Can someone help me with this line of formula, where item.attr is the radio button group, and the radio button keys are str, either, and dex. I'm trying to set up a setting that selects either strmod or dexmod on the sheet depending on which is selected in the weapon item:
(ref(item.attr)==str?strmod:(ref(item.attr)==dex?dexmod:(strmod>=dexmod?strmod:dexmod)))
Use equalText() to compare string-values for equality
And keep in mind, that the Radio Button Group returns the value of the selected Radio Button, not the component key
Yeah that's what I was figuring, but the value is text. I'll try with equaltext if I can figure out where to put it.
You replace the comparison operator with it, because you're trying to compare your result
Quick question: I have a formula that does a couple of rolls and then reads some attributes from the target token.
As a DM the formula works fine but then as a player I get an error "user lacks permission to update actordelta in parent token" unless I set the permissions of the token as owner for the players.
Is there a way to circumvent this?
Like so?
equalText(item.attr,'Strength'?
Exactly
Roger.
Not a direct way. The request to update an Actor must go through a GM if the players lacks the permission for it
And CSB doesn't offer that, so you need your own solution
Hmmm...not quite there, getting [0,0] result, but at least now it isn't an error.
Alright then! Thanks anyways!
It's working perfectly now! Thanks!
How to properly format an if statement to check if a checkbox is checked?
${checkboxKey ? 'true' : 'false'}$
Hmm... That seems familiar to one of the things I asked a good while ago... Where was it...
Thank you very much yet again! 🫀
To follow up... Is there some other/cleaner way to just have various options, not just boolean one or the other other than just stacking these "ifs" together?
Kinda like...
If X is less than 5 do This
If it's between 5 and 10 do That
If it's greater than 10 do Those
etc.
Maybe with a lookup table and a little script, which can perform a range-lookup. Besides that, you have to resort to nested conditionals logically.
I didn't mean "This" "That" and "Those" as like... Things that are placed somewhere for the script to lookup. I meant those as static code snippets written out like if you were to go: If X is 1 to 5 send 24
If X is between 5 and 10 send 37 etc.
But if that doesn't change the situation then dang, guess I have a lot of nesting to do this winter. 🥲 Thank you very much!
You didn't get what lookup tables are meant for I guess. I'll try to grab an example
I don't think I use those. 🤔 I'll look into them
This e.g.
You have a value x (score) and want to find out, what the corresponding value y (modifier) is.
Yes, I understand what a lookup table is. I'm not sure how I could use it though as I currently didn't look into it yet. And is it possible to just have it somewhere on the background so the end user doesn't see it and only the script sees it when it needs to?
Yeah, you can create a global Actor, which only holds those tables
If your x and y values are sorted, you could even do the lookup without a script by doing something like fetchFromActor('global', "max(lookup('table', 'y', 'x', ${value}$, '<='))")
Hm... I was looking through stuff and I noticed the "Configure hidden attributes". Technically if I filled it with all the stuff I needed and referenced those, I could keep all of it enclosed in a single actor?
Depends on your case, but without further context I wouldn't do it this way.
Why not? I personally somewhat prefer when things are nicely packed in a way that don't reference outside themselves.
The specific thing is just:
The player has an attribute value. That attribute value goes through some math and it spits out an integer between 0 and 8. And I want that to determine the type of die (Or in some cases a flat value added) that is rolled in an output: 0, +1, d2, d4, d6, d8, d10, d12
That example is easy to solve with only 3 different cases, because beginning from the 3rd value, the sequence can be described in a linear function
In this case, I'd refer to a nested if-else
Or even 2
The d2 d4 d6 d8 d10 d12 options so far are just a first draft kind of deal. I'm somewhat pondering using different amount of dice instead so I'm looking to have the option to fill out 8 completely different items there.
But anywho, I'll just look into nesting the ifs and if I end up adjusting the system I'll just try to figure that out at a later point. Thank you for your time Martin yet again!
One more thing unrelated to the ifs here:
Is it possible to export a system out of CSB so that it can be used by others as a full standalone system?
You can export the templates in the settings tab or you create a compendium with your stuff in it
The example module is basically only a compendium
I revised my previous, deleted, question:
${Punching_Fail ? ${setPropertyInEntity('self', 'Punching_Value', 'Punching_Value + 1')}$ : 'Nope'}$
If I'm not mistaken this should be a simple if that checks a checkbox Punching_Fail and if it is checked it should make Punching Value increase by 1 and if it is not checked, it should send a Nope text into the chat log. However, every time it runs, regardless of the state of the checkbox, the formula just increases Punching_Value by 1 every time, regardless if it's checked or not. The only difference is that if it's checked, it will post the incremented number and if not it will post the Nope, but the increase happens either way.
Because you have a nested formula. These start from the innermost one
I don't even get why you have a nested formula. The inner one is completely unnecessary
What do you mean... In order to permanently adjust the value of another field I need to use the setPropertyInEntity thing, no?
Yeah, but the inner formula delimiters are unnecessary
And there it goes working exactly as intended once I removed those... 🥲
So if I have the outer formula delimiters any formulas inside the thing don't need their own delimiters and just get recognized wherever they are?
Also how do I print out nothing? Like telling the script "Do not print out/do anything."
You could provoke an error 😅
When I put absolutely nothing there in the "false" area it prints out ERROR instead which isn't a win either. I want it to do nothing if it's false. 👀 Even tried null or '' which printed out a tiny empty text box.
How about 0 / 0 in the false-part?
Spits out a NaN
Hmm.... Wait a second...
Isn't this some of that Game Master debug value visibility nonsense again...?
Nope
Ok, no. Yeah... I have the hidden roles thing disabled.
And that shouldn't even return NaN
Never thought it'd be difficult to have a program do nothing...
Because division through 0 is an error
Not in this formula apparently 😅
Hey Martin, I wanted the "Patente" label to be filled with the correct position depending on the "Pontos de Prestígio". If it was between 0 and 19 it should return "Recruta" and so on. But I couldn't find a logic that would work like that, the closest I could come up with was using first() and lookup(), but that just returned the option with the lowest value. I'm still studying the formulas so I'm not sure if that would be a good way.
%{return '${lookup('dynamic_pate', 'dyn_pate_name', 'dyn_pate_value', pontosdeprestigio, '<=')}$'.split(',').at(-1);}%
Or ${find('dynamic_pate', 'dyn_pate_name', 'dyn_pate_value', max(lookup('dynamic_pate', 'dyn_pate_value', 'dyn_pate_value', pontosdeprestigio, '<=')))}$
trying to make it so that current hp cant be set higher than max hp, anyone got a clue?
Remove the double-dots
you're right!
would it be correct to say: ${max_hp_val, temp_hp_val}$
In an example where i wouldnt want current_hp_val to exceed max or temp hp?
Nope, because you don't tell which one of those 2 should be taken into account
I see, just started learning this today
x, y is a syntax error, because you didn't specify, what should be done with those values. You can either do:
x + y: Combined with an operatorsum(x, y): Part of arguments of a function
Thank you for the clarification, its greatly appreciated
As I scroll through the chat I saw an example of someones custom sheet that looked pretty cool, how are they changing the background and fonts?
They used CSS (which is a file, which handles styling)
I'll have to reach out to the guy and ask
if you don't care to make your own css file you can use the custom css module that lets you edit it inside foundry
the background can be changed with the css statement
.window-app .window-content {
background: url('filepath')
}
and then edited to your liking using the various css properties you can find by googling such as:
.custom-system-actor-content {
padding: 90px 80px 90px 20px;
overflow-y: auto;
overflow-x: hidden;
background: url('assets/sheet-foreground.webp'), url('assets/sheet-background.webp');
background-size: 100% 100%;
background-repeat: no-repeat;
background-attachment: local;
}
fonts have to be specifically edited either from
:root {
--font-primary: "fantasy";
}
or in idividual cases by (with the chrome browser) pressing F12 to open the console and pressing 'inspect element' on specific text elements to view their style, and then copying that to your css file and changing it case by case, for example:
.sheet header.sheet-header h1 input {
border: none;
font-family: 'modesto condensed';
background: none;
font-size: 44px;
border-bottom: 6px double #d1bea1;
}
you can download your own font files, put them in a folder inside foundry and use them aswell using filepaths.
Hello everyone. I have written a macro (obviously with the help of ChatGPT, since I know nothing about programming) that returns in chat the result of the damage the attacker inflicts on the opponent (basically the damage is obtained as the difference between the attacker's roll and the defender's roll by applying appropriate modifiers to the 20 die) . However, I cannot set up the macro so that on the target's character sheet the value of hit points is automatically updated. The field containing the number of hit points in the character sheet template is of numeric type and I have named its component key as 'custom_hp' . I've made dozens and dozens of attempts, but I just can't figure out what instruction I need to insert inside the macro (which is obviously compiled with the Javascript language and doesn't accept CSB formulas as they would normally be written) to make the hit points on the defender's character sheet progressively decrease as the character takes damage from the attacker. Also, to simulate the healing intervention of a cleric or the effects of rest, how could I tell the macro to consider starting over in the damage count on a new encounter? Can someone kindly help me out here? Thanks!
There's one warning I'd like to address before you dive deep into applying damage to enemies. Your players don't have the permission to update actors they don't own. That means, that the final update-request must go through a GM. I have no premade solution for this issue, so you might want to ask in the macro-polo channel.
I thank you for your response. It would be sufficient for the automatic update to occur on the PC sheet whenever it takes damage from an NPC, leaving the burden of manually updating NPC hit points to the GM. After all the Master at the permission level can take action on the PC sheet, so this solution should not run into the problem you mentioned...or should it?
That would be fine.
Then my next question. Why do you need a Macro? The function setPropertyInEntity() can adjust a value of a target without the need of a Macro
Your're right, i know about setPropertyInEntry (read about it on the CSB Github) but, since i'm not into programming, i could not understand how to use it to automatically change the hp on the player' sheet by the amount of damage that my damage macro reports on the chat window.
So your Chat Message is generated by a Macro instead of a Label Roll Message?
Yes, exactly: the macro contemplates very special cases (e.g. if the attacker gets 20 with the 20 die and the defender gets 1, if only the attacker gets 20 etc. etc.). Also, the damage depends on a particular value relative to that particular weapon (e.g. a sword can inflict a maximum of 8 damage, so the macro limits the amount of damage inflicted depending the weapon the macro refers to). So it would be ideal if the macro (at least on the Master side) also dealt with decreasing the amount of damage on the PC sheet rather than resorting to other formulas or scripts. One macro to rule them all 🙂
game.user.targets.forEach(token => token.actor.update({'system.props.custom_hp': token.actor.system.props.custom_hp - damage}));
Thanks. I tried to insert your instructions into my macro but with no success. I am giving you the entire macro with your additions placed almost at the end. Maybe I made a mistake where to insert it or there is some other problem. I don't want to waste your time, thanks anyway.
I'm a bit stuck on a css issue here and was hoping for some inspiration. I'm trying to have the left border of the table be coloured aswell as the header but for one they're overlapping and since I want to use opacity their colour gets overlayed, and secondly the left border is placed outside of the table as it's a border property which means it looks a bit strange with the black 1px top and bottom borders of the table, they end before the pink border. Any suggestions on how I might style it better?
Ideally I'd want to scootch every TR in 8px to the right and fill the space with the background-color but I'm not sure if I can accomplish that
I kind of got it the way I want it but I had to say goodbye to the black table borders, I couldn't make them extend the way I wanted. I did manage to make the table borders rounded though 🤔
I tried making an <input> tag in an item displayer column but realized that the number entered into the field doesn't stay, it disappeares again when you update the character sheet. Is there a way around that?
You have to save the state in the Item. The Item Displayer itself won't save it
I see... how would you go about linking the text field to a component key from the item?
Dunno, never tried
For Checkboxes I have this simple solution: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Checkbox-in-Item-Containers
I did something similar with equipped items actually
yeah exactly that was what I looked at for equipping items! 😄
what I'm trying to accomplish is uses / charges for an item if you happen to have a simpler way of doing those
That must be stored in the Item anyway. The mirroring to the Item Displayer is just an additional access option
Which kind of Input Field?
number
I think undefined
basically I want to do something like item.uses == not empty ? ${item.uses}$ / ${item.usesMax}$ : ""
so it displays the uses column only on items that actually have numbered uses
I'll try with != undefined
It might also be an empty string. You should be able to check that in the console
undefined worked
but the forward slash remained for some reason
what the heck
alright fixed it
was just stupid
I fixed it pretty simply actually!
that way if you left click, it increases it by 1 up to max uses,
and if you shift click it decreases it by 1 down to 0!
Well, that works, yeah
I'd rather have it where right click decreases it and not shift click
but that means I have to script everything manually and I don't really know javascript well enough, it'd take me all day I fear
Is it possible to make custom conditions and perhaps remove the default ones?
or I mean it's possible but is it reasonable?
hello all
and for removing the ones already there?
could just do display: none in css maybe
It overrides the entire collection
And not everything is solvable with CSS 😅
my understanding is that the dynamic table allows say the player to create rows?
yet
Yeah, you can decide, if players should be able to create rows or not
I got a hypothetical for you Martin.
So i got a lil basic inventory setup. My goal is to eventually get it so that if a player clicks the attack button, it displays the item name and appropriate roll in the chat.
so im assuming it would start off something like ${sameRow:wep_name:}$
${sameRow('wep_name')}$
:: are only relevant in Roll Formulas like ${[:Strength:d20]}$
so '' is like quoting text specifically?
Things in quotes are strings
It's one of the primitive data types
Others are numbers, booleans (true or false) and Arrays (collection of values)
so im assuming then number values should also use []
No. [] are special delimiters for Roll Formulas
You can just write 7 as a number
Question: How can I iterate through the items inside a specific item displayer of an actor object in a macro? I found a way but I doubt is the ideal one.
You actually never use [] or :: unless you want to perform rolls
what if i wanted to fetch a number value from a specific row?
such as with: ${[1d20]+sameRow('wep_tohit')}$
The Item Displayer only contains the Item IDs, not the whole Items. So you have to fetch by id for every row
Same as with the name. You just specify a different column key
assuming i need to use some sort of way to specific a number val
Wait, do you actually mean outside of the Dynamic Table?
in the same dynamic table but eventually ill need to figure that out for specific player attributes
i got the formulas github page open trying to figure out how to get the value of the number field in there
If your Formula is within the same row, just use sameRow() like how you did
${sameRow('wep_name')}$
${[1d20]+sameRow('wep_tohit')}$
is the addition wrong? do i need to expand the [] around the whole equation?
Not needed. The Formula is correct
oh you're right, i guess i was reading it wrong
Actually I just realized that only one of the items is going to have a specific property as true at a time so I can do it like this, no need to check the item displayer per se
actor.items.filter(item => item.system.props.item_equipped == true)
i have no clue what i did but i broke something on my sheet lol
${sameRow('wep_name')}$
${[1d20+sameRow('wep_tohit')]}$
Attack button wont even work now:
I made a roll button within an item container;
how would i go about making it a macro? i can't just add it to the hotbar with dragging like one off a dynamic table.
sameRow('wep_tohit') is not a valid Roll Formula, that's your issue
You might want to check this article here to get familiar with the syntax
could you link it again?
My frankenstien code rn:
To Hit: ${[1d20]+('wep_stat'=="STR"?str_val:'wep_stat'=="INT"?int_val:'wep_stat'=="WIS"?wis_val:0)+sameRow('wep_tohit')}$
Trying to get something condition to work where if wep_stat = one of three values, then itll use the right value
nevermind i got it: To Hit: ${[1d20] + switchCase(sameRow('wep_stat', 'unknown'), 'STR', str_val, 'INT', int_val, 'WIS', wis_val, 0) + sameRow('wep_tohit', 0)}$
okay almost lol
actually did get it this time:
To Hit: ${[1d20] + switchCase(sameRow('wep_stat', 'unknown'), 'wep_str', str_val, 'wep_int', int_val, 'wep_wis', wis_val, 0) + sameRow('wep_tohit', 0)}$
I'm trying to write a line in a roll message where the entire roll is conditional on a property in the item but it's not working, can y'all tell me what's wrong with my syntax here?
<td><strong>${item.check != '' ? (${Roll:= [1d20]}$ ${!Roll >= 20 ? '<br>Critical Success' : ''}$) : ''}$</strong></td>
I've tried with different variations and I'm not really getting it
basically what I want in mock code just to explain is something like:
if(item.check == undefined) {
<td><strong>''</strong></td>
} else {
<td><strong>${Roll:= [1d20]}$ ${!Roll >= 20 ? '<br>Critical Success' : ''}$</strong></td>
}
Hi people 👋
I'm creating my first system and currently struggling with the effect displayer.
The documentation tells about a reference column and various options related to that specific column or columns header.
My question is how can I add another column like the remaining time for each effect?
Is it feasible with just this module or should I use a simple table that I build myself from the effects attached to the actor ?
Currently it has only a single column to easily access and create Active Effects
Ok thanks for the quick reply 👍
I guess I'll tinker with something with a plain old table then.
there has to be some way of doing this that I'm missing, I can't figure it out for the life of me
The thing is, you can't make a Roll conditional, only the Roll Formula. So you could construct a Roll Formula, where one conditonal path has 0 as the Roll Formula
${#Roll:= item.check != undefined ? [1d20] : [0]}$ Something like that?
You now have 2 Rolls, that are being executed
A good direction, but that is not a valid Roll Formula
how come?
${#Roll:= [:item.check != undefined ? 1d20 : 0:]}$ enclose everything in ::?
doesn't seem right
Yeah, it would normally work this way, buuuuut... the ternary operator also uses :, so you have 3 of those, which is not valid
In essence, the ternary operator doesn't work directly in Roll Formulas
but I can reference it from a key
But what you could do is to construct the Roll Formula, save the result in a local variable and just use that in the Roll
what I'm trying to do here is make a roll button for my abilities but I realized some abilities don't have attack and damage values and are instead healing abilities for example, so I figure I need to have the abilities output attack and damage if those fields are filled, and instead output healing if that field is filled. If there's a different method to achieve this that comes to mind I'd love to hear it 😄
because right now, if the check / damage fields aren't filled in, it just errors. I need it to go through just with no values or empty strings
I'll dig into saving the roll formula result and see what I can accomplish in the meantime
I solved it actually ${#Roll:= [${!item.check.includes('STR') ? '1d20' : 0}$]}$
thanks for the help
Hello everyone, i'm starting to use CSB and i have a question for you. If your system need to add species (elf, human, dwarf...) on player sheet. And each species could give an improvement on an attribute choice (ex choice between Agility or Intelligence). How could you make the player choose between the attributes suggested in the "elf" item for example. I was thinking about using a dynamic table with a radio button allowing to know which attribute has been choosen like this but is there another way to do it or example ? Thanks for your advice
https://gitlab.com/custom-system-builder/custom-system-builder#48-user-inputs
you could use user inputs to give them a dialog to choose one value
but for that i should ask for user input in an event when i drop down a race in an actor sheet ? how i could trigger this event in CSB ?
Hi again, I'm still struggling with effects. What is the format for Attributes key ? I tried using my component key as typed in the template but it does nothing. I also tried using the various methods from foundry's official doc but I can't find(or understand ?) the thing.
The official website and community for Foundry Virtual Tabletop.
system.props.componentKey
Thanks 👍
However, used as it is in the effect editor it does string operations (0+30=030).
Am I missing something?
Hmm, I thought I fixed that... Well, you can use the Custom option and input a formula as the value
Ok it's working that way thanks. I'm in 4.2.0 according to foundry so last version if I'm not mistaken
I'm trying to get a heart icon to appear on the item displayer table only when there's a relevant healing value on the ability, but no matter what I do I only get errors. What could I do to make this work?
<i id="icon" style="display: none;" class="fa-solid fa-heart-circle-plus"></i>
%{
const myIcon = document.getElementById("icon");
if(${item.healing.includes('-')}$) {
myIcon.style = "display: block";
}
}%
I'm trying to make a heart icon only appear in the item selector table when there's relevant healing data on the ability, but I'm only getting errors, what could I do to make this work?
<i id="icon" style="display: block;" class="fa-solid fa-heart-circle-plus"></i>
%{
const myIcon = document.getElementById("icon");
if(${item.healing.includes('-')}$) {
myIcon.style.display = "none;"
}
}%
without the function part there are no errors so there's some syntax error inside the %{}% but I can't figure out what
I've tried doing the same thing with ternary operators but it doesn't like the <i></i> tag
silly question, is there a way to remove this little white square that appears from foundry chat because a nil value was made?
it shows Critical Success & Failure appropriately, was just wondering if there was a way to omit the chat in the event neither 20 or 1 was rolled
put a '!' at the very start of the formula
it removes the explanation box
Hello, i'd like to play a custom system but develop a full system for Foundry is far too much for me right now. I was wondering if there is a way to make a module for a poor man character sheet. What i have in mind is basically just a way to have some labels with input value that you can save and some macros who read them. Is there something like that or is doable by a beginner in some way?
If you want to figure out, what the system is capable of, you might want to install the example module of CSB, which includes an Actor and some Items.
Building Templates is easy at the beginning, but the difficulty increases with complexity ofc.
Do you mean like taking one in the library and try to messing around?
Well, you could also take one from the sheet library, but I meant a module, which is available in the package manager of Foundry
Oh, thank you very much, i missed that.
Uhm, if i try to activate the module it says i need 4.3.0 version and i have the 4.2.0. Custom System Builder is in fact 4.2.0 but if i check for updates it says it is up to date. I'm missing something?
Ah yeah, it might try to download the latest version regardless of system compatibility... You need the one for 4.0.0, because 4.3.0 is in beta right now
Or you edit the version of the module in the module management
I don't think that it won't work with 4.2.0, because I haven't used the new feature there yet
<i id='icon' style='display: block;' class='fa-solid fa-heart-circle-plus'></i>
%{
if(${item.type.includes('Instant')}$) {
document.getElementById('icon').style.display = 'none';
}
}%
Any update on why this doesn't work as a label text? I can't see what's wrong with it
Missing return
I was experimenting with return a bit but couldn't get it to work, where would I put it?
At the end of the script. You probably want to use empty string or such
like just return ' '
Yep
well the error signs disappeared but the display property still isn't being changed
I think that the element doesn't exist at the time the statement is executed
I think it would be easier to make the style itself use a Formula to determine the display type
Like display: ${!item.type.includes('Instant') ? 'none' : 'block'}$
didn't even cross my mind
<i style='display: ${!item.type.includes('-') ? 'none' : 'block'}$' class='fa-solid fa-heart-circle-plus'></i>
I don't even know what's wrong. The only thing I'd change are the single-quotes to double-quotes in the HTML, because... convention
yeah just did that and no difference
weird
just outputs error... not really sure what else to do 🤔 I'll have to sleep on it I guess
Remove !
Tried that, still error
interestingly though with the ! removed, it doesn't pass style="display: error;" anymore the style tag is just gone
OH
ok found a combination that worked, it needed string delimiters around the none and block, and no !
can't believe I didn't try that yesterday, I really did just need to sleep on it
alright, everything works as intended now! One button that shows as a heart if it's a healing ability and a dice if otherwise, and sends conditional table rows depending on the ability keys. If it has a check, it sends a roll and a result row, if it has damage it sends damage rows, if it has healing it sends healing row, otherwise those rows are display: none;
${#Target_Defense:= item.type.includes("Physical") ? fetchFromActor('target', "defense", -1) : fetchFromActor('target', "magicdefense", -1)}$
${#concat(string(?{Dice_Modifier:'Attack Modifier'[number]|0}), string(?{Damage_Modifier:'Damage Modifier'[number]|0}))}$
${#Damage:= item.damage}$
<table>
<tr>
<th colspan="2">
<img src='${!%{return linkedEntity.img;}%}$' width="48px" height="48px"> ${!item.name}$
</th>
</tr>
<tr>
<td colspan="2">
<details>
<summary><strong>Description:</strong></summary>
<p>${!item.description}$</p>
</details>
</td>
</tr>
<tr style="display: ${!equalText(item.check, "-") ? "none" : "table-row"}$;">
<td><strong>Roll</strong></td>
<td><strong>${#Roll:= [1d20]}$${Roll}$${!Roll >= 20 ? '<br>Critical Success' : ''}$</strong></td>
</tr>
<tr style="display: ${!equalText(item.check, "-") ? "none" : "table-row"}$;">
<td><strong>Result</strong></td>
<td><strong>${Result:= Roll + ${item.check.toLowerCase()}$ + Dice_Modifier}$
${!Target_Defense == -1 ? '<br>No target selected' : Result >= Target_Defense ? '<br>Direct Hit!' : ''}$</strong></td>
</tr>
<tr style="display: ${!equalText(item.damage, "0") ? "none" : "table-row"}$;">
<td><strong>Damage</strong></td>
<td><strong>${[:Damage:]}$</strong></td>
</tr>
<tr style="display: ${!equalText(item.damage, "0") ? "none" : "table-row"}$;">
<td><strong>Direct Hit</strong></td>
<td><strong>${DirectHit:= [:item.directhit:+:item.damage:]}$</strong></td>
</tr>
<tr style="display: ${!equalText(item.healing, "0") ? "none" : "table-row"}$;">
<td><strong>Healing</strong></td>
<td><strong>${[:item.healing:]}$</strong></td>
</tr>
</table>
@formal goblet Hey Martin, nvm for that macro problem, i managed to integrate your instructions in it and now it works perfectly, thank you very much! (Oh, and Merry Christmas 😄 ). I'd bother you with another question regarding setPropertyinEntity: i wrote this formula ${setPropertyInEntity('self', 'custom_hp', 'custom_hp+[3d8]')}$ PF to simulate self-healing for the cleric, but it seems to ignore the maximum value that i've set in the HP field: in this way the cleric could give himself infinite hp without respecting any cap. Why does setPropertyInEntity ignore the 'maximum value' field i've set in the character sheet's template for hp?
Because there's simply no mechanism to prevent that. You could do a manual Document.update and the effect would be the same. That's why you have to respect caps aswell
Ok, that doesn't seem a big problem anyway: no matter how many hp the number under the token shows to you, i'll warn my players that the value on the sheet is what matters (and it's enough that opening the sheet automatically updates the token number).
Do you know if there are any plans to update this sheet? I'm looking to run Deathwatch and it would be great to use CSB. The sheet looks great but I don't think it's functioning as planned.
These are user-generated and not maintained by us (unlike the Example-sheet)
Can anyone help me?
I think it should be really simple to solve, but I didn't understand from the documentation.
I need to roll an "Agi" attribute inside an item. I can roll a die inside it, but I wanted, for example, roll+Agi.
I'm currently using this:
Rolling ${roll:=[1d10]}$.
but I've already tried, for example,
Rolling ${roll:=[1d10]+Agi}$. and nothing. Agility is inside "Habilidades". I also tried something like Habilidades.Agi. 
Does anyone know how I can solve it? Ty!

Context is important, so I need the following information:
- Where is your target Formula (the one, that should perform the roll)?
- Where are your dependent values (in your case
Agi)?
Entity types like Actors/Items and Components like Dynamic Tables and Item Displayers play an important contextual role. All other Components don't
Target inside "Armas" template for itens
Agi is inside Tabbed Panel "CabAba" and inside table "Habilidades"
this is the label:
Rolou Agilidade com ${[:Agilidade + AgiBD:d10cs>=7df1]}$ Sucessos e adiciona ${AgiBF}$ no resultados de testes.
alternative label:
${#concat(
?{DifAlt:"Dificuldade Alterada"[number]},
?{Bonus:"Bônus de Circunstância"[number]},
?{Penalidade:"Penalidade de Circunstância"[number]},
?{Info:"Informações Adicionais"[text]}
)}$
Rolou Agilidade com ${[:Agilidade + AgiBD + Bonus - Penalidade:d10cs>=:7+DifAlt:df1]}$ Sucessos e adiciona ${AgiBF}$ no resultados de testes.
Informações Adicionais: ${Info}$
is that what you need?😊
Yep, that helps. Tabbed Panels and Tables are irrelevant in terms of Formulas, so we can skip that.
You're trying to fetch a value from the attached Actor to the Item, am I correct? If so, use fetchFromActor('attached', "Agilidade", 0)
how would you most easily go about adding items that can be added as effects on an actor?
such as spell effects or debuffs and stuff
that would show on the token as an active effect and stuff
Use an Active Effect Displayer inside the Item to create Active Effects, which should be transferred to the Actor
is that so
but that doesn't show up on the token
custom script territory?
It will only show up in the Token if you select one of the statuses inside the Active Effect, otherwise it will be hidden
and with 'one of the statuses' you mean the conditions predefined by the CONFIG?
Yep
Yep
and there's no easy way to make it show up on the token as itself?
Nope, mandatory
I want for the players to be able to see if they have a spell active on themselves for example
You can add a Custom one in the Config and use that for all custom effects
Easy as that
wait so if I add a status condition, it doesn't actually show that status condition?
oh I see, it shows as active but the icon becomes that of the item's active effect... weird
That's Foundry default behavior
usually in systems I've used if they use active effects for such things those active effects append themselves to the conditions so they show up there when the buff is on the actor, and then go away once they aren't
don't know how that works behind the scenes so to speak so I've never thought about it
Me neither, I've only made Active Effect modifiers work with CSB (and the Active Effect Displayer). That's it
oh quick additional question I've thought of, when you use rich text fields they usually pop up like this and you have to manually extend them to see/edit the text. Why is that and can I change it?
its become really annoying after a bit 😄
Dunno, it wasn't always this way to be fair
Maybe something changed with the RTA with V12. I honestly use only the Dialog editor type
But could be worth a bug report. Chances are high, that it's an easy fix with a 1-liner
I'll toss it on the gitlab
Is an if statement possible without the else bit somehow?
do you mean a ternary operator or an if statement?
if you mean an if statement then
if(condition) {
code block;
}
If as a formula.
if you mean a ternary operator then no but you can always do something like
condition ? exprifTrue : ""
to provide an empty string as the falsy expression, depending on what your specific context is
Yeah that doesn't work. "" in specific prints out a tiny empty window.
what's the context
"" prints out this.
in a roll message?
0/0 was also suggested by Martin and it prints out NaN
I have a formula that checks if a checkbox is ticked and if it is I want it to do something. If not, do nothing.
But the "do nothing" part is more difficult than expected.
Always prints out something.
what's it printing to, the chat? Is the only issue is that it prints something to the chat that it shouldn't?
Yup.
ok is this in a roll message?
what does the context look like, is it a table?
what does your html look like
${Punching_Fail ? setPropertyInEntity('self', 'Punching_Value', 'Punching_Value + 1') : ""}$
if you only want the box gone that's doable but if you want the chat message to not send at all I don't know if that's doable
Punching_Fail - Checkbox
True value is just a placeholder to increase a value in a field by 1 (Works fine.)
False should be doing nothing.
I want nothing to get printed out if the checkbox is not checked.
Quite literally skip, move on, do not print, alter, do anything.
well I still don't quite understand the context. It looks like it's a roll message since it's printing a chat message. Just throwing something out, maybe try a html comment
not sure it'll do anything but
${Punching_Fail ? setPropertyInEntity('self', 'Punching_Value', 'Punching_Value + 1') : <!--do nothing-->}$
Yeah, that prints ERROR
figured
If the False area is not filled or whatever it expects a second value which I kinda don't need.
${#%{
if (!entity.system.props.Punching_Fail) {
throw 'Chat Message aborted';
}
return '';
}%}$
${Punching_Fail ? setPropertyInEntity('self', 'Punching_Value', 'Punching_Value + 1') : ''}$
You have to actively throw an error to abort the creation of the Chat Message
The success should print Chat Message Aborted?
oops. negated
do NOT ! operators work inside %{}% delimiters?
Holy shit you did it mate...
apparently so
Yeah, you have full JS there
what does the #do?
Hide the result in the Chat Message
Useful for local variables, which you don't need in the Chat Message
ah cool
Hm... It seems that the Return exits the entire code. I tried slapping a copy of that with adjusted names right after it and it only properly works if all of them are checked. If some or all are unchecked, it doesn't work.
How's the logic? How should be the decision tree?
I just have a list of skills where each skill has a single checkbox. If this is checked and then the button is pressed to run the script in question, it should go through all of the checkboxes and if it finds a checked one, it should increase that skill value by a certain amount. (As a placeholder I just do a +1 for now.) It's kind of an automation attempt because these skill increases are all done at a single point so I'm trying to make it all run from 1 button which would check all checkboxes and add the ones that should be added.
So basically in a dumbed down version:
Is skill 1 checked?
Yes - Add this to this value and continue.
No - Do nothing and continue
Is skill 2 checked?
Yes - Add this to this value and continue.
No - Do nothing and continue
etc.
etc.
And this list is inside a Dynamic Table?
No, a static, regular table because the list of skills won't be changed.
...
I most likely don't realize the purpose of dynamic tables but it just seemed like everything wanted to be the same for every row.
Use a Dynamic Table, remove the option for your players to add rows and create predefined rows in the Template. With this, you have a list of a fixed size
With this, you won't need a Formula for every fucking single skill
Any way to edit the rows because iirc when I tried to use a dynamic table I had labels for the skill names and couldn't edit them.
Is it possible to not have a text field box there? So it only shows text like a label does?
Are you only concerned about the visual or do you want a read-only field?
The text field box just makes it seem like the area should be editable. As a user if I see a box like that I by default expect to be able to write in that area and the names of the skills won't change ever so that's why in the table I have now I made it with label rather than text box. (Same for the modifier near the end. Only leaves a box in the areas where the user is expected to interact.)
How about you create 2 Components in the Dynamic Table?
- Text Field for the name of the Skill with no column-name, which is always hidden (visibility formula)
- Label, which only contains a
sameRow()-Formula to the hidden Text Field
Will I always see the hidden collumn just because I am a GM? (In the actual sheet (Left), not the template itself.)
You can hide it even as a GM. Just enter false in the visibility Formula and you'll never see it again
Yes, I figured but if I leave it without a specific formula it wouldn't be visible to regular players as long as the Column Name of the specific column was left empty as instructed?
No. Default is visible to all. You have 3 options to adjust the visibility:
- Visibility by Permission level
- Visibility by Role
- Visibility by Formula
Ooooooh, I misunderstood your original comment here. ☝️
I understand now and now that I understand the setup I'll look into porting the table into a dynamic one. Thank you very much for your nerves of steel with my noob questions. 🥹
By the way... Is there a situation where a dynamic table would be worse than a regular table? Since from what you've told me it's best to use a dynamic table for lots of stuff. 🤔
If you have stuff, which behaves different in certain rows
Something like this here
Ah, ok gotcha. Thank you for the clarification!
how can i nest multiple "then" statements?
Value == true ? doThis andThis andThis : doThat andThat andThat
&, &&, +, ,, nothing seems to work
unless there's a better way to do what i'm doing.
I am making a roll button within the item container for weapons:
I am effectively trying to do the following
if attribute radio = true
get base attribute name
lookup attribute on dynamic table, roll that skill using the button on the table (to hit)
&&
reference weapon dice quant, value, and modifier
[roll damage]
else radio = ability
do the same but for the selected ability and ability table
What about and, or?
You can also just make the text box go away with css
.textBoxKey input {
Background: none;
Border: none;
Width: whatever you want;
}
I'm barely on the edge of understanding scripting so I'm trying to somehow put together a functional automatization system that looks as intuitive as possible. To my understanding css only focuses on visuals, not functionality so for now I'm not looking into css at all and I'm leaving it in the back of my mind as a possible option for after I have my logic set up and functional. 😅
can I have fields get info from rolltables so that if I create an actor it fills in all info I want?
more specifically in a text area field
You can do that if you use setPropertyInEntity() in the Label Roll Message
i can't fined "Label Roll Message" in the text field component
sorry
ugh
I mean rich text area component
i would like the rich text area component to come in filled with some text from rolltables
You need a Label with a Label Roll Message or a Macro to achieve that. You need some point to trigger the changes, the Roll Table itself can't do that
that's it, it worked tyy ❤️
Anyone have any idea why this concat:
<p style="text-align: right;">${concat(string(diceRoll), '-', sameRow('Skill_Attribute', 0), ' // ', sameRow('Skill_Value', 0))}$</p>
keeps trying to convert the dash and double slash into numbers when I'm trying to keep it as text?
If it has one numeric type in the args, it will try to convert everything to a number
Any way to tell it not to do that? I tried closing both of them in a string() but that changed nothing.
The solution would be indeed to cast every arg to a string
Oh EVERYTHING... Ok I'll try. 🤔
At least everything, that is not a string by default
You've done it yet again Doctor. 
Doc Martin
Haven't tried,
So
Value == 1 ? Dothis and dothat ; elsethis and that?
Also how does or work?
They are just logical operators:
false and false => false
true and false => false
false and true => false
true and true => true
false or false => false
true or false => true
false or true => true
true or true => true
Oh no, I meant for the conditional logic, how can I run multiple functions within the iftrue and iffalse areas?
I'm specifically trying to
If Attribute radio selected
-> get selected attribute
-> roll that value in a dyn table
--> get weapon damage, roll that
Else
-> get ability from ability dropdown... Etc
So I tried
ItemBaseGroup == 1 ?
Ref('item.itemBaseAttribute') + lookup(...) : Ref('...')
I replaced the + with everything I could think of, and even tried nothing but the functions... Can't figure it out.
Funcion and variable names are case-sensitive
That's just my phone auto capitalizing, I'm not at my pc.
What's the syntax tho?
It highly depends if these functions can be chained. A Formula must give 1 definite answer at the end, so multiple statements like in JS are not directly possible
But the only conditional thing I see at your example is, if the value comes from an Attribute or an Ability. The rest stays the same regardless of the condition
The ability to delete a row in a dynamic table is visible just because I'm the GM, right? (I did select the crossed out garbage bin on all of the rows but still see it in the test character sheet.)
Yep, your players won't be able to
hey there,
I've been working with dice rolls expressions and I've reached this expression :
STR Roll : ${roll:=[1d100]}$/${p_net_STR}$
result :
${
roll<=p_highroll?'CRITICAL SUCCESS':
roll<=p_STR?'SUCCESS':
roll>=p_lowroll?'CRITICAL FAILURE':
'FAILURE'
}$
I've encountered two issues and I'd would like to know if they are known limitations or bugs :
- I could not make conditions with more than 2 operations (ex A==B -> OK, A==B&&C==D-> KO)
- Only the "if true" part can be chained into another one.
The logical operators are or & and, not || & &&
Bruh... sorry, I'm a network guy not a dev 🤣
Don't worry, || and && are common in programming languages, just not in CSB
Am I insane, or does lookup not work when trying to match Booleans in Custom System Builder / CSB? (v4.2.0)
I have been fighting with this for at least 2 hours, and I need a sanity check to see if it's just me. Any insight to what I am doing wrong would be greatly appreciated (or another method to get the same result).
I have an Item Displayer (charWeapons) on the Character sheet with the weapons a Character has. There is a checkbox for "isEquipped" (using the logic from the example sheet). It has a column on the table and a prop on the weapon with the same name.
I am trying to get the weapon skill (weapSkill on the Item Displayer) of the equipped weapons (where *isEquipped *== true)
lookup('charWeapons', 'weapSkill', 'isEquipped', true)<<<< always returns nothing
lookup('charWeapons', 'weapSkill', 'isEquipped', false, '!==')<<<< always returns the skills for all weapons, regardless of isEquipped value
I have tried multiple variations passing the booleans as: strings, 0 and 1, various casing, setting a variable to true/false and using those
(and yes, *isEquipped *value is changing on the items)
isn't the right symbol "!=" ?
just tries "!=" no change in results
at least I tried
I think the difference is that !== compares types as well as data (so "0" and 0 wouldn't be equal)
and about my other point ? is that expected as well ?
You can use another conditional in the else-part, that's also not an issue
Try out game.actors.getName('actorName').system.props.charWeapons in the console and give me the data from one row
{
"name": "bow",
"id": "Jy4hAYOidj64ZRTD",
"weapRoll": "",
"damageValue": "",
"weapSkill": "Bow",
"weapSkillValue": "0",
"bulk": "",
"isEquipped": "<i class="fa-regular fa-square" style="color: red; background-color: white;"></i>",
"testRoll": ""
}
oh... I kinda see it now the isEquipped is the display value
thanks! I moved the checkbox into the label prefix and now I'm getting changes! Results are still not quite right, but I can work with this 😁
How can I work with an entire column of values in a dynamic table at once?
- I'm looking to make a formula outside of the Dynamic table which sums up all the values of a certain column.
- How would I make the training script run through all the rows of a checkbox table upon a single click?
I tried adjusting the solution I got to the previous situation:
${#%{if (!entity.system.props.Skill_Fail) {
throw 'Chat Message aborted';
} return '';
}%}$
${Skill_Fail ? setPropertyInEntity('self', sameRow('Skill_Value', 0) + 1) : ''}$
But while this doesn't give out any errors it also doesn't adjust anything.
right; but i need multiple conditions to be ran after a path is selected? How could I do that?
sum(lookup())setPropertyInEntity()expects at least 3 args, but that will also not help enough to adjust all rows. Give me a minute...
Statements, not conditions. The simple answer is, you can't (at least not multiple complete statements). Give me a concrete example on how the Label Roll Message should look like for both cases
{Actor} attacked using an {item.name}.
Roll to hit: {ability/attribute} ( {dicepool} )
(alt roll) Situational Bonus: {Value}
Total: {value}
Damage: { item damage pool }
(alt roll) Situational Bonus: {Value}
Total: {value}
%{
if (!entity.system.props.Skill_Fail) {
throw 'Chat Message aborted';
}
const table = entity.system.props.Table;
Object.values(table)
.filter(row => !row.$deleted && row.checkBoxKey)
.map(row => ({
...row,
Skill_Value: parseInt(Skill_Value) + 1
}));
await entity.entity.update({'system.props.Table': table});
return 'Values updated';
}%
Damn... I did not expect this much...
Do you have a halo yet mate?
If I see it correctly, then the only conditional part is the Roll to hit
correct - the dice pool and ability name are both conditional on the radio selection
Then save both in a variable and use them down below
Something like this:
${#dice_pool:= isAbility ? ability_pool : attribute_pool}$
${[:dice_pool:d6]}$
ability and attribute pools are not stagnate - they're items in a dynamic table
I'd need to get the same function used withtin the dice for say 'dodge'
Then do multiple conditional checks
doesn't that require the chained logic i was asking about earlier?
isAbility ? getAbilityName -> sameRow get total : getAttributeName -> sameRow get total
Nope. Each statement performs the same conditional check:
isA ? b : c
isA ? x : y
oh so
isAbility ? get ability name : get attribute name
isAbility ? get ability function : get attribute function?
brilliant
Yep
So i'm getting a cannot convert 'd6' into a number error with the concat?
${ref('item.itemRollBase') == 1 ? concat(string(lookup('attributeTable', 'attributeDiceQuant', 'attributeName', ref('item.itemBaseAttributeName'), '==')), 'd6') : 'placeholder'}$
Is it possible to modify/add/remove effects from this list ? (sorry I don't know if it is even related to CSB or core Foundry)
From what I've seen there is a class for that "ActiveEffectConfig"
But is it usable with CSB ?
Yep, it will try to convert all args into numbers if at least one is a number
i think that's a list of defaults -> you can create custom ones within an active item effect pannel but idk about the core list.
you could if you dug into csb files but changes would revert on update
Yeah but its only ephemeral
That's what I would like to avoid
@sinful spade This was dealt with today here. -^
btw, lookup() returns an Array, not a string or number
Thanks, didn't even notice there was a wiki... I was doing everything from the readme 
Yeah, many just ignore the first few sentences of the Readme 😅
i did try string('d6') as well, no luck.
Yeah, I've read it more carefully and yeah :p
Imo, the readme is so dense that I thought it was about everything.
I'll probably split the Readme into Wiki-sections, but that's work for my future-me
and also the wiki tab is hidden under another section on the nav lol
Understandable
Yeah, it makes very few sense to fold it into another section especially near everything linked to bug reporter
it'd be more obvious to the user that they need to look for the wiki if the home page stopped at incompatabilities rather than having 85% of the information there.
https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/README.md
I'm reading the readme file directly not on the front page
Also a reason why I should move it
anchors are working weird for me in the main page, it moves me at the wrong spot and given the size of the readme...
That's because of the Images, that are lazy-loaded
oh...
right, but shoundl't it be converted because of the string function?
That's a core foundry question but are macros persistent ? I'm very new to foundry and it feels weird to touch defaults settings with a script hotbar 🤔
🤔 thanks for pointing that out, but i'm not technical enough to read between the lines there. Can you post the solution? I can probably scrap it for parts.
Yeah, they are
This is a good article: https://github.com/GamerFlix/foundryvtt-api-guide/blob/main/README.md
it feels kinda wrong to make a macro from a hotbar to run it once.
And now I'm worrying about obliterating the default settings by accident and having a fun time reverting my mistakes
You can create backups from the setup window. Once you have one, you can have as much fun as you like without regret
True
Use F12 to check for errors. I saw you had a '==' there.
yep. just getting the cannot convert d6 to a number error
== is fine though
right, which is why i tried string('d6') as well, to no luck.
ref('item.itemRollBase') can be shortened to item.itemRollBase
thanks lol
while it's less efficient, i'm gonna keep the ref() just for my own sanity, it helps me remeber what it's doing.
unless it's breaking something
Nope, it's not. Just shorter
And item.itemRollBase is kinda... redundant with the item in the Component key
🤣 at the time i didnt know that i could reference it with item.key
i care less about it being pretty than i do it working 😦
I have to override this damn concat()-function. Nobody uses the overloaded one for numerics...
there's another concat?
It's overloaded for different types
I mean... try out string(lookup()).concat('d6'). This SHOULD'T try to cast to a number, right? RIGHT!?
Because String.prototype.concat() != mathjs.concat()
how are you concat-ing outside of the parenths 😭 i hate code
Because you can do 'Hello'.concat(' World')
Because it's a prototype function of strings
string(lookup('attributeTable', 'attributeDiceQuant', 'attributeName', ref('item.itemBaseAttributeName'), '==')).concat('d6')
2,d6
dunno where it's getting that extra comma 🤣 but it's not an error anymore
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
The world scripter module is obsolete and was never updated it seems :/
You can still get it and make it work regardless of missing updates, because the functionality is pretty minimal and it didn't break since then
But here's an alternative guide: https://foundryvtt.wiki/en/basics/world-scripts
Interesting. Normally there shouldn't be one, except you get more than one entry from lookup()
I mean this is the closest I've gotten lol
Oh I see, that's quite a cheap trick lol
is there an easier way to get the output of an enitre target item? prefix, suffix and all?
the d6 is a suffix on that original cell since i have to reference the value a lot elsewhere
Wait, if i need to use a world script, macros effects are only effective during the current runtime
oh you meant the script themselves as text files are persistent ?
Yeah, Foundry saves everything as a Document
okok in the world dir etc... got it 👍
There's also a Directory for Macros. Just click on the folder icon in the hot bar
Almost everything is world-bound
Exceptions are modules, which are global (but can contain world-data ofc)
Huh, what's the difference between Apply and Save Macro... I mean save macro is obvious but apply
run vs save?
yeah, of course makes sense since they are grabbed out of a world
There's a run macro option
Either this or save + close or such
oh ok
makes sense if you make a big macro would be annoying to close it after each line for the save addicts
so I'm guessing there's no way to target a cell with pre/suffix?
another solution, - is there a way to in real time grab items out of a dynamic table? e.g. hidden components exporting the value without using a lookup function?
You mean Label prefix and suffix?
like I can make a hidden label that uses the lookup function to just get the 2 - then later concat the label 2 and the d6 in the item roll.
Is there a way to do that real time with additions and what not?
yeah i have the d6 as a suffix for the column. could i just use that somehow? 🤣 two awkward solutions
the 'd6' is just a suffix
Not without a script, because prefix and suffix are not part of the normal system properties
Which is intended
i see.
and a real-time export of the base values?
i could make a hidden column with the concat predone actually
@formal goblet
Your world script example is on its way to be obsolete :
icon -> img
And well, until V14 is a long way
wow such change
What would be a real time export?
don't worry about it, the column is way more effective- as long as i can somehow remove it from taking any space on the player's view.
i'll play with the css ^^ display: none !important; should work.
But i guess that's a feature request martin, a function or other way to access label-prefix/suffix.
Like how we use item.name to specify for the item could we somehow get a
prefix.<label>.suffix addons?
Ehhh. Nope
it'd be a bit of a hastle if you want the full output:
prefix.label label label.suffix
😦 oh ok
We want to keep the system properties clean. If something is not intended to be used as a prefix or suffix, then it should be part of the Label text