#Custom System Builder
1 messages ยท Page 47 of 1
The uuid key is always contained (along with 'name') in any item displayer, but it's not usually shown in the displayer
Is there a way to assign initiative from within a character sheet?
We are using an initiative variant that has a fairly complex formula, including user input. I don't see how it can be done in the normal "Configure Settings" without using "${}$"
In the system settings, you can set your custom initiative formula. This formula must be formatted like a roll formula, returning only an integer. The ${}$ must not be set around the formula.```
that means you can use keys, surrounded by ::
I haven't experimented with it though, so I'm not sure if the individual initiative rolls are generated from the actor sheets or from the GM; I think the former though, so that you could use something along the lines of :dexmod: in them
I can get it to work by accessing variables within the character sheet. For example "[1d20 + DexMod" works fine in "Configure Settings"
However, what I want to do is to allow someone to choose a different Initiative formula based on their plan during their turn. For example, the player choose a normal, slow or fast action. The initiative roll should be 1d20+0; 1d20-10; or 1d20+10
If it's a hot-change you might have to go with manual adjustment. Foundry doesn't roll initiative every round without a script.
Inside the character sheet I can use the ? operator to select a different formula. But it doesn't work in "Configure Setting"
I'm OK to reroll initiative every round. I just need a way to allow the player to select which formula to use when rolling initiative.
have a dropdown with their selected action type and call that key in the initiative formula?
set the Keys on the dropdown entries to -10, 0, 10 and the associated labels to Slow, Normal, Fast and it should return the Key that's selected on the dropdown as part of the formula.
Hmm. Clunkier than I was hoping since it takes 2 steps, but I think that could work. Thanks for the help.
No problem. There might be a more scripty answer to it, but that's what I can think of.
That helps, thank you. I think i figured out my problem though. Since item displayers can only do labels, I am using a trick in the Wiki for equip buttons as labels. <i class="fa-regular fa-'square-check' " style="color: 'green';"></i>
I just realized that trying to use a a 'true' check box as a row filter for that column using that label trick probably doesn't work. What would that column return if checked? Is it still possible to use it as a filter?
for the filter you can just use the item.equippedkey value.
equippedkey being whatever key you're using on the item to indicate that it's equipped.
you mean in regards to using the fetchFromUuid method?
Currently I was attempting to use lookup() or find() (still havent figured out the difference) in order to search through the columns of an item displayer and find the one checked off as equipped.
No, I thought that was a separate case. I used the same label bit for this:
<i class="fa-regular fa-${item.Readied ? 'square-check' : 'square'}$" style="color: ${item.Readied ? 'green' : 'red'}$; background-color: white;"></i>
To indicate if the item was equipped or not, but it toggles a checkbox on the item (visibility GM only) that is saved in the item.Readied key.
then I filter the item displayer by that key instead of by a column.
oh ok. so for that method you need a separate item displayers for players to choose which is equipped, then a second displayer which is showing only the equipped one?
Yeah, I do have that. I have a different tab for Combat and it displays only the equipped weapons and armor. The fiter for the weapons looks like this:
They have a full displayer of all items on their character in a different tab. Mostly because I wanted a place for the combat rolls to be clear.
Yeah, makes sense. I think i was just going about this the wrong way. Thank you!
No problem. And I know all about that. I spend a significant amount of time thinking the wrong way about stuff ๐
Part of my problem is that I'm trying to retain the way I have it right now, where players see the long bow item, but the Test column rolls the appropriate damage and stats for the equipped arrow type in side the item (under projectile attack options on the right. the dynamic table above the item displayer was the old way and Im trying to make use of the new update).
If I did it your way it would show an arrow equipped, not a long bow.
the top one, yeah, DT. but im trying to get rid of it and make use of the items in items method
And what do you want Test on the ID to be showing?
Ah, the bottom one on the Long Bow item is an Item Displayer showing "arrow" as an item.
And you want to pull that out.
to the parent table on the sheet to the left.
Test on the actor side display on longbow? The one reading Error at the moment? Id like it to display the dmg total of the arrow inside the longbow
If you've pulled the information to an item displayer on the item, then you should be able to use the key addressing from the sheet to the longbow item displayer's key.
what's the key to the item displayer on the item?
the key for the displayer on the item is ammoDisplayer
find('item.ammoDisplayer','DmgRoll'), assuming that's the key for the damage roll column
btw, find() is the same as first(lookup()); if you use lookup() it returns an array of all the values from the table that match.
yeah that works, except there may be multiple arrows on the sheet, so Id have to filter to the equipped one. I think thats where I'm getting my error, is trying to filter via column from that checkbox trick.
I need to know what that checkbox actually returns in code (im no good at finding out how) or find a better way to filter. the equipped one, like your method. I guess I could do your method, and then do a hidden displayer that just shows the equipped arrow, then pull the information from that? lol.
so the filter would be on the item displayer containing the arrow; you don't need a hidden column for it if you have the checkbox on the ammunition items.
you mean the display filter itself? I understand how to do that. Im tryining to get the weapon displayer on the left, where you said to do find('item.ammoDisplayer','DmgRoll') to find the dmg of only the 1 equipped arrow. if there are 10 diff arrows all with different dmg, wouldnt find('item.ammoDisplayer','DmgRoll') do an array? or first, rather than the equipped?
Ah, I see what you mean. It's going to be exclusive though, right? Noone is going to equip more than one arrow?
in that case, yeah, you might need a hidden column. That's what I had to do in order to make my armor equipping exclusive, like this:
(this is the armor Label Roll Message for the equip button)
${item.Readied ? setPropertyInEntity('item', 'Readied', "false") : equalText(string(first(lookup('Armor', 'armorhidReady', 'armorhidReady', 'true'), 'false')), 'true') ? notify('error','You cannot ready more than one set of armor') : setPropertyInEntity('item', 'Readied', "true")}$
Correct. So I guess i could just do one displayer as say the quiver holding x different arrows, and equip from there. then the equipped displayer will only have 1 arrow in it and find('item.ammoDisplayer','DmgRoll') works fine
with this being the Label Text entry for the same thing:
<i class="fa-regular fa-${item.Readied ? 'square-check' : 'square'}$" style="color: ${item.Readied ? 'green' : 'red'}$; background-color: white;"></i>
the advantage being that at THAT point, I also have the armorhidReady key to use for find() filters.
so if you have that key available, the code from earlier would look like find('item.ammoDisplayer','DmgRoll', 'isEquipped', true, ===) (edited to fix looking at the wrong command syntax)
I'll play around with it. I think talking to you gave me some ideas on how to handle it ^_^
Sounds good, good luck!
find('item.ammoDisplayer','DmgRoll', 'item.ammoDisplayer','isEquipped','===',true) that finds the isEquipped key on any item in a displayer?
I'm still having a hard time wrapping my head around the new added formula options.
Yes. It's more of a placeholder with an obvious name about what I meant
You would have to create a checkbox with the 'isEquipped' key for it on each ammo item for it to work as written.
and why use ===? I thought conditions used == for equal to
Habits, I guess? It won't matter as long as you're not using anything but a checkbox.
I was looking at the wrong code when I typed the example above, I fixed the original above that to match the signature for find().
@formal goblet What's the use-case for ref() vs just calling the key? Is it just for the fallback value?
or could you use it to say, have a dropdown with a list of other key values in the Key column and have those called dynamically in a roll, rather than having to use a lookup?
ref(dropdownKey) for most parts, where the option keys of the Dropdown match Component keys
Got it, thanks!
I am trying this code and return actor undefined error:
%{const periciasMelee = actor.system.props?.periciasMeleeTabela;const thisRow = Object.values(periciasMelee).find(row => row.danoMelee === "1d10+1");const danoMelee1 = thisRow.currentValue;return await game.macros.getName(danoMelee1).execute();}%
gotta get the actor first
const actor = game.actors.get(entity._id);
if ytou're running within a button in the character sheet this autofills idk about macros
entity // TemplateSystem
entity.entity // Actor | Item
Ok now the code is:
%{const periciasMelee = entity.entity.system.props.periciasMeleeTabela;const thisRow = Object.values(periciasMelee).find(row => row.danoMelee === "1d10+1");const danoMelee1 = thisRow.currentValue;return await game.macros.getName(danoMelee1).execute();}%
TypeError: game.macros.getName(...) is undefined
@formal goblet is it possible to target data of an item in an item from an actor? Example setPropertyInEntity, reducing the quantity of an arrow item, loaded on a bow item, from a roll button on an actor sheet?
I want Know too
setValues(fetchFromUuid(find('weapons', 'uuid', 'name', 'Bow'), "find('ammonition', 'uuid', 'equipped', true)"), 'amount', 'amount - 1')
im assuming the first itemDisplayer is the one with the Bow, and the second is the the one with the equipped Arrow? Sorry, still trying to wrap my head around all this new stuff from the recent update.
Like that?
%{const actor = game.actors.get(entity._id);const periciasMelee = actor.system.props?.periciasMeleeTabela;const thisRow = Object.values(periciasMelee).find(row => row.danoMelee === "1d10+1");const danoMelee1 = thisRow.currentValue;return await game.macros.getName(danoMelee1).execute();}%
It couldn't find the Macro under the name with the variable danoMelee1
I have a little problem. When player uses attack macro, that decresses HP of targeted token, error appear "User lack of permission to update actor". How i can solve it?
When i use this as a GM it all right
Example: roll 1d10+1
By requesting the change to the GM. There's no other way around that
What if token will not be attached to actor?
Same issue
But how can i do macro to automate battles for players?
So, I'm having issues with the dynamic table component; how do I call a part from the same line of the dynamic table to an equation at another column? I've tried using the keys, but I just get an error.
If the equation is out of a script, you can use the sameRow function
Syntax: sameRow('base_value', 0)
I did it
Finally
Thank you! This worked.
Damage is easy this way: ${[:sameRow('danoMelee', 0):]}$
danoMelee == text field containing the damage in Dynamic Table
more questions about this, cant get it to work. 1. do I still need to find the uuid of the bow if I'm rolling from the displayer the bow is already in?
- its finding the uuid of the ammoDisplay item where equipped = true, correct? if thats based on the equipped column name, will it read true using your label trick for displayers (equipped check box)? Because I'm getting a blank field returned when trying to display the equipped check.
- Yes, but then
sameRow() - Nope, Label has a different return
Is there a way to replicate the sameRow or sameRowRef feature, but along a column instead of a row?
My thought was to use the sameRowIndex, set it equal to a variable, then increase or decrease that variable by however many I need. But then I don't know how to translate that updated variable into the correct/original column.
does Math.abs() work in a rollcard?
And is that the easiest way to get an always-positive number in CSB?
What's the syntax on it, if so? I'm getting an Uncomputable Token on "Math"
abs()
ref('dynamicTableKey.', sameRowIndex() + 1, 'columnKey')
If you are at the first row of a table and reduce your index by 1, will it wrap around to the end of the table, or will it provide an error? Or will it just keep the original result?
Same for if you're at the last row of a table and do this?
It will error out
Does the index start at 1 or 0?
0
Thank you!!
Trying to use this function and unfortunately it's outputting the row index rather than the corresponding value from the row index of the listed column. Not sure what I'm missing?
Using this function in the DEdge column: ${ref('item.AbilityResults',sameRowIndex() + 1, 'HEffect')}$
This item table:
And here is how it's displaying on the item:
hey i have a quick question
I am trying to set a checkbox inside an item to false with the "setPropertyInEntity" Formula
However it shows error every time, is it something that can be done or am i just missing something
this is the formula i used and 'equip' is the key of the checkbox
${setPropertyInEntity('item' , 'equip' , "false" }$
Hello Community. Could it be that scripts in roll messages are read-only and only work with local copies of objects so that you have to work with SetPropertyinEntity to write values?
The objects are mutable, but won't be persisted in the DB unless you call Document#update(). That's how Foundry behaves: https://github.com/GamerFlix/foundryvtt-api-guide/blob/main/macro_guide.md
i have a very basic understanding of programming so this might be a stupid question
is there a way to make a function accessible in any field that accepts formulas?
i'm currently using this
%{function errornt(x) {
if (isNaN(x)) {
return 0;
};
return x
};
return errornt(entity.system.currency.KR)}%
to filter out errors that were causing issues but would like to just use
%{return errornt(entity.system.currency.KR)}%
You'd need a world script, which would load for every client and you'd need to store the function in the global window-object
actually that's a fair point
martin can you explain world script to me?
is this doable with little programming expirience or should i just let it be?
so if i do it right i just need to put
function errornt(x) {
if (isNaN(x)) {
return 0;
};
return x
};
in a world script and it should work or am i missing something?
You guys are using monks little details to change active effects or something else?
Since I didn't find a way to change Foundry's default active effects
I just updated to the latest version since i have a need for items housing other items with my current project.
Does anyone have any experince setting up item containers within items? How do i get them to display properly?
explain what you wish
I tried the simple
- create item container within housing item and filter for template of sub item
- drag drop subitems
both within the actor and outside
I just want to make an item that has an item container in it for display purposes, the item container needs to filter by a few conditions but i think i can manage that once i get anything displaying.
Regardless of how i change settings, nothing appears within the container
I dont think that works well.
But i know two ways to do that.
Using Griddy or Item Piles
update 4.3 allows for items to contain other items ๐ค i should just be able to make a 'backpack' item natively no?
(its not actually a backpack but the concept applies)
Yep, you should
is there something i need to enable or do the templates need to be made post update??
Nothing of the sorts.
can items only be added to an item within an actor or can i premptively do so?
(though i tried both)
There was a bug with 4.3.1, but got fixed with 4.3.2, where you couldn't drag Items from the Directory to an Item inside an Actor
Anything in the console when you try?
no errors normal messages
Logger.js:33 Custom System Builder | Created items YlhjV6HgqcFrFDg0
Logger.js:33 Custom System Builder | All props for Beggar (YlhjV6HgqcFrFDg0) computed in 1 loops.
Logger.js:33 Custom System Builder | All props for Beggar (YlhjV6HgqcFrFDg0) computed in 1 loops.
Logger.js:33 Custom System Builder | All props for Beggar (YlhjV6HgqcFrFDg0) computed in 1 loops.```
When you try to drag from an Actor to an Item inside the same Actor?
hold on. i think i found the error
do visability formulas apply before they're loaded into a character?
seems so.
They only decide, if an Item should be displayed or not. They do not prevent anything else
not filters
so my setup was:
- the item displayer itself was checking if the character sheet was in the creator menues, if yes display this displayer if no display this other dispalyer
- Neither displayed as it wasn't added to the character sheet
- added to character sheet, neither item displayer displays still. possibly not updating after being added to the sheet? checking to see if i had a typo in my visaiblity formula currently.
ah wait, i think i got it.
i can't ref('key') as a visibility formula within an item can i
i need to identify checking the parent somehow.
fetchFromParent?
yep that worked. should have thought about that sooner. sorry
Any Idea how to fix this
Trying drug and drop item to the compendium.
Even if I directrly create item in compendium - import it and trying drag and drop to compendium back
You can't drag and drop items into a compendium since tha last update. You can put the item into a folder and drag the folder to the compendium though.
wow, thanks will try. This is CSB limitation?
You are missing the function's closing bracket
Bumping my question from a few days ago:
I found out my foundry install was a bit busted so I reinstalled it. I'm gonna check my CSB to see if I can get a number to spit out to chat when I click a stat now.
Yep, I no longer get errors now.
well, for just printing out a number from a stat that is.
This popup that I'm working on
${#Roll(
?{checkdifficulty: "Check Difficulty"[number]},
?{statchoice:'Which Stat'|"MEstat","Mind"|"BEstat","Body"|"CEstat","Community"})
checktotal:=(checkdifficulty - statchoice)
[(:checktotal:)]}$
gives me this error.
the keys for the stats are MEstat, BEstat, and CEstat. am I not calling them correctly?
do I need to surround them with colons?
dunno man, but is everything displaying? is a more helpful error in the console?
yeah, I'm poking around and this
${#Roll(
?{checkdifficulty: "Check Difficulty"[number]},
?{statchoice:'Which Stat'|MEstat,"Mind"|BEstat,"Body"|CEstat,"Community"})
}$
${statchoice - checkdifficulty}$
now gives me a number print out
[(:checktotal:)] ? What is this?
Running a session in 5 mins. After that I'll get into that! Thank you for checking.
I figured I'd make a variable with the numbers already subtracted and see if I could get that to spit out. I should have removed the () though
[] is usually called to roll something
not sure if that's always the case but yeah [1d6] rolls a d6.
i think the colon has something to do with saving the variable for later use
ah ok
so now I just need to use the find function to compare the subtracted numbers total to my dynamic table and roll the correct value
ok, I've made this so far
${#Roll(
?{checkdifficulty: "Check Difficulty"[number]},
?{statchoice:'Which Stat'|MEstat,"Mind"|BEstat,"Body"|CEstat,"Community"})
}$
${find('rolltable', 'dicerollformula', 'checkdifnum', (statchoice - checkdifficulty))
}$
which ends up giving me this.
also it displays this
I feel like I'm fumbling in the right direction.
when I replace
${find('rolltable', 'dicerollformula', 'checkdifnum', (statchoice - checkdifficulty))
}$
with
${find('rolltable', 'dicerollformula', 'checkdifnum', '0')
}$
it gives me 2d8 which is correct
so I probably need to make new variable that equals statchoice - checkdifficulty and slot that in.
however it doesn't roll 2d8, but I'll figure out that issue next
How may I decrease a number field value in a Dynamic Table?
${#concat(
?{checkdifficulty: "Check Difficulty"[number]},
?{statchoice:'Which Stat'|MEstat,"Mind"|BEstat,"Body"|CEstat,"Community"}
)}$
${find('rolltable', 'dicerollformula', 'checkdifnum', ref(statchoice) - checkdifficulty)}$
From the same row or outside of the Dynamic Table?
i dont think you set it where you can call those values back later. I dont see and = anywhere
would ${checktotalnum:=statchoice-checkdifficulty}$ work?
not a coder lol dunno unless you try
k
dude no lie, i've trained a chatGPT chat on how to use CSB and use that to make 90% of my functions haha
im a UI guy at best
gotcha
from the same row
setPropertyInEntity('self', sameRowRef('targetColumnKey'), sameRow('targetColumnKey') - 1)
It works! Thank You Very Much, you help-me a lot
That ends up giving me this:
${#setPropertyInEntity('item', 'item.cooldown_active', item.cooldowndrop)}$ is this possible and im not getting the location or the property right. So im trying to have a damge roll set a cool down number from an item drop down, to a number field on the item,
How may I get and sum different columns from dynamic tables and values of outside from dynamic tables?
Then just without the surrounding ref()
${#setPropertyInEntity('item', 'cooldown_active', item.cooldowndrop)}$
sum(lookup('tableKey', 'columnKey')) + sum(lookup('tableKey', 'columnKey2'))
That ends up spitting out this
There is no error log for it either
${find('rolltable', 'dicerollformula', 'checkdifnum', statchoice - checkdifficulty, '==')}$ For a non-strict comparison
If it still returns undefined, then you have no match and you should think about using fallback() when using find()
That seems to have done it!
The question is how do I pass that string value to a roll
${#roll:= find('rolltable', 'dicerollformula', 'checkdifnum', ref(statchoice) - checkdifficulty)}$
${[:roll:]}$
Ah now it's working! Thank you very much!
ok, so setting the number worked, now im trying to use an end round button that currently reduces cool down by 1.
its a number field
${#setPropertyInEntity('item', 'cooldown_active', "item.cooldown_active - 1")}$
i have 120 of these errors, seemingly for every instance of whatever it is
how do i start to look for the source, i couldn't find just 'BI' mentioned anywhere
getting this with that change
the orginal roll sets the number but this does not adjust it
Quick question. What is CSB Embedded Items Folder?
A system folder, where Items of other Items inside the Item Directory are stored.
Items of other items? like a compendium?
@formal goblet any idea why this formula may not be working ive tried a bunch of adjustments to it and cant get it to work,
Not really, that's something different. Just keep the folder as is, CSB will handle the content of it automatically.
ok
Is it inside the Item Displayer?
yes
Then show me the error in the console if there's any
Try it this way: ${#setPropertyInEntity('item', 'cooldown_active', item.cooldown_active - 1)}$
Is the Button really in the same Item Displayer as the Item?
Well, that's the reason. Otherwise this approach won't work.
You'll have to use setValues(lookup('itemDisplayerKey', 'uuid'), 'cooldown_active', "target.cooldown_active - 1")
@formal goblet how do i get that uuid
As shown in the example. Every Item Displayer has a hidden uuid-column.
oh ok i thought it was an id i had to put in, uuid is the entry
that is awsome thank you
with warpgate gone and done, is there an alternative way to automatically apply damage from a player-initiated roll to an NPC target?
It works perfectily, thank you very much.
I think you have to go through sockets. But that's all I can tell.
Is there a way to hide the sheet refresh and hidden attributes buttons from even the GM? I've built my templates and (for now) I'm happy with them, so as I'm running sessions I'd like a cleaner look. Basically if I could set this to "Hide from all" and then move it back to GM if I need changes later.
Only via CSS for now
How do you get the additional item filter formulas to work in item displayers? For example, I have an item template for weapons, and a dropdown in the item that indicates if it is ranged or melee. Or a dropdown that indicates if it's piercing, slashing, bludgeoning, or some other kind of damage type.
I want the item displayer to display only items of the weapon item template (which I can do just fine by selecting the template). But then in the Item filter formula, how would I get it to filter by that dropdown?
I tried using 'item.ComponentKey' == 'DropdownKey' and 'item.ComponentKey':= 'DropdownKey' but neither worked.
equalText(item.key, 'dropdownKey')
Is equal text an actual formula? I didn't find it on the gitlab wiki anywhere. What does the formula do?
This works perfectly thank you!!! ๐
It's a Math.js command, they all work natively (without the Math. part of the commands), there's a link in the wiki to the full documentation for it.
If you set the minimum role to Game Master but don't change any other settings, you could run the game as a separate user account that is set to Assitant GM. By default, I think the only differences in Foundry for Assitant GM and regular GM accounts is being able to edit the World-level settings. So for running a game purposes, they should basically be the same, but you'd get that cleaner look you want.
that's a pretty smart work-around. props dude.
Thanks! ๐
is it possible to make a macro inside a label text?
Yeah, although I wouldn't refer to the term "Macro", because these are specific documents of Foundry.
# is only allowed in Label Roll Messages, so get rid of that.
Thanks!
what did i do wrong?
im gonna macro this to be able to see something in the sheet
the macro make it works :p
so-so
how can i make it return another variable?
i want to make something like:
%{return currentLevel; await game.macros.getName('XP').execute({entity: entity})}%
then
%{return halfwayTonextlevel; await game.macros.getName('XP').execute({entity: entity})}%
Howdy! (probably Martin, let's be honest, he's the help god)
I'm designing a chat/rollcard, and I was wondering if there is/what's the best way to only have text/a <tr> or <td> only display based on a computation?
I have "Focus Points" players can add to rolls for advantage, and I'd like the card to display the use of a focus only if they use one, otherwise the card display just skips the whole row.
1st is desired output (when a Focos is used or Fault Exploited)
2nd pic is desired output (with no Focus/Fault)
3rd is what I'm getting when trying to put the <tr><td> and text inside a formula. (${focus > 0? <tr><td><i>Focus: ... etc}$)
I have tried #none and '' as the "else" option when focus = 0, but it still displays that ERROR calculation up top.
Definitely a syntax error I'm not sure how to overcome... ๐ค
<span style="display: ${!focus > 0 ? 'inline-block' : 'none'}$;">Your content</span>
Ooh okay, I'm playing with it!
Though, I'm not sure how to <tr> and <td> in there without it ignoring the span display formula.
I either get the table formatting lines (empty) when I don't want 'em to appear, or I can't apply any formatting. Do I need to be putting rows and td/alignment/colors etc in the span styling, or in some other syntax inside "Your content"?
Yeah, best I can get is displaying that content outside of the table... I might be able to work with that though,
Oooh, think I got something with <tr style="display: ... >
hah! got it
<tr style="display: ${!focus > 0 ? 'span' : 'none'}$;">
Allows me to still use <td> inside that row and have my fancy formatting, while keeping the row full-width
what would i add to this formula to make it set the value to 0 if it goes below zero, i have the field set as min 0 but it still goes below 0
${setValues(lookup('powess_ability_display', 'uuid'), 'cooldown_active', "target.cooldown_active - 1")}$
please try ${setValues(lookup('powess_ability_display', 'uuid'), 'cooldown_active', "max(target.cooldown_active - 1,0)")}$
max(x, 0)
onw more question for the evening whats the command to check a check box for true for an item displayer
An Item Displayer doesn't have Checkboxes technically
It's all Labels, so equalText() (HTML counts as text)
err i want the item displayer to ref a chk box on a item to see if its true or false so it will know to display it our not
Or you directly check the Item itself with fetchFromUuid()
equalText('item.chkbox key',1) ?
If you mean the Item filter formula, then simply item.checkBoxKey
Very simple/silly question where I'm probably overlooking something right in front of me: is there a component key to reference the name of an actor?
For example, if I wanted a chat message to say 'Actor'sName used Fireball!' what would I use/reference to get the chat roll to pull the actor's name?
How would I combine a user input with table results in a roll label message? For this example, there should be a user input (checkbox) as to whether they have advantage (which gives a +1d6 to Hope).
I would use a conditional based on the variables you're setting in the player input. so the Hope line would look like:
<td>${Hope:= Advantage ? [1d12 + 1d6] : [1d12]}$}$</td>
use the key 'name'. as in ${name}$ used Fireball!
You can remove the box around it by prefacing it with !, so ${!name}$ used Fireball!
(I didn't actually do that for the screenshot, I thought about it after I had taken it and was typing..)
Okay, that works pretty well! Now to figure out how to hide the dice that get rolled with DiceSoNice ๐ค Thank you so much โค๏ธ it's further than I was
${#Roll_Formula:= Advantage ? '1d12 + 1d6' : '1d12'}$
${Hope:= [:Roll_Formula:]}$
Thank you so much! I'm in bed already but I will try this out tomorrow โค๏ธ CSB community is amazing
Is there a way to do a simple multiline text entry without the Rich Text Area? Interacting with the control is clunky and awkward, and the toolbar area is visually distracting.
Label would be the other Component. Otherwise there are none.
Here's the use case. Spells are items with a name, a mana cost, a damage type and I need a large field for the spell description.
The character sheet has a tabbed control. with a page dedicated to spells (which will be in an item display container). Most spells are several sentences in description.
How is everyone else handling similar stuff?
Is there some way to update a label's text? Maybe with some code in the label roll message?
Nope, these aren't meant to be changed by users.
Rich Text Area in Dialog editor mode. That's what I'm doing
let me see what that looks like. Wish there was a way to surpress the WYSIWYG section at the top of the rich text area
That's Foundry standard
If you don't need to edit it often, you could have the RTA somewhere else and the displayed description linked to a label.
Martin's tip will work for me, in this case. Thanks!
Can you nest conditions? In other words, would this work?
${a==1 ? b==1 ? "A and B" : "Only A" : "A is not 1"}$
If a is 1, then check if b is 1. If b is 1, then show "A and B", otherwise show "Only A", and if A isn't 1, then show "A is not 1"
Yep. Just use parens for the sub-condition and it should be fine
would there be anyone around who could help me write up some code for things for my character sheet?
chatgpt my friend
Hello Again ๐
to be frank with you............................ I've never used chat gpt... dont know how ๐ถโ๐ซ๏ธ ๐ฅฒ
yeeeeeeeeeeees plz
there's a free and a paid plan -- I'm on the $20/mo and it is worth if you do anything over the bare bone basics
i'll be free in like an hour
Im trying not to spend money... ๐ but if the free version will help me out then thats great ๐ , then ill see yuh in an hour ๐
free will get you by, tho there will be limitations -- should still be enough for most of what you want tho
yeeee basically want to make it to where the total health is auto calculated using all the factors... wanna make it so that their 'feats' descriptions can be displayed in chat at the press of a button, and to figure out how I am gonna set up the attacks page... thats all for now anyways...
hopefully the free version can do that much
that's actually so simple, but yes i can do that easy
i think the free plan limits how many messages you can send to it and you cant use the newer (better) versions till later
at the plan im on i can use the free models as much as i want, but have limits on new models, full access is like $200 a month ahha
yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee im not trying to be special...... just user friendly ๐ making this for a couple of people who haven't played dnd before so I wanna make it as easy to understand as I can
or you could use free copilot: https://copilot.microsoft.com/
i already have a paid gpt subscription and use it for art as well ๐
no point switching switching AI for less function and minimal quality diff
my intention was to give context to my answer so that it would be easier for Rhinobi to connect it.
Alternatively, you're welcome to ask questions about it so you can actually understand what's going on when you implement it. Was there something specific you were wondering about? You're welcome to message me if you'd rather not type it all in here.
I'm pretty confident, that I can beat the AI in terms of support for CSB ๐ฑ
Thank you both, but I was just in call with Scyrizu and he set me up quite nice, Imma see what I can do with it for now and if I need more help I'll ask right in here for assistance ๐ ๐ซ
I am stumped, I am trying to display the id of an item in a column of an item displayer alongside the item which is attached to an actor, using 'item.id' or ${sameRow('id')}$ errors
%{return linkedEntity.id;}%
That worked, thank you, what was confusing me was 'item.name' worked fine
Because name is a standard-property, that is present everywhere
id isn't
Although it should be present in the Item Displayer somehow
ahh ok, just this bit made it more so ๐
Also, every entry in the Item Displayer comes with 3 hidden columns: name, uuid and id, which can be referenced from Formulas.
It is as you can see
a quirk of foundry?
Dunno. What error do you get in the console?
Because I've tested this ${sameRow('name')}$ ${sameRow('id')}$ ${sameRow('uuid')}$ and it works as expected
undefined
Which version of CSB are you using?
never lucky with lookup. This time its a label, i think if its works on a label.
lookup('escondidos_boon', 'escondido_boon', 'keyescondido_bonus', '${pericia_atletismo}$')
getting deep into the bowels of this now, so I will be back with more questions
I'm referencing this table in an item:
This:
${BaseDamage:= lookupRange('item.AbilityResults', 'Damage', 'TierResult', FinalResult)}$
And this:
${BonusDamage:= lookupRange('item.AbilityResults', 'DmgBonus', 'TierResult', FinalResult)}$
both work. But this:
${Effect:= lookupRange('item.AbilityResults', 'Effect', 'TierResult', FinalResult)}$
doesn't work. What am I missing???
oh no question, but you need an administrative assistant to keep us from stealing all of your time haha. Enter GPT as the front line of stupidity defense
he just wanted a simple max health calculation referencing multiple fields and doing simple math on the values.
the whole thing should be in ${ }$ you shouldnt need to call ${ }$ again for just pericia_atletismo
i once spent 3 hours debugging a csb error... because of an invisible \n that was left behind from a time i pressed enter and deleted out the new line it made.
What does the console say?
I'm... not sure I know how to check the console.
Press F12
the only difference i see is that you have the variables names different to the column keys in all of them except the borken one, maybe CSB is confused about what you're trying to call after?
Try renaming ${Effect:= to something else (even Effects should be ok) just for testing
nope
Oh, lord...
How do your entries look like?
no clue then, but i'm still certian it's to do with '${pericia_atletismo}$'.
The Effects column is a rich text field, if that is what you mean?
I was just coming here to ask for help with my RPG system, just general ideas and trying to maybe use the Foundry to better organize it, and I see THAT.
im using lookup like this in another macro so this its just a scarecrow
Ah, that explains it. The target column of lookupRange() must contain numbers. Rich Text Areas can only contain strings.
ask away haha -- quick before martin leaves ๐คฃ
This is exclusively dedicated to the programming side of things, right? I would rather not importunate anyone.
For users, only the error message above is relevant. The stack trace at the bottom is for developers only to see, at which line of code the issue occured.
I have it working in a different roll chat though? A different roll formula is able to parse it and return the rich text field just fine.
i mean its largely used to ask questions about CSB -- a lot of bug fixing yes but i also see (and partake in) a fair amount of goofing off. I think as long as it doesnt flood the chat so people trying to solve issues / need dev attention you should be.
This channel is for all sorts of things for the CSB-system of Foundry. It's not exclusevly for code.
just obey martin, sacrifice your free will, volunteer to be a sacrifice to making link's code work and you'll be just fine
That's fair. I've been trying to develop a system with a combat perspective similar to Mega Man Battle Network and One Step From Eden. I have some "sketches" done on Google Slides, but Foundry really got me for how organized things are and I like organized stuff. I'm just trying to figure some stuff out in the meantime.
I doubt that it will work with exactly this formula. The issue is, that the RTA adds HTML-tags to the content, which becomes unusable if you try to convert it to a number.
Solved
${lookup('escondidos_boon', 'escondido_boon', 'keyescondido_bonus', 'pericia_atletismo')}$
If your line matches this ^ then it should work fine so far as I can tell (though you're right, lookup always throws me off too). I'd have to see the Dynamic Table to be sure though.
Is there a different way to pull a rich text field value, as a string, out of a dyanmic table using the lookupRange feature of checking a corresponding column as a range?
Foundry is fantastic. So flexible and stole my heart straight from roll20 at first glance.
The only complaint is that the drawing tools are booty.
CSB is also very flexible and modular, and is very helpful for making your system, though there is a learning curve to it. Certainly less than doing it from scratch tho ๐
even if you're pulling it as a string, you're getting all the formatting and html elements <p></p> that'd come with it, if i understand correct. does it need to be a rich text area and not a normal one? Should have less elements that way - then an be pulled with ref('Key').
There's also the string() function that pulls you out of text back into CSB functions.
Actually, nevermind. The lookup column is probably not a RTA. So it should work in theory.
Try out fromUuidSync('itemUuid').system.props.AbilityResults in the console and give a sample of the output.
It is already a string, string() will be ignored in this case
Expand one row
Wait, why does it say HEffect... I changed that
Because I clicked the wrong item uuid, hold on.
This is also wrong though, it's using keys that I updated on the template that look like they didn't get updated on the item.
Embedded Documents (Items inside Item or Actors) will not be updated when you click "Reload all templates"
Just removed it and added a different item. It's working now. What a wild ride.
You're the best - thank you for walking me through all that!!!
can we please get a "we love martin" emoji
With what kind of picture in the background? ๐
i mean your PFP is blackfrost anivia, maybe her holding a sign with a heart emoji ๐ฎ
Good luck getting that through Foundry staff ๐
I think you're best of if you start with a simple layout of the sheet without any automatizations involved. After that you can start with simple Formulas and increase the complexity bit by bit.
And don't forget that there's a Readme AND Wiki on our page, where you can read through stuff.
how can i make it works?
for some reason using lookup to reach the ${fisico}$ value return the exact string.
${mstr:=sameRow('oficiotree_tree',0)}$
${atrr:= lookup('escondidos_atributo', 'escondido_atributo', 'keyescondidos_atributos', sameRow('oficiotree_atributo',fisico))}$
floor(${sameRow('oficiotree_tree',0)}$+${lookup('escondidos_atributo', 'escondido_atributo', 'keyescondidos_atributos', sameRow('oficiotree_atributo',fisico))}$/2)
im trying to put a conditional on an item modifier is this how it should be set, ${duration_active >= 1 ? '(item.bonus_damage* item.buff_rank) + item.buff_lv' : '0'}$
i think you need more ${
i tried but its worse haha it simply returns ERROR
What's the error?
Surround the last formula with recalculate()
thanks!
The quotes are unnecessary. Rest is fine
@formal goblet tried it with out the quates getting no error but getting this which is the same with
How does your Label look like?
I suspect, that it doesn't contain a number. NaN means "Not a Number"
again, what its happening here?
since its says the correct value but don't save it on the right
How does your Dynamic Table look like?
@formal goblet
You can literally just write 0, same result
But that means, that something is off with the values within your Formula of your Item Modifier
just for help, this works. The first that i send that its not.
${#boon:= lookup('escondidos_boon', 'escondido_boon', 'keyescondido_bonus', '${pericia_medicina}$')}$
%{
const roll = await new Roll("2d12"+"+"+"${boon}$").evaluate();
...
Try it out with '==' as your 5th argument of your lookup()
how?
lookup() can have 5 args, not only 2 or 4
so: lookup('escondidos_boon', 'escondido_boon', 'keyescondido_bonus', sameRow('oficiotree_tree',0), "==")
like this?
Missing comma and quotes
Quotes around the operator. It should be interpreted as a string
Yep
${duration_active >= 1 ? (item.bonus_damage* item.buff_rank) + item.buff_lv': '0'}$ is my current formula looks like everything should be returning a number, as rank and lv are drop downs with numbers as the key and bunus damage is a number field
Surround it with consoleLog() and verify it in the console.
how do i verify it
I still see quotes btw
A log entry should appear after you update your sheet
The Components are fine. The formula itself is not, because it shouldn't contain any quotes. You're working with numeric values and not with text literals.
i got rid of all the ' and still giving me nan. i reloaded everything
Then change the modifier value to 1 and see if it still fails.
changeing it to 1 worked
Ah, and get rid of the item.-prefix
that was it thank you sir
How do I only output a part of a roll message if that string isn't empty?
<p>${!item.name}$ ${!item.keywords}$</p>
<p>${!item.actions}$, Weave: ${!item.weave}$</p>
${!item.description}$
I only want to output item.actions and item.weave if those actually exist within the item
I'd try a conditional.
Set the value if true to what you want, and the value if false to just "" so it'll display blank.
${!item.actions ? item.actions : ""}$
I guess I have to do another separate conditional for the comma?
Try ${!item.actions ? item.actions"," : ""}$
Just gives an error
I guess I also need the comma to only show if both actions AND weave exist, otherwise theres no need for it
does CSB really need to recompute ALL the props for items in a sheet, every time i update a value on that sheet?
sometimes doing it MULTIPLE times?
hallo
I have absoulutely minimal coding experience and I want to setup a character sheet for a system I like on forge lol
I've managed to do roll messages, even relate them to number fields when adding bonuses-the issue comes that I don't know how to display modifiers real time on sheet (Robust 10+7 Athletics = 17 Combined Bonus basically), and some other help on allowing me to add situational bonuses to a roll in a clean way would be nice too.
${'Robust'+'Athletics'}$
And
${?{bonus[number]}}$
Will prompt for a user input number on roll
that simple huh?
thanks-I might ask for more advice from here, I only managed to work out how to add colors, I'm that far behind lol
You're all good, I can't remember how to call that input as a bonus to a roll off hand right now and I'm already in bed so ๐
issue-what component is the first formula supposed to go in?
${'Robust_Stat'+'AthRank'+'AthItem'}$
is the formula I expanded on, taking in the overall Robust+Athletic Rank, and any Items that accompany that bonus, but it only comes back in error, I've tried number field for default value, label, and even text field and it comes back as Error or doesn't do the calculation at all
ah, no pictures, fair enough my bad
Because the quotes shouldn't be there at all
ahhh
doy, yeah sorry, coding is literally my bane
what about when I want to have it be a conditional value added?
Example-there is a 'Presence' skill, that can draw from Charm or Robust for its value, but obviously people are going to want the strongest value
==
likewise, the 'Proficency' of each skill can't exceed 20 among these combined skills, but it can exceed it using other values like situational bonuses. aid, etc. How do I apply a cap, while also allowing other bonuses to be applied?
i'll leave the questions there for now-I'll space it out so it isn't me being an absoulute goober when it comes to learning what is probably babies first steps about this thing.
Good morning.
${abas!= 1? ${setPropertyInEntity('self', 'abas', 1)}$}$
the logic its to change a radio button group value. And if i set a : "no" statement it works. But its a simple if and it actually dont have to do a thing if its false.
but that its not the main problem, it works but i cant see. The radio button simply uncheck itself, even if the value of the group has been changed. Its just visual but significant.
Another question
How can i use setpropertyinentity to change a check box. "True" doenst works
Have you tried 1 and 0?
No
It's true, not True
I tested both
Radio buttons would be better in this case since only one checkbox at a time could be true.
Trying to setup an item container to only display an item with the corresponding type. The item has a dropdown menu with several options, one of which is 'melee' as the key.
item.itemType == 'melee' ? 1 : 0
But this just throws an error in the console that it cannot convert melee to a number.
You must use equalText() when comparing strings
Ah I couldn't find that on the wiki, thanks
could you help me with this?
the radio buttons looks like this
1-4 sequence
i created that triangle that i cant click to erase it
There's an undo-Button at the top right corner of the Template
All the console gives me is "Cannot convert 'ERROR' to a number."
Bumping this once again!
Everything else in the roll works and displays correctly.
This is the same issue I had before some recent tragedies struck and I couldn't come back to fix it for months:
#1037072885044477962 message
This one.
${?{Oddity:'Oddity?'|"${!fetchFromDynamicTable('OddityTable', 'CSpheres').join('"|"')}$"}}$
This displays an error in a textbox
version 3.0.0 btw
And @formal goblet gave me this code, I don't even know how to read it xD
I don't have an environment for V11 anymore and 3.0.0 is really old now
cant undo that.
It took me a while to realize this triangle doenst clicks
Is that in a Container Component? Then move everything else out and delete the Container
no its just a label
But does everything look right with that line of code? The variables are correct
Is the Label in a Container Component like a Panel?
no
but this gave me an idea
Dunno tbf. It might be easier to use an User Input Template instead. That one should natively support a Dropdown with options from a Dynamic Table
โค heres the symbol
How would I go about finding this User Input Template?
thank you
If I update the VTT and the System, won't the only difference in the code be the "fetchFromDynamicTable" part?
There are way more changes to be fair and some parts will not work anymore. And some parts will be automatically migrated. But an update with such a big version difference will break stuff, which will need fixing
I know, which is why I can't really update. It would break everything. I have 3 different fully fledged systems on the same World which I made with CSB too.
So is there an "official" way to distribute premade items for CSB systems? Myself and a friend have created a CSB system for a game called Beacon, and we've made compendiums containing all of the core book items so people don't have to make them manually.
We've been distributing the entire thing, templates included, as a module, and having end-users import the templates with "keep document IDs" turned on. This works but only the first time, so every time we release an update and people have to reimport the templates, all the items in the compendiums lose their link to their templates. This causes a whole bunch of issues that can be fixed by the end-user but it's a lot of busywork and avoiding that was the point of the compendiums.
Is this the part I should be reading?: 8.11. Extend the system
4.8.2
oh, cause the link sent me to that. Lemme check.
I usually use the Adventure type to export Templates and Item and Actor types for concrete sheets
So, in that case, I'd have to create a unique item for every character sheet with their Oddity list and values (dynamic table)?
No, it's a special type of Item Template
Yeah, I'm creating one here to try and understand.
So, would I just add a value there that connects to a each different character? I'm so out of my depth here.
It doesn't really have a dynamic table option
So that can't be it
You create 1 Dropdown, select the Dynamic Table option there and enter the necessary data
Oh. Alright lemme try that
Oh, for the Document Type setting in the module's Compendium Packs page? Will try that, thanks.
${abas!= 1? ${setPropertyInEntity('self', 'abas', 1)}$: '${'test!'}$'}$
this works but doenst
It does not change which Radio Button is checked
but can alters "abas" value
Just ${?#{OddityTableInput}}$
It's cause I need to reference it to deduct from it in the same roll
The key you defined in the User Input Template will be referencable in your Label Roll Message
${setPropertyInEntity('self', 'Oddity', Oddity - Sphere)}$
Was using this after
Okay okay
I'm dumb
it's been a few months
${setPropertyInEntity('self', 'OddityTableInput', OddityTableInput - Sphere)}$
not the proper structure it seems
I tried with {} and with the # too
I can no longer recall what the differences are.
${?#{OddityTableInput}}$
${setPropertyInEntity('self', 'Oddity', Oddity - Sphere)}$
But, what is Oddity in this case?
If I don't set ${?#{OddityTableInput}}$ to be = to Oddity
The key of your Dropdown in your User Input Template
Oh
Okay, so far so good. But it does not reduce the value of the Dynamic table.
Even though the 'Column from the dynamic table to use as option key' is set correctly.
It shows a lower number on the roll label, but the dynamic table itself does not change.
I'll explain what your setPropertyInEntity() does at the moment:
'self': This will target the entity where the Roll is executed'Oddity': This will set the value of the Component with the keyOddityOddity - Sphere: The value it will set, will be the result ofOddity - Sphere
That looks like what I understand of it, yeah.
But I clearly am not understanding something.
${(?{Sphere:'Sphere?'[check]})}$
${?#{OddityTableInput}}$
${setPropertyInEntity('self', 'OddSpending', OddSpending - Sphere)}$
The key to the OddityTableInput UserInputItem is OddSpending
And in OddityTableInput it directs towards the OddityTable and the column CSpheres.
The point is to reduce the specific dynamic table value by 1 if Sphere is checked.
The JSON-structure of normal top-level Components look like this:
{
"Strength": 7,
"Dexterity": 5,
"Constitution": 5,
"Health": 50,
"WithdrawalResistanceValue": 10,
"selectedAttribute": "Strength",
"name": "TestActor"
}
The JSON-structure of Dynamic Tables and their columns looks like this:
"dynamicTable": {
"0": {
"column1": "Fighting",
"column2": 5
},
"1": {
"column1": "Flying",
"column2": 0
},
"2": {
"column1": "Skinning",
"column2": 5
},
"3": {
"column1": "Walking",
"column2": 10
}
}
And thank you Martin for all the patience.
This is about what I understand of it, yeah.
You actually have to tell setPropertyInEntity in the second argument
- Which Dynamic Table
- Which Row
- Which Column
you want to target for the change. You're missing all 3 of them
OddityTableInput:
Right, but that's supposed to be decided by the dropdown.
The Dropdown will return you the value of one of the CSphere you've chosen
And the dropdown now is based off of the UserInput item
This was your suggestion before the flood:
You are confusing key with value.
- A key is something like a reference or a data path, where your value is stored
- A value is... well, a value
For example: Strength: 5
- Key:
Strength - Value:
5
Right, so I can't use a dropdown?
You still can, but your Dropdown has to grab a unique identifier (like a name) to identify the right row later on with getRefFromDynamicTable()
man, why can't I remember these things ever. I have to re-learn all of this every time.
getRefFromDynamicTable() and fetchFromDynamicTable() work similar, but return different things.
- getRef... returns a Key/Path
- fetchFrom... returns a Value
Every time I bother you guys here, I learn all I need after quite a few back and forths, and then I program an entire system, and figure all of the rest on my own. Months later I have a new thing I wanna do, or an issue, and I can't remember one thing I learned. I must have a learning disability with programming, or some trauma or something.
Sorry. This was uncalled for.
Okay, can the UserInputItem do that for me?
felt this
Or do I have to go back to ${?{Oddity:'Oddity?'|"${!fetchFromDynamicTable('Odditytable', 'CSpheres', 'OddityName', 'something').join('"|"')}$"}}$
I started programming in C# to help my father when I was 8yo, and I stopped when I was 18, and by then I was absolutely done with programming. Decided to never do that again. A decade later..
That's not, what your User Input Template should be concerned of. You only need your Dropdown to help you point to the right row to let your Formula decide, which cell in your Dynamic Table should be updated
Something like ${setPropertyInEntity('self', getRefFromDynamicTable('dynamicTableKey', 'targetColumn', 'filterColumn', dropdownKey), 'your value to want to set')}$
Okay, then,
${setPropertyInEntity('self', 'fetchFromDynamicTable('OddSpending', CSpheres')', getRefFromDynamicTable('OddSpending', CShperes') - Sphere)}$
well, I got at least 2% of it right
The 2nd argument of setPropertyInEntity() must be a path/key. And remember:
getRefFromDynamicTable() and fetchFromDynamicTable() work similar, but return different things.
- getRef... returns a Key/Path
- fetchFrom... returns a Value
Okay, so this is valid?
getRefFromDynamicTable('OddSpending', CSpheres')
Being that OddSpeding is the key of the UserInput?
Cause the Target column is decided by the dropdown
rather, the target row
oh, I think I get it
oh
I got it
I missed the dropdownKeypart of your comment
๐คฃ never got far enough to make functional programs. every time i try to learn i end up banging my head into the wall.
I love formal logic, but man coding is like trying to have a debate in formal logic against an autistic grammar natzi.
"Your argument isn't logically valid"
why?
"I cant tell you exactly, but it's coming from line 372"
... (forgot a colon on line 301)...
${abas2==1? true : false}$
could you guys help me with that?
its a visibility formula
you dont need ${ }$ on visibility formulas
Doesn't help that my brain processes information in a weird way, where I need things to be really clear, even grammatically, kind of like a computer wanting you to program it, yet that is part of the reason I have such a hard time programming too. Autism has its ups and downs.
there's a way to make a warning text on the screen?
the yellow one
with ${}$
${notify('warn', 'TEXT')}$
thanks!
I'm trying to use the "items within items" functionality to have a weapon with different magazines the player could equip. That I have been able to achieve with item display and using a checkbox to mark which magazine is "locked and loaded".
For next phase I would like it to deduct ammo from the specific magazine by a random amount (1d6, 2d6, 3d6 etc. depending on rate of fire)
The keys I am using are:
In the magazine the loaded checkbox: _loaded
In the magazine the amount of ammo: _ammoCount
The item displayer in weapon: _MagazineDisplayer (with _displayAmmoCount and _displayLoaded as the columns which work perfectly with the magazines)
The "Fire" button is in the weapon sheet so I do not need to involve anything else at this point.
${#?{Rate of Fire|0}}$
<p><strong>Ammo spent:</strong></p>
<p>${roll:=[(:Rate of Fire:)d6]}$</p>
But that is where my coding skills hit the wall. How can I deduct the spent ammo from the equipped magazines _ammoCount? Any help appreciated.
bro i thought you meant magazine like... yk? Sports illustrated, and was like oh shit fallout buffs! I was so confused why you were talking about guns after, but i'm on board haha. I've been calling them mags too long ๐คฃ
Where are you running the formula from? Actor, Gun, or Mag?
@sinful spade lol I use mags too but thought it might confuse even more. From the gun. There is a FIRE -button in the gun for ammo expenditure.
is there different mag types other than say single, semi, burst, and full? e.g. explosive?
(Weird that fire rate is a property of the mag and not the gun btw but if it's easier for you i get it)
There are different ammo types (FMJ, subsonic, HP etc) but they do not factor in this and are handled otherwise. The rate of fire is not a property of tbhe mag. The idea is to ask how much extra ammo the player is willing to spend and the actual amount spent is Xd6. Kinda like Twilight2000 latest edition
So it is a property of the weapon, players cannot pick rate of fire that is faster than weapons but ofc they can decide not to go full auto and fire a lower amount
so if we're running from the gun and not the actor I think we'd just use
${'_loaded' == 'Semi' ? ('_ammoCount' - ([1d6])) : ''}$```
try something like that
I'm still troubleshooting. I'll mention here upon success or questions
@sinful spade is there a way to do it from the "Gun" like my initial formula which asks how much rate of fire would be used? A numerical value to roll d6's and then reduce that amount from the specific magazine? I prefer to do it from the gun sheet bc players might switch mags etc during firefights
Just deducting the raw number that the xd6 gives
sorry im a little confused about your component locations
loaded is a property of the gun and ammo the mag correct?
if so
${'_loaded' == 'Semi' ? ('item._ammoCount' - ([1d6])) : ''}$```
lemme note that 'single' and 'semi' needs to be set to the value of Key in the dropdown list
${setPropertyInEntity('self', getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', OddSpending), 'getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', OddSpending) - Sphere')}$
Okay, I am at a loss.
I was told the 2nd argument should be getRef, but I was also shown that the first one should be too. So both of them are. According to the formula that was given as an example, the OddSpending doesn't need ' ', and the set value does. That produces an ERROR. I have however, tried every other way, removing and adding ' ' in every instance with every alternative I could think, I have tried fetchFrom in both and either and the only way I get any results is if I remove the ' ' from the set value. It at least doesn't show an ERROR, it shows a -1 on the roll label for some reason. But it still doesn't deduct from the dynamic table.
And even if I'm just changing the ' ' I sometimes get this error:
And sometimes I don't
But I've counted all of the ()
and nothing seems out of the ordinary
is there a reason you havent updated CSB ๐ญ there have been a few renamings so i'm not sure the functions you need to use.
Many many reasons, sadly.
But your errors is pointing out that you have an excessive parenthesis
Yeah, but that shows up only when I have ' ' around the value
doesn't seem to make any sense
does it work without ''
Not really, it just doesn't give me an Error, but the purpose of this is to alter a value on a Dynamic Table, which is picked on a dropdown connected to a UserInput Item
@sinful spade _loaded is a property of the magazine, meaning is that specific magazine loaded in that specific weapon.
The weapon has an item display showing all the magazines but naturally only one can be loaded. The mag has the _ammoCount which is the amount of ammo in that specific mag, so it is also a property of the magazine. But since the item displayer can display stats from the item, the magazine displayer in the gun shows all the mags and how much bullets they have left.
there appears to be an erronious ' before the second getRefFromDynamicTable
or if it isn't extra then there needs to be one after the () as well.
'getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', OddSpending)'
and if that's the case then do you need to pu them on the first getRef as well?
oh weird. so both are mag properties.
i thought loaded was a property of the gun- as in a dropdown value or radio button saying what mag was selected so to speak.
I was hoping to achieve that but had no idea how to include magazines in drop down since the amount of mags and types of ammo in them might vary
Also wasn't able to get the "equipped" checkbox for magazine to be selected from the gun so now players need to go to mag to "lock and load" that specific mag
I've tried both of those again, but no dice :/
so you removed the ' before the second getRef, and it didn't work, added it back and added one to the end of the functions ) still no? but did you add it before and after the first function as well?
you can 100% change the mag equipt from the gun do you want to do that?
Yeah :/
yk i think i had a similar issue trying to reference a value in a table and subtract something from itself. I resolved it by putting a label with no visibility outside of the table and using that for the subtraction
something about self = self -1 doesnt seem to work, but if it's
self = notexactlyself - 1 worked fine
@sinful spade oh definitely that would be ideal. I just had no idea how to make it selectable from the item displayer
from the wiki:
Create a Label in the Item Container (this will be the Checkbox-column in the Container)
Label text: <i class="fa-regular fa-${item.equipped ? 'square-check' : 'square'}$ " style="color: ${item.equipped ? 'green' : 'red'}$; background-color: white;"></i>Label Roll Message: ${setPropertyInEntity('item', 'equipped', "item.equipped ? false : true")}$
(Optional) Uncheck Send roll message to chat to avoid sending a Chat Message with every click
replace item.equipped with item._loaded
you can css style it however you want
I'm pretty sure I've done something like that before as well
so in mine:
and I have likely said these exact words towards the exact same solution at least one time before.
the star, chest, and shield are all item toggles changing check values in the item from a displayer in the parent
Oh how do you guys partition inventory? Was that available in 3.0.0?
item displayer filters ^^
Is there any way for an item displayer to show how many items are contained in another item displayer?
I did try this before and it didn't do the reduction:
${setPropertyInEntity('self', getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', 'OddSpending'), OddSpending - Sphere))}$
need ' ' around OddSpending - since it's a number, no?
I'll try to turn OddSpending - Sphere into a thing
does checkbox work as 1 or 0 or as true or false?
true or false, but it does seem to always have the value of either 1 or 0
or at least I've used it like that sometimes if I remember correctly
('OddSpending' - 'Sphere') if it's a number,
or
${Sphere == true ? (setPropertyInEntity('self', getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', 'OddSpending'), OddSpending - 1))) : (setPropertyInEntity('self', getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', 'OddSpending'), OddSpending - 0)))
${setPropertyInEntity('self', getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', OddSpending), fetchFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', OddSpending) - Sphere)}$
besides, when I do x - true it does always show the result of x - 1
ahh, i never remember when i need to lookupRef or just lookup ๐ฆ
I've tried that. But I'll try again.
Checkboxes always contain booleans, so either true or false. Nothing else
It's just that booleans can be converted to numbers if needed
wdym? like an item displayer displaying a #? or just a sub display of certain items contained within another list
man. i wish i understood computers haha
is that a CSB thing or is true always auto-converted to true?
Did not know that was a thing, always thought none of the "if" equivalents worked
Can you remove the HTML for now?
Yep, displaying a #
Oh, yeah, been a second since I checked
oh
Yeah, HTML got in the way again
like inventory quantity?
or do you mean a raw sum of all items contained?
e.g. 5 arrows -- or
{arrow, bow, sword, backpack} == 4 items
Btw, you only use quotes when you want to declare strings. So something like 'Hi' or 'Hello world' or '32' if your intention is that it should be handled as a text and not a number. Otherwise you don't use quotes.
Interesting thing is, I've tried that before, and it would show in the roll the result of Value - 1, but not deduct. Now it just shows a 0 and does not deduct.
wait what??? half the time i'm declairing numbers and it doesnt work without ' ' ??? ๐ฎ
But sphere is a checkbox.
Okay thank you
Yeah, I've experienced that, but I think it's because it needs the declaration to find the key or something
I tried just changing - Sphere to a - 1 but same result
The raw sum, the system i'm working on is based on the persona series and a character's persona can only have a maximum of 16 spells on their repertoire, so i want the table to quickly show how much spells they already have
I need you to give me the result of every single variable you're using, so that we have all necessary values you depend on.
count(lookup())
i was just reading to figure this out haha
Thanks!
Spheres left should show the amount left in the Oddity
Oh
I think I know what the issue might be
OddSpending is a number, but you want it to be a string with a name, that matches with one entry of the OddityName-column
I was wrong
Also, show me your current Dynamic Table
Good, but also with actual values
Yeah, the Dropdown will be our row-selector.
Okay okay
I have a feeling you taught me this 6 months ago
before the flood
Thank you for the patience.
We want the Dropdown to return 'Path of Intention', so that we know, which row we have to adjust
I set it now
It did show Path of Intention on the dropdown but because I picked it as a label
any luck?
The Label is just for display. The actual value is retrieved with the option keys
I know I know, but I directed it directly towards the value, as CSpheres (Current Spheres)
but now it is directed towards the name instead.
It's working now
that was the issue all along
The UserInput needed to be set to the name rather than the value I wanted to change.
Thank you guys.
Now, there is 1 odd thing, and one "window" issue I'm having, that are likely obvious but I don't understand it.
The first is this:
which is related to this:
${#concat((?{Act:'Actions?'[number]|0}), string(?{Roll:'ROLL'|'2d10',"Normal"|'3d10kh2',"Advantage"|'4d10kh2',"Domination"|'3d10kl2',"Disadvantage"|'4d10kl2',"Submission"}), string(?{method:'METHOD'[number]|0}), (?{Energy:'Energy Spent ='|"CNothing","None"|"CStam","Stamina"|"CWill","Willpower"}), (?{Sphere:'Sphere?'[check]}))}$
Well, 2d10 is simply not a number. The console is right ๐
But it works just fine
I know :P
But it will not stop stating that to me every time
Even though it works just fine
it's nothing important, really, that one is just annoying, logging an error every time
I wondered if there was something I could do about it.
@sinful spade Awesome! I have the weapon display and indeed the mags can be chosen from there so that is an improvement for sure, thanks!
I still am not able to get the ammo deducted from a specific mag though... any help with that would be appreciated!
And the other one is this:
${#concat((?{Act:'Actions?'[number]|0}), string(?{Roll:'ROLL'|'2d10',"Normal"|'3d10kh2',"Advantage"|'4d10kh2',"Domination"|'3d10kl2',"Disadvantage"|'4d10kl2',"Submission"}), string(?{method:'METHOD'[number]|0}), (?{Energy:'Energy Spent ='|"CNothing","None"|"CStam","Stamina"|"CWill","Willpower"}), (?{Sphere:'Sphere?'[check]}), (?#{OddityTableInput}))}$
With the addition on the very end appearing in a separate window, instead of inside the same one.
${#concat(string(?{Act:'Actions?'[number]|0}), string(?{Roll:'ROLL'|'2d10',"Normal"|'3d10kh2',"Advantage"|'4d10kh2',"Domination"|'3d10kl2',"Disadvantage"|'4d10kl2',"Submission"}), string(?{method:'METHOD'[number]|0}), ?{Energy:'Energy Spent ='|"CNothing","None"|"CStam","Stamina"|"CWill","Willpower"}, string(?{Sphere:'Sphere?'[check]}))}$
I need to look into this later!
You just added a string to the Sphere?
Lemme try that
It worked!
Weird but noted
But yeah, there is the separate window
Should I try String on that too?
Doesn't feel right but I'll try
nope
Is that in the same Label Roll Message as the User Input Template?
Then you have to shift everything you've written there to the User Input Template with corresponding Components
It will always do that by design
You either use the User Input Template or simple prompts. Or you can use both, but they will always appear in their own windows
Oh
Hmm
Can I make the UserInputTemplate only appear when the Sphere checkbox is checked?
Nah
Damn
Alrighty
Thank you
One last thing
?{Energy:'Energy Spent ='|"CNothing","None"|"CStam","Stamina"|"CWill","Willpower"}
can I make the "CNothing" into just a blank option?
Just use an empty string
so like, |"", "None"|?
Careful, you can't have an empty string as a key. 'None' is your value and that can be an empty string
ah!
Oh
with empty string
you mean some invisible number field in the sheet
That's what CNothing is
I thought I could just leave it blank so that it won't say CNothing -1 every time :P
Nah, empty string is this here: ''. That's literally an empty text
And invisible only means, that you as a user don't see the Components. The values are still present and stored
When I do that I get this:
So I thought I got it wrong
Yeah, that's why I wanted to avoid that
And now the big question. Where do you use Energy? Does it allow you to have an empty string?
The dropdown decides which energy is spent, and if an energy is selected it rolls an extra dice based on a bolean.
This is the whole mess:
${#concat(string(?{Act:'Actions?'[number]|0}), string(?{Roll:'ROLL'|'2d10',"Normal"|'3d10kh2',"Advantage"|'4d10kh2',"Domination"|'3d10kl2',"Disadvantage"|'4d10kl2',"Submission"}), string(?{method:'METHOD'[number]|0}), ?{Energy:'Energy Spent ='|' '|"CStam","Stamina"|"CWill","Willpower"}, string(?{Sphere:'Sphere?'[check]}))}$ ${(?#{OddityTableInput})}$
${sameRow('Skill')}$
Roll ${RollResult:= [:Roll:]}$
Aspect ${#Aspect:= ref(AspectLocked)}$ ${#AspectDice:= equalText(Energy, 'CNothing') ? 0 : 1}$ ${AD:= [:AspectDice:d:Aspect:]}$
Method ${method}$*2
TOTAL ${(floor(RollResult + (method*2) + Sphere*2 + (((sameRow('SLevel'))/10)*2))) + (floor((((ref(sameRow('MainSCS'))))/10)*2)) + AD}$
Cost
AP Used ${Act}$ out of ${setPropertyInEntity('self', 'Actions', Actions - Act)}$
${Energy}$ ${setPropertyInEntity('self', Energy, "equalText(Energy, 'None') ? ref(Energy) : ref(Energy) - 1")}$
Spheres Left ${setPropertyInEntity('self', getRefFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', OddSpending), fetchFromDynamicTable('OddityTable', 'CSpheres', 'OddityName', OddSpending) - Sphere)}$
${CharName}$ ${CharSurname}$
This one fails: ${setPropertyInEntity('self', Energy, "equalText(Energy, 'None') ? ref(Energy) : ref(Energy) - 1")}$
Because ref('') is an error case. It can't find a Component with the key ''
So CNothing it is, yeah?
Do you have a top-level Component with the key CNothing?
Just a key at the bottom of the sheet
I CNothing wrong with that I guess
Thanks again!
Heya peeps, trying to turn this logic into something which returns its corresponding roll rather than completing its corresponding roll (the roll gets called somewhere else) - what syntax am I getting wrong here? Don't thiiiink it's the logic going wrong, but I may be wrong.
${or(move_type == type1, move_type == type2) ? (not(type2) ? (move_advancements == move_advancements_0 ? [d6] : (move_advancements == move_advancements_1 ? [d8] : (move_advancements == move_advancements_2 ? [d10] : (move_advancements == move_advancements_3 ? [d12]:))): (move_advancements == move_advancements_0 ? [d4] : (move_advancements == move_advancements_1 ? [d6] : (move_advancements == move_advancements_2 ? [d8] : (move_advancements == move_advancements_3 ? [d10]:))))): (move_advancements == move_advancements_0 ? [d4-1] : (move_advancements == move_advancements_1 ? [d4] : (move_advancements == move_advancements_2 ? [d6] : (move_advancements == move_advancements_3 ? [d8]:)))))}$
How does the Add Filters work exactly?
Cause I had in each item a dropdown to select which type of item it was, could I sort the inventory by that?
Ahh so it's executing before getting to the end :/
you can. just put it in the filter
item.filterValue == filterKey
So like, if I set ItemType is Currency, referring to the dropdowns on the items
The currencies will appear separate?
Didn't seem to work
it just hides all of the items
Example
I'm checking cause it'll be a bit of an ass to make an Item Template for every item type and then update hundreds of item sheets one by one
Hi guys me again, if a character have multiple items on his inventory, how can i make an item to only give his item modifiers if it is equipped?
An ItemType cannot be 'Currency' and 'Miscellaneous' at the same time, that's why the expression will always resolve to false
Hi All, i have an interesting one. I have a Label (lets call it labelA) that has a formula and auto calculates, this calculates correctly. I have another label (labelB) again has a formula and this also auto calculates correctly, I have 2 user input number field (numberA and numberB) I have another Lable (lets call it totalsLabel) that has this formula ${labelA+ labelB + numberA+ numberB}$. The issue i have is if the user input number fields update the totalsLabel auto calculates correctly, but if labelA or labelB updates totalsLabel does not auto calculate, i have to hit the charactersheet refresh button to get it to calculate, any ideas on how to fix this? There is no errors showing in console.
${equipped ? 5 : 0}$
I don't understand. ItemType is the dropdown key, and Miscellaneous is one of the options of the dropdown.
So what I thought this would do is that if the dropdown is Miscellaneous it would be separate from the Currency.
that's why I set two different ones
as a test
Think of the Filter as a test. Whoever passes the test to 100%, will be displayed in the Item Container.
Oh
So it won't separate the items in different tabs?
That's what I had asked earlier :P
Damn, gotta update all items now I guess.
No. The only job the Item Container does, is to display Items.
But you can setup a second Container, that should display other Items
Thanks!
i'll check later mid game now remind me tomorrow
Wait, really? Cause every time I created another container it displayed the same items, I'll try again when I can
yeah pretty much what martin said, i have different item displayers filtering for different values to show the items that meet that criteria -- so only species show up in the species item container, only weapons - armor - and accessories in the container meant to catch those categories.
You could make all these dropdowns static like I have, and if you want them to connect to the dropdown change the visability formula to display whichever is selected so it looks like it's real time filtering
Actually, I have a bit of a ... not so much problem but minor inconvenience - and I'd love some community input to resolve it if possible.
I have a lot of buttons that open items in the character sheet - largely things like INFO buttons (among others) that effectively just open an item or journal based on UUID before it's added to the actor sheet.
The problem is for these buttons to work, the players need at least observer level access to the items, which clutters up the items on the right hand window (because there are a lot, yes they're in folders but still).
I could toggle permission for those items before the command is executed I guess, or potentially just hide the GM folders somehow. Any other ideas?
Well, that's a limit by Foundry. CSB is not involved there
i figured, but any workarounds?
it's just untidy
Not that I know
as far as CSB limitations -- can we get the embedded items folder to be able to be nested?
it'd help some
i need a module that lets me nest further so everything can be in 1 folder and that'd be better
That folder shouldn't be touched by users at all to be fair
oh okay, i didnt know if they'd need to open items within it - like when they click open a back-pack then a dagger that'd be in that folder they dont need access?
They would need access, but Users don't have to go into the Folder manually, because they can open the Sub-Items over the Parent-Item.
OH yeah that'll work!
https://foundryvtt.com/packages/permission_viewer/
Dunno if this one helps you
Ownership Viewer, an Add-on Module for Foundry Virtual Tabletop
I was super exhausted yesterday.
Gonna set it all up today.
sadly no, i've just accepted there'll be a mess of folders.
that or i can upload them to a compendium and update all my macros to check there --
Same case here.
Martin ๐ฆ i'm trying to help @shy osprey but gpt isn't able to grasp the syntax of nexting JS in CSB logic
${%{const magCount=entity.items.filter(i=>i.system.props&&i.system.props._loaded===true).length;return magCount;}%!==1?notify('warn','Expected exactly one loaded magazine'):""}$
is the last version fo the code we had but getting syntax errors on char 4
_loaded is a component key of a sub item,, if that helps - we're checking that only one item is loaded at a time in the displayer
And where is the executing Label?
in the parent item
What about ${count(lookup())}$ on the Displayer then?
Hey! Can you share that link about the changes I need to make in the formulas since 3.0.0?
I'm trying a virtual update
like, fetchFrom and getRef
Thank you Martin
That'd count all items not just _loaded ones
supose we could have a new displayer filtered
Do you think I could just open a Json of the templates and find-and-replace all of the differences?
You know that lookup() allows to filter?
Yep, would work.
Awesome! Thanks
count(lookup('itemDisplayerKey', 'name', '_loaded', true)) if you have an invisible column in the Item Displayer with the column key _column
@shy osprey ^
what's the invisible column doing tho
umm, where are those stored, again?
I forgot
Not in documents
I imagine
That should just contain ${item._loaded}$. It's always invisible if the visibility formula is false
Not in systems, and not on the Game Folder, unless I named that weirdly and forgot
Right-click -> Export
Yeah, I did that, but where would I import it into
Right-click -> Import
Oh, like, just in-vtt
I thought I was doing this in another format
dunno what I was thinking
I was just gonna go to the folders and edit there instead. But I just realized that I don't remember that being a thing
wait actually this hsould be different if he already has a column that made a checkbox to toggle it no?
we should just be able to use the checkbox column to check the true values of that column no?
The thing is, it is not a true Checkbox, it's a Label that just simulates one with HTML
The return of that cell would be the string with the full HTML
ahhh
Okay, so version 4.2.3 no longer has the same item filter in the item containers from before. It's a more customizable one. What would be the formula for filtering something by a specific dropdown key in the item?
equalText(item. dropdownkey, 'key')
Thanks dear, I'll try.
I am copying an actor,
const newActor = await originalActor.clone(data, { save: true });```
how would i update a variable when it is created?
I tried
```const data = { name: itemName, folder: folderdata Assigned_ID: "1" };
const newActor = await originalActor.clone(data, { save: true });```
however this does not update the hidden attribute
I tried that, but it didn't seem to filter the inventory, nothing changed.
are you trying to make only certain items show up
Each item has a dropdown in it to select its type. I wanted to make an Item container that only shows items of one type.
equalText(item. ItemType, 'Currency')
equalText(item.ItemType, 'Currency')
It just suddenly worked
no space between the . and the drop key
It seemed to be creating blank spaces in the middle of the text field
I had removed it as well, and it hadn't changed. But I think it was the blank spaces.
my way of filtering
It's fine now
yes always chk your feild for mysterious blanks
Thank you brothers
Hidden Attributes behave like Labels. They cannot be changed by users, because they are constantly overriden by the system.
my players are having an issue dragging items from the directory onto items, works fine for me as a GM though. Has anyone else experienced this or know what the problem is?
so i should use a number field?
Yep
how would i then update the number field?
I just changed it, and it still isn't working
There's a missing comma in data
nope, it's there
And it should be system.props.Assigned_ID: '1'
doesn't like the '.'
I can grab the ID of the new actor, then update it after creation
You have to convert it to a nested object. The dot-notation doesn't work that way.
system: {props: {Assigned_ID: '1'}}
Trying to hide an entry when a checkbox is ticked, image works in reverse
tried item.Char_Assigned ? 'false' : 'true', but it no longer works
doh, I am a dumbass 'false' is a true statement needed to be ''
not(item.Char_Assigned)
oh cool ty
Hi All, I have an issue with labels not auto calculating. I have a Label (lets call it labelA) that has a formula and auto calculates, this calculates correctly. I have another label (labelB) again has a formula and this also auto calculates correctly, I have 2 user input number field (numberA and numberB) I have another Lable (lets call it totalsLabel) that has this formula ${labelA+ labelB + numberA+ numberB}$. The issue i have is if the user input number fields update the totalsLabel auto calculates correctly, but if labelA or labelB updates totalsLabel does not auto calculate, i have to hit the character sheet refresh button to get it to calculate, There is no errors showing in console. Does anyone have any ideas on how to fix this?
%{
localVars.newActorID = newActor.id;
}%
${setPropertyInEntity('item', 'Assigned_ID', newActorID)}$
gives error
uncomputable token
nm I figured it out
What would be the best method to make a dynamic table roll show using the normal roll dialog rather than the inline system?
The image shows my current roll message and roll behavior, and then the roll posting method I would like to use:
Ok probably dumb question but if i wanted to include a modifier from a character sheet in a players roll how would i do that. i originally figured using the property reference chat feature but that only works to display the number in chat, not include it in math
ok i need to be more specific, im trying to include it so it can be passed to a macro as all skill checks are rolled on a table
still works with rolls just fine just not macros like /macro SkillCheck mod=@AdrenalDefense. doesnt throw an error but it returns a 0 for said bonus
Are there Uncomputable Props warnings in the console?
No unfortunately not, this is why i am lost. it seems to skip the property in the auto calculate, then i press the sheet reset, and it then calculates it. I even tried with just one label (rather than all 4 items) it still did not work (PS this is v11.315, csb 3.2.5)
What is the correct syntax for checking if a value (Hood) is present in a column (Name) in a dynamic table (Mount_Location) contained on an item on a different actor (Assigned_Player)?
I think there were issues about that in the earlier versions, but should be fixed now (at least I haven't heared anything)
Thanks Martin, do you know what version of CSB i can try that is still v11 compatible that this could be fixed in?
can anyone help me out with making a certain system?..
im lost when it comes to making the sheet
๐ญ
Indeed there is an issue there... I looked at it, and the solution is not easy. I can fix the base problem easily enough, but it doesn't work when the item contains items itself: contained items are not added to the sidebar with the main item... And this is tricky to figure out...
Nevermind, I found a solution.
I'll add in the README that Compendiums are not officially supported, but dragging from a sheet to the directory works now
Hey, it's already in the README ^^
is there a way to make the tables have lines separating each column...? cuz everything keeps getting pushed to one side and I just want it all to stay where it should be
Yeah that'd be a css thing. You can select all td and give them a border right if you want for the same effect simply.
So can someone help me find what i'm missing (or rather, what i need to change) on the following formula? Its made as a damage checker to determine whether the damage will be a normal(no), critical(yes) or a maxed critical(kokusen). The problem is that, whenever i choosethe "kokusen" option, the number dialog still appears, which it shouldn't since its formula isn't on the Kokusen check. The message still rolls the maxed critical but it still asks for a number modifier, even though it does nothing.
`${#concat(?{Crit_Check:'Crรญtico?'[button]|'nรฃo','Nรฃo'|'sim','Sim'|'kokusen','Kokusen'})}$
${equaltext(Crit_Check, 'kokusen') ? '${#dmg:= switchCase(item.verscheck, 'Padrรฃo', '${item.armakokusen}$', 'Versรกtil', '${item.verskokusen}$')}$
%{let roll = new Roll("${dmg}$");
await roll.evaluate();
await roll.toMessage({flavor: '<div class="chat-roll"><div class="grid-container"><div class="text-icn"><img style="vertical-align: top;" src="${!%{return linkedEntity.img;}%}$" width="35" height="35"; "border: 2px groove #9f9275";> <strong header class="title">${!item.name}$</strong> </header><div class="subtitle"> <a> <b class="critico">KOKUSEN! </a></div></div></div></div>',
speaker: ChatMessage.getSpeaker()});}%'}$ : '${#dmg:= switchCase(item.verscheck, 'Padrรฃo', '${switchCase (Crit_Check, 'sim', '${item.armacritdmg}$', 'nรฃo', '${item.armadmg}$')}$', 'Versรกtil', '${switchCase (Crit_Check, 'sim', '${item.verscritdmg}$', 'nรฃo', '${item.versdmg}$')}$')}$
%{let roll = new Roll("${dmg}$ + ${${switchCase(item.hitatri, 'Forรงa', '${formod}$', 'Destreza', '${desmod}$', 'Constituiรงรฃo', '${conmod}$', 'Inteligรชncia', '${intmod}$')}$ + ${?{Bรดnus[number]|0}}$ + ${item.bondmg}$}$");
await roll.evaluate();
await roll.toMessage({flavor: '<div class="chat-roll"><div class="grid-container"><div class="text-icn"><img style="vertical-align: top;" src="${!%{return linkedEntity.img;}%}$" width="35" height="35"; "border: 2px groove #9f9275";> <strong header class="title">${!item.name}$</strong> </header><div class="subtitle"> <a> ${equalText(Crit_Check, 'sim') ? '<b class="critico">Dano Crรญtico, ${item.armadmgtipo}$' : 'Rolagem de Dano, ${item.armadmgtipo}$'}$</a></div></div></div></div>',
speaker: ChatMessage.getSpeaker()});}%'}$`
I would like a proper table if possible...
like whats the css code I gotta use to make a proper looking table to where the columns and rows are actually divided
You're getting bitten by the execution order of CSB-Formulas inside phrases. The following order applies:
- Move into the next Formula
- If the Formula contains a Sub-Formula, move into that. Repeat with step 2 until the condition is not met
- If the Formula contains a User Input Template, resolve that
- If the Formula contains a User Input Dialog, resolve that
- If the Formula contains a Roll Formula, resolve that
- Parse the Formula
- Move to the parent Formula. If there is, repeat step 3. If there's none, move to the next Formula in the phrase. If there's no next Formula, stop
Conditionals work with step 6, not earlier. And switchCase() is non-short-circuiting.
For a few days have been struggling with โitem within itemโ.
Idea is to have item (weapon) that has item displayer (Key: _MagazineDisplayer) that shows different mags the character can equip for that weapon. I have gotten this far, but would like to automate ammo count.
Upon clicking a button (label) on the weapon sheet, I would like the following to happen: The prompt should ask: โHow many ammo dice?โ and after players answera, it should deduct 1 + Xd6 (X being the amount chosen) from the equipped magazines ammo count. Now it does not matter, if the ammo goes into โnegativeโ, I can handle that with rules so no worries.
Keys:
_ammoCount (the number of bullets in the magazine sheet)
_loaded (a checkbox on the magazine sheet)
_MagazineDisplayer (a item displayer on the weapon sheet, showing all magazines)
_displayLoaded (a column in _MagazineDisplayer for the loaded checkbox of magazine)
_displayAmmoCount (a column that shows magazine _loaded with label: ${item._ammoCount}$
_column (Hidden column in _MagazineDisplayer with label: ${ count(lookup('_MagazineDisplayer', 'name', '_loaded', true))}$, as per Martins help on the matter.)
Any help, even pointing into the right direction is greatly appreciated.
<tr>
<th>Title of 1st column</th>
<th>Title of 2nd column</th>
</tr>
<tr>
<td>Info in next row of first column</td>
<td>Info in next row of second column</td>
</tr>
</table>```
You can add as many rows as you want with an extra <tr></tr> tag and info in each of those columns with <td></td> tags, going left to right. You can also input code through ${}$ in between the <td</td> or <th></th> tags and it will format the output of the code in that cell of the table.
I would try something like this:
fetchFromActor('actor.id', "fallback(find('Mount_Location', 'Hood', 'Name', Hood'), 0))
This should pull the value, and if it isn't in the column, return 0. You could then put a conditional after this to get two different results based on if it's there or not, like this:
fetchFromActor('actor.id', "fallback(find('Mount_Location', 'Hood', 'Name', Hood'), 0)) ? "Hood" : "No Hood"
note, I have not tried this code so it may not work or may require some tinkering.
not sure what you mean.
CSB made you an actual table, no ? If so, you're just adding a border to it with the CSS provided.
${#?{ammo_dices:'How many ammo dices?'[number]|1}$
${#ammo_count:= [:ammo_dices:d6] + 1}$
${setValues(find('_MagazineDisplayer', 'uuid', '_column', true), '_ammoCount', "target._ammoCount - ammo_count")}$
is 'uuid' a filter of some kind? Because it could be several types mags from my understanding,
That's the target column. Every Item Displayer has name, id and uuid-columns
We need the UUID to target the right Item, because we cannot perform updates on the Item Displayer itself
That's why you have to use setValues()
ah and you're using the _column to see if there's only 1 checked -- though i dont see how it stops if there's more than one checked.
I figured you'd still have to conditional it
_column != 1 ? for example
find() only retrieves 1 entry at all times. Doesn't matter if more meet the condition
It didnt provide a solid border to keep stuff in its place, it squashed the other two columns when I added more to the info message, trying to put lines there so that if there is more info it will stay within its columns width and not push outward and continue down, and that my players will be able to add info into it as they please
Basically want to add border that stays in place and doesn't move outward is there is too much info, want it to just continue downwards
I have ${fetchFromUuid(Assigned_Player, 'Mount_Table')}$ which returns an array, I am having trouble figuring out how to use find with this to check if there is an existing entry
<table style="width:100%">
<tr>
<th style="width:any%">Content 1</th>
<th style="width:any%">Content 2</th>
<th style="width:any%">Content 3</th>
</tr>
</table>
${first(fetchFromUuid(Assigned_Player, 'Mount_Table'), 0) ? 'outcome if existing entry' : 'value if not existing entry'}$
This will only tell you if the colmn has any value in it at all.
I am looking for a specific value in a column
Is it the same as above, you're trying to find a value Hood in column Name? Or different?
${find(fetchFromUuid(Assigned_Player, 'Mount_Table'), 'Location', 'Hood') ? 'outcome if existing entry' : 'value if not existing entry'}$
${fetchFromUuid(Assigned_Player_UUID, "find('Mount_Table', 'targetColumn', 'filterColumn', filterValue)")}$
Can target column and filter column be the same here, if you just want to filter a certain column for a specific value?
Ty @formal goblet , can use '' for filter by looks of it
It's the use of double quotes that messed me up
That's somehow pointless, because that would mean, that you'd get the same value that you've provided with filterValue
is there also a way to put walls between the columns and rows like this? ๐
also how do I make it then that the player has access to type in said spaces?
${fetchFromUuid(Assigned_Player_UUID, "find('Mount_Table', 'targetColumn', 'filterColumn', filterValue)")}$${fetchFromUuid(Assigned_Player_UUID, 'find("Mount_Table", "targetColumn", "filterColumn", filterValue)')}$
Logically both are equal.
oooooooooo
it doesn't work as expected ๐ฆ and I am getting errors
I can't really work with that input ๐ . Let me soak info
haha, I am actually doing the same thing
let me try to explain, The find() returns the result of column 1, row 1 of the dynamic table, not matter if the thing I am looking for is present or not
Simultaneously unrelated but might be, I am getting errors for the dynamic table
so I am thinking, should I move the info out of the dynamic table and just use text boxes that I reference directly
Fixing those takes priority
im trying to use the Custom System Builder dice.
Currently, im trying to make it so that when you roll 2d8s and roll doubles (like two 1s or two 5s) it rolls the dice again until you don't roll doubles, then adding the total roll together. Is that possible?
(also is this the right channel to ask that question? if not please point me to it)
Only solvable with a tricky workaround: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Handling-Dice-Pools
ty for the fast response, appreciate it!
is there a way to dynamically select templates in filter items in an item displayer
Nope
Awesome
I am aware that you can drag and drop an item from one actor to another, and that will create a copy of the item, can the item instead be duplicated?
I have a User Input Template that pops up when I click on a label from an item displayer. Is there a way to set the default values in one of the numeric fields on the User Input Template to be a number from the item that I clicked on in the displayer?
I tried using ${item.Key}$ but even though it's a number field I get "NaN' and the console tells me Value must be Numeric.
@elfin laurel have you checked what item.key outputs?
It outputs the correct number when used elsewhere, just not in the default value field of the user input template.
I haven't got to user input yet
I only got to it recently, I feel you.
@elfin laurel seems to apply to you
Any input field using a key already defined in the triggering actor or item will use its value as default value, but will not be saved in the actor or item.
Managed to make it work with fetchFromUuid!
cool
I am tying to figure out a way to display a table of items that are attached to another actor
Item Displayer with a filter? But no, those only display items attached to the actor.
Hm. Interesting conundrum.
yeah, I think a better solution is to clone the item and attach it, then I can use displayers