#Custom System Builder
1 messages · Page 22 of 1
${setPropertyInEntity('self',getRefFromDynamicTable('status_table','status_number','status_effects',status_effect_list),status_potency)}$
${shield_drop:=fetchFromDynamicTable('status_table','status_number','status_effects','Shattered Shields')}$
${setPropertyInEntity('self','shield','base_shield <= 0 ? 0 : base_shield-shield_drop')}$
${armor_drop:=fetchFromDynamicTable('status_table','status_number','status_effects','Corroded Armor')}$
${setPropertyInEntity('self','armor','base_armor <= 0 ? 0 : base_armor-armor_drop')}$
${speed_drop:=fetchFromDynamicTable('status_table','status_number','status_effects','Paralysis')}$
${setPropertyInEntity('self','speed','base_speed <= 0 ? 0 : base_speed-speed_drop')}$```
${setPropertyInEntity('self','status_duration','status_duration <= 0 ? 0 : status_duration - 1')}$
${status_duration = 0 : setPropertyInEntity('self',getRefFromDynamicTable('status_table','status_number','status_effects',status_effect_list), 0)}$
${status_duration == 0 : setPropertyInEntity('self','shield','base_shield')}$
${status_duration == 0 : setPropertyInEntity('self','armor','base_armor')}$
${status_duration == 0 : setPropertyInEntity('self','speed','base_speed')}$```
Not sure if there's a way for me to have a click to expand, I'll scoure through the commands later
If it helps at all, this is how I've made the dropdown and dynamic
Sorry my question was a general one, not in reference to yours sorry!
Ahh mb
CSB Question: Is there a command or code that can be included in chat output or label roll message expression so that a piece of chat output allows the user to 'click to expand' or toggle visibile of that portion of it?
Some thing like that?
Or that?
Message template without VAR definition - just for message structure understanding
Yes like the first one, where if you click on some element in the chat window, more information is presented in the chat window.
I think this is a product of the roll mechanics, correct? Or can that be added to normal chat text as well?
So if I understand, this can be done as part of a custom-CSS that is then added to the element on the sheet in the 'advanced options'?
Though from the example, this has to be coded for each specific bit of content you want to expand?
It's mainly by CSS - so main requirement correctly use CSS class in your messages.
I Use it in Label Roll
Is the correct class then the 'tooltip part"?
This is default Foundry style, as I know
Oh great! So then it looks like the class to use is "tooltip-part"?
Can you share the 'advanced settings' part of your Label Roll? That's where css can be assigned right?
No any advanced styles
In Label Roll message:
<div class="dice-roll">
<div class="dice-result">
<div class="dice-formula" style="font-weight: bold;">Your MESSAGE</div>
<!-- This part is toggle by mouse click on prev div -->
<div class="dice-tooltip" style="display: none;">
<section class="tooltip-part">
<div class="dice">
<header class="part-header flexrow">
<span class="part-formula">Header of tooltip</span>
<span class="part-total">000</span>
</header>
<p>Any Info for tooltip</p>
</div>
</section>
</div>
</div>
</div>
Oh okay thank you! I didn't realize you could put HTML/CSS in the roll message
The order is stored in the actor flags
If it can help I'll be happy to, but I don't no how to do that. I'm not even the one really doing this work, I'm using AI for most of the js. I'm no dev or anything. So i'm not familiar at all with Gitlab, branches and stuff. 😅
This worked perfectly! I'm saving this for future use. Thank you!!!!!
So, how do I format an item container/items to do a simple quantity thing?
Basically, I'd like to be able to have the main column say "Rations" or whatever and then another column with quantity that can be easily added to or subtracted from.
Even better if someone can tell me how to format a macro or button or whatever to automatically subtract certain items (like rations) when clicked. E.g., a player clicks a label button titled "rest" and it subtracts a ration.
Okay, figured out the quantity thing by just putting:
${item.'item component name'}$ in the label of a new column and making sure the item sheet has a number field for quantity on it.
Still struggling to auto subtract though.
Basically, I think I'm trying to use a script or macro to change the number field on the item's sheet. Not sure that's possible though
none of them have what i asked help for, i'm out of that shit, weeks i'm seaching, asking and nothing, i'm just going to ask for a refund of the vtt at this point
setPropertyInEntity() should do it
Sry for this experience but you always asked me at a pretty much unfitting time for me (probably because of timezone shifts) and the questions you asked need quite a bit of time to answer in full detail (and I tend to forget stuff when it's a few hours ago). Just understand that CSB and Foundry is a private hobby and not a commercial job, so everything falls under personal free time (which is limited).
I'm missing something here. I don't really know what I'm doing with CSS or Java. Just kind of reading, copy/pasting, and tinkering till stuff works.
But yeah, I can this to put out a chat message with the correct result, but I can't get it to actually edit the item sheet.
e.g.
${setPropertyInEntity('item', 'rations', "item.quantity - 1")}$
I tried using %{ }% like it suggests for scripts, but nothing happens.
Thanks for answering the questions here. I know you attempt to help when you can and no one shows you the respect you deserve. This is a hobby for most of us. So again thank you from all of us for your assistance.
Indeed, gratitude is very much in order. I'm glad to get any guidance, even if I end up too dense to make it work
I am sorry your having issues and as a community we are happy to help as much as we can. If your frustrated that no one is answering you its because this is not a job, its a hobby and the ability to even use this to create your own design without fully coding it in js or css is a benefit. Please continue to ask youe questions but know they are answered as a community and not always the right approach depending on what your doing. I am not an expert but would like to help if you need it. Please ask again.
Okay, I can create a workaround by just putting a label and number field directly on the character sheet and then using setPropertyInEntity()
That's fine as long as I only want to subtract a single kind of item and one that is universally used by all characters. The example given at gitlab of subtracting ammunition is totally lost on me. Also, that example seems to refer only to clicking a label within the item container. I was looking to be able to use a label with chat message macro (script?) somewhere else on the sheet that then edits a specific item's quantity in it's container.
I'd like to figure out the quickest way to automate subtracting various items in response to other actions throughout the sheet, if anyone has a relatively simple way of doing that?
It gets a bit more complex because you have to fetch the right items from the actor and that is only doable via Script-Expressions: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Script-for-updating-multiple-Items
Hi. Sorry I am sure this has been covered somewhere, but I find it difficult to search here correctly. Anyway.... I have a label roll message that calls a macro to roll dice and output to chat. This is all working fine. There is a variable in the macro that I need to pull out and reuse as part of the roll expression so I can add skill value and other mods. I cannot figure out how to get this to work. Is there someone that can possibly help?
I already asked for the refund but to give you an idea of what i was asking : Creating items sheet ( making it non modifiable, good looking and linked to the classes of the characters ),
token and map sizes ( a chair is like 1m large and the character very small and can't center it on those) and character sheet design.
Can't get stats connected between tabs
All that is doable, css and js can be used for pretty much everything. There are sample templetes that you can used or create your own. I used a sample templete to begin with to learn how things are done.
Items templates normally are static sheets that push vaules to the main sheet. You just have to tell it what field its mapped to.
Tokens and maps all follow foundry default. None of that is controlled by csb.
I tend to use helper cells for some things, hidden sheet eith values that calculate the value but each field created can have a key which then can be used as a reference.
Without more context, issues your having this is the best i can provide as a high level overview.
I assume your trying to use csb because you would like to create your own system. If this is the case then nothing will be polished out of the box.
Can you give me more context? You can add skill vaules to rolls and modifers by either using the reference key or by doing it manually.
Thanks for replying. I have a macro it generates a dice roll. The macro contains a variable diceRoll. I need to use this variable outside the macro to add other variables such as a skill. I can add variables, but i can not get the variable diceRoll from the macro to use it.
The label roll message contains %{return await game.macros.getName('D100OpenEndedTest').execute()}%. This activates the macro correctly, but at the moment the variable diceRoll cannot be reused
In this use case i believe you would need to update a cell somewhere else on the sheet. And then use that cell as a reference point.
Not sure but using setpropertyinentity might work for you.
https://gitlab.com/custom-system-builder/custom-system-builder#4211-setpropertyinentity
Ok. Thanks. I will look into these options.
No worries bud, let me know if it works.
Thanks Martin!
Also think you could do it via js by capturing the variable but... go with the above lol
To make a resume of what i asked for because it seems like you didn't check my precedent messages : 1 connected stats of the stats tab to the one in the summary.
2 : just make a item sheet that player can't modify.
3 : have item damages connected to the character race.
Spoiler : i didn't even had a proper character sheet after 3 weeks working daily on it
- I need more information for that one. Do you mean stats between different Tabs of the Tab-Component? It shouldn't make any difference in calculations if stats are within the same Tab or not.
- You cannot directly do that, but there is a little workaround. First, you need Input-Components for the GM. This should be only visible to the GM. Then you create a Label, which references the stats of that Component. You cannot really hide this Label from the GM, but at least the Players will not be able to modify the stats.
- You can use the function
fetchFromActor('attached', "formula/key")for that case: https://gitlab.com/custom-system-builder/custom-system-builder/#4210-fetchfromactor
Can you call fetchFromDynamicTable() from within a text field column display of that same dynamic table?
It has to be a Label (or something that allows formulas), but yeah
Okay, this was a text field that tried to have a formula in it
and I keep getting Error
Text Field is only an Input Component, it cannot handle calculations
context 😅
I think it's my macro causing problems with some characters I may need to 'escape'.
Sorry for the confusion
Is there a string 'exact' match comparison operator that can be used with fetchFromDynamicTable calls?
Example, I have a dynamic table with a Title column that contains the following two rows (There are other columns but not important for this):
extra_is_selected extra_title extra_cost
X Range 10
X Increased Range 20```
This ```fetchFromDynamicTable('extras_selection', 'extra_title', 'extra_is_selected', true, '===', 'extra_title', 'Range', '===')``` returns
Range,Increased Range
But I only want "Range" returned. Is that possible?
Huh, shouldn't that be an exact match? Otherwise it's a bug 😅
Hello, I want to create a confirm dialog for a label roll (no other input, only confirm or close).
The best I could do is this. With a userInputTemplate
How to remove "sleep_message" from the chat message. I know with ${! }$ I can hide formula but "sleep_message" is still written, and with "throw Done" I remove everything but I want the message about hp 😖
Wait, fetchFrom() only allows max. 5 input parameters
Hello, working on trying to understand items and item containers. I configured item modifiers in an item template, but these modifiers don't seem to be inherited in items created with the template. Is this the expected behavior? I'm having to input item modifiers in each item created or switched to the template.
They apply but you won't see them in the Item Modifier Configuration of the concrete Item
I see! Thank you.
But, how can i keep track of the modifiers. Or, what if i want to change a modifier for a particular instance of an item?
Thanks Martin, will give it a go.
so how do i make a thing in a dynamic table not visible when a checkmark of the same row is checked, and make it so no other rows are affected. @formal goblet
Morning everyone. Is there any way to limit the number of items in an Item Container?
Nope
Not possible currently due to a bug
I feared so. Thanks anyway 👌
- Item Template Modifiers: Should be used if the modifiers should be applied for a whole category of Items (e.g. modifier
Weightfor Inventory-Items) - Item Modifiers: Should be used if the modifier should be applied only for a concrete Item (e.g. a legendary sword, which boosts your
Strength)
Sorry if this seems like a dumb question is it possible to use visual effects add ons with custom system builder?
It depends how it works
Was thinking you click the dice button and it places the spell down onto target or target area?
This kind of thing must probably be triggered via Script-Expressions for every effect. But should be generally possible.
Awesome thanks I'll look into it
I am using it this way. Have the visual effect set up in a macro and calling the macro via a roll message.
But I separated the dice roll from visual effect, so GM can first decide if the roll was a hit. Then the player can start the effect via the label alternative roll message (SHIFT+Click).
Thank you, I will take your advice. For now, I've found that if I want to create a whole bunch of items that have the same type of modifier (eg "weight") then, rather than creating new items from the template (which does not confer the modifier), I can just duplicate an item and write over it. The modifier is created on the new duplicate.\
@lyric swan
After implementing your solution in most containers of my whole sheets, I had to recognise that the drag and drop is not working for players, only for GM. I was so excited that I had forgotten to test this. Is there some setting that I have missed?
Also there is a strange interaction between your script an item piles.
Item piles offers a solution with allows to drop items from character sheet onto the canvas.
For containers which are connected to your script this function of item piles is not working anymore for players, while containers without connection to the script work with item piles like intended.
As GM there is no such problem.
Can Just do the hit check also in the macro so you dont have to click
In a label roll I have this script :
`%{
async function updatePA() {
let message = "";
[... code to edit message ...]
let chatData = {user : game.user._id,content : message,};
ChatMessage.create(chatData,{});
}
updatePA();
}%`
In the chat how the show the Actor instead of User ? I think chatData should have ",speaker : [???]," but can't a correct value for it
Thx working code is :
`let chatData = {user : game.user._id, speaker : {actor:entity.entity}, content : message,};
ChatMessage.create(chatData,{});`
That's normal, I was using this script to handle a skill list. So I wanted to make it impossible for players to reorganize it nor drop a skill on the canvas 😅 .
i'll post a version without that you want
Here is a version where I commented the GM only section, allowing players to drag n drop items in the container too. About the canvas droping with item pile, this code does not prevent this to happen (it's on an other code thar I use), I just tested it with only this script and you can drop it on the canvas so you must have some other script that is interfering with this one.
Thank you very much.
This also solved the problem with item piles.
You made my life much easier with this.
I'm not the one doing this, I'm using AI, so thanks GPT 4 lmao
How do I make a roll be gm only? ${[gm1d20]}$?
Hello, Im trying to wrap up a sheet for Shadowdark (dont like the adv/disadv system de actual module uses), its like this right now
I'm trying to use the shift+click to roll with adv/disadv using the formula
${switchCase(adv_check,'advantage',[2d20kh]+strmod,'disadvantage',[2d20kl]+strmod)}$
is there a better way? It works, but its rolling 4 dice, I want to make it roll only 2 ...
Also: all the Gear items have a "slot" numberfield with a certain value. Its possible to sum up all the values of them and place the result value in a label at the end of Gear section?
Is it possible to show a resource bar such as HP on a character sheet as well as on the token?
I can do token resource bars ok, but would like it to show on the sheet
@formal goblet how do i make a roll formula that calls for two different values from the same roll (one of which only applicable when a checkbox is checked?), with the values being on the same row of a dynamic table (dropdowns in specific)
Yes, but only with CSS. Have a look in here:
#1154507115172466810 message
Not possible with basic CSB. Maybe with JS/macro. But I am not sure.
worked like a charm, thanks!
Doing a follow up: I want to make some items as "free to carry", that means weight = 0. I've added a checkbox to the item template , but I can't figure out out to do after that. Could someone help me? (I'm not a programmer)
You mean that the checkbox sets item.weight=0?
no problem at all, but it's pretty "hacky" it only works on fixed size and such. Argh, character count limitation its on the file below. I'm using the Custom Css module during the creation to speed things up. But keeping the files on a module folder for later distribution:
@turbid sphinx
exactly this @fierce harbor . But I dont have the faintest idea on how and where to setup
There is the exact code you need in this thread, but shoot me if I remember where 😅
It is also very hard for me to search for it on my mobile, so if you do not mind you can search yourself...please bear with me 🤷🏻♂️
I think I found the post, just needed to invert the order, worked perfectly. Thanks for point it out! The original is like this, from here #1037072885044477962 message
Prio: 1
Key: totalWeight
Operator: +
Formula: ${equipped ? weight : 0}$
I changed the formula to: ${free_to_carry? 0: weight}$ and that was it. Thanks, @fierce harbor
You're totally welcome!
${#roll_formula:= switchCase(adv_check, 'advantage', '2d20kh', '2d20kl')}$
${[:roll_formula:] + strmod}$
You need to be more specific
in this particular case how/where do I add the strmod modifier?
At the end
Thanks!
Is there a way to make a token default to have vision enabled?
You can hide the whole Label from players or the whole Label Roll Message (via Chat-Options), but not specific parts of it.
ok... this one has to be a dumb question... is there any tutorial on how to format/create chatmessages cards for the rolls? Or the correct way is to do it with macros and call them?
It's just plain HTML and CSS 😅
Hello everyone, do you know if it is possible to update a character property with JS without using return? I have this code block for an Errant hack and the issue i have is with the 3rd to last line, the property (entity.system.props.SPECIAL_DIE_num) is correctly updated in the log, but doesn't get updated in the sheet.
let rollString = ${FIRST_DOCTRINE_DICE}$+"d6"
let doctrineThreshold = 5
let r = new Roll(rollString);
await r.evaluate();
game.dice3d.showForRoll(r,game.user,true);
diceResults = r.terms[0].results;
resultsArray = []
for (let i=0; i<diceResults.length; i++)
{
resultsArray.push(diceResults[i].result);
}
spentDice=0;
for (let i=0; i<resultsArray.length; i++){
if (resultsArray[i]<doctrineThreshold)
{
spentDice++
}
}
console.log("YOU BURN THIS DICE AMOUNT: "+spentDice);
entity.system.props.SPECIAL_DIE_num = entity.system.props.SPECIAL_DIE_num - spentDice;
console.log(entity.system.props.SPECIAL_DIE_num)
return r.total
To add on this, the property entity.system.props.SPECIAL_DIE_num is the value of a number field
been tinkering with CSB for 3 weeks now, I never realized the wiki was different from the main documentation page FML. Thank you!
nevermind, was able to figrue something out.
hey Martin, just a quick follow-up. Am I correct in assuming that the function entity.update() is not part of CSB but is defined in the cited Macro Compendium?
asking because I get this when I try to use it
Uncaught (in promise) TypeError: entity.update is not a function"
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#332-entity-linkedentity (1. Layer is instance of https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/module/documents/templateSystem.js?ref_type=heads and 2. Layer is Actor https://foundryvtt.com/api/classes/client.Actor.html)
Thank you, it works now 🙂
Guys, does anyone have a but when they open and save the "configure active effect" window on an actor sheet? When I do that (even if I don't change anything, as long as I save it happens) then I can't edit anything on the sheet definitively...?
That's new to me (and this version is running since months). Any errors in the console?
Yep, i'm getting this when i clic on any element on the sheet. When I turn off all modules, the bug does not happen anymore but i can't isolate which one, even with FTC. Still trying
Yeah, I saw that but i'm not using this one at all.
Found it : https://foundryvtt.com/packages/tokencover
This is coming from the Alternative Token Cover module
Alternative Token Cover, an Add-on Module for Foundry Virtual Tabletop
This could be problematic for people because it breaks the actor template for good
You cant still edit the active effects while the module is off and put it back on after tho
is it possible to have a table based on a variable like X = 2 and the amount of rows = X?\
No
Darn thank you either way
Is there a way to put a button or something in the final chat output that lets a player click to roll?
Like, I want them to click to display the item/ability in the chat and then be able to click a button inside that message to then make a related roll.
Not directly supported by CSB, you have to do that on your own
Ah well. I'll just have them roll from their sheets
Hey, yall! I'm trying to set the initiative formula in Game Settings, but I can't seem to figure out the right way to reference the key for an attribute on the character.
[1d20]+${key}$
[1d20] + key
Hi everyone. I'm pretty happy with were this is going, thanks for all the help.
the duplicated rolls are happening again, right now my code is like this:
${#roll_formula:= switchCase(adv_check, 'advantage', '2d20kh', '2d20kl')}$
<div class="chatRollCard">
<div class="rollMdf"><span>+</span>${dexmod}$</div>
<div class="rollResult">${[:roll_formula:]}$ </div>
<div class="rollTotal"><span class="text">Dex:</span>${[:roll_formula:] + dexmod}$</div>
</div>
any clue on how to solve?
I'm using flex: row-reverse to show the total first, then the roll, then the modifier. If anyone has any idea how to do this better you're more than welcome 🙂
nvm figured it out
@turbid sphinx & @formal goblet Thank you so very much! I was being silly and putting everything between the [ ]!
Is it possible to have more than one Condition statement in a formula and add their results together? Such as ${Key ? '2' : '0' + Key ? '+6' : '0' + etc + etc}$?
${(key1 ? 2 : 0) + (key2 ? 6 : 0) + ...}$
Brilliant! Thank you, again!
So I'm trying to make the item inside the item container play the animation and roll the dice at the same time. but copying the script for the item doesnt do the roll
Each [] will perform a roll. If you want to save the result, use <variable>:= <Formula> https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#318-additional-syntax-rules-in-label-roll-messages
Is there any way to use a component to display an image on a CSB sheet, other than the default actor image?
(not an icon...an actual image...)
Label with an img-tag?
Could you give a quick example of that code? (I suck at HTML)
img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">
Like that ^^^
would that work?
Yeah
Excellent! Thanks
not working for me with the switchCase
${#roll_result:= switchCase(adv_check, 'advantage', '2d20kh', '2d20kl')}$
dont know if I'm missing a bracket or something...
(worked for the normal roll, thanks!)
I think I got it [WRONG: STILL TWO ROLLS BECAUSE OF 2[] ]:
${#roll_A:= [2d20kh]}$
${#roll_B:= [2d20kl]}$
${#switchCase(adv_check, 'advantage', roll_A, roll_B)}$
${#modifiers:= strmod}$
<div class="chatRollCard">
<div class="rollMdf"><span>+</span>${modifiers}$</div>
<div class="rollResult">${switchCase(adv_check, 'advantage', roll_A, roll_B)}$</div>
<div class="text">${switchCase(adv_check, 'advantage', 'A: ', 'D: ')}$</div>
<div class="rollTotal"><span class="text">Str:</span>${switchCase(adv_check, 'advantage', roll_A, roll_B) + modifiers}$</div>
</div>
Hi ! for Roll A et B use 2d20 not 1d20 bécause these no choice 😉
hahahaha, of course, thanks!
You have 2 Roll Formulas [], so you'll still see 2 separate rolls
I don't see the issue so far 😅
yep still a problem, my bad. Is there a way to wrap this correctly?
I'm probably doing it wrong with the variable part, because its showing as text only:
${roll_result:= switchCase(adv_check, 'advantage', '2d20kh', '2d20kl')}$
removing de ' does not solve. I'm missing brackets or some other thing?
You're missing the second part where you resolve the text-formula
${roll_formula:= switchCase(...)}$
${roll_result:= [:roll_formula:]}$
Thanks again @formal goblet , and sorry to be such a bother.
The code that works in the case someone is following my stupid ass thread of a no coder:
${#roll_formula:= switchCase(adv_check, 'advantage', '2d20kh', '2d20kl')}$
${#roll_result:= [:roll_formula:]}$
${#modifiers:= strmod}$
<div class="chatRollCard">
<div class="rollTotal"><span class="text">Str:</span>${roll_result + modifiers}$</div>
<div class="rollResult"><span>${switchCase(adv_check, 'advantage', 'A: ', 'D: ')}$</span>${roll_result}$</div>
<div class="rollMdf"><span>+</span>${modifiers}$</div>
</div>
Stop asking " more info " i already gave you everything
I can see your frustrated trying to get things setup and I am sorry. I wanted to see if I might be able to provide suggestions on what you are trying to accomplish. However the sheet image posted has no supporting text to provide clarification of your needs and the question you asked about the summary (referenced) also isnt clear. By summary, do you mean a page that shows uneditable stats that reference the information shown in the image posted or something else?
Sorry. This is getting longer then I intended. I have found that, when seeking answers, I frequently need to provide additional supporting information to get help in doing things. In my seeking to build a proper sheet, I have been given the answer, multiple times, of "you can't do that". Which usually means that it requires javascript so I started learning that. I have also had questions completely unanswered. Everyone here is helpful, but its all a volunteer endeavor for them and they are busy and most of us are amateurs; sometimes things get missed plus some of my questions have been rather unusual.
Its also taken me 3 rebuilds and about 5 months to get a proper sheet, as I found my self going down the wrong path. I am almost finished (I hope). It has tons of javascript and I can drop items on to items, theres a macro to simultaneously create actors/items and assign templates, newly created actors auto attach skills (which are items). Items now supply text data (only number data is native) to the actor. Dropping race (also items) auto assign abilities (items), talents (items) sort to containers based on previously existing talents, dropping careers (item) on actors spawns popups asking player input, actors can be dropped on vehicles, custom dice roller, a macro to fix the unique quirk, and player claimable combat slots. None of this I had any clue how to due when I started down this path. You will get there, it just takes take time and patience.
Hello everyone and thank's already to all of you !
I've a question more about the structure than the code itself. How do you organize your formula to gather multiple variables ? I mean, if you have a formula that gather multiple component into it (for example, charisma will gather your number of points, but also some feature of you race, maybe some modifier given by item...) how do you calculate it ? I'm currently doing cascade 'switchcase' but this is terrible to read... I'm not a programmer so I'm struggling with it. Good luck everyone and happy play!
I'm using special table which created in specific NPC. And instead of switch doing
call
${fetchFromActor('ServiceUser',"fetchFromDynamicTable('attribute_data', 'attribute_rank','attribute_level','${STR}$')")}$
with filtering by my value - in example it's **STR ** attribute.
It highly depends what you're actually calculating... The switchCase()-function in general serves as a multi-mapper, where a specific key is mapped to a specific value (more or less like a Lookup Table). Like mentioned above, one alternative to using this function is to actually have a Lookup Table, on which you're performing lookup operations (fetchFromDynamicTable()). This scales great with 1 to 1-mappings (each key has one value), but not with n to 1-mappings (data-ranges, where multiple keys correspond to the same value).
PS: I'll implement a solution for the later case for the next update (similar to VLOOKUP() in Google Sheets)
Is there a way to increment damage?
${sameRow('weapons_name')}$ Damage: ${[:sameRow('weapons_damage'):]}$
For instance the above roll will display the field in weapons name, "Damage:" and then roll the value in weapons damage which is typically something like 1d12 and it displays that for me.
What I'd like is to be able to do something like roll a d12 5 time but roll the dice one at a time and add them to the previous value. So 1d12, +1d12, +1d12, etc instead of 1d12, 2d12, 3d12, etc
Is this possible in the custom system?
Not really. You can either have one single roll per Label Roll Message (so every Roll would create its own message) or you roll these all at once, but stored in separate variables:
${roll1:= [1d12]}$
${roll2:= [1d12]}$
Sum: ${roll1 + roll2}$
How do you set variables? I'm a bit new to this and I read the wiki but I might have missed the variable section.
Ah, thanks!
I've done this. Before "=" is the key of the label. The table gather everything but modifier are add manually in the table. "Nom" is just a text field to remember what is the modifier, "Bonus" is the modifier (numberfield) and Actif is a checkbox.
Last line is a numberfield for fast and temporary modifier, in combat for example.
Is there a way to use single quotes in item names without having to include an escape within same name: Goa'uld Baster vs Goa\\'uld Baster
This is a template I duplicate for every variables, for example I use it like this
Hello, I've got another quick question. Is there a way to decrement a different field when clicking a rollable filed?
I have weapons_ammo which is a number field that stores how many shots we have left
I have Label weapon_tohit that runs the following message roll
<br>
AC: ${[1d10] - (sameRow('weapons_ac_mod'))}$
<br>
Body part: ${[#Body_Chart]}$
<br>```
Could I add something like "{sameRow('weapons_ammo)-1} or something?
That would just print out the value in the chat. It wouldn't actually change the data, right?
Hmm, I've looked through this but I'm not sure what section has the information I'm looking for.
the link has already the right section 😅
Okay, maybe I really am that dense. Is it linking to the 4.5 Scripts section? I'm still not entirely sure how to go about modifying the value of a different field. Sorry
4.2.11
Oh weird! That was a trainwreck on my end. Thank you! I will play with this!
Is there a way to make a Dynamic Table 'permanent'? I made a Dynamic Table of all the skills in the system I use in my _template, but in my testplayer character it leaves out a lot of information. The reason I use a Dynamic Table is because in the skills section of the character sheet there is a dropdown menu with the skill names.
What is left out?
A text field with the asociated attributes to the skills
... I fixed it. I deleted my test player and recreated it, and now it's working fine
@formal goblet so how do i make it so that in an item contain it would only show a label, one with a value based on the item in question, if a checkmark within an item is checked?
Is there an issue with those?
${item.checkboxKey ? 'Checked' : 'Not checked'}$
so uh, how do i make a label of a item container fetch a number value for its label? same goes for fetching something within a text field.
Just reference the component key
so I figured I can put images in labels if I use 'rich text' do you know if there is a way to reference the portrait in a character or item?
something like "${item.item_amount}$", cuase all i got is the text 'item.item_amount'
No ref. And well, you can use HTML in Labels (and HTML has the img-tag 😅)
Ok I'll play around... would love to enter 'a shortcut' (to itself) instead of always setting up an image or link
Either you forgot the delimiters ${}$ or you added quotes around the key.
This is for the amount of ammo "${item.ammocheck ? '${item.item_ammo_amount}$' : ''}$", which for some reason is returning "undefined".
@lethal flax I use ammo in a couple of systems I built... give me few minutes while I see how I did it
${item.iquant}$
which I think you are using item_amount where I'm using iquant because I'm weird
its the amount of one item, but ya
still isn't returning a number for some reason.
oh I see you have some logic there
You don't need nested CSB-Formulas. One layer of ${}$ is enough
$ are for the whole sentence or see what Martin just posted
(so do not treat them like parenthesis but rather blocks... so you can have multiple blocks like multiple formulas in a label or roll but no need for internal ${ within an existing ${)
well now it says "item.item_ammo_amount", so clealy i have no idea what is happening now.
Now remove the quotes
now it says "'',"
Also remove the double-quotes and show the final formula
it just says "ERROR"
Formula
${item.ammocheck ? item.item_ammo_amount : ''}$, which for some reason isn't revealing the number of its number field for some reason.
Looks good so far (syntax-wise). Go to the console (F12) and show the error.
Also that is a logic statement but you could straight up just have it show the ammo
(with the drawback that it would show 0 instead of ' ' which I think you want)
Arguable
okay, i just need to delete the item and it shows stuff. For some reason it isn't showing stuff from text fields but it is showing stuff from number fields.
It should also do that, it's not limited to number fields only
If you're unfamiliar with the Formula System, check this article in full detail: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#1-introduction
Yes. If I have an item in a container with a single quote in the name, if I call a key with the item, I get strange results. ${item.skill}$ where skill == "Arcane", A is returned instead of Arcane. The same happens with linkedEntity.system.props.skill.
That would be a bug
Just kinda curious is there a better way to manage spells cause atm I have them as an item that players select from their inventory
Depends of the needs of your system.
In my system all spells use the same skill, so I don’t need separate items (big items slow down the sheet).
I just decided to give players a dynamic table so they can easier manage links to the spell description and their special effect macros.
System atm has spells that due different things like set up terrain, just damage, inflict status effects, and can cure them
But currently code wise I've just been trying to break em down into different types of spells
Roughly support (restoration), support (cure), attack, status inflictor, and aoe
But atm I'm im getting to the point some spells do both damage and status stuff so kinda stuck deciding on what to do with it
Has anyone done work on a Lamentations of the Flame Princess set up for Custom System Builder? I feel like I must be reinventing the wheel.
Hello, can anyone help me ? I'm using the Custom System Builder because I have created my own system, but I don't know how to code. I have created stats blocks for my actors and I would like to integrate them as PNG or HTML code to their sheets, how can I create such sheets ?
I have absolutely 0 experience with coding
You cannot create CSB-Sheets out of HTML or PNG-files. So you'd need to do completely new sheets.
In other words... I mean, can I have a PNG or a PDF or a HTML block when I click on an actor in the side menu ?
That would look like that
(the power of Paint)
That's how it can look like (you can download the example from here: https://gitlab.com/custom-system-builder/custom-system-builder/-/tree/develop/sheet-library/Example?ref_type=heads)
I'm gonna take a look, thank you 🤗
Ok. So if I was able to find someone to code me a quick JSON statblock template, I could use it ?
The format has to match, otherwise no
You can export the example-template to check the format
Yeah I mean if I give the template to someone, he can simplify it to work with my stats blocks and I then I can import if on Foundry ?
Well, you can freely import/export templates between different Foundry-instances
the issue of displaying my stats blocks directly on actors has been a huge problem of mine for weeks now and I cannot progress further in my game unless I have a reliable way to display and edit those blocks on the actors, instead of taking screenshots, putting them in journals and doing it again when I'm updating due to balance
I mean the core concept if CSB is to create templates and editable actor-sheets 😅 . It doesn't even need deep coding-knowledge, just some simple concepts (variables, data-types, operators and functions). That's why CSB is so popular even among non-programmers, it's pretty easy to create simple sheets.
You can find more info here:
Thank you, I'll try and look into it
Does condition lab work at all with CSB ?
ah neat, thanks
I have a dynamic table setup on my sheet that will give you an shoot action based of of another player editable dynamic table in their inventory.
So say they have gun a and gun b in their inventory with all of the data used to calculate range and damage etc. They can go to their action tab and select gun a and the sheet is setup to use that weapon's stats to roll to hit and all that good stuff. This works great!
My question is: Can I set up the defaults for the number fields to populate based off of a field in another table when the player selects a drop down option?
So if the player selects gun b, I want their "ammo" field to default to what their "maxAmmo" field is set to in the table in their inventory that has all of gun b's info.
Sorry if this is too convoluted.
TLDR: Can you use a reference command to populate a default number in a dynamic table from another dynamic table when the filterValue is a drop down selection?
Hello, I'm using this code here to update values around the character sheet. Everything works fine, but I have to reload the sheet to see the changes caused by "actor.update()" towards the end. Am I doing something wrong?
${#roll:=%{
const actor = entity.entity;
const props = entity.system.props;
const doctrineThreshold = props['FIRST_DOCTRINE_DIE_THRESHOLD'];
const fervor = props['FERVOR_SPENT'];
const startingFaithDice = props['SPECIAL_DIE_num'];
const startingFervor = props['SPECIAL_RESOURCE_num']
const doctrineDice = props['FIRST_DOCTRINE_DICE']
let spentDice = 0;
let resultsArray = []
let rollString = doctrineDice+"d6";
let r = new Roll(rollString);
await r.evaluate();
game.dice3d.showForRoll(r,game.user,true);
finalResult = r.total+fervor;
diceResults = r.terms[0].results;
for (let i=0; i<diceResults.length; i++)
{
resultsArray.push(diceResults[i].result);
}
for (let i=0; i<resultsArray.length; i++){
if (resultsArray[i]<=doctrineThreshold)
{
spentDice++
}
}
console.log("YOU BURN THIS DICE AMOUNT: "+spentDice);
props['SPECIAL_DIE_num'] = startingFaithDice - spentDice;
props['SPECIAL_RESOURCE_num'] = startingFervor - fervor;
props['FERVOR_SPENT'] = 0;
await actor.update({'System Props': props});
return finalResult;
}%}$
<p> ${[#Prima Dottrina|:roll:]}$</p>
The string in the update()-function should be system.props
even if it is declared as const at the top?
I think I got what you meant, you mean the 'System Props', right?
Yeah
gotcha, thank you Martin
Can you store a variable in a conditional clause? I tried and I kept getting an error
Proficiency: ${sameRow('proficiency') == '2' ? unblockableBase:= 9 : unblockableBase:= 20}$
I'd do that like this:
Proficiency: ${unblockableBase:=sameRow('proficiency') == '2' ? 9 : 20 }$
also the number 2 in there, do you need it as string?
It's the result of a dropdown table. I figured that was a string?
@formal goblet what is the key that stores the last viewed tab in a tabbed panel. 😳
I think it's this:
let activeKey = null;
let renderableTabs = this.contents.filter((tab) => tab.canBeRendered(entity));
try {
activeKey = game.user.getFlag(game.system.id, entity.uuid + '.' + this.templateAddress + '.activeTab');
} catch (e) {}
if (renderableTabs.filter((tab) => tab.key === activeKey).length === 0) {
activeKey = renderableTabs?.[0]?.key;
}
Perfect! That worked like a charm!
Nope
Thank you so much ! I've been able to make progress with a friend of mine !
Gotcha. I didn't think so but I thought it was worth a shot. Thank you!
Hello I have a question I have a d6 system where I want the roll message to say the number of success where success is between 4 and 6 how do I do that
${[:stat_for_mod:d6 + :stat_per_mod1:d6]}$
Actually this is my formula
Just want to add this roll message
Nobody?
You could check for success with cs, like this
${[:stat_for_mod:d6 + :stat_per_mod1:d6cs<success_threshold>]}$
Be advised: syntax to be checked 😅
Please check this link: https://foundryvtt.com/article/dice-modifiers/
The official website and community for Foundry Virtual Tabletop.
I have a master actor that holds common calculations. Is there way to force an update/recalculation without opening the actor, probably using JS.
Hey there!
Im looking for a macro, but my first step is asking if the core Foundry macro can call for CSB variables?
or will it work with the built in?
anyway im looking for a macro that does [1d20+Skill_value]=>[Target defence+mods]
Target defence, would be good if it could be a dropdown of either the tokens on the map, or the tokens in Combat
You can list all the tokens on the canvas, should be game.canvas.tokens but please check via console (it will give you soggested commands as you type). Not at my PC so cannot verify, sorry.
Thank you very much it works !
My guess would be that it's TemplateSystem#reloadTemplate(), but I'm not sure on that. https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/module/documents/templateSystem.js?ref_type=heads
You can use fetchFromActor('target', ...): https://gitlab.com/custom-system-builder/custom-system-builder#4210-fetchfromactor
Thanks!
Does anyone have an example of making an ammunition table that adds damage to a weapon based on the ammo used
So this did not work,
${[Roll_Value >= fetchFromActor('target', "Dodge") - Melee_mods ? "Hit!" : "Miss" ]}$
sight, i dont understand,
i tried to boil it down but im stuck
${fetchFromActor('target', "Dodge") + 100}$
${:fetchFromActor('target', "Dodge") :+ 100}$
Please help
Nvm, ill just make manual calculation
Question: I'm trying to predicate off of the value of a prompted drop down but I keep getting an error.
<br>
${aimBenefit=='Target'?'yes':'no'}$```
I'm able to print aimBenefit and it shows Target (if I choose that which I did for the test) but I keep getting an error for the above
Any error you are getting?
A snippet from the Example-Template:
${#Target_Defense:= fetchFromActor('target', "Defense_Value", -1)}$
${Roll:= [1d20]}$
${Target_Defense == -1 ? 'No target selected' : Roll >= Target_Defense ? 'Attack would hit' : 'Attack would miss'}$
Perfect! I'll use equaltext!
Thanks, I'll look into in when I have time again. Sorry for wasting your time
It is doing a 'includes' style match and not an exact match. Could it be a bug? (Sorry for a few days away)
Where does it state this? The format seems to show that you could filter based on different column filters? or is it just one filter per call?
So in my example it's completely ignoring the second column filter? Is there no way to have multiple column filters?
Unfortunately it can only have 1 column filter. A solution would be to use Script-Expressions, but that's a bit more complex
Hello, is this correct? The idea: to show the spell DC on chat only if the item is a spell. I have a checkbox on the item with the key isSpell:
${#spell_dc:= (10 + item.tier)}$
${#show_spell_dc:= switchCase(item.isSpell,'true',spell_dc,'')}$
A simple ternary should be enough: ${item.isSpell ? spell_dc : ''}$
Thanks @formal goblet And how should I format the text to insert it in front the spell_dc? to be like: Spell DC: spell_dc ? The text only has to appear IF the item is a spell. Its on the spell_dc variable, on the ternary? with quotes or not?
${item.isSpell ? concat('Spell DC: ', string(spell_dc)) : ''}$
thanks a lot! @formal goblet
Is there a way for an item to fetch from a dynamic table of the attached character?
It can via fetchFromActor('attached', "...")
Thanks, I'll give it a shot. I have a friend currently telling it it doesn't work so I guess I'll see in 52 seconds
${ammo}$```
Ok this is the way I've typed it, but it doesn't work
Any ideas
You need double-quotes around the 2nd arg
Just check the examples of that function: https://gitlab.com/custom-system-builder/custom-system-builder#4210-fetchfromactor
Thanks, definitely a step further into solving it. Gonna test a few more things
${ammo}$```
Am I not understanding something? From what I think I know, this should refer to the Table with key "ammo", and the value it looks at should be the "ammo_count", filtered by the "ammo_type"
But it's returning 0s to me
If I remove the ammo count it does seem to work
The 3rd arg is the filter column and the 4th arg is the filter value. If you want to filter, you need at least 4 parameters.
Oh I see! Thank you
Sorry, I'm both learning the basics to coding and also making a custom system. You and everyone else in this server have been very helpful and polite
No problemo
I can make a label so that it changes values inside a dynamic table, but how do I make one that updates a number field on the character sheet?
E.g. If i put a label that says "Heal 10 HP", how do I make it so it automatically updates the number field 'HP' with a new number 10 more than what's currently there?
I feel like this is an extreme oversight on my part, but how do I call a field value in a panel? I've been working with dynamic tables and have that down but I'm having trouble with the simpler version!
${ref(acPanel.armorName)}$
I tried this but no luck. I also tried
${ref(acPanel.0.armorName)}$
This looks amazing.
You can use setPropertyInEntity() in Label Roll Messages for that. Check the examples in the Readme
Panels don't influence data-processing at all in CSB. You can directly reference the key
Oh, yeah that makes sense
Womp! That's why I couldn't find it. Thank you!
Tried basing it on the examples given.
When I use ${setPropertyInEntity('selected', 'HP', "self.HP + 2")}$ nothing happens.
If I set it to ${setPropertyInEntity('selected', 'HP', "target.HP + 2")}$ and target the token, it works then. Why does self.HP not register inside a formula? Is there some other way to indicate the property of the current actor?
"The formula which should be calculated on the referenced actor or item. It can also just be a key. Inside Item Containers, item properties should be targeted with the item. prefix, just like in other parts of the formulas. If you need to use the properties of the target-actor, you can achieve that by using the target.-prefix."
Where does the self.-prefix come from? 😅
I don't mind adding a bit of complexity if it's possiible to do what I'd like. I have a Dynamic Table with several columns:
Selected (Check) Title (Text) Cost (Number) Notes (text)
( ) Range 1 This makes it a ranged attack
( ) Increased Range 3 This increases range by 10 per cost
So essentially I'd like to know if "Range" is selected and I also want to get the "Cost" column from "Increased Range" if it's "Selected"'
The first case is just fetchFromDynamicTable('key', 'Selected', 'Title', 'Range').
The second one is fetchFromDynamicTable('key', 'Selected', 'Title', 'Increased Range') ? fetchFromDynamicTable('key', 'Cost', 'Title', 'Increased Range') : 0
I'm not sure I'm following the second one....the first fetch() is returning the 'selected' column, should the next two be 'Title', 'Increased Range'? Why is the 'filter column' being referenced with 'Range'?
Yeah, should be Title. It's hard to review on mobile.
Are there global dynamic tables or are they only found in the assets themselves?
Thanks. So this seems to work because the 'selected' column returns true/false right? Is there a way to 'double filter' on two columns that might be text columns?
Why should there be global tables?
I'm using drop down boxes in a few different places and they reference similar things
I was hoping to not have to make the tables every time
Script-Expressions
So I can do the coding right in the Item and not go to a macro? I'll have a look!
You can create your own global actor with tables, which can be referenced by other actors.
Ah, awesome! Thank you!
I'm gonna make a module to distribute at the end, I'm just giving the finishing touches. Hope that this weekend is done
Is someone that done with css?
All of it really
Fair. I need a starting place to learn such.
This discord is awesome and the CSB project has a lot of tools that when you understand are pretty easy to have something done in no time. I can't code to save my life but this is not stopping me from moving around 🤣
I guess I (incorrectly) extrapolated that it was an option because the Readme listed things like 'self' 'selected' and 'target' as options for the entityName. When I saw that 'target.' also worked as a prefix in one of the examples, I kind of figured 'self.' and 'selected.' might work.
I couldn't think of how else to designate which actor/sheet I wanted to edit.
Of course, I just now tried to simply put the property without any prefix and that worked. So, it turns out I was making it more complicated than it needed to be.
Thanks!
Question: I have an item with a label (unkeyed), which has a label text field with a ${recalculate(%{return await ...}%)}$ call in it for a macro. The macro returns a string (with various ${variable}$ calls to display on the item The returned string is a concatenation of several other strings that I read from a dynamic table, any of which might contain single quotes (') or double quotes (") in them.
I'd like to ensure that the string I return from the macro to display maintains the right display of single and double quotes without causing an error in the sheet. I've tried doing (what I thought) was a global escape replacement of the single and double quotes with escaped versions \' and \", however, in the output display I'm seeing the backslash characters display in front of single quotes and sometimes the first instance of a quote is ignored for the escape sequence.
Am I going about this the right way?
This is my string replacement code in the macro (Posted in macro-polo for insight there too)
let newNote = dataNote.replaceAll("'","\\'").replaceAll('"', '\\"');
Just found out how easy it is to place a value bar on the sheet and because it was several times asked wanted to share with you:
More information: https://alvarotrigo.com/blog/how-to-make-a-progress-bar-in-css/#semantics---the-progress-html-element
How do you make really cool and functional progress bars for your site? Learn everything you need to know here!
Incredible!
Thanks!!
Hi. I am trying to create a formula to roll 3 dice that in the chat tells me that if there are any 6 I am successful in the roll, but I can't finish creating it because what it does is add the results. Could someone tell me how to do it?
I want something like Vaesen or Mutant Year. Each 6 is a success.
${#Target_Dodge:= fetchFromActor('target', "Dodge", -1)- Melee_mods}$
${Target_Dodge == -1 ? "No Target" : Roll_Value >= Target_Dodge ? "Träff, slå skada" : "miss"}$
It seen that it can't read the targets dodge
Any errors in the console? Or does it just say "No Target"?
First it said no target, but after moving the token and trying again it always goes for "träff"
The variable state it's -5 for some reason
Try it without melee_mods
No target
How do you target?
I have made a manual calculation now that I fill the dodge, it's just easier
Not enough, that's just selected. Press T while hovering over the token.
Oh my god
I had no idea
I've tried and didn't want to bother more as I thought I understood..
Thank-you for the help, hopefully I won't need to bother you more
Great! Thanks! 😁
Is there a guide or documentation on how to target an attribute in an item on a character's sheet? I'm trying to figure it out but haven't gotten very far.
On the same line ${item.name}$ , out of line impossible I think
It sounds like you can't? First, you cannot get values from Item Containers by referencing them
In Item Container you can with ${item.attribute}$ but not out of it
I believe you could traverse the whole data tree via JS to do that...
If we're talking about outside an Item Container, then either via Item Modifiers or Script-Expressions: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Script-for-updating-multiple-Items
If anyone is able to help with this:
#1037072885044477962 message
Hmm, okay! Thanks everyone. I'm not 100% on what that means but it's enough of a thread for me to pull on to see if I can't figure it out. Thank you!
I remember that escape is done by adding \ before quotes, double or single. Not a regex expert, so what you wrote might be the same...
I think I have the replacement part right, but when it's run through the recalculate() code, things seem to go weird. The single quotes display with the actual \ so that I get things like
the character's score in this abiity
displayed on the sheet. However, when I remove the escape code, I get the error:
SyntaxError: Property name expected after dot (char 311)
Now I'm seeing that your code is
let newNote = dataNote.replaceAll("'","\\'").replaceAll('"', '\\"');
but I think it should be
let newNote = (dataNote.replaceAll("'","\\'")).replaceAll('"', '\\"');
I think it is applying the second replaceAll to the first replaceAll, not to the modified string.
I made that update, thanks. it doesn't seeem to change the overall output.
Here is an example of the content inside a dynamic table that I want to format and display in a label.
Source content (In Dynamic Table) - 2 instances of the single quote
Allows the character to leave behind a copy of his armor; however it can't be worn by others. For appropriate quantum powers, this Extra now adds +2 to the character's physical (PDV) defense value. PDV and MDV must each be purchased as a separate Extra.
Here is what it looks like after the 'escape code' in the macro using console.warn() - Both instances have been escaped
Allows the character to leave behind a copy of his armor; however it can\'t be worn by others. For appropriate quantum powers, this Extra now adds +2 to the character\'s physical (PDV) defense value. PDV and MDV must each be purchased as a separate Extra.
And heres what it displays after being run through the recalculate() on the label - Only the first instance displays properly. The second instance displays the \ character.
Allows the character to leave behind a copy of his armor; however it can't be worn by others. For appropriate quantum powers, this Extra now adds +2 to the character\'s physical (PDV) defense value. PDV and MDV must each be purchased as a separate Extra.
So it's escaping the first one properly and displaying right but all others are displaying the .
Oh, I see.
Problem might be the period between the two sentences. I've has similar issues myself and had to remove the period.
I have many more sentences that I didn't show so removing periods isn't possible. Can I escape the periods? Would that work?
Can't say, but trying won't hurt, if you will 😅
Well that didn't do anything. I also don't think it's the period. I put two single quotes in the same sentence:
Allows the character to leave behind a copy of his armor; however it can't be worn by others and the character's armor. Used mainly for distraction purposes. Cost 1 Willpower.
And it came out
Allows the character to leave behind a copy of his armor; however it can't be worn by others and the character\'s armor. Used mainly for distraction purposes. Cost 1 Willpower.
I appreciate your help in this, but it seems like a bug or at least something wonky
Sorry for not being of any real help. I'll check on my system as soon as I can get my hands on it. I'll let you know.
Thanks!
Is there a place to see the actual recalculate() code?
Not that I know of, but I might easily have missed it.
I'm wondering if it's doing some type of .replace() code without making it a global replace
Custom functions from CSB are all here: https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/module/formulas/Formula.js?ref_type=heads#L496
Tested like this, seems to work.
So I know nothing about this code, but I saw this function in what you linked, @formal goblet
const handleTextVars = (formula, textVars = {}) => {
formula = formula.toString();
// Isolating text data, enclosed in '' inside the formula
// The (?<!\\)' part means match quotes (') which are not preceded by \
let textTokens = formula.matchAll(/(?<!\\)'.*?(?<!\\)'/g);
let textToken = textTokens.next();
while (!textToken.done) {
let textValue = textToken.value[0].substring(1, textToken.value[0].length - 1);
if (textValue.includes("'")) {
let textRef = '_computedText_' + (Object.keys(textVars).length + 1);
// Recreate apostrophes inside text + removing delimiters
textVars[textRef] = textValue.replace('\\', '');
formula = formula.replace(textToken.value[0], textRef);
}
textToken = textTokens.next();
}
return { formula, textVars };
};
I see a textValue.replace() should that perhaps be a replaceAll()?
It looks like it's doing the "remove any escape characters" but only on the first one (which is what I'm seeing in my output)
In your macro code, I see you're using only a single \ in the replaceAll(0 expression. I was told in macro-polo that it required two:
let newNote = (dataNote.replaceAll("'","\\'")).replaceAll('"', '\\"');
Dunno, I just tried that 🤷🏻♂️
If you add two \ into your macro what do you get? If you don't mind?
If I only use one \ in my replaceAll code, I get the recalculate error involving dots
This, it just adds another \.
I think that extra \ is needed for the recalculate() code to work
Atm cannot test that part, sorry 'bout that.
No problem! You've been a great help so far and I appreciate your time. I think I may have found the issue in the code @formal goblet linked above. When it does a 'remove escaped characters' it's using .replace() instead of .replaceAll() which is consistent with what I'm seeing
Do not mention it, my pleasure helping 😉
@formal goblet hi martin, i'm not sure if an earlier update already adressed this. from what i can gather from the documentation (5.2.3 & 5.2.5) it should be possible?
my question: is it possible to create an dynamic item modifier?
for example if i have a dropdown (for different skills) and a number field so i can create different modifiers with the same base item (e.g. same base item can be used to make +2 atheltics or +5 stealth item). then the item modifier key would be whatever the dropdown would be and the formula the number-field-key.
is it possible to add logic to this, so i have two modifiers (for add and subtract) and with a checkbox i can set one or the other modifier to 0 (= activate one or the other modifier --> necessary since the operator is not changeable)?
I'm not Martin but I use dynamic item modifiers. Are you asking if the key can be dynamic or the value formula be dynamic?
🙂 sure if you already use it you can help me as well
my main concern is if it is possible to use a dynamic key. the formula states clearly that it can be a formula and the value will then influence the chosen key.
so is it possible to build a key which can be used e.g. for all skillchecks? so i don't have to write 12 modifiers (for each skill 1) but can just use 1 modifier for all of them
Yep, that's the culprit
Oh! Awesome!
Just so that I can learn more...how comes it worked for me?
You didn't run your result through recalculate() on a label message
Oh well...thanks for clarifying that 😉
I use Dynamic Formulas mostly. My GM has done something like what you're asking, where he created dropdowns on the item and then created a hidden dynamic table with each skill listed as a row. I'm not sure if there's a way to make a single key that dynamic. Sorry
Sorry, the longer version is, the string with the escaped characters when you run it through Recalculate() on the CSB sheet, reverses the escape code, but was using Replace instead of ReplaceAll so it was only doing the first one.
Nothing to be sorry about, really. And thanks for adding more useful info 👍🏼
Is that a quick 'fix' or will that have to wait for a release?
The only one that can schedule releases is LinkedFluuuush, not me
Okay. I'll keep an eye out. It doesn't 'break' anything I'm doing just has ugly output. Thank you!
But you can change that manually until it's released
That sounds like something beyond my abilities I think
You just go into the system folder and change replace() to replaceAll() in Formula.js. Nothing more
You want a single key, derived from an item, to affect many statchecks? Just to better understand.
Okay can give it a try! Or actually the GM can!
Not really. It's 1 single key-value for every modifier, not a collection
for an example see this item fields i have at the moment (screenshot).
to adjust the right stat at the moment i have 234 item modifiers which have an value formula to only output a number if the appropriate thing is set (so a modifier for each stat and each row)
in a future update i would like to reduce this huge amount of item modifiers and make it dynamic so i can use one modifier to handle all the different stats
A few questions (I may be able to share how our GM did something like this)
- How many stats can the item modify at once?
- How many skills/stats is it possible to modify?
- Does each stat get changed by a single number?
Does one item instance have changeable modifiers (e.g. because of changing ingame-circumstances)? Otherwise why not using static modifiers for each item?
Let's take this as an example from TDA 5: https://dsa.ulisses-regelwiki.de/vorteil.html?vorteil=Glück+I-III
I'd create an Item Template for all Advantages (with Level, Requirements, Costs and Description as properties). And then I'd decide for each Advantage the modifiers (in this case, a static modifier, which modifies the maximum amount of chips dependent on the level of the item).
i want to "future proof" my current working system. so when i rework it it should be possible to adjust it easily so that is way there is always this "could be adjusted in the future"
- at the moment i think i have 4 stats - but i would like to be able to maybe extend that in the future
- at the moment i think i have ~43 different stats (maybe more in the future)
- mainly yes (there are exeptions but they can be handled in another way in the future
martin: no changeable modifiers is not necessary since i use active effects for such things. at the moment i have 234 instances of such modifiers (see screenshot)
Not sure this makes it any easier on you to setup, but it should make it easier to extend later. With 43 different stats it will be big...
A) Left Image: The item template has 3 dropdowns since this item can change up to 3 'stats'. It also has a dynamic table listing each of the stats, it's key, display, and values that could get changed. For this particular use, the modifier is always the same, but you could also incorporate a text field next to each ability/stat dropdown and read the value from it
B) Middle Image: This is the code on the dropdown that shows the key/labels which are the same as the stats
C) Right Image: This is the "Item modifiers" for each stat to change based upon it's selection and the dynamic table values. This is where it becomes easier to extend this later as you only need to add a new row in these tables/lists for each new stat.
The code in the "Value Formula" for one key (academics_dice) is
${((equalText(ability1, 'academics') ? recalculate(first(fetchFromDynamicTable('abilities', 'abil_dice', 'abil_key', ability1), 0)) : 0) + (equalText(ability2, 'academics') ? recalculate(first(fetchFromDynamicTable('abilities', 'abil_dice', 'abil_key', ability2), 0)) : 0) + (equalText(ability3, 'academics') ? recalculate(first(fetchFromDynamicTable('abilities', 'abil_dice', 'abil_key', ability3), 0)) : 0))}$
thank you very much - i'll dive into it 🙂
Is there a way to transfer an item from one character's item container to another character?
There's no functionality for this currently
If you have any questions I'll try to answer them
That seems way too much for an Item to be honest. All I'd list is what the Item actually modifies and not what it can modify. At least that's how I handled modifiers for Shadowrun 6 and for a homebrew system.
yeah but the goal would be to create one item which can be adjusted to be everything (esp. creating it with random stats 😮 ) 🙂
I wouldn't call it a good decision design-wise
This is for a Professional Style Item, where the character picks what their 'profession' is and it can modify 3 of the available skills. There're too many combinations to create an individual item for each profession (Since the player can basically make up anything)
Also the GM didn't want players to need to figure out the right code to put into item modifiers
Alright. If it's always 3, then why not having 3 modifiers with variable keys (selected by 3 dropdowns)?
I didn't think keys could have formulas?
They can
I think that got changed with the introduction of the Conditional Modifier List
Ah! This is an older template so might have been before that change
Will definitely keep that in mind knowing keys can have formulas though
i think this is the solution i was seeking 🙂
Hello everyone !
Does someby have found a workaround to bypass the setPropertyInEntity bug ? https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/332
Got the same issue...
This is my lines... Don't judge me, I'm a noob...
But you can reproduce it --> The Hidden_FRC for the MECA is not updated (in fact, it update, then rollback almost instantly to 0)
${(switchCase(SC_selection, 'MECA', 1, 0)) ? (setPropertyInEntity('self', 'Hidden_FRC', "Hidden_FRC + 1", 0)) : (setPropertyInEntity('self', 'Hidden_FRC', 0))}$
${(switchCase(SC_selection, 'MECA', 1, 0)) ? (setPropertyInEntity('self', 'Hidden_DEX', "Hidden_DEX + 1", 0)) : (setPropertyInEntity('self', 'Hidden_DEX', 0))}$ ```
If you use the module item piles, Yes.
Check the last caveat of Conditionals: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#315-conditions
I actually found that looking at your posts.
So far I have figured out how to make an actor a container so I can transfer from container to PC.
Is there a way to transfer from PC to container?
Thank's ! I'll try to rewrite my code then !
But, this is a new "feature" right ?
I got no issue since 11.308
You can check the changelog for that. Not really new
Alright ty for the support !
I don't want to be annoying but I think there is a problem.
I followed your advice and to be honest, since I'm note very good at programming, I decided to bypass some 'complex' formula (like thoses in your link).
I made a very simple label with this roll text
${setPropertyInEntity('self', 'Hidden_CHA', "Hidden_CHA - 1")}$```
When you roll it, the first one is working, the second isn't.
If you swap them, same, the first is working, the second isn't.
There is nothing else than that.
I'm getting wrong ?
PS : The second is working after a reload of the sheet...
Does anyone have a script for totaling weights in an item container? Or just referencing anything inside them? I know formulas can't.
The FAQ version doesn't seem to work consistently. Even when it does, I can't get it to update weights when an item's 'quantity' changes.
If I could just get a script that can pull data out of all the labels of one type within the container, I could work out the rest.
I've managed to set my first former working code to your "prevention problem double-execution" formula.
For a quick note, the 'FERO' and 'MECA' value are now in Class_Value and SC_Value, nothing too fancy.
This is what I got.
${setPropertyInEntity('self', 'Hidden_FRC', (Class_Value==2) ? "Hidden_FRC + 1" : 0)}$```
The issue is still present. Update to 1 then instantly fall back to 0.
I've got to say that I'm quit surprised by the new "limitations".
Based on the fact that this script
const itemTemplateId = game.items.getName('_rations').id; entity.items .filter(item => item.system.template === itemTemplateId) .forEach(item => { const newQuantity = Math.max(item.system.props.quantity - 1, 0); item.update({'system.props.quantity': newQuantity}); });
can manage to pull item.system.props.quantity out of each item (that matches the filter) and use it in an equation, it seems that I just need to
a) widen the filter or remove it altogether
b) get it so spit out item.system.props.quantity (or 'weight' as the case may be) into some label or something instead of simply using it in the equation and never showing it.
Just klick and hold on the item !picture! on PC, drag it over the canvas an let it drop. It will ask if you really want to drop the item and produce a new container at the place.
Also with klick and hold on the !picture! you can drag and drop an item from one PC to an other open PC, but on this way it will make a copy of the item inside the second PC.
Thats sound for me like your Class_Value is not 2.
I suggest placing a print out nearby, so you can control if the values are right.
Anyway, maybe make joust one sentence out of it:
${setPropertyInEntity('self', 'Hidden_FRC', (SC_Value + Class_Value ==3) ? "Hidden_FRC + 2" : (Class_Value ==2) ? "Hidden_FRC + 1" : (SC_Value ==1) ? "Hidden_FRC + 1" : 0)}$
It can be simplified to ${setPropertyInEntity('self', 'Hidden_FRC', "(SC_Value != 1 and Class_Value != 2) ? 0 : Hidden_FRC + (SC_Value == 1 ? 1 : 0) + (Class_Value == 2 ? 1 : 0)")}$
Btw, in which cases should it reset to 0?
And these limitations aren't new, they exist because of the external math.js-library.
hey, anyone using monks token bar module with CSB? does it (partly) work?
Hello, I may have a slight problem with item containers and dynamic tables.
How can I assign my item container only to the second line ?
Template looks like this
I did something similar but using static containers (not in a dynamic table). I had to use JS and a "dropActorSheetData" hook, to increment a counter on the item that determined which container it went in. Since you are doing a dynamic table, it gets more complicated since you would need to determine how the code knows which row it was dropped on.
The bar works for me. The rest of the module not.
Huh-huh.
I don't know how to do that sadly and I don't know how to display my items and their properties without this system...
Can I use a filter or anything ?
Even if it means using another component and changing all the items I created
Because no matter what I try, adding one item container to the sheet adds it to every item container 😦
The name "container" is irritating – you have to think about it a different way:
You do NOT ad an item to a specific container – you DO ad it to the character sheet.
And a “container” is just a window with filter possibility that shows what items are stored on the sheet.
But the filters inside the “container” can not be set with variables/formulas.
So from my viewpoint, there is no way with basic CSB to do it the way you want.
(maybe with script – I don’t know)
But why not storing your variables (Arme, Degats, Portee, Cadence) inside of the item and display/interact them via the “container”?
Example:
Mh...
I guess that could work
Can you display these stats directly on the sheet tho ?
This is a picture of the weapon sheet part of one of my players.
So yes, but without problems only inside "countainer/window".
Everything (OB, Anzahl, Range, Wo) comes from the item.
Ok
Here you can see two diverent "containers" on one sheet page.
For everything that has to be used outside of the container (ex. item weight), you need to use the item-modifiers inside the item and a label somewhere on the sheet.
Yes but only display on a label. No text field like your video
Ok, I’ll try that once I’m back on the computer
I'm gonna try and do like you did
But that doesn't work if you allow multiples of a single item.
E.g. if you have the item 'Rations' which has both 'quantity' and 'weight', then using the item-modifier to modify a label for weight only ever catches the 'weight'. If you raise 'quantity' on the item to 100, it still only registers the weight once.
You'd need players to carry multiple copies of stackable items (rations, ammo, potions, etc.) in order to accurately reflect weight
You know that Item Modifiers have access to the properties of an Item? Just do a ${quantity * weight}$ for the modifier value and you're good to go.
As Martin says.
For me quantity and weight of a single item is not interesting outside the container, but the sum of weight is. So I do the summing of quantity and weight inside the item and only send the weight_sum via itemmodifier to the character sheet.
And I even have a system for several different weight_sum stacks 😜
I have created a weapon using a panel, and I can add it as an item to my sheet. However how can I display it directly on the sheet ? Like integrate it like you did ?
Sorry, I don‘t understand.
Each of my weapons is a different item, all basing on my weapon-item template.
On the sheet template I placed a container with the template “weapon” as filter.
Then I added several labels to the container to show values from within the items.
On the player sheet I just had to drag-drop an weapon item over the container area.
Done.
It is all in the CSB description and examples.
https://gitlab.com/custom-system-builder/custom-system-builder
Can you show me an exemple of one label in the container ?
This is my quantity column (Anzahl) with possibility to add/subtract directly from within container.
Ok so if I wanna do that I still have to input some formulas...
To tell it what it should looking for – yes.
😦
If you just need a place to store values of the character’s in foundry, this can be done by just click and drag-drop.
But if you want functions, the possibilities are to high that any system can fit them all in just click/drag.
The CSB logic and formulas are much, much easier to understand than learning java and realizing your own system wishes in foundry from nothing.
It will take some time.
I am building up my system for more than a year now, and still find ways to make the live of my players and me easier.
But back in 1992 they said rolemaster is the most complicated system of the world… 🤪
It's just I have so much to display
You know nothing, John Snow.😉
I indeed know nothing
On my sheet i have 29 containers each with different filter settings.
The problem is the formulas ahah
What I’m gonna do is try and display all the things I need even if it’s not really optimal for now and when I have everything on Foundry, I can try and make things prettier / simpler.
I have delayed my work for too long…
I tried that and got NaN as a result. Let me see if I can get it to work now
Huh. It works. I must have had a typo or something before. Thanks!
This will be my makeshift solution for now
A dynamic table I have to manually fill ahah
I know there is a way to hide a result from a chat message by adding a # to the beginning of the formula. Is there a way to make the result or a part of the result visible to the GM only?
~~Idk if this is the best solution but I have two dynamic tables at the moment. One in the inventory tab where you can set all of the values, and another on the action tab that shows me only what I need to see and the buttons to roll using the data from the inventory table.
This way I can be as detailed as I want but not have the clutter on the main page. I'm looking at finding a better way but this has been a huge improvement to the clutter I had before.~~
Nevermind, I read the earlier comments and this has nothing to do with what you're talking about!
Sadly nope.
Ah, thank you!
how do i sum up a Matrix from a dynamic table?
my code is this
${fetchFromDynamicTable('Damage_taken', 'damage_mangd')}$
I get the matrix to show, but i want it to sum up to one number
I found this thread, but dont know how to use it
https://stackoverflow.com/questions/1230233/how-to-find-the-sum-of-an-array-of-numbers
Surround this with sum()
worked, Thanks!
Alright, new question:
Any way I can prevent this ? 😂
The huge gap between "Corps à Corps" and "Distance" because of "Intelligence"
Have you set "Intelligence" as right alignment?
I haven't.
Can you show the template,please?
I now have
Sure
I have set empty labels in the middle because I will eventually put things there
Put vertical Panels into each column
Will do
Indeed, that's way better 😄
Thanks !
Also is there a better way to let spaces and gaps than putting empty labels ? Pretty sure that's not a good option 😂
CSS
Is there way to set a drop-down list within a dynamic table to only allow each option to be selected once?
Like, if there are 4 options, each option can only be selected on a single row of the table rather than selecting the same thing on every row
Nope
Thought so. Just have to ask players to use common sense in their data entry
Hello everyone, Ive kind of hit a wall and I have no experience doing anything like this but ive gotten my system somewhat functioning. For player convenience Id love for Skills and stuff to automatically pull resources.
I currently have Skills set up as an item subtemplate I would love to know if theres a way to have them subtract resources when clicked. Happy to provide more information if it would help, thanks in advance 🙏
This is what the Skill/Item looks like when opened
You could set a label in your item container with the button style and put setPropertyInEntity() code in it so that item' Stamina,Mana and Other resources can be subtracted from actor's pool.
Please refere to this link for more info
https://gitlab.com/custom-system-builder/custom-system-builder#4211-setpropertyinentity
Awesome, thank you so much!
Hi guys
I basically gave up on making the system from scratch, at least for now I still don't have the knowledge.
Could you help me with the custom?
first question
basicaly level and xp. I would like to automate this, I already have the algorithm in js for this
You want to have the level set depending on XP value, do I read this correctly?
yep
`function calculateExperienceRequired(currentLevel) {
if (currentLevel <= 136) {
if (currentLevel === 1) {
return 0;
} else if (currentLevel === 2) {
return 100;
} else {
let previous = calculateExperienceRequired(currentLevel - 1);
let previousPrevious = calculateExperienceRequired(currentLevel - 2);
return previous + (previous - previousPrevious + 1000);
}
} else {
const baseExperience = 25;
const growthFactor = 1.1;
return Math.floor(baseExperience * Math.pow(growthFactor, currentLevel - 1));
}
}
const currentLevel = 5;
const experienceRequired = calculateExperienceRequired(currentLevel);
console.log(To reach level ${currentLevel}, you need ${experienceRequired} experience points.\n);
`
So xp is not the actual xp amount but what is needed for the next level?
now that I realize that the algorithm does the opposite lol
nup the amount itself and depending on that amount, its level is defined
I would have gone on the KISS path.
In the level label text
${xp<xpForLvl2?1:(xp<xpForLvl3?2:(and so on))}$
Well, you can also just use this js-code with %{}% in a Label if it's simpler for you.
being the keys, the variables?
You have (more or less global) access to the entity-object. The props are under entity.system.props
🤔 I am going to try
The string interpolation in the console.log() might be an issue because CSB uses similar delimiters for Formulas ${}$. Besides that idk, because it's hard to read because of the formatting.
`function calculateLevel(experience) {
if (experience < 1000) {
return 1;
} else if (experience < 3000) {
return 2;
} else {
let level = 3;
let previousExperience = 1000;
let currentExperience = 3000;
while (currentExperience < experience) {
let newExperience = currentExperience + (currentExperience - previousExperience + 1000);
previousExperience = currentExperience;
currentExperience = newExperience;
if (newExperience <= experience){
level++;
}
}
return level;
}
}
`
the code
I removed it and left it just returning the value
Alright, now you have a function-definition but not a call
Yep
iam back with the console.log calling the function, using key "experiencia" with parametrer
You're missing 2-3 things:
- A top-level
return - The property value for
experiencefrom the character sheet - (optional) The call to your function if you want to keep it. Otherwise remove the function-header and only work with the body
LOL
What's your component key for experience?
So you need either const exp = entity.system.props.experiencia or const exp = ${experiencia}$
Then you need a call to your function. Simply declaring it is not enough. It's like knowing how you process the values but not actually doing it.
If you're unfamiliar with the Formula System, check this article here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System
AAAAAH! you have to declare this within the algorithm
i will go check
iam going to try
BIUTIFUL
thanks very much
any way to stop this pop up from happening
I'm using "target" in the fetchFromActor command for attack rolls. The issue is that if I don't have a target selected the whole button fails to work. Is there a way to prevent this from happening and just skip that part of the csb?
The third value of the function is a fallback, which means it's the value the function 'falls back to' when all fails. You can use that as a default for no target.
It might mean there is an item that uses a template that has been deleted. If so, just remove the item, be it on an actor or just in the items section.
thats the thing I deleted the item, the template, and the inventory slot
Then you got the message?
Oh, ok. Trying to think of a reason, but hit a wall. Sorry for not being of any help.
nah it's all good thanks though
Is there a roll message to add an actor (self) to an encounter on the combat tracker and roll its initiative?
Good morning!
I have a problem regarding the creation of something. Essentially, in my system, the player has one key/main mental attribute (int, char, win) and one key/main physical attribute (str, dex, con). What is the best way to implement this?
I thought about something like checkbox, but I don't know how I would do it, would this be the best way?
in my system, attributes have their values and their modifiers as well.
Could you explain a little more? Does the player choose one of many stats?
The player must choose only one mental attribute, to be the key one (used in things like skills in the system) and one physical one
I wanted to save this information so when I called the key attribute I would go straight to the value
like the mods, or just the value
Well you could create 2 radio button groups, one named physical and one mental where the options are the key of stat labels so when one is selected you can retrieve the value/mod by ref().
https://gitlab.com/custom-system-builder/custom-system-builder#426-ref
This happens when you have an orphaned item in an actor (item with lost reference to an item template). You can delete those by creating an Item Container with no filter selected an deleting the Item showing in it.
Or by just using the radio group key. No need for ref()
I'll take a look at this radio button and try, thanks
Right 😅👍🏻
Should be doable by a Script-Expression
This or the Dropdown Component. Both are designed to select one single value.
It was like this with the Excel form
something like this?
and in value would be the key of the attribute value?
but if would like this, where would the mods be?
Yes
You can build the key via concat(), like if your mod is int_mod you can ${concat(mental,"_mod")}$.
Let me get this straight, when I want to mod the mental attribute, knowing that it already exists and the key is "atr_mod", I call the concat function, with the desired
genius
This would be the same logic as a mental.mod
I will test
Kind of, yes.
Any detail on the error? Please check the console.
You need ref() around concat(), otherwise it's just a string
True that, sorry for not saying it.
work it
no problem
sorry me for so many dumb questions rs
Questions cannot be dumb, answers can 😉
Is there any way to make my functions global, so I just call them? Is there any problem with using script instead of formula?
You can create a macro and call it via script.
No problem with either.
Yes Putting them in the world Script should make that possible
Is it possible to integrate a panel into a dynamic table so this dynamic table can spawn a fillable panel ?
Hi guys, I got some awesome guidance a few days and a link to the github to help me understand the tools a bit more. I just ran into a bit of a problem that i dont understand.
This is an item that i remade into Skills. I successfully got the item to interact with the attached actors Stamina with ${setPropertyInEntity('attached', 'STAMINA', "SCSTAM")}$
SCSTAM being the items listed cost and Stamina being the actors current Stamina amount. When I tried to edit the formula to
${setPropertyInEntity('attached', 'STAMINA', "attached.STAMINA - SCSTAM")}$
(with the intent of having the item subtract its stamina cost from the actors current stamina) but it just stops working. I cant seem to get the formula to properly pull any values from the actor sheet, even though it does interact with the actors Stamina. I've tried a bunch of different edits to the formula but all have failed and after a few hours of ERROR i come asking for help again 🙏 . I thought it would be as simple as something like the example setPropertyInEntity('item', 'Ammunition', "item.Ammunition - 1")
It's target.STAMINA, not attached.STAMINA
I don't guess there's a way to use the filter on fetchFromDynamicTable to automatically select the current row? Like, I want to put a label column in the dynamic table that automatically calculates its value based on a number entered in another column of that same row of the table.
E.g
Column 1 is a number field, column 2 is a label that automatically reads 'column 1's number value * 2
sameRow()
Thanks!
Is there currently a way to suppress the dice roll audio when using a label roll message?
I think that's Foundry default
There might be a setting to lower the audio, but idk
I see, I'll hunt around. Ultimately I'm 'misusing' the label roll message to act as a checkbox for me in an item container to set something as damaged or not. So trying to get rid of the dice roll audio that isn't necessary.
Thanks for the response 🙂
Yeah, we already tackled that one but it's not released...
🤦♂️ gdi I figured it was probably something simple i didnt understand, thank you so much.
Is there a way to apply damage to a selected token from a die roll in the chat message?
Is it possible to have a checked checkbox have a positive and negative affect? As in, give one stat +1 and another -1
That's not for the checkbox to decide 😅. The Label is the responsible Component with the logic in the Formula.
Yep! I figured it out!
Awesome! This will trigger when the label button is triggered though, right? Is there a way to have the damage display in chat as a button? Then someone can click the result to automatically decrease or increase health?
No, it will be instantly applied with the roll. This kind of deffered actor-update via onClick-event with a Button in a Chat Message is not implemented in CSB. You have to implement this behaviour by yourself.
Ah, I see! Thank you!
Is there a formula to add more than one checkbox to the same panel or radio button (like in vampire the masquerade) and when selecting them subtract dice from a roll?
Example: Normally you roll 4 dice, but if you are wounded 1 you would roll 3
Yes. As you said, create a radio button group where each button has the desired malus, then in the roll message you can use conditional to modify the roll as needed.
Like this:
Radio button group
Label: Wounded (1)
Group: roll_malus
Value: 1
Label: Wounded (2)
Group: roll_malus
Value: 2
and so on.
Roll message
${roll_malus==1?[:dicePool-1:d6]:(roll_malus==2?[:dicePool-2:d6]:(...))}$
and in the innermost conditional you'll put the unmodified roll [:dicePool:d6].
Please always refer to CSB doc or wiki.
https://gitlab.com/custom-system-builder/custom-system-builder#36-radio-buttons
and how can I create radio button groups?
Sorry for the questions, but I'm very new to this.
Thats actually is in the Link TorlanStein provided:
Group : The group of radio buttons this button belongs to. Only one radio button of this group can be selected at a time. The group is also the key to use in Formulas. Mandatory - will not save otherwise
Sorry for not answering, but I'm busy at work.
no problem. This is a great help for me.
I already have a formula for the rolls. To add this do I need to put "if" or something else?
mi formula es "${[:fortaleza_field:d6cs=6<success_threshold>]}$"
Correct formula is:
${[:fortaleza_field:d6cs=6]}$
<success_threshold> was just a placeholder.
Ok ok. An I need to add the formula "${roll_malus==1?[:dicePool-1:d6]:(roll_malus==2?[:dicePool-2:d6]:(...))}$" to substract a dice from the pool?
In that formula, if I read correctly, dicePool is fortaleza.
${[:dicePool:-:roll_malus:d6cs=6]}$ should be more efficient
Is it possible to have a dice roll grab the number of dice it needs from another component key? In this case a number and type of dice needed for a damage roll:
Thank you. I've tried ${[:weapon_damage:]}$ but I get this error. weapon_damage in the item container pulls from item.weapon_damage to display the number of dice required. I'm assuming I've missed a step or what I want to do isn't quite possible.
You cannot reuse values from Item Containers. So add the item.-prefix to pull directly from the item
Oh, duh, yeah that does it, thank you 
I'm trying to use a simple user input, but to no avail.
This is my code:
${total:=base+?{add:"Additional:"[number]|0}}$
Cannot get it to work. Could anyone point out what the mistake is, please?
Seems fine for me. What's the error?
These are the complete code and the error
You know that screenshots are a thing? 😅
Sorry, was on the phone and did not think of that 😅🙇🏻♂️
Remove the whitespace left from := next to totalCost
Thank you so very much, just saved my brain from exploding! Much appreciated!
I add this formula ${[:dice_pool:d6cs:-:wounds:d6cs=6]}$ , but when roll does not subtract the dice.
Example: atack roll 5 dices, but the character is wounded 1, the he must roll 4 dices
It is (:dice_pool:-:wounds:)d6cs=6 I think
Sorry for the inconvenience, but I'm quite new to this and I've gotten myself into a big mess xD
No problem, we are all in a big mess 😅
Hi, i'm using foundry for first time; specifically using Custom System Builder, I want to put this dice visual directly on the chat. Is there a way to do this?
Chatting to follow this thread for good instead of manually opening this again later
does CSB by any chance have premade character template to tinker about? i think i do better learning by taking an example apart rather than building it from scratch
🥲
I want the chat message to show any individual or grupal dices. Is there a way to do this?
Not with Label Roll Messages atm
If I was to create a dynamic table, could i use it to generate panels when clicking the + button on a sheet ?
You mean Panels as Sub-Components of a Dynamic Table. Not really. I know of a case where someone fiddled with the JSON of the template and it kinda worked, but that's not the standard.
Ok !
Yeah I was looking at a way for the sheet user to quickly spawn more panels for my inventory system.
(sorry for the not so good english, not a native speakers)
Hello, i'm new to coding and CSB so i struggle a lot :
How can i display a text from a character sheet in a roll ?
For example i have :
${chara_name}$
${'fait un jet de Force de'}$
${[:chara_stat_force:]}$
Which works but separate the message into 3 small box (see my screenshot)
But if i want to put the character name, like this for example :
${chara_name}{'fait un jet de Force de'}$
${[:chara_stat_force:]}$
or without the second {}
Then the dice still rolls but the rest get me a ERROR message in tchat :/
Also, i don't understand how the math.js related stuff works, i try this to test : (it's the base example, i just changed it for my stat key)
${floor((chara_stat_force - 10) / 2)}$
And it does nothing, not even have a ERROR :/
(i forget that the error consol was a think, didn't help much >.>)
Should be ${concat(chara_name, 'fait un jet de Force de')}$. The last part seems fine for me though.
Welcome
If you want ${floor((chara_stat_force - 10) / 2)}$ get rolled, you just have to place it in [ ] again.
${[floor((chara_stat_force - 10) / 2)]}$
Thank you ! It works !
One think however :
How can i put a space between the name and the following phrases ?
I manage to ''cheat'' by putting a ,
but it's not very good :/
${concat(chara_name, ', fait un jet de Force de')}$
${[:chara_stat_force:]}$
Also i guess it's impossible to have the roll inside the message box because it's either a text without calcul or a number with calcul / roll right ?
hi, i need a custom chat that show dices when rolled directly, each one separated (d6)
i need my own Script with a custom Chat-Message.
only i dont know how to do ito r even start
${ (kom == "str" ? "**" : (kdm == "str" ? "*" : "")) }$
Why is this generating an ERROR?
kom and kdm are Dropdown fields.
How can i put a space between the name and the following phrases ?
Basically a simple SPACE should do it: ' fait
Otherwise use a HTML non-breaking space < > so: '< >fait
Also i guess it's impossible to have the roll inside the message box
I am not absolutely sure about this, but maybe just hide the boxes will fill your needs?
${!concat(chara_name, '< >fait un jet de Force de')}$
${![:chara_stat_force:]}$
Just place a printout of your variables beside:
${kom}$ ${str}$
What are they showing?
${ kom }$ is showing str
${ str }$ won't show anything as I haven't defined that variable
Thanks, it works, the ''< >'' shoulnd't be put in (work without it and if put, it show < >
for the ! in the start it do wierd stuff :
Thanks again, i'm good with this formula (until i need to calculate and try to automatise the hp bar and dmg calculation but that's for another time ^^'
basically anywhere I try to use a variable name in a formula, it's displaying ERROR or the name of the variable rather than the variable's value. Except in this simple case where I told it to show just ${ kom }$.
You need to use equalText() to compare strings:
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#314-functions
ah, thanks ... that got one field on my sheet working. But still not the nested ternary that's supposed to return ** or * or empty string.
got it, was missing a )
You can use the result of the roll directly in the text. For example:
${#damage:= [1d20]}$
${concat('You deal ', string(damage), ' damage!')}$
"rollMessage": "<br>\nAtributo: ${(Stat1)}$\n<br>\n<br>\nTirada: ${[:StatFull1:d6]}$",
This is the atribute in the json of one charactet sheet i have
how can i display the vallue of every rolled dices in the chat?(separated each one)
this is the character sheetç
Oh nice, it works perfectly, but how can i hide the first value ?
i try to put a ! before the # or after the := but it didn't work :/
It's already hidden (dashed lines), but one of your settings is letting it show regardless.
got it, it was the option on show hidden roll
thanks !
hi, if anyone can help me retrieve the atributes rolled dices all in the chat, like; showing them all separatedly in the chat message https://cdn.discordapp.com/attachments/1037072885044477962/1209225970893197323/Asd.png?ex=65e62671&is=65d3b171&hm=5f45f791e7fc435916148282586a6dded6542759db6365c88600ff901a1ff03c&
These are the stats
https://cdn.discordapp.com/attachments/1209494836483334185/1209494881903583244/image.png?ex=65e720e3&is=65d4abe3&hm=2d07055436740328c3d5422ab478a10a345813f0e7d527a4fd8bb4a6244bf99a&
https://cdn.discordapp.com/attachments/1209498722963169280/1209500458897514516/image.png?ex=65e72614&is=65d4b114&hm=ab2784bd0ad302045463a38aec88d360a00b4562b52826ab180f398d1e9d10f3&
the character sheet is this one
i think there is the part where the message should be changed
${[:StatFull1:d6]}$
Being StatFull1 a stat, my intention is to show all the dices rolled
in that
stat
in the chat
how do i have to proceed
"key": "Tirada1",
"cssClass": "",
"role": "0",
"permission": "0",
"tooltip": "",
"visibilityFormula": "",
"label": null,
"defaultValue": null,
"size": "small",
"icon": "fa-solid fa-dice",
"value": "",
"prefix": "",
"suffix": "",
"rollMessage": "<br>\nAtributo: ${(Stat1)}$\n<br>\n<br>\nTirada: ${[:StatFull1:d6]}$",
"altRollMessage": "false",
"style": "label",
"type": "label"
},
{
"key": "STB2",
"cssClass": "",
"role": "0",
"permission": "0",
"tooltip": "",
"visibilityFormula": "",
"label": "Bonus:",
"defaultValue": "",
"size": "small",
"allowDecimal": false,
"minVal": "",
"maxVal": "",
"allowRelative": false,
"showControls": false,
"controlsStyle": "hover",
"type": "numberField"
That's an example I've found in another channel: #macro-polo message
Also check how Script-Expressions work before you try to apply this example: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#33-script-expression-
i hope im able to do it
Just be aware that you'll lose the Roll-Explanation from CSB
When I roll dice, the chat message shows me a number with the d20 icon. Is there a way to change the style of the message so that only the number appears? Thank you.
With or without the roll explanation (clickable grey box)?
I dont care. For example, if you have 2 succes in the pool dice, the message must say SUCCESS: 1
${!...}$ instead of ${...}$
and if you want without the roll explanation?
That one is already without
You sure your Roll Formula is correct then?
That is the message i got. Can i have only the one?
my formula is ${![(:pooldices:+:skill_field:-:wounds:)d6cs=6]}$
That's not the default-display of a Label Roll Message to be fair
any CSN that know a bit of macros?
i need the system to print different dice pulll ( in fact, a summarzing of two dice pools)
and maybe i need %{}% script macro
but the pp from macro pool says to ask here
I fix-it.Thank you for the help 🙂
i'm doing some thing wrong? The talent vars are working on the sheet (image). They came from the talent items. But my formula doesnt work. Should I do it in another way?
${#roll_result:= [1d20]}$
${#attribute:= switchCase(item.attribute, 'Str', 'Str: ', 'Dex','Dex: ','Con','Con: ','Int','Int: ','Wis','Wis: ','Cha','Cha: ')}$
${#att_bonus:= switchCase(item.attribute, 'Str',strmod + TalentStrBonus + item.wp_str_bonus,'Dex',dexmod + TalentDexBonus + item.wp_dex_bonus,'Con',conmod + TalentConBonus,'Int',intmod + TalentIntBonus + TalentSpellBonus,'Wis',wismod + TalentWisBonus + TalentSpellBonus,'Cha',chamod + TalentChaBonus)}$
${#roll_dmg_dice:= item.wp_damage}$
${#roll_dmg:= [:roll_dmg_dice:]}$
${#spell_dc:= (10 + item.tier)}$
<div class="chatRollCard">
<div>
<span class="rollTotal">${attribute}$<span></span>${roll_result + att_bonus}$</span>
<span class="rollResult"><i class="fa-solid fa-dice-d20 bigger"></i>${roll_result}$</span>
<span class="rollMdf"> + ${att_bonus}$</span>
</div>
</div>
<div class="rollDmg"><span class="smaller text">${item.name}$:</span><span class="bigger text">${roll_dmg + item.dmg_bonus}$</span><span class="smaller text">damage</span></div>
<div class="rollDmg"><span class="tiny text">${item.isSpell ? concat('Spell DC: ', string(spell_dc)) : ''}$</span></div>
Check the console. That one has the description of the error
TypeError: Unexpected type of argument in function addScalar (expected: number or string or boolean or BigNumber or Complex or Fraction, actual: undefined, index: 1)
I have this formula ${descripcion_text}$ to show the description of an object in an item container, is it correct?
Can you check all used keys and local variables and tell where it fails?
You need to use the item.-prefix to access values of items.
I'm using labels now, but I should be using number fields? Could be that?
It depends on the content of the Label
As I was just using to show values I've used labels for everything, but since now I'm trying to use on the formulas...
heya, by any chance, is there any function to sort dynamic tables?
if there isnt thats ok, its just a little qol thing for my players if its available
I'm working on auto-sorting
poggers!
this isnt a question i just wanna share what I've made cus I've been enjoying the flexibility so far

it started from FATE and oh boy my group ended up modding the system so much the official FATE no longer supports what we want
so my group agreed to take a campaign vacation while i work on trying to reconstruct our homebrewed FATE while also adding the systems we want

Pure numbers
Well, good luck. But you're not the only one. I've worked on my own SR-6-template, because the official system here lacked functionality, so I also had to redo everything 😅
Hahahahahhahahah I think at this point our system's a full fledged game system
It's 5+ years worth of modding
Check the used keys in the Label Roll Message from top to bottom 1 by 1 and see, where it fails first
today's last questions xD
- How can I make a roll from a skill item that is on the character sheet?
- In item container can I put a roll formula that is in an item?
- It depends from where the roll is performed
- What do you mean by that? 😅
I need a Wiki-section about scopes/context and troubleshooting...
My prayers for you to not be burnt out in the long term 🙏
Well, it's not without a reason a hobby.
And I have a feeling an Inugami is following us...
This item has a roll with the formula ${![(:dicepool:+:skills:-:wounds:)d6cs=6]}$ where the pool of dice, skills and wounds are located on the main page of the sheet of character
and the second, I mean if that previous roll, I can simplify it into a formula in an item container on the main page of the character sheet
I don't know if I've explained myself well, I'm making a big deal on my own xD
- If you want to access the values of a character from an Item, then you need to use
fetchFromActor('attached', ...). - I think a concrete example would help to understand it
Hello there! I'm trying to get drag ruler to work. I have this actor.system.props.Speed_Total in the speed attribute section. I'm having a hard time with setting up the Speed_Total attribute. The total has multiple parts added together, does it need to be in a Label or a Number field?
I can't get the speed total to add together and that value to get picked up by the ruler
When I add an Item to an Item Container, it shows up on all the sheet's Item Containers -- even the ones for which it is not a correct Item Template according to the Filter. What is happening?
never mind, figured out that I just needed to Refresh the sheet after setting the Filters
Make Speed_Total a Label Field, and put your formula in the label
I would like to have a label on the sheet open a journal entry directly (without having to send it to chat first), is this possible?
I know that it works with a Rich Text Area in "Dialog editor"-mode, but I'm unsure about the Label.
Might be doable with the right HTML-code
Thanks Martin, I will try the RTE first.
Thanks Martin, Tested ok. This will work for my needs
When you add an item such as a race, is there a way to have the player choose something such as a language from a list then add that choice to the sheet?
Thanks!
Thank you!
This formula on an item is showing a blank:
${ fetchFromActor(attached, genAttack) + miscAttackMod }$
do I need a ref() function somewhere or something?
1st parameter must be a string
ah ok, I thought that would make it look for an Actor named "attached"
You mean that a Dialog then pops up? Nope
There are special keywords: https://gitlab.com/custom-system-builder/custom-system-builder/#4210-fetchfromactor
ok
making it a string wasn't clear to me when I read that, but that's probably on me
What is the formula to display the name of an item when you roll on it? Im trying item."name"
Almost, it's without quotes 😅
it is correct <h2 style="text-align: center;"><strong>$(item.name)$</strong></h2>??
The delimiters are wrong. You need ${}$
I have a weird one. I have a rich text area that I use for the notes on the associated weapon. I'd like to only print out data if the notes aren't empty.
${equalText(weaponNotes,'0') ? '' : weaponNotes}$
This will print the notes but if the field is empty I get an error
${weaponNotes == '0'? '' : weaponNotes}$
This will give me an error if the notes aren't empty but will display a tiny box with no data if it's empty.
Any suggestions?
The second one causes a type-error (comparison of strings with ==). Try to compare with '' (empty string) instead of '0'
I tried this but I got the same issue. An error when there are notes but a tiny box when it is empty
${weaponNotes == ''? '' : weaponNotes}$
Ah, it says it cannot convert the notes to a number
So it seems like when there are notes it's character but when it's empty it's a number?
Like I said, your second one causes a type-error without equalText()
I'm not sure I follow...Sorry!
Try this one: ${weaponNotes ? weaponNotes : ''}$
Oh, that worked!
And if this is inside a Label Roll Message and you want to get rid of the box, then you need to use ! at the beginning of the Formula
Beautiful!
When I change the delimeters and make the roll, it doesn't work.
The complete formula is
<h2 style="text-align: center;"><strong>${item.roll_icon}$</strong></h2>
<p style="text-align: center; font-size: 1vw;"><strong> ${![(:habilidad1_field:+:habilidad2_field:+:bonus_talento_field:-:penalizador_talento_field:)d6cs=6]}$</strong></p>
What's the error in the console?
So I'm trying to use the example macro but it doesnt seem to fire any idea as to why?
Should be const keys = ['Health']; instead of const keys = ['Health''];
Thank you I cant believe I missed that
Uncaught (in promise) Error: Uncomputable token item
at mathInstance.SymbolNode.onUndefinedSymbol (Formula.js:853:27)
at math.js:26377:89
at math.js:24320:51
at Object.evaluate (math.js:24162:45)
at r.evaluate (math.js:24139:55)
at Formula.computeStatic (Formula.js:858:27)
at Formula.compute (Formula.js:442:21)
at processFormulas (ComputablePhrase.js:139:35)
at async ComputablePhrase.compute (ComputablePhrase.js:212:34)
at async HTMLAnchorElement.<anonymous> (Label.js:271:21)
Can it be that this Formula is outside of an Item Container?
The funny thing is that if I change {} to () the formula works but it does not show the name of the object and shows the formula in the chat as the name of the object
Because it's not a formula then
then I will write a general word for all the items or create a field to put the name of the item
You can just use ${name}$ to access the Name of the Item, if your Formula is inside an Item.
Nice. You rock 🤘
So I'm trying to make a macro pull up the players dexterity saved as "DexStat" and cant seem to make it pull that stat in the roll is this something I can actually do?
The macro usually has access to the actor-object. The data should be in there.
Otherwise take a look here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Macro-for-updating-values
Ok Thanks
Hey everyone... Hope y'all are having a good day/night.
Is there a way of changing / adding / removing from these?...
The "Core Settings Expanded"-Module can do that
Thanks Martin, wasn't even sure if I should have asked here. (smile and wave)
hello everyone, I have struck a wall in my system development. I need to display on the tokens a health bar based on thresholds (arbitrary numbers derived from a script, not straight fractions nor formulas).
Ideally, I would like to apply effects on the tokens when the thresholds are triggered.
For example, when health goes down from 10 (max) to 5 (past the "wounded" threshold) I would like the token to gain the "weakened" status effect.
Is there anyway to take care of both the issues within CSB? Do I need other modules? I was thinking about using a world script to trigger the status effect activation, but i don't know if it is feasible for multiple targets linked to the same sheet.
You have to listen to actor property changes, so that means either WorldScript or a Module, which can handle such behavior. It should work with multiple tokens, because these are either linked to an actor sheet (share the same instance) or have their own instances of the sheet.
Ok, thank you Martin. Any advice on how to develop/debug with Foundry world scripts? should I use vscode with remote directory or do you have any preferred setup?
There's a module called WorldScripter, in which you can register your own Hooks, which are registered after game-init.
A direct debugging session might be a bit tricky to set up, so idk what is the best way here. Besides that, I think #macro-polo can give you more advices, because that's related to core-foundry and not really to CSB.
gotcha, I'll check it out, many thanks 🙂
Morning guys!
Back to this question, how exactly do I do this? (the macro or world script) (I took a while because I was a little busy)
someting like this?
function is the name of macro, where is the function
.
it is a module 🤯
I'm struggling with figuring out if it works on v11
It works, even if V11 gives a warning.
Several people here (including me) using it without problem.
You have to make a compendium with title “World Scripter Macros” and place your scripts in there.
World Scripter macros are not like normal macros. "World" macros run when certain events occur. Typically, these are done with "hooks", but not always. A hook says "do something" if high level event occurs such as an item/actor is rendered, item is dropped, combat begins, etc. World scripts can be used to "enrich" actors or journals by adding or replacing text. What this means is that you don't write world macros like you write normal macros. I have used the world scripter module to all the above but I had to figure it out by searching #macro-polo alot. Martin is right, #macro-polo is a great resource for aid in creating macros. They are very helpful and knowledgable.
Can I have a column in a Dynamic Table in which the user enters a die roll formula (e.g. 3d4+5), and another column that performs whatever roll is written there?
EDIT: Figured it out!
in other words, can't you make a simple global macro for functions? since there would not be a hook but a call.
My goal was simply to have a function that could be accessed from anywhere else in the world, to save time and make everything more organized
If I use a simple prompt for an user input (Wiki 4.8.1) a dialog is shown and after I closed it with the okay button I can access all the variables used on the input dialog.
How does this work with userInputTemplates (Wiki 4.8.2)? With ${?#{AttackDialog}}$ I can open the dialog window and I can close it with the okay button too. But where and how do I have to enter the roll message that uses the values that I entered in this dialog window?
For easy developing i found triggering a macro with the world Script and then Altering the macro is a good way to work on stuff. No need to f5 all the time after you Setup your Hook right
You can but it really depends on the purpose of the macro as "simple" is relative. The entire purpose of hooks is to make things global. When a hook fires, it returns data based on the event that fired the hook. This data is usually necessary to achieve the desired outcome. I haven't followed your entire thread so I am not certain what, exactly, you are trying to do.
Can you elaborate more on how this works. How do you alter the macro and see changes w/o F5?
sure. so when developing a world script you have to reload foundry each time you make a change to it (i use desktop client --> F5 to reload). otherwise your change will not be implemented.
if you have your hook in place you can let the world script call a macro which does the job you want your world script to do. for this you can do a simple code like this (this is not optimised can be written shorter)
let macroName = "YOUR MACRO NAME";
let key = "YOUR COMPENDIUM PATH WHERE THE MACRO IS STORED" // world."compendium-name" all lowercase and blank spaces are "-" e.g. "world.test-macros"
let pack = game.packs.get(key);
let macro = (await pack.getDocuments()).find(i => (i.name === macroName));
await macro.execute();
so in essence you call await macro.execute() on a macro in your compendium. then you can open this macro in your compendium and change the executed code in there and save it. so you don't have to reload foundry each time after a change (which can take a lot of time...)
hope this helps. if there are further questions just ask.
What's wrong with this visibility formula on an userInputTemplate? If I use the same formula as text on a label it shows "true". If I remove ">0" it shows "6". Both is right, both should be true, right?
I guess it's a reference bug, which got fixed in the upcoming version. Would be my guess at least if the Label text shows the right results with the same Formula
Okay, I have to admit I don't understand the use of userInputTemplates. I have created an userInputTemplate with a number field named "usedMana" where players can add how many mana they would like to spend for a skill check. But it seems like I have no chance to use the value of "usedMana" on any roll message. If I add an roll message on the userInputTemplate I can not use the value (not working). And I cannot use "usedMana" on the roll message that has opened the userInputTemplate. What do I get wrong here?
Is there a way to create more vision modes than the default ones that I can pick here?
???
Trie the + beside "Enabled".
basically, my final go is make a function and use that function just by making the call in any other script, specifically within the form. maybe macros don't be the way for that
No, no. There is a drop down menu which I can't screenshot with detection modes. How can I add more to those, or change the current ones?
That is a basic foundry setting that got improved with the last three main version updates. I never heard or seen any setting or module that allows changing this. But I also never searched for any.
Because if I could add more, then maybe I wouldn't have to macro Night Vision Goggles in my games
This is generating an ERROR in my chat on the rolling part, even though I've greatly simplified it:
${ item.name }$ Attack: ${ roll:=[1d20] }$
OK I restarted Foundry and it works now 🧩
Your description is very vague. When you say "use that function just by making the call in any other script", does this mean you want a common function that can be called by multiple scripts? When you refer to "form", do you mean an actor or item sheet? Perhaps if you can provide a more specific example of what you are specially trying to do, such as "When an actor is opened, I want to automatically run a macro that sends information to another macro and, depending on the information sent, a second common macro is called to further process some of the sent information". The more detailed you are, the more we can help
Anybody knows what is wrong here? bwPoints is a DropDown where keys and labels are numbers from 0 to 10.
${concat('<i class=\"fa-solid fa-hat-wizard fa-2xl\"',${bwPoints==0?' style=\"color: #c0c0c0;\"></i>':'></i>'}$)}$
It just says value expected.
Too much unnecessary stuff:
<i class="fa-solid fa-hat-wizard fa-2xl" style="${!bwPoints == 0 ? 'color: #c0c0c0;' : ''}$</i>
Thanks mate, works perfectly 🙂
About the math
Okey so I am making the custom character sheets (or rather the custom template for the character sheets), and I've come to a math problem. The players have to distribute points to determine their Abilities, the abilities go from -2 to +4 and go from 1 to 1. So if a player wants to have a +3 in one of their abilities it will cost 5 points. However, going from a +3 to a +4 costs 2 points instead of 1, so "buying" a +4 would cost 7 points instead of 6. How would I write said formula so its automated within the character sheet? (I'm sorry for any grammar problems English is not my first language)
Im also sorry if i am asking too much with this
${abilityPoints + 2 + (abilityPoints == 4 ? 1 : 0)}$
Thankyou ^^
Hello everyone ! I am trying to build my own system thanks to "Custom System Builder" but I am struggling with the use of "UserInputTemplate". Does anyone is familiar with that ?
it seems we have the same kind of issue ! Did you find a way to use the UserInputTemplate since yesterday ?
Unfortunately no. I've already looked for examples, but haven't found any. I'm now using the normal dialog again and just checking the entries after the OK (the advantage of the userInputTemplate would have been that min/max values were specified and existing or non-existent options could be seen directly in the dialog).
Yes I can't agree more... I warn you if I find a way !
You usually call the UserInputTemplate from a Label Roll Message and afterwards you can use the keys from the Dialog in the same Label Roll Message. At least that's how it's supposed to work
If I call an userInputTemplate from a Label Roll Message, no other line - before and after - the call is executed. At least there is no output on the chat.
The example shows the AttackDialog and I can close it with the okay-button, but I have no reaction on the chat window at all.
What's the error in the console?
Okay, I think I found the issue here. To give my templates an easier read, I have named them like "[Dialog] Attack" or "[Item] Weapon". In terms of actors and items there was no problem with this. But it looks like the square brackets made trouble with userInputTemplates. I have changed the name from "[Dialog] Attack" to "DialogAttack" and now it fires the messages on the chat. So I will try if I have access to the values from the template too.
But I have another question to the userInputTempalte, just to be save. Can I insert a new Label with an unique Key (not used on the calling actor sheet) or do I have to have all Keys already on the actor sheet?
It can have new ones
nvm, my mistake lol
by any chance, can I make it so that a "character actor sheet" (left) is drawing variables from some sort of "global actor sheet" that stores all the global variables? for instance, the left sheet drawing default HP and MP from the right sheet
fetchFromActor() can do that
oooooh thanks!
Is the ability to have a label display the label (visible) part of a dropdown list (instead of the key) on the future list of additions/improvements?
Nope (and will probably not be because of multiple reasons). Can explain it later if you like
If it isn't possible due to how things are done, that's good enough for me. It would be very helpful for sheet design, since keys have limitations on things like spaces, etc. But I understand if it can't be done.
They actually don't share the same limitations as component keys
Fair point, but at least in our game's case, the dropdown keys will refer to (and be the same as) component keys used elsewhere on a sheet
So in the end you want nothing more than a lookup-table. Should be doable. Make a Dynamic Table and just make a standard fetchFrom() with your component keys
Hmm, that's an idea. That could be done on the actor sheet and hidden, then fetched/referred to by items. Thanks!
Sorry for this, I think I couldn't express myself properly
lets try again with an example
The question: "is there a way to have a function that can be used anywhere?"
the example, i create a function showNumber(number){ console.log(number); }
What I want to know is if there is any way in other scripts, within the form itself, whether it is an actor or an item, I can use showNumber(), without rewriting the function
Is it possible, if so, where would I put the showNumber. Made sense? (sorry for the inconvenient)
dumb question but how do i make an if statement inside a formula? I want a formula that adds a variable only if said variable is superior to a set value (in this case 0)
I tried ${(CharacterLevel * 25) + (If(cultureTotal<0, 0, cultureTotal}$ (wich obviously didn't work i tried like it was excel) and i cant find the actual way of making the formula
Not really. You can use Macros and call them from different places and use the returned results, but besides that there's currently no way to write and use own functions conveniently in CSB-Formulas. Maybe by extending math.import(), but that would require an import before the sheets are loaded: https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/module/formulas/Formula.js?ref_type=heads#L496
thankyou ^^
Kay, I will try, thanks
I think the import is better than copy and paste 30 lines of code whenever I need the function
I didn't get the import issue, but anyway
Is it possible to leave this hidden (the code)? (ignore the code please lol)
You could put it into a hidden attribute, otherwise nope
You might want to create a lookup table instead. This would be more convenient and easier to use.
attributeValue | value
...
2401 | 200
2501 | 250
2751 | 300
...
${max(fetchFromDynamicTable('table', 'value', 'attributeValue', <attributeValue>, '<='))}$
it really looks better, going to try
Hey, everything good?
I've got this ongoing dilemma on how to solve a problem with a system, let's dive in:
The system basically involves one to three rolls for tests/damage. Usually, there's an attack test roll, then a damage roll, and after that a status condition roll (poison, sleep, etc). My first question is: Can I automate it so that it only rolls when it passes a test, and then it moves on to the next one? (Example: let's say I passed the attack test, then I'd want it to roll for damage, and if necessary, roll for the status condition, all separately in an automated way). Is that possible?
For this specific example, put the following code in a macro inside the World Scripter module. i tested it by creating a button on the actor and inserting showNumber(5) into the roll message. However, I assume, perhaps wrongly, the you want to do something more complicated. Depending on what you are actually wanting to do, this may be the wrong approach:
window.showNumber = function(num) {
console.info("Your number is", num);
};```
I had a similar problem. I used the Custom CSS module and wrote some css that turns the code on the template into a small overflowing square with a lightly colored background (to easily identify these blocks) so my templates dont explode like this. The class to target is ._template ,element_or_class_name. The _template this is required to target only the template and not the actor sheet.
ash using css, it makes sense
I'm still going to test more, but thank you very much :))))
worked exactly how I wanted
funky stuff with dice
I have to make a little of a long explanation to get to the point of what I wanna do. My system is a 2d10 system, each check is made by rolling 2d10 and adding any relevant modiffiers (abilities, skills, etc) to the result. Instead of critting when you get the maximun roll possible, the dice in my sistem expolde. They explode only and only if both dice have the same result: if you roll a 2 and a 2 (ignoring the modifiers) the dice explode, so you roll an adicional set of 2d10 and add the result to your total roll for the check. Is there a way I could automice that? Theoricaly my player can check manualy when they roll in the chat, but doing so each time they make a check is a pain and they often forget. With fissical dice that aint a problem, of course, but in this vtt it is.
You might find what you need at this link, there is a specific modifier for that.
https://foundryvtt.com/article/dice-modifiers/
The official website and community for Foundry Virtual Tabletop.
When made a change to one item-template, all items that are still in the items list can be updated via “Reload all item sheets” on the template.
But this is not updating the items that are already connected/inside of an actor.
Is there any way that the GM do not have to separately open all the items on all the actors to update them to the changes made in the item template?
That is always very annoying.
Danke ^^
Not to my knowledge.
:/ there is stuff about exploding dice but none of the examples do what I'm trying. Do you know if there is a site where I can check all formulas by chance?
okey never mind I've seen the advanced dice link
okey never mind again that didn't work
i think ill ask in a different chat
I fear a formula is not enough and a macro is needed, because you need recursion.
You could try this to check each roll separately:
${#roll1:=1d10;}$
${#roll2:=1d10;}$
${roll1==roll2?<reroll>:''}$
but the <reroll> code is basically repeating the above code on and on recursively.
For macro help you can try in #macro-polo
I shall
My hope is that one off the scripting gods (wink to @formal goblet) here knows a solution.
Okey now
dumb question again
How do i make it activate a macro instead of plainly roling (now that i have a macro that rolls)?
Something like game.actors.forEach(actor => actor.items.filter(item => item.system.template == <templateId>).forEach(item => item.templateSystem.reloadTemplate())) I guess (no guarantees).
Thank you very, very much.
I will try this out.
danke
Can someone help me?
Sorry for not answering, message got lost in the chat flow 😅
I believe a macro would best suite your needs. There you could check every roll outcome and then request the next if it's the case.
With a formula you could check each roll result but then for the next roll you could not request modifiers, if any, or things like that.
It sadly leads to:
replace <templateId> 😅
Sorry, how do i get the ID?
top left of the item template sheet or game.items.getName('<templateName>').id
Ahhh…never recognised.
But if I pace the ID of the template in it still leads to:
forgot quotes?