#Custom System Builder
1 messages · Page 44 of 1
And that is 1?
yes
What about ${[:spdscorepc + spdrankmodpc:d12cs>=9]}$
that was it thank you very much
im having a rough time fiureing out how to do the following the roll for a skill. If a skill is trained then the target number is reduced by one( training is is recorderd with a chk box, but if the skill is not trained it uses the basic stat roll. This is the expression i have but its not working i feel as if im not to far off but i can find what im missing. ${[:unarmedchkpc:,1,:spdscorepc + spdrankmodpc:d12cs>=8,0,[:spdscorepc + spdrankmodpc:d12cs>=9]}$ . :unarmedchkpc is a chk box, and the others are values im useing for the rolls
${unarmedchkpc ? [:spdscorepc + spdrankmodpc:d12cs>=8] : [:spdscorepc + spdrankmodpc:d12cs>=9]}$ this is what ive worked out to but is rolling 6 d12 instead of 3 dice like the value od spdscorepc=3 and spdrankmodpc=0
the chk box seems to work for the target number change
no matter what i set my dice amount to it rolls is double if its set to a dies pool of 3 i get 6 rolled if set to 1 i get 2 dice instead.
${#target:= unarmedchkpc ? 8 : 9}$
${[:spdscorepc + spdrankmodpc:d12cs>=:target:]}$
Hi everyone, I would like some help on a matter. The point being:
- The system is xd10
- And a '1' substract a success
- I'm using the table martin did in his example to show the roll in the tchat
- And I would like it to show "critical success' If they are more '10' than '1'; and 'critical failure' if they are more '1' than '10'
thanks in advance guys 😄
thx I will look into that
I made this :
<table>
<tr>
<td>Roll</td>
<td>Force: ${[:totalf:d10sx10cs>=6df1]}$</td>
</tr>
<tr>
<td><strong> Critical Successes:</strong></td>
<td>${Critical_Successes:= [:totalf:d10sx10cs=10]}$</td>
</tr>
<tr>
<td><strong>Critical Failures: </strong></td>
<td>${Critical_Failures:= [:totalf:d10sx10cs=1]}$</td>
</tr>
<tr>
<td><strong>Result</strong></td>
<td><strong>${Critical_Successes - Critical_Failures}$</strong></td>
</tr>
</table>
but this roll me 3 time instead of once and then digress
Every [] is its own instance
so I need to supp them?
The only viable solution is a script
You simply don't have the tools in normal Formulas
The link I gave you contains basically everything you need
okkey and where do I put the script
Into the Label Roll Message surrounded with %{...}%
okkey thx a lot I will try that
If you have questions about scripts @hazy moon , https://discord.com/channels/170995199584108546/699750150674972743 is a great channel with very patient helpers. Scripts are largely javascript, so if you know that, you can likely hit the ground running.
okkey thanks!
🫸🫷
Well, in this case they won't really be able to help, because you need quite a lot from the CSB-API
Every house needs a foundation though, right @formal goblet ?
I mean, if Necro needs to make a script and doesn't even know how to declare a variable... I'm just sayin'...
don't fight for me I'm sure I need the help of both of u ♥️
In the script it say : // The key to our Label, which holds our original Label Roll Message.
// The Script assumes, that the Label is in the same Entity
const labelKey = 'phrase';
If i understand correctly I need to have a Label with my formule, and an another one with the script so that when I roll the first one the script play too?
Yep, 2 separate Labels
Your users should only trigger the Label with the Script
The other Label just acts as a Template
so If I want to set a this script for each statistic I need a lot of shadow template?
It depends. If your Roll Message looks the same but only has different values, then you can adjust the template to use generic keys and you just pass the right values from the Script. If the Roll Messages differ in structure, then yeah
same roll but not the same number of dice
then I must do a dropdown or a lot of script?
That's not an issue. You can give the script the responsibility to pass the right values to the Template.
I can go into the details, but only after work. So after around 3h
I'm having a problem where this is no longer throwing an error in the console, but it's not doing anything either, am I missing something? The intent is to have a clickable checkbox (similar to in _example) that also does a check if there are any other items readied. It works to uncheck the box in the "this item is readied" instance, but it doesn't in either of the other two instances (no items readied, other item readied)
context in comments.
? setPropertyInEntity('item', 'Readied', "false") //if readied, then intent is to unready, so set item.Readied to false
: equalText( //not readied, check the rest of the item container to see if any other items are readied. the checkbox in the item container is a pain,
first( //so using equalText(first(lookup())) as a form of text-based and() statement; armorhidReady is a text-output of item.Readied used for a formula elsewhere
lookup(
'Armor',
'armorhidReady',
'armorhidReady',
'true'
),
'false'), //if no instances of 'true' in lookup(), first() returns 'false'
"true") //equalText() output T/F if the first(lookup()) returned true
? notify('error', 'You may only ready one armor') // if true, then "You may only ready one armor
: setPropertyInEntity('item', 'Readied', "item.Readied ? 'false' : 'true'")}$ //if false, toggle selected armor to readied.```
in CSB proper I removed the tabbing, I just expanded it for debugging.
Basically the only thing you need to change in the Script is adding customProps to this call:
//...
const phrase = await entity.getCustomRoll(labelKey, {})['main'](false, {
...options,
explanation: false,
customProps: {
var1: 'test' // This will set the key 'var1' with the value 'test'
}
});
//...
This will add your own variables, which can be used by your Template-Label
It seems valid for me, so I don't know what's wrong with that
Try to log variables and verify each step. You can use the function consoleLog() for that
I'm having trouble making a label button that rolls the dice + bonus fields from an Item
in an Item displayer
${'damage_bonus' + ['damage_die']}$
i have no idea how to do this
So my item has a dropdown with a list of die sizes and a number field for a bonus
an attack is damage die + bonuses
so when I add a weapon item to the item displayer, i want to create a label button that rolls that attack and displays it in an image
I am failing at setting up this formula
Similar to the way this works (click the die to the left of the skill, get a popup for the skill modifiers, and return the card and such on the right)?
I made that based on the same sort of popup from _example; the code for that is this:
?{stat:'Attribute for roll '|STRMod,"STR"|DEXMod,"DEX"|CONMod,"CON"|INTMod,"INT"|WISMod,"WIS"|CHAMod,"CHA"},
?{modifier:'Skill Roll Modifier'[number]|0},
?{difficulty:'Difficulty of Check?'|6|8|10|12|14}
)}$
<table>
<tr>
<th>${!sameRow('Name')}$ Roll</th>
</tr>
<tr>
<td>Roll</td>
<td style="text-align: center; vertical-align: middle;">${roll:=[2d6]}$
</tr>
<tr>
<td><strong>Target:</td>
<td style="text-align: center; vertical-align: middle;"> ${!difficulty}$</td>
</tr>
<tr>
<td>Dice Mod:</td>
<td style="text-align: center; vertical-align: middle;">${!modifier}$</td>
</tr>
<tr>
<td>Stat Modifier:</td>
<td style="text-align: center; vertical-align: middle;">${!stat}$</td>
</tr>
<tr>
<td>Skill Rank:</td>
<td style="text-align: center; vertical-align: middle;">${!rank:=sameRow('Rank')}$</td>
</tr>
<tr>
<td><strong>Result</strong></td>
<td style="text-align: center; vertical-align: middle;"><strong>${result:= roll + modifier + stat +rank}$</strong></td>
</tr>
<tr>
<td><strong>${!roll == 12 ? 'Critical Success!' : roll == 2 ? 'Fumble!' : result >= difficulty ? '<br>Success!' : '<br>Fail!'}$
</tr>
</table>
However, you can't use the sameRow commands in an item container; you'll have to use the item.key references for that to pull data into the variables.
Or other keys, for like your skill or attack bonus, depending on the system you're using.
oh wow
ok, I don't need a popup, would that b simpler?
<shrug> you just eliminate the first set of ${}$ from the code there.
?{stat:'Attribute for roll '|STRMod,"STR"|DEXMod,"DEX"|CONMod,"CON"|INTMod,"INT"|WISMod,"WIS"|CHAMod,"CHA"},
?{modifier:'Skill Roll Modifier'[number]|0},
?{difficulty:'Difficulty of Check?'|6|8|10|12|14}
)}$````
this bit, right?
Yes.
lemme try this 😄
I took a quick swing at it too, since I have yet to build this for my sheet, and I guessed at your damage bonus key, but I'll spoiler it for if you want to finish your try before seeing if I made any errors.
||```//Damage Roll for GiftofGabe
<table>
<tr>
<th>${!item.name}$ Damage Roll</th>
</tr>
<tr>
<td>Damage Roll</td>
<td style="text-align: center; vertical-align: middle;">${roll:=[:item.damage_die:]}$
</tr>
<tr>
<td><strong>Damage Bonus:</td>
<td style="text-align: center; vertical-align: middle;"> ${!item.damage_bonus}$</td>
</tr>
<tr>
<td><strong>Total Damage</strong></td>
<td style="text-align: center; vertical-align: middle;"><strong>${!roll + item.damage_bonus}$</strong></td>
</tr>
</table>```||
looks like user input sheets do not update when things in them change, example: a check box always reads true, or false (based on whether set to checked or unchecked), and never changes when manually checked/unchecked.
Does this mean I cant use selections inside the user input sheet that affect other formulas also inside the user input sheet?
let me try!
nothing is happenning at all
it is the correct spot
the key name is correct too
I wonder if using a dropdown instead of flat text field is the problem
Oh, the key for the entry is what's sent to the call for it, so it's trying to parse [_1d8] instead of 1d8.
try changing your keys to the same values you have in the label column for the item.
on the item.damage_die dropdown
yep, that was it
OH OK!
wait, that won't break something else right?
for being one of the most basic values ever
do you use that key anywhere else?
Personally, I did use a text field for my damage values on weapons. After all, what happens if you have a weapon that does 3d6 damage?
But that's up to you.
works perfectly now!
well, true
but in this system, weapons don't really do that tbf
Fair enough.
thank you!
in the matter of lil icons, what is the best way of customizing the item icons?
ykw, never mind, I got it
Hello there! First, I’d like to thank everyone for all the help you’ve given me. I need a little quick help. I want to create a user input to choose between two types of reactions in my system: DODGE and BLOCK. I’d like it to have two buttons to select between these options, and when pressing a button, it should return the choice to a variable. Thanks in advance for your help!
Buttons like confirmation Buttons or Radio Buttons for the selection?
confirmation
Meh... You need a Script for that case, because we don't offer custom confirmation Buttons 😅
so what if i did it with a radio button?
Either Radio Button or Dropdown:
${#?{reaction: 'Reaction'[check]|'dodge','DODGE'|'block','BLOCK'}}$
My reaction type: ${reaction}$
thanks
Is there a way to find how a key is being altered? I have a number field getting a bonus from somewhere I can't find, anywhere. My first thought was an item with a rogue modifier in it but I can't seem to find it.
im trying to referance a drop down and from that dropdown chk to see what is selected and use the matching roll formula from another part of sheet, im doing this on an item
The item sheet, or the parent actor's sheet?
the dropdown and the roll would be on the item but the skill referanced is on the charsheet
Do you have a concrete example?
sounds like something that could be accomplished by fetchFromActor(attached, ... )
im working on another issue but yes ill will post the example in a sec
and thank you
Nope, but you can put it inside a normal Panel, which can do that
ive already made the tabbed panel can i add it to a nromal panel or will i have to redo the tabbed panel
You can drag every Component
oh thats awesome
${consoleLog(item.Readied)}$ doesn't return anything (not even a null) when executed as part of a Label Roll message, is that normal? As in I have the roll message in the image shown, and get the result in the console.. (2 is the DEXMod variable that I'm calling as a control for the experiment...)
but I know that item.Readied is generating as part of a roll message elsewhere.
because it reads as true or false in a conditional for the primary roll message on the same component label.
the roll message is being called from a component in an item container, with a valid item that has the Readied key currently set to 'false'
What you put in Roll Messages is restricted to just one "line" of stuff.
${ConsoleLog(DEXMod +" : "+ item.Readied)}$
Should give you what you're hoping for.
It's not, what he did is correct
Try out fromUuidSync(itemUuid).system.props in the console and look for Readied
Ok, I'm corrected. Sorry.
This morning I sat down, restarted Foundry, pulled up the item and the consoleLog() worked as intended without changing it. Chalk it up to mystic forces, I guess I owe a goat. I'll see if the restart fixed the problem I was having with the exclusive Ready formula next.
Hey, y'all! I want an item display table to display the description of a rich text area field but if a particular item has an empty description it shows an error
what should I do, please?
There will be the new function fallback() available with the next version, which allows to set a fallback value in case the value is undefined or null.
For now you can use this formula: ${item._item_details ? item._item_details : ''}$
Btw, your keys in your Item cannot collide with Actor keys even if they have the same name. So your _item-prefix is kinda unnecessary.
Martin, for general information, I found where my error was coming up, the whole function was always returning as case A (this item is equipped and so set item.Ready to 'false' directly, which was coming about because I was using item.Ready = 'true' ? ... : ... so I wound up converting to an equaltext() to make the comparitor work. Once the consoleLog() was working for me again (praise to the Ancient Gods, etc) it showed up with a step-by step read on the case forms, and I used a toggle function instead of a direct set on the item key.
Am I doing something wrong with the syntax on that comparison though? on my item templates, item.Ready is a check box, which I thought I understood to be a boolean, but it never seems to convert to a number at all for a simple logic statement (as in item.Ready = 'true'). Should I be using item.Ready == 1 instead? I wind up having to go about it roundwise with a equalText(string(item.Readied),"true") form instead, which seems redundant.
Also, for anyone in the community wanting to do an item comparison for an exclusive equip slot (as in "you may only equip one set of armor") here's the code I used. item.Readied is a checkbox on the item sheet, and I have an item container called 'Armor' which contains all armor sets and a column called 'armorhidReady' which is a GM-only visible field that contains ${item.Ready)}$ as a label because I needed it for a previous area of the sheet (counting number of readied or unreadied items)
${item.Readied ? setPropertyInEntity('item', 'Readied', "item.Readied ? 'false' : 'true'") : equalText(string(first(lookup('Armor', 'armorhidReady', 'armorhidReady', 'true'), 'false')), 'true') ? notify('error','You cannot ready more than one set of armor') : setPropertyInEntity('item', 'Readied', "item.Readied ? 'false' : 'true'")}$```
edit: fixed the first comparison per Martin's comments below.
It works, although I'm certain there has to be a more elegant way of doing it.
The Checkbox should return a boolean, so simply doing item.Readied ? a : b should be enough
Ah, got it. So throwing in the '=' is what's throwing it off. That'll trim the code down some, thank you!
= is an assignment-operator actually
right, so that's the reason why it was always coming up with case A when I got to logging it, because the original code was just setting that value to true.
thank you,k i'll test in a bit 🙂
Hey @formal goblet . The Custom System Builder - Example says it is for version 4.3 CSB and wont run on any earlier versions but CSB is on version 4.2 and has no updates.
That's correct, the latest version is for the upcoming version of CSB
with item displays i have 3 slots that take the same kind of item in differnt tabs of a sheet essense1, essense 2, and essense 3, when i put an item into essense 1 it also shows up in the other essense slots is there a way to fix this w/o making three copys of the items and 3 diffent templates
You configure for each Displayer a filter formula
So this what my sheet looks like essense 2 and essense 3 are set up the same way im looking for a way to filter it if something is shown in essence1, it wont be added or cant be added to essence 2 or 3, but im trying to make it so ii dont have to make 3 differnt templates for each essense to make it fit in the item displayers with out duplicating itself in the other essense displayers. How would i go about that i dont see anything that discribes this in the gitlab documentation
in the item filter formula section at the bottom you can put in a filter criteria for each container, which will only show items of the appropriate item type AND which match the filters.
So if the essence items have a defining key field that states which essence they are, you can put that in the filter field on the container.
currently i have 1 type but i want it to go in all three but 1 each currently if i put lets say the fire essence in essense 1 it also shows up in essense 2 and 3
Your system allows 3 essence slots?
can a flter do something like itf its in essense 1 it wont show up in essense 2 or 3
im making a TTRPG based on he who fights with mnonsters litrpg sseries
Ah, so you'll want 5 eventually.
No. Items are directly owned by the Actor, there's no hierarchy. Item Displayers just display the Items of the Actor
ess1 2 and 3 go off the same list of ess, but the 4 slot takes differnt ones
so ill have to copy the list 2 times to have 3 lists of essenses with diff temps even if the only diff is the number like essense temp 1. 2, 3
You don't have to copy the Template. A simple Dropdown in the Item should be enough to let you distinguish, in which Displayers they should be displayed
so this is fire essense i can add a drop down that makes it either go into ess 1,2,or 3
Yes, once it's on the character the player can change which slot it's designated as.
Or you can set the dropdown to only be visible to the GM.
and can i do it per item moved so if player 1 gets fire 1st and player 2 also takes fire but gets it as thier 3rd essense
Once it's on a character the item gains a new uuid, so yes.
sp step one would be to add a drop down to the basic template
Your players have to select manually, from which Displayer they should be displayed. But that's it
so like this for the drop down, and then set the filets to look for the dropdownkey and look what optionkey is selceted to determine what item displayer that it should show up on
Yep. Use equalText() for that
You don't need ${}$ in the filter. equalText(item.essslotdrop, 'essence1') in that case
woops.. item.essslotdrop
Dropdowns always return the key, not the Label when they're called, so you have to use the key. It becomes important if you need to call something that's selected in the dropdown later.
so i put it in like that and it broke my character sheet could not open my test character
is it throwing a console error when you try to open the character?
nothing just wont open no error just not opening when i removed the filter and reloaded it all came back
It's impossible, that there's no error when that happens. Did you actually inspect the console with F12?
What's your filter formula?
removed
And change 'essence1' to 'essense1'
yeah sorry for the comunication issues but thats how i had it, or do you mean equalText(essense1)
equalText() must have 2 parts at all times. So equalText(item.essslotdrop, 'essense1')
ok
ok it working now thank you both very much you have been lots of help
if i were to want to ref 2 diff drop downs for text, so like for power placement i ould have to do like equalText(item.essslotdrop, 'essence1' : item.key, 'key')
so 2 filter lines like , 1st line equalText(item.essslotdrop, 'essence1 2nd line equalText(item.key, 'key')
or is it not possible to do more than one filter
The whole formula must resolve to a single boolean. equalText() takes 2 strings and returns 1 boolean.
Now you want to have 2 different comparisons. But this will leave us with 2 boolean values instead of a single one. That's where a logical operator comes into play. We can use either and or or, so that our 2 booleans return only a single one.
true and true --> true
true and false --> false
true or false --> true
awsome thank you for being so patient with this old guy that stopped trying to keep up with coding stuff after visual basic 🙂
26 years ago
So you stopped when I was born? TRAITOR!
lol
and now i want to learn gotta knock the cobwebs out
not interwebs till i was a junior in HS had to get off the phone to connect
At least we can offer all different sorts of complexity level
Ah, thaaaaat time
ancient times
The most recent version of "how do I get CSB to calculate the range on the canvas for me" didn't work for me, so I spent some time playing with it and have it into a single entry that I've tested from a character sheet roll message and from an item container roll message. I was having trouble getting the outputs of the resident canvas.grid.measurePath() so I went with values I could pull through.
${#%{let controlledToken = canvas.tokens.controlled[0]; let targetToken = game.user.targets.first(); if(controlledToken && targetToken) {return;} else {ui.notifications.warn('No actor or target selected!');};}%}$
${#range:=%{ let controlledToken = canvas.tokens.controlled[0]; let tokenLoc = canvas.grid.getCenterPoint(controlledToken); let targetToken = game.user.targets.first(); let targetLoc = canvas.grid.getCenterPoint(targetToken); let attackRange = Math.round(Math.sqrt((controlledToken.x - targetToken.x)**2 + (controlledToken.y - targetToken.y)**2)/(canvas.grid.size/canvas.grid.distance)); return attackRange;}%}$
${#consoleLog(range)}$```
N00B question here. I want to use a dropdown to indicate the dice roll (i.e., a drop down might be for which dice pool is used for a certain stat) - I don't see a way to associate a dropdown to a dice roll. I may be missing something obvious though bc I have no programing skills. Help?
A lot would depend on the nature of the dice rolls and the values you want the dropdown to take.
At the simplest you could just have the drop down keys as numbers and the roll formulas as [:<dropdown key>:d6] which would roll the number of d6 indicated by the value key of the dropdown.
Quick questions. I'm going through the wiki and the Readme.md looking for a list of basic functions to modify dice rolls. I haven't found it. Specifically, how to do exploding dice (I thought I ran across a simple way to do this once on this thread) and I'm trying to figure out what "hg" does to a variable, such as "hg_str" where "str" is the numeric value of the strength attribute on a character sheet.
afaik all the regular modifiers for Foundry work inside CSB's '[ ]' indicators, with the addition of having to call :<keyname>: to use variables from outside the roller indicator. If you're looking at an example, and it's inside the [ ] format but outside ': :' you should probably look for it in the Foundry-Roll-API instead of CSB.
Thank you! That's exactly what I needed.
Hi peeps! Solved an earlier issue with rolling dice based on a dropdown by referencing a dropdown which allows for essentially advantage, disadvantage, or flat rolls. I can now make the chat box show the dice rolls, but would like it to acknowledge the level of success. In the system I'm using the values represent Bad, Good, better, best depending on the dice roll you get. Is there an easy way to do this? (I'm using a simple call to the dropdown key to roll a set number of dice. I made a few macros that do this well but have no idea how to make the maco work in the sheet. Appreciate the help for this non-developer trying to develop!
i'm working on a label (button) roll message, is there anyway to just run another macro in javascript without creating a new chat message?
wait nvm think i figured it out
Designing my first sheet and trying to learn system. I can get a dropdown to show lists from a dynamic table e.g. ${first(lookup('Attributes',
'AttributeModifier', 'Attribute', AttributeSelection))}$
What I cannot figure out how to do is get a dropdown to do the same thing on an Item Displayer. Is it possible to have a Dropdown access an item displayer in the same way it can access a dynamic table? The dropdown list has Custom, Dynamic Table and Formula options. Should I be using Formula option?
Basically, I want to be able to have a dropdown where the sheet owner can pick a weapon from their weapon inventory (Weapons Item Displayer), choose it, and then it populates the various modifiers for that weapon (damage, Penetration etc) in relevant places as key variables. I can’t figure out how to do this.
Another question: How do I make a dice roll say success or failure in the chat. Image shows the label I use to get it to roll a damage roll. What I would like to be able to do is for it to look at result of the roll, and then in the chat where it shows the roll total it also says success or failure, based on the roll e.g. If the roll result was an 8+ it would say ‘Success’ or if not would say ‘Failure’. Also, if I wanted it to have more than just the two options (e.g. less than 8 = failure, 8-9 = success, 10-11 = Critical Success, 12+ Double Critical Success), how would I do that?
if the result of the dice roll is set as 'result' you could make that happen with a comparitor chain: result >= x ? 'Best' : result >= y ? 'Better' : result >= z ? 'Good' : 'Bad' If those numbers are variable you might have to declare them on the sheet or calculate them earlier in the message.
Ok. They are not variable. Where would I put this comparitor chain? Would it go in the Label Roll message of the label that does the dice roll?
I was replying to JimmyJay's question, I'm reading yours now, FIFO 😄
Are you married to the idea of using a dropdown for it? I can definitely think of how to do it with a 'ready' status on the item and a separate item container with different column definitions.
Is that to me or Jimmy Jay? 😀
You, sorry.
and in relation to your first question.
I haven't experimented with using a dropdown that way, that would be more of a Martin answer about if you can assign the dropdown keys from the values in an item container.
I am not married to anything. At moment I have a dynamic table where the player fills in the various columns of the table for each weapon. In another part of the sheet, I have a dropdown where they choose a weapon and it takes that weapons damage modifier to apply to a damage roll.
What I want to do is to be able to have weapons as items, and then in the damage roll the player gets to pick which weapon they are using from their items, and then sheet will take the weapon damage modifier from the weapon they pick.
How the sheet goes about doing this, I have no preference for. Whatever works best - but I want the player to be able to pick the weapon they want to use from the item container so it applies the damage roll for that weapon. Hope that makes sense.
This is what I used for that sort of thing. First Image is the item container for weapons, where there's a check mark for "readied" meaning that they're prepared to use that weapon. The second is on a different combat tab, where it shows the data only for weapons that are readied. They have an attack roll and damage roll for each weapon available.
For this question it's a bit simpler. Something like this would work if you have a 'difficulty' variable declared somewhere in the message:
${!roll == 12 ? 'Critical Success!' : roll == 2 ? 'Fumble!' : result >= difficulty ? 'Success!' : 'Fail!'}$ (this assumes a 2d6 roll)
Ok, that makes sense. How did you do the 'Readied box'? When I add a checkbox to an item template it never shows up on the sheet as a checkbox, just as a true/false.
Also, how would you write the information on the Combat tab? Still very rookie at all this.
BY the way, thanks for taking time to reply to muy questions!
I cribbed the formatting from the _example sheet Martin put together. This is how it looks in my sheet:
it's a label column on an item container.
Great! Where would i put that? Would it go in same place as the Label roll message that does the role (see image)? If yes, would i need a new curly brackets line, or would I just add it to the one that does the dice roll? e.g. ${[2d6+:DamageTotalModifier: !roll == 12 ? 'Critical Success!' : roll == 2 ? 'Fumble!' : result >= difficulty ? 'Success!' : 'Fail!']}$
I would put it on another line to help keep your code formulae separate.
Another line in the same label? or would I be better to have a new label box for it?
No, just another line, one sec, I'll give you an example.
${roll:=[2d6+:DamageTotalModifier:]}$
${!roll == 12 ? 'Critical Success!' : roll == 2 ? 'Fumble!' : result >= difficulty ? 'Success!' : 'Fail!'}$```
if you take that code and put it in a label roll message box and execute it from a test sheet, you should see a box come up asking for the difficulty, then it'll roll the dice and see if the roll beat it.
You can have as many lines of separate formulae in a single message as you like, I haven't hit the limit yet.
Nah, me gone for the day 🐱
Thanks! I will experiment with it 😀
For example, this is the code I used for that attack roll on the combat tab:
${#itemName:= item.name}$
${#wpnskill:=equalText(item.Type,'Melee') ? first(lookup('SkillTable', 'Rank', 'Name', 'Melee')) : first(lookup('SkillTable', 'Rank', 'Name', 'Shoot'))}$
${#wpnAttr:=equalText(item.AtkAttr, 'STR') ? STRMod : equalText(item.AtkAttr, 'DEX') ? DEXMod : STRMod >= DEXMod ? STRMod : DEXMod}$
${#wpnRange:=%{ let controlledToken = canvas.tokens.controlled[0]; let tokenLoc = canvas.grid.getCenterPoint(controlledToken); let targetToken = game.user.targets.first(); let targetLoc = canvas.grid.getCenterPoint(targetToken); let attackRange = Math.round(Math.sqrt((controlledToken.x - targetToken.x)**2 + (controlledToken.y - targetToken.y)**2)/(canvas.grid.size/canvas.grid.distance)); return attackRange;}%}$
${#rangeBand:=wpnRange <= item.RngSht ? 'Short' : wpnRange <= item.RngExt ? 'Extreme' : 'Out of'}$
${#rangeMod:=equalText(rangeBand,"Short") ? 0 : equalText(rangeBand, "Extreme") ? -2 : -99}$
${#wpnAtkBonus:=equalText(item.Type,'Melee') ? mwak : rwak}$
${#?{atkMod:'Attack Modifiers?'[number]|0}}$
${#tgtDef:=fetchFromActor('target',equalText(item.Type,'Melee')?'MAC':'RAC')}$
${#tgtTTarg:=fetchFromActor('target','TTarg')}$
<tr><th>Attack with</th><th>${!item.name}$</th></tr>
<tr><td>Range:</td><td>${!rangeBand}$(${!rangeMod}$)</td></tr>
<tr><td>Attack Bonus:</td><td>${!wpnskill + wpnAtkBonus}$</td></tr>
<tr><td>Modifiers:</td><td>${!atkMod}$</td></tr>
<tr><td>Roll</td><td>${dRoll:= [1d20]}$<strong>${!dRoll == 20 ? '<br>Critical Success!' : dRoll == 1 ? '<br>Fumble!' : ''}$</strong></td></tr>
<tr><strong><td>Total:</td><td>${!totResult:=(dRoll + atkMod + wpnskill + wpnAtkBonus + rangeMod)}$</td></strong></tr>
<tr><td><strong>Result</strong></td><td><strong>${tResult:=dRoll >= 20 ? 'Traumatic Hit!' : totResult >= tgtDef ? 'Hit!' : 'Miss!'}$</strong></td></tr>
${#setPropertyInEntity('self','LastRoll','dRoll')}$
${#setPropertyInEntity('self','LastResult','tResult')}$
</table>```
All in one roll message.
Thanks! A lot to digest there! Time to go experiment 😀
Word. That's how you get it working. While you're experimenting, I recommend having a console open and tossing in the occasional ${consoleLog(<variable>)}$ to make sure you're getting the results you're looking for.
How would I phrase a roll that was more than 5 but less than 8 in the code?
if you have a series of results, the same sort of comparitor that I talked about in the reply to JimmyJay would work.
Ok, will check that out. Thanks again
No problem.
I wrote the following and am getting an error message. Can you see what i am doing wrong?
${Roll:=[2d6+:DamageTotalModifier:]}$
${!Roll <6 ? 'Flesh Wound: 1 Shock' : !Roll == 6 ? 'Light Wound 3 Shock' : !Roll == 7 ? 'Light Wound 3 Shock' : !Roll == 8 ? 'Moderate Wound 5 Shock Location Impaired' : !Roll == 9 ? 'Moderate Wound 5 Shock Location Impaired' : !Roll == 10 ? 'Serious Wound 7 Shock Location Incapacitated' : !Roll == 11 ? 'Serious Wound 7 Shock Location Incapacitated' : !Roll >= 12 ? 'Mortal Wound 7 Shock Location Impaired'}$
what's the error message?
I get this in chat
I mean in the console.
I haven't used the console.
You'll want to, it helps with debugging.
hit F12 in Foundry and open the console tab, then look for the last red message.
However, for that many specific results, it might be better to use a switchCase()
It says NS_Error_Unexpected
delete all the !'s except the first one after the ${ then
How do i use a switchCase()? Sorry, a bit of luddite when it comes to all this
What it does is let you define a series of results and outputs for each.
But (and I'm not absolutely sure about this) they have to be values, not logical functions. So I would use the operators for the outside results (the <= and >= ones) and a switchcase for all the ones inside.
I did that, but still no luck. This is what I have currently:
${Roll:=[2d6+:DamageTotalModifier:]}$
${!Roll <6 ? 'Flesh Wound: 1 Shock' : Roll == 6 ? 'Light Wound 3 Shock' : Roll == 7 ? 'Light Wound 3 Shock' : Roll == 8 ? 'Moderate Wound 5 Shock Location Impaired' : Roll == 9 ? 'Moderate Wound 5 Shock Location Impaired' : Roll == 10 ? 'Serious Wound 7 Shock Location Incapacitated' : Roll == 11 ? 'Serious Wound 7 Shock Location Incapacitated' : Roll >= 12 ? 'Mortal Wound 7 Shock Location Impaired'}$
Does the !Roll have to be the same as the Component key I have in the label, which is DamageRoll, not Roll?
Roll is the variable you declared as the die roll + DamageTotalModifier in the first line with :=
is it throwing the same error?
I think the error message is: Custom System Builder | False part of conditional expression expected (char 399) SyntaxError: False part of conditional expression expected (char 399)
Ah, yup. Add : ' ' to the end after Impaired' and before the }$
the x ? y : z setup is required.
Fantastic, it worked!! Thank you so much for helping me through this 😀
This is a more complicated addition - if I want it so that if i roll snake=eyes (1 and a 1) it is automatically a failure, anyway of doing that? It doesn't really matter, as can just look at the dice rolled, but thought I would ask 😀
I don't think that will work, as I have modifiers on the dice roll which can be negative, so could get a result of 2 when actually throw something else.
Yeah, you would have to declare the roll as a different variable, then add the DamageTotalModifier in afterwards.
Sounds a bit complicated for my small brain 😂
${#Roll:=dRoll + DamageTotalModifier}$
${!dRoll == 2 ? 'Automatic Failure' : Roll <6 ? 'Flesh Wound: 1 Shock' : Roll == 6 ? 'Light Wound 3 Shock' : Roll == 7 ? 'Light Wound 3 Shock' : Roll == 8 ? 'Moderate Wound 5 Shock Location Impaired' : Roll == 9 ? 'Moderate Wound 5 Shock Location Impaired' : Roll == 10 ? 'Serious Wound 7 Shock Location Incapacitated' : Roll == 11 ? 'Serious Wound 7 Shock Location Incapacitated' : Roll >= 12 ? 'Mortal Wound 7 Shock Location Impaired'}$```
If you want to display the total roll (dice + DTM) then just delete the # from the second line.
Ok Cool 😀
oh, that code still was missing the : ' ' from the end, I just grabbed what I had sitting in notepad.
And, because I'm horrible at putting something down once I think about it, here's the version using switchCase() that I mentioned. I included some line breaks and text to make more sense, but you could do some inline to put it in a nice table if you like.
Roll: ${dRoll:=[2d6]}$<br>
Total Roll: ${Roll:=dRoll + DamageTotalModifier}$<br>
${!result:=dRoll == 2 ? 'Automatic Failure' : Roll < 6 ? 'Flesh Wound <br>1 Shock' : Roll >= 12 ? 'Mortal Wound<br> 7 Shock<br> Location Impaired' : switchCase(Roll, 6, "Light Wound<br> 3 Shock", 7, "Light Wound<br> 3 Shock", 8, "Moderate Wound<br> 5 Shock<br> Location Impaired", 9, "Moderate Wound<br> 5 Shock<br> Location Impaired", 10, "Serious Wound<br> 7 Shock<br> Location Incapacitated", 11, "Serious Wound<br> 7 Shock<br> Location Incapacitated")}$```
Thanks for Switchcase info 😀
No problem. I hadn't used it at all, so it was worth the work on it.
If i wanted to compare a roll to a compenet key, how would I do that. I have something called ShockPoints (entered through a Number Field). I wanted to compare a dice roll to the ShockPoint Value and then have the chat say whether success or failure. However, i am getting an error message. here is the code I have written for it:
${Roll: = [2d6+:ShockValueTotal:]}$
${!Roll >= ShockPoints ? 'Success!' : Roll < ShockPoints 'Failure - Shocked' : ''}$
I have tried it with ShockPoints being surrounded by full colons as well, but same error (i.e. ${Roll: = [2d6+:ShockValueTotal:]}$
${!Roll >= :ShockPoints: ? 'Success!' : Roll < :ShockPoints: 'Failure - Shocked' : ''}$
error says NS_Error_Unexpected.
Don't use the : : around your keys unless they're inside a roll indicator [ ]
Ok. The version I used without it still came up with error
You don't have another ? after the false case for the line.
${!Roll >= ShockPoints ? 'Success!' : Roll < ShockPoints ? 'Failure - Shocked' : ' '}$
also, you don't need the second conditional there; if the roll isn't >= Shockpoints, it'll be less than it.
${!Roll >= ShockPoints ? 'Success!' : 'Failure - Shocked'}$
Ah ok. Still getting an error. I don;t think it likes my ShockPoints!
This is my current code: ${Roll: = [2d6+:ShockValueTotal:]}$
${!Roll >= ShockPoints ? 'Success!' : 'Failure - Shocked' : ' '}$
This is my component where SHockPoints are entered:
delete the second colon and ' ' at the end of the 2nd line
This is the error message: Custom System Builder | Cannot convert "Total" to a number Error: Cannot convert "Total" to a number
second, let me plug this in my junk tab.
I think the problem is that it is not recognising my ShockValueTotal I use as a modifier to my dice roll
Which is strange, as it was recognising it previously. I will go investigate why!
But I could br wrong
This worked for me; I had to declare the values:
${ShockPoints:= '7'}$
${Roll:= [2d6+:ShockValueTotal:]}$
${!Roll >= ShockPoints ? 'Success!' : 'Failure - Shocked'}$```
You had an extra space between the colon and equal sign of the roll declaration
Perfect. Thanks you!
as far as typos go, the best thing I've found on complex code is to type it all in NotePad++ and then copy it into the label message field; that way you can see all the code in-line and it also helps you catch stuff like forgetting to close your brackets.
I think I will start doing that, as I might never have spotted that if you hadn't pointed it out
Last thing (I promise - at least for today!)
If I want the chat message to be in bold or be a colour, how would I do that? Would it be something I have to input in Label Prefix/suffix?
you can insert the <strong> indicator at the beginning of the line you want bold, and </strong> at the end. For the text you can use html or css notation in-line to set them, for instance adding this part makes the result come out in a blue:
<p style="color:DodgerBlue;">${!Roll >= ShockPoints ? 'Success!' : 'Failure - Shocked'}$
put the style note inside the ' ' marks if you're trying to make specific areas specific colors, like in the formula with all the varied results we talked about before.
So that last formula with my local values (you can omit those declarations on your version; they're on your Sheet) and some formatting looks like this:
<th><strong>Shock Roll</strong></th>
<tr><td>Shock Value:</td><td>${ShockValueTotal:= '2'}$</td></tr>
<tr><td>Shock Points:</td><td>${ShockPoints:= '7'}$</td></tr>
<td>Roll:</td><td>${Roll:= [2d6+:ShockValueTotal:]}$</td></tr>
</table>
<strong><p style="color:DodgerBlue;">${!Roll >= ShockPoints ? 'Success!' : 'Failure - Shocked'}$</strong></p>
And outputs the attached.
Hello, I'm new to Foundry and wanted to tackle macros (I'm using Custom System Builder and PDF Pager)
Coming from roll20 I was quite used to the language used but this is more complicated for me who only wants a single macro
I had a macro that asked players to choose three attributes from a list I had written, then it rolled a 4 die for each (in a roll table to have a lore friendly display).
Then the player had to launch a second macro indicating the three chosen attributes and the result of the previous die, and then it calculated everything
I know it wasn't the most optimized, but it worked ^^
Could someone help me see this more clearly?
For the moment I have not managed to even call on an attribute of one of my characters…
I created just a list of attribute (because we will use the PDF so it can just be ugly)
For example, I have a TEST character.
It has an attribute: Label “PB” / key: fiche_PB
On the form, I have several possible names, but nothing works if i try to call it with a macro :
system.props.fiche_PB
system.attributebar.fiche_PB
I saw that I could use this kind of thing ${[1d20 + 3]}$
but when I run a macro with that, it takes me out of the text, so I imagine it's not made for...
I'm looking at the formula system documententaion for CSB. Can the fecthfromactor function be used to fetch a value from a targeted actor/token? So instead of this: fetchFromActor('Steven', "Strength"), 'Steven' would be replaced with some sort of general 'target'? Or is there a different function I should use?
Yes, that's how it works precisely. The list of allowed actor keys is in the documentation, but the most common ones are 'self' and 'target' from what I've used so far.
The best i can do to help get you started is to say that you should create another label on the sheet, keyed and named as Roll. Then type the exact code you used above ${[1d20+3]}$ into the label's roll message section, and save and close it. Next you create a character from the template you're working off (I name mine Test a lot) and open them, selecting your template as the sheet. You should see the Roll label in red text. Click it and you should see your die roll happen.
Okey
And if I do that, how can I access to this roll within the pdf I use for the "true" character sheet ?
Thank you for the quick response!
okey, that worked
Ok. You can replace the 3 in the roll formula on the template sheet with the key for any of those number fields you have on the sheet, but you have to surround it with :, such as :einhertz:
Now, this is my "true" sheet, each number is linked to a variable (and thoses are the variable I want access to)
Nice thanks, it worked
Umm.. I'm not sure how csb works with imported pdfs like that. It might be simpler to just recreate the whole sheet in csb and go from there, otherwise you're going to have to read the documentation about how to integrate scripts and formulas together. Like, it could be done, but it would be quite a bit of extra code when you could just make fields for the data on the template.
Im on my mobile at the moment or I'd pull it up and take a look.
I see, I was afraid of this response (the odds of creating your own system, lore and sheets 😅 )...
The thing is that my sheet is 5 pages long (it contain few values, but there is 3 tables within)... but maybe it will be easier to create the sheet in csb than to dig in code
I'll let you know when I'm back at my desktop and can mess with it some. I'm certain there's a way to pull through the pdf pager document that you're using, i just don't know it yet
Has anyone tried using the Freeform Sheets module (https://foundryvtt.com/packages/ffs) with CSB? Just curious. Being able to map the fields of a CSB character sheet onto official character sheets would be cool, especially for games with stylistic sheets. I'm going to give it a try unless someone already knows that they are incompatible.
Freeform Sheets, an Add-on Module for Foundry Virtual Tabletop
I haven't, but I imagine the same sorts of things I was talking about with Argos would be issues there. The mod winds up addressing in js, and then you have to pull them back out with %{}% scripts every time.
Thanks a lot, I was drowning in my frustration 😅
Hum, maybe it's easier, I do not know
The downside of pdf pager is that you must have a fillable PDF, and from what I read from the other module, you create the fields you want
I crashed Foundry 😯 I can't do anything ^^"
can a roll/button from one item setProperty in another item?
Yes, provided the actor triggering it has access to the item. So while it might work for the gm to do something, it might fail on a player controlled sheet
Pulling this from the guide.
The name of an actor to reference. It can also contain special values like:
self: Sets into the current actor (can be used in labels, initiative formula and attribute bars)
selected: Sets into the actor-data of the currently selected token
target: Sets into the actor-data of the currently targeted token
attached (Item only): Sets into the actor-data an Item is attached to
item (Actor only, inside Item Containers): Sets into the item-data of the current row of the item container
Which entity would I use? It sounds like Item only references the current item, or am I wrong?
Me back (later than expected AND at the same time earlier than expected, cause someone just added a +1 h30min to the estimated train travel time for unknown reasons, which caused a chain reaction in the overall estimated plan).
Context. The first train was delayed by 15 min., so I missed the second train (train A). So I got assigned to another train (train B), which arrived around 1 hour later than train A.
Train A and B basically used the same route. The travel time for A was estimated to be around 1h10min. Buuuuut the travel time for B was estimated to be around 2h40min for the same route without any disturbances at the track. And guess what, I arrived 1h30min earlier than the expected arrival time, which made it possible to catch the final train C earlier than expected.
The item option is only usable in Item Displayers and targets the Item in the current row. Other cases require a script
In short, nope. Only possible with a Script
Why does this read like a 5th grade math problem... xD
Hey guys, apparently i'm having problems with that setPropertyInEntity formula. I wish to subtract 2 to the current mana point of a character which i've selected on the map. Could you tell me why ${setPropertyInEntity('selected','current_mp','selected.current_mp-2')}$ not only doesn't take any effect, but console says Uncomputable token "selected". I thought it was enough to select a token referring to an actor, but this doesn't seem to work at all.
Because I like simple variables 😅
Had to replan twice for this. It was exhausting 😅
The 3rd argument is the issue. The prefix selected. simply doesn't exist
Oh, couldn't be that simple. Thought the syntax was the same as 'target' (e.g. ('target', 'Health', "target.Health - Damage")). Thank you Martin.
You can still use 'selected' as the 1st arg.
Indeed, this worked perfectly.
And well, people get confused with the 3rd arg, because target. doesn't mean the targeted token, but the target actor in the meaning of source-actor (the source of execution) vs. target-actor (the target of the modification)
Got it. So in this case the source actor and the target actor are the same (that is 'selected').
No, source is always self
And target depends on what you've defined in the 1st arg
Good to know. I think setPropertyInEntity is a great formula. Still trying to manage spell casting outside the character's sheet 😅
I am suddenly having a problem with several of my roll messages not hiding the formulas. Am I missing something? I swear they were hiding last week.
That is GM-only visibility in your settings
Wow, not sure when I re-enabled that, thanks
Designing my first sheet and trying to learn system. I can get a dropdown to show lists from a dynamic table e.g. ${first(lookup('Attributes',
'AttributeModifier', 'Attribute', AttributeSelection))}$
What I cannot figure out how to do is get a dropdown to do the same thing on an Item Displayer. Is it possible to have a Dropdown access an item displayer in the same way it can access a dynamic table? The dropdown list has Custom, Dynamic Table and Formula options. Should I be using Formula option?
Basically, I want to be able to have a dropdown where the sheet owner can pick a weapon from their weapon inventory (Weapons Item Displayer), choose it, and then it populates the various modifiers for that weapon (damage, Penetration etc) in relevant places as key variables. I can’t figure out how to do this.
Hi. I have a working part of my character sheet that allows a player to manually enter in armor class to determine if they hit a target. I'm trying to switch it to using fetchFromActor to get the armor class value from the selected token. My original, manual entry version works great, but My fetchFromActor version isn't working. Any advice on what I'm doing wrong would be greatly appreciated! I've included the code with notes on what I think it's doing (I keep a Word document with examples of different ways to do various functions and I add comments to help me learn what the code means, that's why it may look a little weird 🤓 ).
Here's the version that works fine (with players manually entering the AC).
Try replacing the " with ' in the ffa line
Ah, wait.
So that first line function resolves to just ${<# or 0>}$, which doesn't make it available in the message for anything later. You should assign it a local variable name (you can even use npc_ac) to use it later.
${npc_ac:= fetchFromActor('selected', 'npc_ac', 0)}$
Thank you for your help!!
I changed the code and reloaded the template but it's still not working. Does anyone see where I'm making an error?
When you say not working, is it throwing a console error?
When I click on the character sheet dice icon that should activate the script, nothing happens.
Is there an error though? The error messages in the console help narrow down where the problem is.
Ahh, my apologies. I don't know how to check the console yet. I'll go look at the wiki and figure out how to do that.
Hit f12 in Foundry to open it, then do a reload and reexecute the command
Reload the actor, I mean, not all of foundry
Thank you! If I'm reading this error message correctly, there is something going on with the variable "circum_mod"?
Yup
Yup. It's not called anywhere in the Message.
Vice versa. It's being called, but there's no value for that
Oh! becuase it was defined in the original version of the script where it was inputted by the user but not the new version! I'm an idiot!
sorry, my lexicon isn't professionial.
Thank you both for you're help!
right, right.. 'called for' not 'called out' I should have said "not being defined"
It works perfectly after I removed the unused variable. Thanks again, much appreciated!
Good to hear, hope everything else on it goes smoothly!
@spark lotus something I thought of for that first macro you put up today (the to-hit one) is that you might want a check on if the user a) has their token selected, and b) has a target defined. It's not strictly required based on how you set a default value for your fFA, but it might be handy to promote having the players select their targets to help automate the process. This is the code I used for it, which you should be able to just insert at the beginning and see if you want to use it (it's pretty standalone, because it's a script and uses defaults from the Foundry documents).
${#%{let controlledToken = canvas.tokens.controlled[0]; let targetToken = game.user.targets.first(); if(controlledToken && targetToken) {return;} else {ui.notifications.warn('No actor or target selected!');};}%}$
That check was more required for my sheet because I use a range calculation in it, and that will throw errors all day if you don't have a token selected and a target.
I've been trying to figure something out that sounds like it should be very simple but for whatever reason I can't get it to work. I'm just trying to do a logical AND on two boolean values for an Item Displayer filter. I've got both working as expected in isolation but everything I try to AND them doesn't work (returns ERROR).
It's a hidden attribute can_use_skill calculated with a formula and an equipped checkbox. I can even use one or the other as expected in the filter formula for the Item Displayer and it works.
But for the life of me I cannot figure out why I can't get a simple logical AND working on these two values. Whether I do it in the Item Displayer filter, or right now in another hidden attribute show_attack that precalculates it, I always get ERROR for the final value. I know it's gonna be something dumb I'm missing but i've tried and() ternary opreator, switchCase, etc. Just can't figure out where I'm screwing it up.
What error is it showing?
Is there a log somewhere I can see more specific error reporting? I've just been going off of the results displayed in the hidden_attribute table.
Hit f12 in Foundry and look at the console that comes up.
oof okay yeah probably needed this
The last error on it should be the one from that message, but if you're not sure run it again with the console open and see
okay it's getting the result as a string it looks like
what are the expected results coming from the sheet you're running the formula on?
is it a brawn or tech weapon?
this is a brawn weapon with the current skill set to technique, so "can_use_skill" is returning false, but as a string it seems
Yeah, Labels usually store values as strings
so even for a hidden attribute, its values are converted to strings?
Yeah. There's an exception for Labels, which are modified by Items / Active Effects
got it. well thats what i needed to fix it; i just used equalText() to 'true' to get the value. thanks for all the assistance 🙂
Have to say been having a lot of fun in CSB over the weekend thanks for this.
I've been looking at the github instructions but have been unable to add a Hit Point (number display) to the character sheet and have it show on the token on the battle map. I'm using the latest 12v of Foundry and the latest version of CSB. Any help or pointing to help would be appreciated. I've made a template character sheet and added Hit Points to it. If I right click the token the hit points are there and can be edited. I want the layers to be able to see their and the enemies health at a glance though.
You mean like the green bar, or are you saying you want it to be a number? Because it seems to be working fine in CSB through the Foundry default...
forgot to tag.. @tough scarab
The green bar. If the token is right clicked it shows the number and can be edited. I want players to be able to see how healthy opponents are.
I must not have set the number field up right.
You set that up on the token appearance when it's created. You can change the defaults by changing your template or in the Foundry settings for all of them.
It does need to have a defined maximum to be an attribute bar, so if you create another number field with the Max HP and set the maximum of your current HP tally to ${MaxHP}$ it might fix it?
Other than that, it's just go to the token settings, Resources Tab, like it shows in the pictures and change the settings there.
I don't see hp in the resource dropdown. I have minimum and maximum set up.
Does it show up in the attribute bars when you click on the "See attribute bars" on the character sheet?
if so, could you show me your container where you have the HP set up?
Maybe I didn't set it up as an attribute. Sorry for my lack of knowledge. I'll look at this again. Let me check.
You shouldn't need to change anything to have it show up there. Pretty much everything I set a maximum for has popped into my attribute bars list, provided it's in a Number Component
I have it working now. I'm not familiar with the system yet. I'm going to run Deathwatch on it. Thank you for the help, I appreciate it.
No problem, good luck!
I have Created a world, used the CSB, twice deleted and Created, and I do have the option to agree to Dependancies
How can I solve this?
Install the module Chat Commander
That worked. Thank you
Another help request!
I have a roll button with the following script implemented:
const result = await game.macros.getName('CalculateAttack').execute({
entity: entity,
weapon: {
hits: ${weapon1_attacks}$,
acc: ${weapon1_acc}$,
damage: ${weapon1_dmg}$,
ap: ${weapon1_ap}$,
keywords: "${weapon1_keys}$"
},
attackModGM: 0,
defenceModGM: 0,
penetrationModGM: 0,
armorModGM: 0,
damageModGM: 0
});
}%```
The triggered Script works and outputs the data into the console log as intended. It returns an Object with the following structure:
```return {
accuracy: {
targetDC: finalDC, // The calculated target DC for accuracy
hits: nrOfHits, // The number of hits (total number of successful accuracy rolls)
rollData: roll, // The roll object for the accuracy check
description: finalAccuracyDescription // Detailed description of the accuracy modifiers
},
penetration: {
targetDC: finalArmor, // Final target DC used in the penetration check (updated)
penetratingHits: nrOfPens, // Number of successful penetrations (after the penetration roll)
rollData: penRoll, // The roll object for the penetration check
description: finalArmorPenetrationDescription // Detailed description of armor and penetration modifiers
},
damage: {
totalDamage: totalDamage, // The total damage after applying all modifiers
targetHealth: newTargetHealth, // Target's remaining health after damage
description: damageDescription // Detailed description of the damage calculation and modifiers
}
};```
At the moment it simply returns an Error in the roll message, since I suppose it cannot display an Object. How can I access the parts of the Object? My coder isn't sure and I am neither, so asking here 🙏
Save them in localVars, that is accessible in every Script.
Can you give me an example based on the above, if you were so kind? 🙏
%{
const result = await game.macros.getName('CalculateAttack').execute({
entity: entity,
weapon: {
hits: ${weapon1_attacks}$,
acc: ${weapon1_acc}$,
damage: ${weapon1_dmg}$,
ap: ${weapon1_ap}$,
keywords: "${weapon1_keys}$"
},
attackModGM: 0,
defenceModGM: 0,
penetrationModGM: 0,
armorModGM: 0,
damageModGM: 0
});
options.localVars = {
...options.localVars,
...result
};
return null;
}%
The Target-DC is ${accuracy.targetDC}$
Sorry to ask further... can you give me one example of what exactly goes in the local Vars = { } ?
local Vars = {
accTargetDC = accuracy.targetDC
}
This..?
Just do it as posted. localVars is a global Object in all Scripts. And the rest is the use of the spread syntax: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#spread_in_object_literals
The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value pairs to the object being created.
Okay, so the script is changed, thanks. Doing my best to understand it 😖
My hopefully last question for the moment then... how would I access, say, totalDamage from the returned object in the formula for displaying?
${damage.totalDamage}$
You got a few coffees 
Sadly this doesn't seem to work, I am getting an error in the console
Corrected
Getting some data! ✊
Thank you man ❤️
Now I just gotta puzzle out how to display the roll data as actual roll data 😄
You roll in the Macro?
yeah, I get it back as roll data in the return.
In my formula I output it as this: Roll Data: ${penetration.rollData}$
I don't have a premade solution for this, I can only guide you to the relevant sources:
- https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/src/module/formulas/Formula.js?ref_type=heads#L465
- https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/src/module/utils.ts?ref_type=heads#L46
- https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/src/scripts/chat-enhancements.js?ref_type=heads#L10
That will already help significantly, thank you.
I am working with a coder who knows javascript but neither the CSB system nor Foundry, so that will be quite helpful 👍
This will be challenging even for him though
nods
Worst case we will make it work another way somehow.
Thanks again for all the help, hope I can leave you in peace with my inquiries for a while now 😉
Super Support, Danke 🙏
Hello, in the wiki page it say that "item piles" is a supported module but if i install it a warning is issued and a manual configuration is asked. Is there a guide on how to configure it correctly, please? I have doubts on some options.
can you referance an item dis for the name of the item and use that name for an entry in an option for a drop down
Where do I find templates to import to CSB? I know almost nothing about javascript but I only need a character sheet with like five stats and thats all.
Ugh, okay. Custom System Builder says it is up to date with 4.2.0.
But the CSB Example Module says it is up to date with 4.3.0 and is not compatible with CSB? Huh??
Edit the minimum version in the json file. Is compatible with 4.2.0 with no issues
Hi, I am hooking the renderCVhatMessage event because I want to divide all dice rolls by half
I think I have an error in the last line or I don't know how to update the message
Anyone knows what is wrong?
(```
const hook = Hooks.on('renderChatMessage', async (chatMessage, content, speaker) => {
console.log('Hooked!');
console.log(chatMessage);
var conversion = parseInt(chatMessage.content/2, 10);
console.log('New value: ' + conversion);
chatMessage.content = '' + conversion;
});```)
So I think the question is: how do I update the content of a chat message?
Can you use normal rolls instead of inline rolls for roll messages?
Is this the intended way to not post a roll message to chat?
%{throw "Done";}%
Hi, i have a "_template" actor sheet and i have changed some value for the prototype token there but when i create a new actor based on that template, the token configuration are no kept. How do i change the default configuration for tokens so all new created actors have them, please?
The Prototype Token of the Template has no effects on Prototype Tokens of Actors using this Template. It's simply a missing feature
That's a relic from earlier versions. You can now unselect the option to post a Message in the Chat right under the Label Roll Message
Oh. So, I need a macro to bulk change the configurations of tokens for actors after i have created them if i don't want to modify them one by one?
Either that or a World Script, which can synchronize your Prototype Tokens automatically whenever a new Template is selected
I think the world script is by far out of my capabilities, sadly.
The token config are that of foundry core or CSB have some custom things?
Foundry core. We only provide the necessary data for Attribute Bars
Ok, thank you very much.
You mean the Foundry style output? Only with a Script
chatMessage.content is a string containing the full HTML of the Chat Message. You can't simply divide it by 2. You have to do a Search + Replace
I know nothing about Java, but thanks to the example sheet i've been making my way through CSB without much issue. However I'm at a roadblock. Im trying to create a roll message that chooses between one of two formulas based on whether or not a checkbox is checked. This is what I cobbled together based on what I could find in the example sheet, plus some googling.
${#?#{_DancerUserInput}}$
${(if(indptcheck)
{[1d10 + 1]}
else
{[1d10 + 2]}
)}$
Where "indptcheck" is the component value of the checkbox, and "_DancerUserInput" is where the box is checked or unchecked.
Any help would be greatly appreciated!
${#roll_mod:= indptcheck ? 1 : 2}$
${[1d10+:roll_mod:]}$
You're awesome! Thanks so much :)
Hello! I want to fetch the value from a character sheet that is selected through a macro. What command should I use for that?
actor.system.props.componentKey
Thanks! It worked.
Is there a way to "de-mask" inline results from references?
Basically turning the linked data into a pure string.
String() did not work.
These inline results is what I mean, just to be specific 😄
You mean the grey box? Just use ${!...}$
Hello,
I have a thing again with an Itemmodifier. I want to modifi a Value that contains conditions.
LP_Grade
So my modifier is:
${Active_6 ? (fetchFromActor('attached', "LP_Total") == fetchFromActor('attached', "LP_Max") ? 'Unverletzt' : fetchFromActor('attached', "LP_Total") > (fetchFromActor('attached', "LP_Max")-(fetchFromActor('attached', "KON")*3+1)) ? 'Angeschlagen (0)' : fetchFromActor('attached', "LP_Total") > (fetchFromActor('attached', "LP_Max")-(fetchFromActor('attached', "KON")*4+1)) ? 'Verletzt (-2)' : fetchFromActor('attached', "LP_Total") > (fetchFromActor('attached', "LP_Max")-(fetchFromActor('attached', "KON")*5+1)) ? 'Verwundet (-4)' : fetchFromActor('attached', "LP_Total") > (fetchFromActor('attached', "LP_Max")-(fetchFromActor('attached', "KON")*6+1)) ? 'Schwer Verwundet (-6)' : fetchFromActor('attached', "LP_Total") > (fetchFromActor('attached', "LP_Max")-(fetchFromActor('attached', "KON")*7+1)) ? 'Außer Gefecht' : fetchFromActor('attached', "LP_Total") > (fetchFromActor('attached', "LP_Max")-(fetchFromActor('attached', "KON")*8)) ? 'Koma' : fetchFromActor('attached', "LP_Total") == 0 ? 'Tot' : 'Eiserner Überlebenswille') : fetchFromActor('attached', "LP_Grade")}$
So when Active_6 is unchecked I want it to fall back to the old value before modifiying. Insted it uses the modified version. But that doesnt work somehow. Any idea how I can archive falling back on the onmodified LP_Grade?
Why are the wound modifiers in the item modifier?
Because the Level of the Item changes them
Das sollte höchstens nur die Schwellenwerte der Wundgrad-Tabelle modifizieren, oder irre ich mich da?
Nein. Berserker bekommt drei zusätzliche Wundgrade vor Angeschlagen Stufe 6. Da muss man ein paar Sachen umstricken.
Are you playing Deathwatch? I'm doing my 1st session Friday of it. Just using PDF character sheets.
Oof, das bricht natürlich
Is it possible to make a character creator or level up wizard (picking Items as class, ancestry, etc.)?
I know items can't be displayed in other items or user input templates but that would basically be a solution outside of the normal dragging dropping items from the Foundry Items tab 🤔
There's no such feature
Possible... yeah. But how much effort do you want to invest?
I feel like "a lot of effort" for me is moderate for others :p
Could I use a roll/button to open a Character sheet that has all the relevant items displayed maybe?
And then drag them to the actual Character
Das einfachste, was mir spontan einfallen würde, wäre alle Schwellenwerte um KON * 3 zu erhöhen. Das würde dafür sorgen, dass man erst deutlich später in "Verletzt" und andere Wundgrade kommen würde
You can't open a character sheet, that doesn't exist. You have to create one prior
Yeah, I mean like I create a "Character Wizard" Character with its own separate template displaying all items
And then create my players' character sheets using the actual PC template, with a button to open Character Wizard so players can drag and drop the items
Im Übrigen kannt du nen leeren String übergeben in nem Set-Modifier. Das würde dafür sorgen, dass die Modifikation ignoriert wird
I'm not tied to that idea obvs if there's something better/more straightforward/etc I'll look into it :)
That seems doable with a little Script
Ich schreib dir Morgen gerne noch Mal ne PN dazu, danke dir soweit
I'm just mindlessly playing around and I'm pretty sure it's not intended but you can edit a Label in a User Input Template and turn it into a Rich Text Area, even though you can't normally add a Rich Text Area to a User Input Template
Not sure if it's also unintended but you can add Item Displayers (which display the triggering actor's items) and Rich Text Areas to Tables inside User Input Templates
(which could solve my character creator/level up question but i wouldn't want to do it that way if it means breaking the system and it getting patched in the future)
Thank you! I really appreciate the help!
It's not intended, but it shouldn't break stuff hard. And well, a complete fix will be impossible anyway, because you can manipulate the JSON and add any Components there as long as their format is valid.
Is there a known problem with CSB and Tile Controls?
I made a Tile and it is not going fully transparent. Solution?
I just created a random tile in my csb and didn't have a problem with opacity, so it could be a thing with the image you used.
The image I used is just background, Opacity is the control, right?
Yup
I figured it out, I didn't realize the image was in the background. It's a foundry feature that when the GM creates a transparent tile while the tile control is active, all transparent tiles get a background so you can find them. If you select any of the other left hand controls it should disappear.
It didn't occur to me that the image that was showing through the tile was the background until just now.
Dann würde ich beim Fallback-Wert also nichts eintragen? Also Beispielsweise:
'(Active ? X : )'
?
Ah blessed I was about to ask something but then I realized that the formulas are case sensetive.
(Active ? X : ) would throw a syntax error. You need something in the 'then' slot that won't affect the modifier; I've used ' ' before when the result will never result in a false statement, but it depends on the original code, I didn't follow it all.
This might be a better use-case for switchCase() instead, since that includes a fallback? I'm not sure how that interacts in the Modifiers though.
Is there anyway to hide the "configure item modifiers" and everything from the GM perspective too? It breaks the CSS on my side..
display: none on that class? Otherwise no
can I have a simple field's default text be the result of a rolltable?
It only updates when created, so it won't ever change, but I think they can be variable. It doesn't sound unfeasible.
Guys, I'm trying to modify a label in an item container using an item modifier from another item.
Ok, I think that sounds confusing, but basically, let's say I have a set of items in this container that represent skills. I also have another item called Race.
In the key field of the Race item modifier, I added:
${fetchFromActor('attached', "lookupRef('pericias_lista', 'valor_teste', 'name', 'Acrobacia')")}$
When the skill item named Acrobacia already exists in the container, the modification works successfully. But it seems that if I include the Race item before obtaining the Acrobacia skill item, the modification no longer works. I tried adding the Acrobacia skill after the Race item, and the modification didn't work.
Would this be a bug, am I doing something wrong, or is it not possible to do it this way?
That would be good enough for me!
Ah, I went and looked at the documentation, and I suppose I was wrong, sorry.
No problem, sorry for sending you down a rabbit hole that was stopped up.
hahaha
no problem
I really want to create NPC actors that come filled with contents from a list (rolltable or else)
this is driving me up the wall coz I don't knwo how to start
I think, though, that you could set a static value that's filled from a roll.. in essence, you create the NPC and hit a roll button once that fills in the fields you want filled.
and I was suggested to look at the "random(?)" function in "mathjs(?)" and I can't make heads no tails of that manual
Then the default value could refer to that generated static value
well, that would be fine!
how do I start?
I'm bodging up a test case, let me see if it works then I'll show you what I'm seeing.
Much appreciated!
- Weapon table set up ('Weapons')
- Text Field on the Game Data tab (for my sheet this is normally only GM-visible)
- NPC Roll set up; I put it on my 'Junk' tab because it's something I'm not using on my sheet, but you could put it on the front page of your NPC sheet if you wanted to..
- Default Weapons spot empty
- Roll output...
- Label is now filled with the desired output. You could have this referred to in the default value of a weapons tab or something, or you could just directly input the results of the rolltable into a truncated equipment section. I don't think that there's any way to actually put an item into an item container without using scripts though.
Code in the Message roll:
${weaponroll:=[#Weapons]}$<br>
${#setPropertyInEntity('self', 'DefaultWeapon', 'weaponroll')}$```
The second line is technically less than optimal, you could have the whole roll inside the sPIE, but I like to have things for debugging.
as an extension, you could have all the NPC's stats and such be rolled by that one button press.
Also, if you turn off sending the message to chat, it doesn't have to reflect there, so you could just create a sheet, hit the button, and conceivably have a whole random NPC just appear in front of you. If you use background and personality tables too it might even fill in some things you can use that way.
yes!
i'm using a lot of meta and fictional elements
here's the perchance generator, for example
NSFW text btw
Same process, and you can have as many keys defined by that one roll as you like.. Something like ${setPropertyInEntity('self','STRValue', '${[3d6]}$')}$ would just roll a D&D style stat number and stuff it straight into a 'STRValue' key.
Yeah, you could do some rolltable typing and create that same sort of output directly into an NPC sheet.
Wait, I don't suppose I could have thenewactor come ou with a random name from a list or rolltable, right?
Sure, if you have a rolltable and a key set on the sheet you can make it happen. You could even have a list of given names and a list of surnames and put them together into a single name with a concat command.
so like:
${firstname:=[#FirstNames]}$
${lastname:=[#FamilyNames]}$
${setPropertyInEntity('self', 'CharName', 'concat(firstname, " ", lastname)')}$
Although the formatting for that concat might be off, I'm bad at free-form code sometimes.
dang
ok, so for this I am trying to put 2 results together in the same firld but I am messing up somewhere
the first one is closer to correct, although you don't want to use the | in there, you have to concat the results of the two rolls.
double quotes kinda works
the second one got me this
'Gravelly: Rough, harsh tone.' 'Hesitant: Frequent ... pauses. Unsure.'
with the single quotes over each result
the 1st one got me nohing
oh yeah, no, that's just teh cursor 😄
this is nearly perfect
but the results adds quotes, I don't get it
is the output you're not liking in the roll message or in the output on the character sheet?
in the character sheet
Try adding this line at the very end of the whole thing:
${escapeQuotes(voiceroll)}$
and see if it outputs it without the quotes. I've been wondering what a use-case for that might be, and this sounds like it could be it.
The output should show up in the roll message when formatted that way.
the one we're looking for, I mean
I don't have my CSB open right at the moment to check it myself.
still outputs them single quotes
'Variable: Alternates between slow and fast.' 'Melancholic: Sad, wistful.'
it's fine, Il'l survive that 😄
this is AWSOME
yeah, concat didnt work in this case either
i'll just accept the quotes no problem
I'll have none of THAT!
${!voiceroll:=concat(string([#Voice A]), " ", string([#Voice B]))}$<br>
Yeah, this outputs a string without the ' ' around it in the message chat, so you could just replace the last line with the sPIE from yours.
${!voiceroll}$```
setPropertyInEntity()
Great! And, just for your peace of mind, it's going to help me when I get around to doing all my table development for my sheets, so not only do I get to help you accomplish it, I'm sorting stuff I'll be working on eventually, so working the puzzles for you is helping me too. Hope it's all coming together for you!
Silly question but is there a way to hide the item that is dragged into Item Displayer?
it's wonderful!
thak you so much for the assistanceand I hope your project is fun and satisfying too!
I dont think you can remove the name column, no.
Well at least won't waste time trying to 😆 thanks for the check.
What were you trying to represent with it?
I tried to display for the players their past careers with a boolean. They can tick a checkbox in the item and mark it as a career they progressed from. It might be a bit confusing to see the careers in both fields. If its really troublesome I could make a new Equippable Item Template with just the name and tell them to drag that into the previous career field.
You could add a filter with not(<checkboxkey>) to hide just the one they have checked
That would go to the Item Displayer's Item filter formula field?
Yes. Without a formula indicator on it (no ${}$)
Alright thank you for your help!
No problem.
Is it possible to have an item in an item display container that can generate a dice roll? What I am trying to do is set up a weapon item container that has a column which will read ‘Roll Damage’ and if pressed the damage will be rolled. So, on my weapon template I have a label that has the following:
Label Text: Roll
Label Icon: dice-1d20
Label roll message: ${Roll:=[2d6]}$
(See image)
However, when I add a weapon created with this template to a character sheet I get an error message in that column of the item display.
I hope all that made sense, as I think I have explained it badly!
I am guessing you cannot have such labels in an item display, but wanted to check, just in case there is a way and I am doing something obviously wrong.
Has someone ever made a Token Action HUD module/addon for CSB?
I tried to make my own, but I have a hiccup in my brain and don’t even get a start…
(I know, it will not be compatible to other CSB templates. But I would be able to learn from it)
Using the lookup command I can get a listing of item weights from item displayer.
However, I would like to get the sum of those weights on the actor sheet.
After browsing faq and this channel I am not sure that is possible, if it is, please tell me how
sum(lookup())
Hmm. I tried that but I get error.
${sum(lookup('_itemDisplay', 'weight'))}$ displays error but
${lookup('_itemDisplay', 'weight')}$
lists correctly the individual weights. What am I missing here?
What's the error in the console?
Does anyone know how to answer me?
I think this behavior is undefined
Does anyone know how you make an attribute show up as a bar on the token by default? I can make attribute bars show up if I go into Protype token for the actor and then set the bars to what I want. But if I go to Game Options -> Configure Settings -> Core -> Default Token Configuration -> Resources, I cannot see the attribute in the drop-down menu for bar 1 or bar 2 – they do no appear. Is there a way of making the bars default for all actors created, or do I have to do it individually set them for each actor created through their Prototype token options?
@formal goblet Got it now! Problem was that the "weight" itself was based on a formula on the item sheet. So now I changed the itemdisplayer to show that formula instead of simply the value of the item. Thank you for the help though, I was so frustrated that the actual sum(lookup()) wasn't the right command
There's currently no builtin option to do that globally
Ok. Thanks. Saves me having to experiment at least! 😀
Is there a way to disable players removing rows in dynamic tables? Feels weird you can control wether they can add things but not if they can remove them
You can lock predefined rows in the Template
Ooooh. That icon did not strike me as a lock. Would still like a way to lock the entire table, but I guess it works
It would be bad, if players would be able to add but not delete their entries. That's why it's restricted to predefined rows only.
Could be a setting that is only available if player-addable rows is disabled 🤷
But then you only have predefined rows anyway
Yes, but having to click the little lock button on every row takes a while and I'm afraid to miss one
Enable the delete-confirm-dialog and that shouldn't be an issue then.
An idea would be to have a toggle all button at the header
That works too
My players always have the "See hidden attributes" button in items. They dont have it in actors. I set the minimum role to edit item modifiers to GM. But it still is shown for normal players. Any ideas?
That's weird. They should have it in both entities
If I wanted to have a 2d6 roll, but wanted to check if doubles were thrown, how would I do that? Would I need to have each d6 rolled separately and then compare the numbers of the two rolls? If so, how would I write that. I have been fiddling around with it, but cannot seem to figure out how to do it.
I think that rolling the two dice separately and then totaling them for the result while doing a separate check for doubles is the best way.
${roll1:= [1d6]}$
${roll2:= [1d6]}$
${roll1 == roll2 ? 'Double' : 'Normal'}$
newest version of the system - will try updating foundry real quick
nevermind - foundry also newest version
Great! In my current code I have:
${#dRoll:=[2d6]}$
${Roll:= dRoll + TotalValue}$
Would I need to put a # in front of both rolls, or leave # out of both of them, or keep in the first roll? I am not 100% sure what the # does - I was following panzerkraken code when I first put in the code, which worked brilliantly, but not sure what the ~ actually did 😀
# just hides the result in the Chat
${#roll2:= [1d6]}$
${roll1 == roll2 ? 'Double' : 'Normal'}$
${dRoll:=sum(roll1,roll2)}$```
That'll preserve the later stuff using dRoll
Ah ok. Thanks 😀
Fantastic! thank you 😀
You can also move the formula for the doubles check anywhere in the message to let you format the chat card results.
Is there a macro to create an actor already loaded with a certain template?
That sounds like a macro-polo question, tbh. You'll want to look at the keys for an existing actor to figure out where the template is applied on the document and apply that, but it's like.. saving two clicks per sheet?
Something like...
const actor = Actor.create();
actor.templateSystem.reloadTemplate(templateId);
hello, is it possible to put 2 condition for filtering items in item displayers?
like x == 1 AND y == 1
x == 1 and y == 1
wait, really 🥲
yeah
now I feel stupid xD
Thanks alot
Thank you very much, I'll try it!
I'm trying to figure out how to fetch a item's name in a label roll message for instance:
(ITEM NAME HERE) Rolls ${Weapon_Die_Number}$d${Weapon_Die_Size}$ + ${fetchFromActor('attached', 'SHIELD')+Weapon_Modifier}$${DMG_TYPE}$ Damage and has ${Weapon_Effect}$ effect
I can't seem to find how to get it in the documentation, though I have only been working on this for about a day.
More accurately, ${item.name}$
Ah, wait, so there's some context required to make an answer make sense for that.
looking at your keys, it seems like this roll isn't generated from an item container?
It's in the item itself... maybe should move it to a container, but, I've kinda just been monkeying things out lol
no worries.
are you using the 4.2 or 4.3 CSB (the beta)? This approach is actually more feasible in 4.3, because it has fetchFromParent() available, but in 4.2 it's probably better to create your rolls in item containers (since that's how the players will more intuitively interact with them)
Yeah, lemme see about moving it to the container lol
From the container, since it's being generated with an item already attached, you can just refer directly to player keys, and any keys on the item itself can be referred to with item.<keyname>.
No problem. Glad to help.
Next thing that I'm stuck on. I want to implement 'skills' for the system I'm making, these are selected before rolling an attack or the like and change the numbers for that attack. In sandbox I made it a bunch of items that modified background values and kept them modified as that was the only way I could figure out how to do it, along with ways to have numbers that are locked. It's been a minute since I set that up, though, so I'd have to look up how exactly it works.
Right now I'm not sure how I'd implement that in CSB, and I want to try a different tack, namely using a dialogue, so, I'm trying to wrap my head around this possibility. My main question is, is it possible to lookup a table in a dialogue, either for a radio or dropdown menu? I'd like to use a dynamic table if possible, just for scalability, if it's not possible should I use hidden values? My first attempt is below, but doesn't work
${item.name}$ rolled ${[:item.Weapon_Die_Number:d:item.Weapon_Die_Size:]+SHIELD+item.Weapon_Modifier+SKILL_MODIFIER}$```
Thanks for any advice in advance :)
hi, I've tried the system during two hours yesterday night and I did not understand anything
Creating texts and labels was easy but OI did not manage to create Attributes for my games and formulaes gave me a headache*
I've thoroughky read the history of this channel to understand but found me thibking that the system was not so user friendly for people with no coding skills.
(having a tummy ache didn't help though ^^ )
I felt and still feel like an idiot. I have been an IT support for 16 years and not to be able to understand how to use the system make me ponder if I'm an idiot or if Foundry is too complicate for me.
Is it possible to have an item that has a roll dice function as part of it? How would you set that up in the item template? I have tried adding a label column in the item template which has the roll dice function in it, but it comes out as an error in that column when an item is created using that template and then added to a character sheet.
This was exactly the situation I fumbled during two hours
Honestly, it's more casual-user friendly than Foundry is at the system development level, becuase a lot of the basic setup is done for you and you're just fitting in things you want.
In answer to some of your confusion, to set up a stat on your sheet, the best starting place is to create a Number field, then assign it the Str key. Next, create a Label component next to it, and in the key for that component, type in StrMod. In the label text field, type in ${floor((Str-10)/2)}$ This will create the basic Stat modifier from D&D (it's just an example, you don't have to use those).
For general thought process, Key = a defined value or formula or array, while the components are configuring parts of it (at least that's how I think of it, I'm NOT a professional).
Rolls can only be used in messages, not in label fields.
So like yesterday when I was working with GiftofGabe on it, he had to set up a button to call rolls on his NPC sheet in order to fetch from rolltables to fill in the sheet automatically.
Which means you could have a roll set up on an item, but it would need to be a button press to activate the roll in a message (even if it's not sent to the chat display) in order to get a result.
You would have to make sure you were wording the roll correctly too, since the 'actor' at that point is the item, not the person it's equipped on.
Is there a way for 1 item to add another when dropped onto a sheet?
It depends on the concrete scenario. If you have something like a variable Roll Formula for weapon damage, then the best thing you can do is to have the Roll Formula in a Text Field of the Item. Afterwards you can fetch the content into a Label Roll Message and let it roll there: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#322-dynamic-roll-formulas
You basically split the declaration into the Text Field and the execution into a Label Roll Message
Pardon the n00b question, can CSB work with and play with Foundry's card system?
Coding skills help a lot, not gonna lie. The thing is, it's hard to make it more user-friendly as it is already, because you can't avoid certain base concepts like variables and functions if you want to automate certain stuff in this system. We can't change that at all. And it makes sense, because you need the tools to build your own calculations. Same with Excel, you need those functions to make custom automations work
Not on its own. You need your own script for that case
Sry, we have no implementation for the card system. I wouldn't even know how to abstract that nicely, so that other card systems could use it
Going to bump this, I could just be failing to read the documentation right. Any help would be appreciated, although, I'm going to be AFK for a while.
Well, having the selection in the Dialog is actually not a trivial thing. The syntax requires, that you have only one key and value separated by | for each option. This is fine for static options, but is a hurdle if you want to use dynamic options (like in a Dropdown with a Dynamic Table reference)
You might want to use User Input Templates instead
Or you change the output of the Formula in the way, that would fit the syntax (which you probably can't do without a script)
One of my two friends who use Foundry is a dev. He is ok to assist me tomorrow night in order to help me understand how all this stuff work ^^
I think they really don't want I go back to Roll20 😉
The thing is we will go back to Roll20 temporarily during the time I will need to transfer the data to Foundry. I tried their new jumpgate engine and it works better. It will at least alleviate the load to have to temporarily go back ^^
Thanks a lot, I'll look into both making a user input template and just making it static.
On a seperate note, is there a way to make a 'locked' number like in sandbox when you put an auto calculation in a simpleNumeric property?
No. Must be a Label. We strongly distinguish between Components with derived and non-derived data
Gotcha :)
Man, I feel like this question has been asked before and maybe even I was the one to ask it, lol, but I can't find it now 😅
Is there a way to add a button to a chat card for players to click to do something?
Specifically like the GM can call for a check with specific parameters, generates the chat card, then the players can choose who to "take it" and one of them clicks the button and interfaces with their sheet and uses their stats to make the roll/check?
It would require some custom scripts, according to Martin. It would be MUCH easier to just have the GM call for the check.
😂 Yeah, so much is easier to just do... you know, manually like real people.
But man if you aren't automating away all your humanity, what are you even doing? haha
lol. Here's the response from LinkedFluuuush, the actual author: #1037072885044477962 message
about the same question
Ahh, yeah his explanation makes sense too
Is there any way to have an Item Container use one of its item's Label Roll Messages?
I have an "Equipped" Item Container, and I'm trying to get it to use the Roll button I've put into the individual items, since there are weapons/potions/armors all in it
As in you have different items with different formulae in an identically keyed roll?
The thing is, you create the roll message for the column on the container, so you would need to be able to use the same initiating formula for each item that shows up.
I dont know if it's a hard no, but it doesn't sound easy.
yeah, exactly
%{
const phrase = await linkedEntity.templateSystem.getCustomRoll(labelKey, {})['main'](false, {
...options,
explanation: false
});
const speaker = ChatMessage.getSpeaker({
actor: entity.entity,
token: entity.entity.getActiveTokens()?.[0]?.document ?? null,
scene: game.scenes.current
});
phrase.postMessage({speaker});
}%
Oh, that makes sense then.
adding this into the Item Container roll message, it says the Label Key i use for the item is undefined
Replace it with the actual Label key
Which must be a string
ah
i had to use quotes
thank you
a module i'm using understands the roll and asks me about the dice size i use in it, so the code can access/understand the item roll, but when it posts the message into chat, all it says is "ERROR"
any idea why?
nothing in the error log, either
Nope, not without an error in the console. If you get the error from the Script above, then it's natural if you haven't disabled Chat Message creation
For instance consoleLog() throws an error in the chat card every time if you don't disable or hide the formula containing it.
That doesn't make sense 😅
wait, is there any way to get it to work with chat message creation?
Ah wait, I forgot a part
Fixed
You should disable the Chat Message creation of the Label, otherwise you'll get 2 Chat Messages, because the script itself triggers an additional one
I meant how (1) results in (2) if you dont either include # or disable the send roll to chat.
the consoleLog() is still working fine, it's just generating error outputs on the chat card.
Is there a way to have a user input template call values from the parent item, or to create two roll messages from one message, or something like that, I want to make a "here's what the item does, and your choice" then roll the dice in a separate message, ideally without having to take a second batch of the same user input.
1 click, 1 message if you don't use a script like above.
I don't know about the user input template one. Maybe you can do that, try it out
It doesn't seem to work, plus it doesn't see the current values in the template either, so I'd need to figure out how to made a user input template in a user input template that passes it's values all the way to the original item or something goofy like that. There isn't any way to have the actual dice roll not roll until clicked in the chat feed correct?
i'm trying to make a roll that subtracts armor if there is a target, but otherwise just rolls damage
<div class="mb-roll">
<h3>Damage</h3>
${Roll:=[:roll_dice:]}$ + ${Strength:=fetchFromActor('attached', "str")}$ ${if(target) != '' ? ${- ${Protection:=fetchFromActor('target' , "protection")}$}$ : ${+ 200}$}$
<div>${! concat('<br><strong class=\"result\">', string(Roll+Strength-Protection), '</strong><br>')}$${roll_type}$</div>
</div>```
is what i'm using so far
when i have a target, it gives the proper result at the bottom, but the value for Protection shows as ERROR
and when i don't have a target, Error: undefined. Uncomputable token "ERROR" shows in the console and it doesn't roll at all
Without a target the values that come from the %{}% portion are returning null, so you might want a conditional up there to set target to 0 if you don't have a target.
I could be wrong on that though. My instinct says that the transition between the script variable target and the formula key target is where the problem is though.
ah, yeah
i've been assuming that if there is no target it would return as a null ''
how would i go about recognizing if there is no target, though?
i guess i could just print out target and see what it says, actually
ah
just returns as Undefined in the console
uncomputable token
If you don't have one?
Then I'd say fall back on an if then else format for the first script, and have it set the key target (as in ${target:=%{...}%}$) so the transition is easier. Your else statement can set it to ' ' so it's not undefined
Is there a way to make a formula conditionally appear in a roll message? or better yet a way to make sections appear conditionally? if I have a blank option in a conditional it still shows the box, which isn't very pretty.
trying to learn how to use dynamic tables, in Label roll message i have ${[d20 + :item.damage:]}$, and there is a column in the table called "damage", but i am getting an error, is there something wrong with my syntax?
i've seen your script above, with
${%{if(target) {return;} else {ui.notifications.warn('No actor or target selected!');};}%}$
and i've changed it to
${#%{if(target) {- ${Protection:=fetchFromActor('target' , "protection")}$} else {''};}%}$
but it doesn't seem to work
am i doing something wrong with the formatting or something wrong with the logic?
i believe it should be ${[d20] + :item.damage:}$
Item.damage only refers to items keys in an item container, it won't work in a dynamic table. You can look up the value in a dynamic tables damage column with a lookup though.
Not sure. It looks right. Try throwing in a couple console.logs in the script portion to see what it's returning.
Oh, RETURN.
Thats what you need in there. You need the then and else commands to start with return.
Mine doesn't because the ui notification can be triggered from the script.
Its explained in the api documentation on the wiki.
If it doesn't have a return command it doesn't pass data back from the % script
thank you, between trying out lookup and discovering the samerow function i have figured out how to do what i want
ahh
i was wonderng about that
i've since changed it to
${%{if(target) {return('- ${Protection:=fetchFromActor('target' , "protection")}$');} else {return('');};}%}$```
and now it's back to saying that target is undefined
oh
the issue was because i separated the let target and the if target into separate formulas
${${!condition ? '#' : ''}$'test'}$
What about just ${Protection:= fetchFromActor('target', 'protection', 0)}$ without the script at all?
Thanks :) I'll try it out tomorrow
Similar question, can you conditionally hide the plain text of a roll? I'd think maybe with CSS, but need sleep so I can't look into it tonight
that works, but I'm trying to hide the protection part of it unless there's actually something there that modifies the roll
i think I've got it figured out, though
I'll post when i eventually iron it out
If I have my attributes set on a dynamic table, and want to add one of the attribute modifiers to the initiative roll formula in the Configure Game Setting -> Custom System builder, how would I go about writing that formula? My initiative is on 2d6 but I want to add the Attribute modifier for a character’s Agility and Will attributes found on the dynamic table – the dynamic table is called ‘Attributes’, the individual attributes have the component key ‘Attribute’, and the attribute modifiers have the Component key ‘AttributeModifier’. I can work the dynamic table so I can access the attributes on a dropdown, but am unclear how I go grab a specific named ‘AttributeModifier’ off a dynamic table.
Usually you combine lookup and samerow to get a relative result from a unique aspect.
Ok. The only formula I have used like that is: ${first(lookup('Attributes', 'AttributeModifier', 'Attribute', AttributeSelection))}$
I use this to allow players to access spefici attributes on a dropdown.
I just copied it from the example sheet I think
The best (least typing intensive) way to do it would be to define a hidden attribute or a label somewhere else where you can do the calculation or lookup and then have that saved as the modifier; for example you might have a hidden attribute keyed as 'InitMod' that you can use in the initiative formula, which also allows you to modify it with items later.
Ok, but I would still need to knwo how to look up the attribute modifiers for Agility and Will, and that is what I am bit stuck on.
Or would I just add a new column to the dynamic table and then have label that creates the intiMod. Would that work do you reckon?
A whole column for it?
Can I just add it to an exisiting bit label?
first(lookup('Attributes', 'AttributeModifier', 'name', 'Agility')) should return the Agility modifier, assuming that's what the key for the attribute itself.
assuming that's the name reference.
I meant to say.
What I have for columns in the dynamic table are a column name of 'Attributes' with the component key 'Attribute, and a second column with the column name 'Modifier' with the component key called 'AttributeModifier'. That is all the columns I have in the dynamic table
So would i miss out the bit in your example where is says 'name'?
Ah, I'm thinking about item containers, they have a reserved column key called 'name'. Replace that with 'Attribute' then.
Ok, cool. So it would read: first(lookup('Attributes', 'AttributeModifier', 'Attribute', 'Agility'))?
With all of them in ' '?
Yeah.
Great! Your are a marvel!! Thank you 😀
No problem, hope it goes well.
Thanks!
Ok. I am getting an error on the character sheet when I type in the formula to a label text box. Formula I am using is:
${first(lookup('Attributes', 'AttributeModifier', 'Attribute', 'Agility'}$
What's the error?
NS_Error_Unexpected.
Can be ignored
Actually error might be: Custom System Builder | Parenthesis ) expected (char 68) SyntaxError: Parenthesis ) expected (char 68)
You're missing 2 closing parens
This is my formula as of now: ${first{lookup{'Attributes', 'AttributeModifier', 'Attribute', 'Agility'}}}$
{} vs (). CSB-delimiters are ${}$. Function calls are function()
Ah, ok. So those internal brackets (after the one after the $, should be ( rather than {?
yes
Fantastic! I should wear my glasses. Sorry about being a bit thick when it comes to all this.
Working now 😀
😭 is there a for loop or a switch case equivalent when multiple options come from an equippable item's dropdown?
Yes I will give this a try!
Yes this worked for me thank you!
Why does this come up with an error: Total ${AgilityMod + WitsMod}$
I have component keys for both AgilityMod and WitsMod
Probably one of those has an error. Check the console for more info
This is error message: Custom System Builder | Cannot convert "Agility Mod: 2" to a number Error: Cannot convert "Agility Mod: 2" to a number
The agility modifier is a Number field
What's the formula within the error message?
if you run a ${consoleLog(AgilityMod)}$ does it come up with '2' or does it come up with 'Agility Mod: 2'? Because if it's the latter, it's a string, not a number.
AgilityMod is the component key of the following formula; ${first(lookup('Attributes', 'AttributeModifier', 'Attribute', 'Agility'))}$
And is a number field
I literally mean the formula within the error message. You can also take a look at the actually calculated properties within the error message
I cannot really understand the console, to be honest. This is what It is showing me:
Click on Object and expand that
There you have the values of your properties at the time of your computation
And now you can expand props
It is showing the my AgilityMod is not a number. It is a string with a number
So that is my problem.
Alright, so we've verified, that AgilityMod is at fault here
Now check for Attributes and expand that
Yes. I changed it and it is now working. I had 'Agilitymod: ${first(lookup('Attributes', 'AttributeModifier', 'Attribute', 'Agility'))}$'. I was presuming the text would read Agility Mod: and then show the number, but instead it took Agility Mod: and the number as the same thing. When I removed Agility Mod; from formula, then it worked.
I don't really understand all this code, just learning from trial and error!
Everything, that you write into a Label text, will be part of your value. So yeah, Agilitymod: became part of it
If you want to have text, that shouldn't be part of the final value, use Label prefix and suffix
Ok. So If I want some text to accompany the number, how would I do that, or would i need a seperate column for the text, before the number?
These won't become part of the properties
Ah, ok, so Prefix or suffix. Got you. I wondered what those were for - I thought they were to do with fonts and such like 😀
So, now I have that working and a lable which has the formula ${AgilityMod + WitsMod}$ with the Component Key InitMod. However, in Configure settings, under System Builder, when I set initiative formula to [2d6] + InitMod, it is not adding the InitMod to the dice roll - it doesn't actually add the InitMod. And when I click on the dice roll in the chat it says InitMod = 0, whereas it should not be 0.
By the way, I apologise for asking such basic questions, but I struggle with all the formula stuff.
Then let's go back to the console, but this time with the command game.actors.getName('yourActorName').system.props.InitMod
Sorry, where do I type that in on the console? I tried pasting it in in the bottom, and it came up with:
THis is what I have in the label box and in the Game settings:
It is now not allowing me to roll intitiative
Ok. I am an idiot. It is now working. I forgot to update the character sheets on the character. I am really sorry for wasting your time!
That's contrary to what you've posted above. [2d6] + InitMod is not the same as [2d6+InitMod]. The later would need to be fixed to [2d6+:InitMod:], because [2d6+InitMod] would be interpreted as /r 2d6+InitMod, which Foundry cannot resolve
Hey quick question, I saw that in setPropertyInEntity you are not able to change item entitys outside of item containers.
Is there a way to change a property of all items attached from an actor and using it outside a item container?
I'm kinda new with CSB and I don't have programing background so I'm struggling a little
Nope. setPropertyInEntity() only changes 1 property per call. The limitation with only inside Item Displayers will be lifted with the upcoming version and the function fetchFromUuid(), but you'll still struggle to get all Items.
On the other hand, it's pretty easy to do so with a Script: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Scripts/Scripts-for-Items#2-script-for-updating-multiple-items
Only thing you should keep in mind is to change game.items to entity.items as you want to change the Items of your current Actor and not those in the Item Directory
I'll give it a try, seems to be pretty much what I was looking for, thank you!
Is there a easy way to conditionally hide the plain text of a roll message?
Also glad to hear that the limitation will be lifted.
Either ${${!condition ? '#' : '!'}$"I'm just text, yeet"}$ or <span style="display: ${!condition ? 'none' : 'inline'}$">I'm just text, yeet</span>
I didn't put 2+2 together for the "!" making a rolled thing plaintext lol
Thanks a ton :)
what is the process of creating HP bars that the initiative system can identify?
when I look to set up health bars in the initiative options, it shows... unrelated stuff
Can you show the options?
Can you scroll there? Otherwise... nope
no, can't scroll
what you see is what I have
this is the list in the default token config dialog
Prototype Token. You wouldn't get this list in a default token
The default Token is configured from the game settings, while the Prototype Token is configured from the Actor
So you want it to show the character's hp in the initiative carousel?
Is that carousel combat tracker that you're using for it?
Probably not much, because these values are coming from our static template-file, which cannot contain user-defined properties by design
These are loaded before any Templates
Martin, what are the criteria for a key being loaded into the Attribute Bar? Is it a number field with a max value?
Although, my Combat Carousel still has a tracking resource...
Yeah, but only for Tokens
right, just checking.
You would have to change the path to the javascript path to the prototype values for the token.
Make sure that these match with the ones in the options of the Token
So I have a feeling that what's causing your issues with pulling up the resources on the token configuration might be how you're handling hp on the sheet.
You are misunderstanding something. The Token works fine (see the options in the Token). We have an issue with the Ressource Tracker in the combat tracker
Oh, I didn't see hp as one of the options there. Fair enough then.
how do I find the one specific parameter? the list is huge and hard to parse
These are the ones
Append them with .value and .max at the respective fields
ooooohhhh
at the end?
Yep, like the preconfigured stuff in Bossbar
I am not sure I get it
I am surry, I am new to all this: i am to append .value and .max, do I do that in the template actor somewhere?
You want to have HP-Bars, right?
Where's your HP stored?
Show me _att_base
You must fill Maximum value to let an Attribute Bar show up
You see the blue icon? That means, that it accepts Formulas
My best friend showed me tonight how to use the Custom System Builder. He did a lot of work, creating objects and a few templates, and then showed me how it worked.
Now that it's done, we've gone from a difficulty scale of 10/10 to 6 or 7 out of 10: I've understood things I didn't understand yesterday about objects and formulas, and it's going to take some time, which we'll be spending on Roll20 in the meantime, but I think I'll get the hang of it 🙂 . It seems a little less complicated tonight 🙂 .
it's one similar to what I used in the Total column, right?
Yep
Show me the Ressources Tab of the Token
You have to configure the Bar itself as well
It must come from attributeBar, props only contain single values
But changes are high, that you have to create these Components outside of a Dynamic Table to work properly
In a roll message, how do I output a string if a certain condition is met?
Example: How do I only output this line if the actor has special as a non empty string?
Special: ${special}$
I used a dynamic table because I thought it was simpler, no other reason
Can you filter lookup(), or something similar, by multiple checks. For example I have an ACTIVE column and an ATTACK column, each are checkboxes, and I want them to both be true for the result to be found.
Hm I tried using that and it successfully hides it. But it hides it all the time, regardless of if the string exists or not
Ideally what shoukd i use instrad?
Thanks
Show me what you've got
${${item.damageNotes ? '#' : '1'}$"Special"}$
Just the same setup outside of a Dynamic Table. You have to replace sameRow() with the concrete Component keys. That's it.
A number field will create an Attribute Bar automatically if it contains a max-value.
Tried with ! before item.damageNotes too
Remove the 1, it must be an empty string
${${!item.damageNotes ? '' : '#'}$"Special"}$
Nope, nothing
What's the output in the chat?
The total label roll message is
Range: ${item.itemRange}$ Damage:${[:item.damage:]}$ Pierce ${item.pierce}$<br>
${${!item.damageNotes ? '#' : ''}$"Special"}$
and chat output is
Move # to the other side. The logic is reversed right now
Yep that worked, thanks
Scratch that, it always displays the string regardless if the textfield is empty or not.
You are within an Item Displayer, correct?
Yeah, you are. The other values proofe that
What do you get in the console if you do consoleLog(item.damageNotes)?
Yeah sorry forgot to mention that.
Range: ${item.itemRange}$ Damage:${[:item.damage:]}$ Pierce ${item.pierce}$<br>
${${!item.damageNotes ? '' : '#'}$!"Special: "}$
${consoleLog(item.damageNotes)}$
Produces
Seems correct, you got the Label back there
Right, but its still there if the string is empty
The only thing I can think of are hidden whitespaces or newlines somewhere. Besides that, I don't know why it's still truthy
item.damageNotes ? true : false just for a sanity check
ill try, thanks!
True while there is a string, false when there isn't
Seems correct. You know what, scrap the first example and take the second one. It's probably easier to handle
The second example does work for strings, how do I make it work for a variable? Like displaying the content of item.damageNotes
Just a regular formula within the span
I still have to use a Label to get the Max values, no?
or maybe I could use Meter instead?
Sorry for the many questions today, this will be the last.
Whats wrong with my syntax here?
%{if (/^-?\d+$/.test(${item.cooldown}$)) {
return await game.macros.getName('Add Alert').execute({argAlert: {
label: '${name}$: ${item.name}$ cooldown recharges',
message: '${name}$: ${item.name}$ cooldown recharges',
userId: game.user.id,
roundAbsolute: false,
endOfTurn: false,
phase: "Squad Phase",
myDuration: parseInt('${item.cooldown}$'),}
})
}}%
If item.cooldown is a number (and thus the if statement is true) then everything is fine. But otherwise I get this error
the parenthesis for .execute({argAlert: ... doesn't seem to close.
no, maybe it does.. sec, let me stick it in notepad++
maybe hit it with an else {return;} ?
everything was in place when I went through it, so it's not missing anything I can see.
I tried that too, but
%{if (/^-?\d+$/.test(${item.cooldown}$)) {
return await game.macros.getName('Add Alert').execute({argAlert: {
label: '${name}$: ${item.name}$ cooldown recharges',
message: '${name}$: ${item.name}$ cooldown recharges',
userId: game.user.id,
roundAbsolute: false,
endOfTurn: false,
phase: "Squad Phase",
myDuration: parseInt('${item.cooldown}$')}
});
}else{return;}}%
produces the same error
Maybe a stupid question but I don't get it right now. On my actor I can insert a weapon item into a dynamic table. One column shows the weapon damage value: ${lookup('item.WeaponAttacks', 'DamageValue')}$
This lookup is because a weapon can have differenct attack/damage types. Now on my actor sheet the weapon damage is shown like "3,5" because lookup returns an array of values.
So here is my question: How can I replace the "," in the array with a line break so 3 and 5 are shown among themselves?
Okay, I got it. It was simple, just needed to add the right JavaScript function: ${lookup('item.WeaponAttacks', 'DamageValue').join('<br>')}$
I’m relatively new to game.macros.getName().execute().
How do you pass an object to the execute method?
Is it possible to create a macro that requires one or more parameters to be passed in order to execute?
(P.S.: Maybe I’m just bad at navigating the API documentation, but I couldn’t find this there.)
Hi, I found a small issue with the Example module for CSB - I re-downloaded it today and updated CSB to the newest version today as well... And I am told that I need to update CSB to the newest version, even that I just did? My CSB's version is 4.2.0, the Example file is 4.3.0.0
In the meanwhile, could I ask for a reminder how to how to make unequipped items not add their attributes to an actor?
I don't have much more experience than you, this is my first one 😄
What is it you want to pass?
You can certainly make macros that require parameters to execute though
I figured it out! I wanted to increase or decrease values based on an integer, but I'll settle for a test for now.
for those wondering
1- Create a macro with the desired name. In my case, I created one called testPrint:
// Macro: testPrint
const { args } = scope || {};
if (args) {
console.log("Argument received:", args);
} else {
console.log("No argument was passed to the macro.");
}
2- Execute the macro using the following inline code:
${%{game.macros.getName("testPrint").execute({ args: "Worked!" });}%}$
The example module is ahead of the system, which is intended. So either install an earlier version of the example module or change the minimum version required in the module itself (via right-click edit in the setup screen)
Is there a way to stop using inline coding inside ${%{}%}$ ?
You mean the kind of stop by throwing an exception?
I was referring to line breaks, like this:
${%{const macro = game.macros.getName("testPrint");
if (macro) {
macro.execute({ args: "Olá, Foundry!" });
} else {
console.error("Macro testPrint não encontrada.");
}
}%}$
From what i understood i need to write all of my code Inline like this :
${%{const macro = game.macros.getName("testPrint"); if (macro) { macro.execute({ args: "Olá, Foundry!" }); } else { console.error("Macro testPrint não encontrada."); }}%}$
No, you don't. You can use line breaks inside %{}%, no issue
I'm kind of lost using fetchFromActor...
I created a macro and simply tried to write:
const Mana = fetchFromActor('selected', 'Mana')
console.log(Mana);
and my console says
VM3113:3 Uncaught (in promise) ReferenceError: undefined. fetchFromActor is not defined
[No packages detected]
at Macro.eval (eval at #executeScript (foundry.js:20082:16), <anonymous>:3:15)
at #executeScript (foundry.js:20087:17)
at Macro.execute (foundry.js:20028:35)
at #onExecute (foundry.js:79391:17)
CSB-Functions are exclusive to CSB-Formulas ${}$. You don't have direct access to them in other places
Hi. Is it possible to make resource bar I can change through token?
All these (or meters configured in same way) do not work. Well, they work, just can not be added/subtracted through token 😭
Oh. I read it before like 3 times
and got it just now
sorry!
Thought I'd share some successes! The armor system for my implementation of the Project Moon TTRPG is done! with conditional display of passive effects and skills!
Is it possible to have a dropdown pull options from multiple dynamic tables?
Hmm, doesn't seem likely... Not sure there's a good way to even have a middle-man that combines them the dropdown then pulls from 🤔
maybe a way to double-up "lookup()" as a formula option for the dropdown origins?
${lookup()}$,${lookup()}$
Haha okay, yeah I was getting there eventually. Glad I was at least looking in the right direction.
Hi all! I apologize for the newb questions. I’m trying to use CSB to make a Dolmenwood character sheet, and several things are stumping me. The first is a simple die roll that I’m trying to apply to a label. I wrote it as ${[:strmod + 1d6:]}$ but it doesn’t work.
What am I doing wrong?
${[1d6+:strmod:]}$ or ${[1d6] + strmod}$
Thank you!
What is the best way to check if a dropdown (on a User Input) is empty or not?
equaltext to ' '?
hmm, or maybe just a == ' '?
No wait...
The first one
Just got it! Always right before I figure it out that I ask.
It's like shopping, you can look for an hour but the moment someone comes and asks if they can help you find something... it's right in front of you
Hmm, okay,
now I'm trying to generate an array that counts from 1 to a value in a number field for a dropdown, but even passing stuff through %{}% and I'm trying Array.from() but must be screwing something up...
For what do you need that Array?
Letting players choose how many "charges" to spend on a roll, up to their current amount
does range work? if I pass the charge variable to it? That might be easier...
%{return Array.fromRange(1, Number(entity.system.props.numberFieldKey) - 1;}%
Documentation for Foundry Virtual Tabletop - API Documentation - Version 12
FROM range.... ooooh okay
Heya, I'ma head to bed, but, I was wondering, since I can't figure it out, at least partially because tired, is there a way to remove all the default status effects from the bar/menu? using Monk's Little Details I can add new ones, but I'd like to remove all the old ones too. The system I'm working on has like 30+ statuses, so adding those on top of the default 35 is not a preferable prospect.
Any help would be appreciated, thanks in advance :-)