#Custom System Builder
1 messages ยท Page 43 of 1
a simple example would be adding a + sign to positive numbers
it's self-calling for example
Yeah, that wouldn't work because of recursion
Oh CONFIG.statusEffects is client-side only !
correct- and i need for the attribute to remain a number value, not a string.
it's modified by items and what not.
Then logically speaking, it consist of 2 parts and should be handled as such with 2 separate Components
Or you use a Script, which fetches the suffix data
which is where we go back to hidden columns lol
one that outputs just a number and is hidden for modification, the other a reference of the hidden for display
I think it was:
return entity.componentMap['labelKey'].suffix;
${ref('item.itemRollBase') == 1 ? lookup('attributeTable', 'attributeTotalConcat', 'attributeName', ref('item.itemBaseAttributeName'), '==') : 'placeholder' }$
for anyone else struggling with a similar concept: this 100% works
Ehhh. Why not just false in the visibility formula? Because 0 == 1 -> false
i thought it had to be a formula of some sort ๐คฃ
dude i think you'd hate to look at how this sheet actually works at this point.
behind the scene:
~dont touch it, it works~
dw, my sheet needs 1-2 seconds to fully update per change because of many computations
dude? what system even
Shadowrun 6
what has you generating so much???
Items... Our sheets have 20-30 Items in average
oh lorde
I haven't even really gotten to that yet. this is gonna be laggy ๐คฃ
i have placeholders
You don't even have multiple tabs
Ok, that looks more like a real sheet
capability equip and social each have 3 sub tabs lol
so ~11 total tabs?
what i've spent the last 3 days working on is those little red roll buttons on the item displayer ๐คฃ
๐ lot of data entry to get all of the abilities in working, atleast semi-satisfied with how it looks now
btw if you haven't heard it before you've really got an eye for graphic design. Both of those screenshots look phenomenal
Thanks ๐
I'm actually really big into environmental psychology lol
this is gorgeous,
question though, how do you get the icon to show on the weapon list? for the life of me I can't figure it out
I think i found a bug:
${[:sameRow():d6]+(sameRow()+sameRow())}$
results in xD6 + modifiers
([:lookup():d6]+(lookup()+lookup()))
results in x+modifiersD6
the image of the dagger?
That's simply the Image of the Item.
did you re-style the content-link? mine has the image and name in a box and it's super tiny (i'm still on default styles for the most part still)
thanks for the support on the css tho haha
it's the one thing i'm confident in about this sheet haha
ohh
i made a class
max-width: 25.6px;
max-height: 25.6px;
border-radius: 20%;
}```
swipes css
you'll probably also want these then:
/* Item Containers */
/*text*/
.itemDisplayer table tbody tr td:nth-child(1) {
width: -webkit-fill-available;
}
.itemDisplayer table tbody tr td:not(:first-child) {
width: 5%;
}
.itemDisplayer table tbody tr td span a {
display: inline-flex;
align-items: center;
width: -webkit-fill-available;
}
.itemDisplayer table tbody tr td span a.content-link {
background: none;
padding: 0px;
border: none;
}```
the first one is just the icon;
these are the rest of the table
cool, I fried my brain earlier, I forgot that sometimes there are simple solutions ๐
Huh?
ici
Streamlined for readability
${[:sameRow():d6] + sameRow() + sameRow()}$
${[:lookup():d6] + lookup() + lookup()}$
Holy fuck, that thing looks so cluttered
Well, I don't see an issue, except that you should use first(lookup()) or find() if you expect only 1 value and not multiple ones
is that how i get lookup to stop spitting out arrays?
Trust me, this will bite you in the neck if you don't do it this way
Yeah
first() retrieves the first element of the Array
you don't know how long i've been trying to find an answer to that ๐คฃ
when would i ever need more than 1 item outta a lookup function, i have yet to find a usecase
sum(lookup())
Returns the sum of all rows within a column
ah. yep i've used that.
Useful for weight in Inventory and such
yep!
anyway
so will the first function fix the uh... adding to the dicepool issue? or is that something outside my scope
It will probably not fix it
correct, it did not.
its weird that within the table it works just fine
but the minute i use the same syntax and logic outside?
You probably fucked up elsewhere
within the same button or meta-button?
What is a meta-button?
meta = prior to
sorry niche use
metaphysics = that which comes before physics or "first"
same for metalanguage and what not
How does it look like with sameRow()?
From the looks of it, it seems to be correct:
sameRow: 2d6 + 3 => 4 + 3 => 7
lookup: 6d6 + 2 => 26 + 2 => 28
Different values, but the modifier is applied after in both cases
I am just now realizing for testing purposes i had changed the skills and my dyslexic ass got confused by 6d6+2 and 2d6
๐ฎโ๐จ all is in order, thanks martin
@formal goblet Thanks for the help yesterday on how to get the character's Agility value from an item you're awesome! โค๏ธ
Can you help me with one more thing? haha
How could I do the opposite, now an item that gives an agility buff? I tried something like $fetchFromActor('attached', "Agilidade", 0)$ 8 inside but it didn't work 
ty โค๏ธ
Just 8
And Key should be Agilidade
Hey there,
I'm trying to have active effects with some custom fields such as stacks, I've seen that Dynamic Active effects allows that but it's not compatible with CSB, is there any quick win module that would allow me to achieve something like that ?
After taking more time to read more carefully the doc, there's already a section in active effect scripting for stacks yay !
Damn that documentation thing is really when one knows how to read it 
is that the chat? Do you know if you can make those dice number visuals show up in chat messages?
That's the explanation if you click on the Roll number
oh, fair enough
here's something weird, if I set sort to auto ascending and input the column key 'abilitylevel' who's label is item.level (a number field), this is how it sorts it, not actually ascending
if I set it to manual sort and then click on that column it sorts it correctly
nvm I did it wrong disregard me
but there's still something wrong here, everything sorts correctly except for the green table
if I do 06, 08, 12 it works
but with 6, 8, 12 it seems to think that 12 is less than 6, 8
it's like it doesn't read the entire number. Is this some weird string conversion
am I doing something wrong?
Lexicographic vs. numeric sort... Can you open a ticket for that?
The real question is can I format it nicer haha I have no idea how to handle the chat styling yet
Struggling with initiative and could use help. I would like the system to roll a die from a dropdown menu (key: Initiative). Now what should I write on the settings "Initiative formula" to get it pick the die from the sheet and roll that?
[:Initiative:]
omg that simple?๐ Thank you!!๐ Sometimes the shortest route is indeed the shortest route
Martin really is the MVP lol
How can i add character profile pictures to chat?
Including rolls sent from outside the charactersheet with the dicetray module?
I've tried a number of things within the sheet like:
@{Selected | actor.image}
but not even sure if i'm on the right track with that one.
found a bug, this one is worth signing up to gitlab to report so i'll be doing that in a bit:
I got my weapon attack message first draft working last night (yey! on to upgrading and formatting it)
The issue: Items with radio buttons checked by default do not work with formula
Long form:
I dragged the same item (iron dagger) to the character inventory to have two of them, renamed one to keep track of which is which and adjusted the modifier.
However, the roll button did not work for the new item, only the old one. The items rely on the same templates and the only difference was their names and the modifier (which is a number field). The error:
[No packages detected]```
Toggling the item to use the other radio button fixed the issue, and toggling back to the default button still works; all new items created and added using the default radio generate the same error.
Sorry to bother but I've been trying for hours yesterday.
Is there a way to automatically fill out the fields based on the choice in a dropdown menu?
Here I'd like to automatically fill out Timing and Effect based on the choice (in this case Blue Wing).
I tried to do it via labels and conditions, but it seems like Labels cannot access the Keys set in the dropdown options.
I fear making them items might be my best option but then I'd also have to get into CSS too which I'd like to avoid.
Hey Malea,
Have you tried using the reference function and conditional logic?
${ref('keyOfDropdown') == keyOfOption ? 'Action Phase' : ref('keyOfDropdown') == nextDropdownOption ? 'appropriate phase' : (...)}$
until the last 'else' you just put
' ' as in 'null' or do nothing.
@half bloom forgot to ping oops lol
That's close to what I tried but I think I was missing the ref part.
Right now I just put in the following.
${ref('wingdrive') == bluewing ? 'Action Phase' : ref('wingdrive') == redwing ? 'Reaction Phase' : ''}$
However it throws me the following error:
Cannot convert "bluewing" to a number
here's where we get into me just trying dumb stuff
try adding the '' around blue and red wing e.x 'bluewing'
if that doesnt work, try removing them from wingdrive and bluewing
leave it around action phase, that should be right
i never know when to use those things so i just default to it ๐คฃ
ref('hp') Returns the value of the field with the key hp
ref(currentArmor) Returns the value of the field targeted by currentArmor
the wiki is a bit weird on it and it's not always just when it is a number like i thought
Just adding '' around blue and redwing didnt do anything, removing it from the wingdrive made it not throw any errors anymore, but it's also not computing anything and just defaulting to Action Phase
switchCase(wingdrive, 'bluewing', 'Action Phase', 'redwing', 'Reaction Phase', ...)
yeah, was just doing 2 for simplicity rn sorry if that changes things
No worries, I wouldn't have thought of that solution anyway ๐
not your fault should have elaborated
Also martin I reported a bug.
But still need help on the chat styling. Any idea how I can get actor pfp and itempfp into chat? ๐ฉ I'm about 12 hours into figuring this out haha
Thank you very much, both of you.
<img src="${!%{return entity.entity.img}%}$" style="width: 20px;">
Ah a return script.
Which entity gets scrapped for actor or item?
Cursed JavaScript
My bane
entity can be both, depending on who executes the Roll
๐ค then if I execute it with a button in an item container it'll still be a player profile picture and not the item?
Is there somewhere on the wiki I can reference this?
Yeah
If you want the Item from the Item Displayer, use linkedEntity instead of entity.entity
Too easy.
There a way to get the default player character though for external sheet rolls? Like through dice tray?
I figure that'd have the be through csb somehow
Though I guess it could be the dice tray module code too
Oh Christ. Yeah that's out of my league for now.
I don't even think I could write a hello world function in JS.
Alright. ๐ Not necessary for function. Thank you anyway.
I'll use the scripts for the internal stuff
console.log('Hi') ๐
๐๐ yeah I'd have got that wrong mate
System.out.println("hello?")
Or is that just regular java? Idek
Java
๐ฉ ๐
Man, nothing has made me feel as stupid as coding
I swear, I'm only a little stupid on a daily basis ๐๐
dw, I'm playing with 4 programmers rn
Huh ๐
The only thing I'm playing is League. I see your PFP over there
but if you mean your ttrpg crew - mine are all big math nerds. none of them can code though... wow i never realized i also fell into that category till just now
I got a forensics guy, engineer, physicist, and myself o3o
thoughts?
how would I go about setting a condition like if skill equals 0 do a different roll than if they are 1 or above?
Hello, i'm trying to have a custom actor for a system of mine. I got the example module and i want to modify the Attributes. I modified for example Strenght in to Brawn under the "hidden" table, editing the label and the ${first(lookup('Attributes', 'Total', 'Attribute', 'Brawn'))}$ but it seem it's not the right way. Is there a guide for dummies for customize those info perhaps, please?
I suppose they are defined somewhere but I don't understand where.
I got a dropdown menu that pulls info from a dynamic table. any chance to make it pick a random entry upon actor creation?
It seems I could use something similar to this except it's from a dynamic table no?
Is there a way to color dropdown options/text without custom CSS?
Is there a specific HTML styling that works in those?
You can use css within the html tag?
<Div style="width: 100%; height: 50%;>
Use the rand function, and set property function using the number?
I'm a bit confused about what you're trying to achieve
Use conditional logic
skillKey == 0 ? ThisRoll : ElseThis
Sorry, i have resolved, it was a mistake of mine.
Apologies,
I was hoping to have one of the text in the Dropdown to be a specific color without creating a full css style sheet,
like how you can have html styling in labels and such.
But it appears as though html styling doesn't work inside the dropdown-list labels specifically?
Perhaps if I make the Dropdown a "formula" rather than a custom? and add the options as an array/string?
For instance, give Overcome a bold and green style, Temporary perhaps just a color, etc.
Ohh! I tried to do that earlier. Link mentioned it would be a nightmare to achieve. I'll see if I can find his response and maybe you'll make sense of it
Okay I can't search on mobile, @elder raft search for messages from me containing 'color' and 'meter', link replied.
Ahh I see, yeah. I had a feeling if it didn't just accept HTML in the dropdown itself that it'd require an actual CSS style sheet, which I'm not ready to build or implement yet.
Thanks!
IIRC it isn't just CSS to access the dropdown either.
Actually @elder raft
I think i did what you're asking for by mistake - it doesn't change the dropdown meter once selected but it does change the menu, i think.
that's with just css, but you can try to had that styling into an html tag into the label value of the dropdown and see if that works
you'd certainly need some sort of JS or something to change the dropdown element based on the selected value though.
Yeah, I was hoping it'd be as simple as making the dropdown option "<p style=color:green;>Overcome</p>' or something like you can with labels and labeltext, but it seems it's more involved!
No worries, thanks for your insight!
bro no worries, you've helped me out before ๐คฃ
how's your system going btw?
I remember you asking about dice faces in chat - did you ever sort that?
Not to complete satisfaction, but I got it to do kinda what I wanted, visually, just using the Foundry dice system.
Aint perfect, but I learned a lot trying to figure it out
shame, i'm not ready to learn JS yet, so no scripts or macros for me.
I'm still scrapping everything together with just CSB and CSS ๐คฃ
I'd love to get the dice faces in chat tho :U
Haha same!
Bit above my head. I got little bits and pieces to work, but I need a lot more learning before I can totally tackle the scripting and macros
๐คฃ such a mood.
I'm not a computer person - what's with all my hobbies trying to make me learn to code haha
I'd love to look at your sheet sometime dude. Not enough people share their wins in this channel!
haha, welcome to the future! Everything needs a CompSi degree now!
I aint going back to school for compsci ๐
maybe my phd haha but that's only because i want to be a professor when i retire
the funny thing is everyone I know in the compsci field basically says that school for it is way less necessary than having a portfolio and using free resources to learn
but certianly not in this black magic taboo of computers
Ahh, I appreciate that!
We're still tweaking the system itself, and are running some more playtests of this "v1.5", but its fun and because my group is 100% long distance, I'm just trying to get Foundry to support it!
I'll have to share it when we get it ironed out!
I've heard that too - but that'd be a weird career change haha. ๐
Very similar to film & tv that I'm in.
Nobody cares about a fancy film school. Credits, a demo reel, references, that's what matters.
I absolutely love when fields recognize that degrees aren't useful at the entry / early middle levels.
They can be helpful once you get far enough into a profession that you start benefitting from knowing theory
I need to do some JavaScript and Python tutorials on Youtube or something, too much is starting to rely on some kind of understanding of certain languages
I'm taking a course on coursera for data analytics to boost my career a bit. It does a fair amount of python for data wranlging
I did take a Web Dev one too that was great for html and css, but i dropped out of the JS unit because it was just too much too quick and a bad time for me irl
The CSS unit was actually disgustingly helpful.
see, all my CSS and HTML comes from learning to pimp out my MySpace and DeviantArt pages back in the day! ๐คฃ
a bit ancient there
Nah bro i remember it
that's where i started but this went way further in depth than that
it tought how to make your own grid system to jerryrig a bootstrap system so you knew the theory, then got you to use actual bootstrap
i've used those principles 100x in my sheet
it all trickles down and builds on itself!
https://www.coursera.org/specializations/html-css-javascript-for-web-developers
Found the link if you're curious.
and here's the data one with python:
https://www.coursera.org/professional-certificates/ibm-data-analyst
i'm about to start my captsone on it ๐ฉ things a nightmare haha
have python specific courses but i can't speak to them since i am just trying to hone in on data wrangling specifically to speed up some of my work
Hi, there is a way to make a button on an actor that execute a macro?
I'm using the actor sheet in example module
you can use the %{}% wrappers to execute normal JS.
I dont know the syntax for identifying the macro but if you can code JS that should be fairly easy to get the macro and execute it with that in mind
I have no experience in coding but i'll try. Thank you.
Noob question: how do I create an action? Like a melee weapon or spell, that I can apply rolls and animations to?
speaking of animations, has anyone dabbled in getting automated animations to work with this system?
or another way of automating weapon animations for that matter
also if you mean an item you can make an equippable item template in the items tab and apply that to an item you create in the item tab, then add that to an actor with an 'item displayer' element
Wrapping the macro get the macro execute every time the sheet is reloaded ๐ญ
if you put the macro contents inside the roll message section of the label?
Nope, the macro has an interactive box so when sent to the chat it doesn't work
And if i disable the "send to chat" simply doesn't work
I did that and it works as expected, but how do I make it rollable?
Use the roll function of a label styled as a button :3
There's been a wiki page shared around a few times i've seen, dont know if i can find it or not. one min
Well, i got most of the actor sheet to work for customized stat, skills, calculated fields and the likes but rolls automation is beyond me. Are there some example that i can try to look at please?
i think this is what you need: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Scripts/Scripts-for-Active-Effects
You'll need to send to chat but use a # to silence it
wdym roll automation? Just fetching a stat and weapon damage?
fyi the # is found here:
4.9. Hide formulas in chat messages
When using formulas in chat-messages, you can hide some formulas to perform preliminary calculations assigned to reusable variables. To do so, prefix your formula with #, for example :
${#testResult := target - roll}$
A bit more complicated. Player can choose a variable number of dice to roll. So i have a macro that prompt a popup, the player can input the number of dice and then roll. It would be the same to have a input number box in the sheet and a button that roll that number of dice but i'm not being able to make it work.
do you prefer the prompt or existing label
i have examples of both sitting around
@bitter spear im about to leave,
answer quick and i'll send it before i go
${sameRow('attributeName')}$ with ${concat(string(sameRow('attributeDiceQuant')), 'd6')}$
<br>
Situational Bonus: ${addMod > 0 ? concat('+', string(addMod)) : string(addMod)}$
${[:sameRow('attributeDiceQuant'):d6] + addMod}$```
This is one of the simpler ones i used:
it creates a prompt for a situational bonus and adds it as a flat modifier to the dice roll
I really appreciate the help ๐
to convert it you'll need to move the + addMod at the end to before the :d6, and replace the samerow lookups
or even just
addMod:d6
and even the d6 is changeable if you want
for example in this excerpt from another function i get the dice number from a number field within the item itself:
{[:ref('item.itemDamageQuant'):d(${ref('item.itemDamageVal')}$)]+(ref('item.itemBaseModifier')+damSitBon)}$
Frankly depending on what you're doing I'd just install the dicetray module and let players manually click the dice they want
foundry natively supports
/r XdY+Z
format:
/r 1d6
/r 5d4+3
dicetray just mounts icons to click on the bottom right by the chat for easy access of flat #d usage
Good luck!
Thank you very much
I can't make it work ๐
I am dumb and don't know what I'm doing. I'm trying to use a "Meter" to act as a health bar, but I can't seem to edit it in the character sheet. Just the _Template sheet
A Meter is a readonly-Component, like a Label
Oh ok. So is there a way to make a health bar then? What are my options?
The best Components for that would be a Number Field combined with a Meter
Right, so how would I get that set up? Forgive me, I am not a programmer
A number field to have the option to change numbers, and the Meter for the actual Bar display
And how do I link them up?
Hi, sorry, i have created a table with an input number field with component key "Dices". Then i have created a label "button" type and in the label roll message i'm trying to get the code right to make "dices"d20 rolled but i can't get it right.
This is the abomination that i have made
${[:sameRow('Dices'):d20]}$
May i ask how i got it wrong please?
You have to set a table, make a input number and set a component key for it
Then create the meter field in the same table and in the "value" box put ${componentkey}$ where componentkey is the one you used before.
Be aware, i'm a noob with no coding experience myself so i hope i don't got it wrong
Got it! Thank you!
@past laurel if you don't have already looked at it, there is an example module that you can download and use as reference. It is very helpful. In the "Main" tab can see Life points or Stamina points that i think are exactly what you are trying to do.
Ah ok! I see that now. I'll grab that, thank ya!
No problem, I'm just relaying what the dev suggested me ahahah. I think i'm in the same boat as you.
Don't worry guys, me too.
I'm just further down that road. I've been working with csb for like 4 months actively spread over a year or so
Well i'm trying to make that item rolld damage thing works but i'm failing miserably ๐
I'm not home yet but if you want to show me what you're working with in like an hour I can probably get you running.
If not cry to martin because he's fixed 90% of my shit code haha
lol
I have created a table with an input number field with component key "Dices". Then i have created a label "button" type and in the label roll message i'm trying to get "dices"d20 rolled
Those are the abomination that i have tryed so far:
${[:sameRow('Dices'):d20]}$
${Roll:=[(ref(sameRow('Dices'))d20]}$
${[:ref('sameRow('Dices')'):d20]}$
As you can see i'm basically guessing but i don't really know what i'm doing.
If @formal goblet would be so kind to take a look...
He's asleep
Pretty sure he and link are either in the French timezone or nearby
Just by their activity times, I don't actually know
Woah you're up late today martin!
Oh, ok. I tryed becaue i'm going to sleep too in short time
It's late here too but this roll thing is making me crazy
Try ${[:Dices:d20]}$
I'm actually just off my sleep schedule. It's only 8 here tho
Oh, thank you very much
FR & GER
It woooorrrkssssss. Thank you very much, now i can go to sleep ๐
Good night and thank you again to all
Called it!
Are you German?
OK got a macro I am trying to link to, it has a couple of let variables
one is a roll name and the other target number
%{return await game.macros.getName('Roll').execute ({rollName: 'Reflex', targetNumber: '${REFSV}$'});}%
target number should be setup right... not sure how to give it just a bit of text though
it runs fine via the /macro command
Hello, when a roll of multiple dices is sent to the chat, it shows the total and you can click on it to see the details of each die. There is a way to get directly the detail in the chat without the total?
Hi, how do I dynamically count the amount of rows inside my dynamic table? Lets say I have a dynamic table the players can add rows to, and there is a separate label above it that counts the total amount of rows of the dynamic table.
Hey, I have a (probably very dumb) question.
Is it possible to create a global variable for an array ?
For exemple, I would like to create one for this array [-250,-160,-60,-30,-15,0,15,30,45,60,75,120,210,360] because I don't want to write this on each of my formulas.
Thank you !
Hey guys, silly question , maybe there is already an answer. Is there a way to get a reference for the whole item when doing an "lookup" search through an item displayer? I am asking because I want to access a property from an item I do not wanna display in my item displayer. Many thanks in advance!
You can add text outside of the %{}% for example in mine it goes
Bonuses %{}%
<hr>
Total %{}%```
Does that help?
I've been trying to figure that out as well from the other answers i've seen - you need a script using JS or something to even come close.
Not sure if there's a native function for that but you can create an index row to count your rows. OR if you want to export that number for some reason set the row's label to be =1 hide it and use sum(lookup())
does it need to be stored in an array format? If so create a dynamic table, hide it, and use a lookup() function. i think that works.
Not sure what you mean, but can you create a display for it in the item displayer and then hide it?
That last point, can't believe I haven't thought of that, thanks so much. ๐ซก
yes, depending of the value of a number field, it should return a value from this array with a formula. Is there another way than using a hidden dynamic table ?
absolutely haha
no idea what you're using it for so i cant speak to how best to set it up.
however as far as i know the only function that gets an array natively.
Does having a label with the numbers comma separated work? no clue.
I'd still use a table since you can first(lookup()) individual values
Nah, I tried with numbers and comma separated, it doesn't work.
Thank you for your response, I will either use your method or use some JS
actually that's true
%{}% lets you use JS
can you just store the array as a variable in a label?
that's what I'm wondering
because you can't use variables except for Label Roll
so, is it possible when using JS ? I don't know, I will try some things ~
Hello everybody, trying to setup a simple dynamic table in which i have some spells with a 'roll' column. In the chat roll field of this column i wrote this: ${setPropertyInEntity('target','custom_hp', "target.custom_hp-sameRow('Danno_Inc')")}$ , where 'custom_hp' is the key for Character's Hit Points.
Now, the number field 'Danno_Inc' that is in the Dynamic Spell Table represents the damage dealt by the spell. The problem is that if i put a normal number in that field (e.g. '4') the formula behaves as expected (the target's health bar decreases by that number). But if i put a dice roll in the field 'Danno_Inc' (e.g. 4d4 to simulate Magic Missile) the system doesn't roll any dice, set to zero the target's health and the console output is an error. I tried to write in the number field the dice roll in many forms, with and without simple square brackets ([4d4])=, with and without double square brackets ([[4d4]]), etc. No problem with normal numbers but i can't get setPropertyInEntity formula to decrease target's health ('target.custom.hp') by the result of the dice roll contained in the 'Danno_Inc' number field i've put in my Dynamic Spell Table. Please help!
count(lookup())
${#Danno_Inc:= [:sameRow('Danno_Inc'):]}$
${setPropertyInEntity('target','custom_hp', "target.custom_hp - Danno_Inc")}$
Try out %{return [-250,-160,-60,-30,-15,0,15,30,45,60,75,120,210,360];}% in a Label
That is what I fear, I saw it implemented in a system but I can't understand how it works.
Hey everyone, happy holidays, I'm trying to find a way to perform a different checks depending on the characteristic defined in the item. I tried with equalText() and now with switchCase(), but I didn't get great results with either. So I thought I would ask if anyone has experienced this. This is what I have at the moment:
actually yes:
edit: that was too messy to get anything from tbh
Use conditional logic;
i dont know what luta or pontaria are supposed to be but if you're basically making a toggle use radio buttons
in mine have two radio buttons that control which dropdown is referenced in the formula:
the value of the attribute radio is 1 and ability is 2.
'item.rollGroup' == 1 ? doThisRoll : doThisRoll
Since I only have 2 attributes ability can be the else. Otherwise you can do
'item.rollGroup' == 1 ? doThisRoll : ''
'item.rollGroup' == 2 ? doThisRoll : ''
'item.rollGroup' == 3 ? doThisRoll : ''
I see, thanks
${[:ref(concat('atributo_', item.teste)):d20kh] + ref(concat('treino_', item.teste)) + ref(concat('bonus_', item.teste))}$
HI! I have a button in an item that I want to increase the player's Belly value by 5. ${setPropertyInEntity('attached','Belly',"attached.Belly+5")}$ *Eats ${Name}$
when I press the button, nothing happens.
${setPropertyInEntity('attached','Belly',12)}$ *Eats ${Name}$
runs and returns "[12] *Eats [Raw Plant]" to the chat, but doesnt change the player's stats
attached.Belly --> target.Belly
Oh huh
Thank you!
Hello everybody, I'm asking for help. I'm trying to find a way to sort every dice I roll in a croissant way and see them all. For exemple: /Roll 4D10 : 8 7 2 1 and not : 18. Thanks ๐
Mee too but i didn't find a way or a module for it. Do you have some coding experience?
nope ๐ฅฒ
Same boat ๐
I noticed one thing, the in chat messages of rolls are different if i roll from an actor sheet or if i use the /r command. Why?
@hazy moon i found a module that it do it
You can use the module Dice so Nice! and turn off automatically hide in the 3D settings. It won't unfold the dice in chat but the dice won't disappear until you click.
Dice so nice is good but not really protical in my opinion if you need to read the results. When you roll a new one you "lose" the previous one and you need to go in chat to open the message.
I found how to sort them in a croissant way but not how o show up in the tchat automaticly
foundryvtt-show-me-the-roll is a module that do that in chat
really???
Got a link bud?
The only problem now is that it works fine if you use the /r commnad or with macro but if i roll form an actor sheet it uses a different format and so it doesn't work
Now, why the roll from actor has a different format? And how i bypass that, please?
kk thx, I'll try to look into that
There is a module called Unfold All Rolls that does the same thing but it has the same restrictions, it doesn't work with rolls from actor or item sheets.
Because CSB has its own format. But you can use the native format from Foundry by using their API: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#33-script-expressions
Thank you
@formal goblet so, sorry, basically if i use :: it will use CBS custom formats but if i don't use them it will simply use the Foundry one?
Nope, is not that simple.
Sorry but i need an example please
This CSB ${[:Dices:d20]}$
In Foundry basic API how is the correct format please?
%{
new Roll('${Dices}$d20').toMessage();
}%
Thank you very much
Martin it seems I got a problem ( Ps: I'm not very good at coding). I succeed to make my dice explose and be in a croissant order but still don't manage to show them automaticly. thx in advance
With the help of Alabaster there is no more message ERROR but the the dice still won't show in the tchat
I don't know how to do it. That topic involves Foundry itself
See if someone from macro-polo knows it
okkey thanks
I resolved with the module i linked and it's working great.
Did you add that code? Can you send a screenshot? ๐ฉ Because if that does what I think it does, and I can sum the results into a total...
Sorry, i did not understand what you need
Lol just a screenshot of what that code and module combo are outputting.
I want dice faces to show up in chat, then I'll add more to it to get a total result after.
Ideally it'll be:
Skillname #d#+#
Faces of roll
Total
I'm trying to get a macro, let say "test3", called from an actor sheet with game.macros.getName('test3').execute() but i can't get it work. I tried with button and label, text and roll message, with and withount send it to chat but nothing.
I'm using
%{return await game.macros.getName('test3').execute();}%
What i'm doing wrong? ๐ค
The syntax is correct. Show the error in the console
It goes in the "label roll message" of a label right?
Yeah
Yeah. That means it cannot find the Macro
That strange. I rechecked the macro is there and works fine if executed manually
Wait, it's in a macro compendium that i have created, it can be that?
If i copy the uid i get Compendium.world.custom-macro.Macro.0NizrlKwib5REURR
how did you get roll faces in chat messages like that?
well I know what my free time is going to look like ๐ฎโ๐จ lol
@formal goblet sorry, do you have any idea on what the problem can be? The macro is there ๐
Hey @formal goblet
just a heads up, I have a roll function that was working just fine last time I was working on the character sheet- no changes have been made, but suddenly the rolls stopped working and were outputting a string error related to d6.
I cut out some code from one of the 6 areas the same code was pasted to test if that section was the error and reloaded the sheet and all of the rolls including the 5 that were the same uncut code, work.
I think there's an issue somehow with when a server (maybe just Node JS) launches for the first time and how CSB reads some formula.
I'm going to shut it down and reload it to see what happens.
-ope he's getting pinged today haha
restarted the server - no error.
but the server launches so much faster after it's been launched the first time. Potentially a background process. Will restart pc.
since he confirmed the syntax have you:
1.) check the macro name for spaces or invisible characters?
2.) checked if the console can see the macro?
3.) check foundry permissions for your account running the macro?
Uhm
- i checked the name more than once and tried other macros with same result
- how you do that, sorry?
- i'm gamemaster on a local installation so i think i have all the permission
Ahhh so i need to get the pack first and then get the macro
Read the full article. That's not the only way
getting an unusual error: sameRow fails to pick up a value when it's default. throws
Error: Uncomputable token "sameRow('Obr_base')". Failed to obtain value from the same row in the column "Obr_base". Make sure, that the column-key is correct.
the same code works perfectly fine when I input the same value manually. if it matters, the default value is derived from a different property. any workarounds?
Try out game.actors.getName('actorName').system.props.tableKey in the console and show me the output of one row
It will never not impress me how you can understand what some people are having issues with. ๐คฃ I read the issues people are having and more than half the time I'm like โ ๐ฉ I have so many follow up questions
2 years of experience, and most questions were already answered in the past
0: Object { "$deleted": false, Rzut: "", Obr_calc: "" }
โโ
"$deleted": false
โโ
Obr_calc: ""
โโ
Rzut: ""
โ
<prototype>: Object { โฆ }```
this is when I haven't defined any values manually
Well, Obr_base isn't there
โโ
"$deleted": false
โโ
Atk: "Bonus_Silny"
โโ
Nazwa: ""
โโ
Obr_base: "7"
โโ
Obr_calc: ""
โโ
Obr_formula: ""
โโ
Rzut: ""
โโ
Uwagi: ""```
and this is when I put in any other value manually
Obr_base displays as "7" on the sheet in either case but only when I "touch" the table in the interface do the other columns show up in the code
I left my pc off for ~20 minutes and relaunched the server. The bug failed to replicate.
I'm unsure of what is causing it but I'll let you know if it reoccurs. ๐ค
Do you have warnings in the console? (Uncomputed tokens)
yes, the one I originally posted shows up when I try to interact with stuff in the table before manually changing things in it
so it seems like the default values only initialize (if that's the right word) when the table gets modified by hand and before that they're undefined
it's not a huge deal as I now know how to work around it but probably a bug?
If it is how you've described, then yeah
Weird question but could you possibly set a fallback value in whatever you're using the roll for equal to the "default"?
That should circumvent the error in the meantime and still leave the default as a display.
@sinful spade well, at least you understand half of it. I'm reading guides that are meant to be used by newbie and i'm feeling dumber every sentences i read because i get the sense but i don't get how put things together...
no no i understand half of what they're asking ๐คฃ not the guides. Those things are a nightmare haha.
The only reason I've gotten so far is because I've been doing this for a hot minute now. ๐
Now, i got that you can use uuid to get an element directly but i don't get how to use that info to execute a macro from it's UUID...
in the foundry article about macros they do have an example of a macro executing another macro:
const macro = game.macros.get("3b7YVSvYsaSoGxlY");
const victim = await macro.execute();
//Logic to manually pick a victim if you'd like
victimName = scope.manualVictim ? scope.manualVictim : victim.name;
console.log("Token to attack:");
console.log(victim); ```
Can you just use that?
(await fromUuid(...)).execute();
Nope, because i'm calling the macro from the actor sheet
right but
%{ }% lets you use regular JS right?
so would
await macro.execute();}%```
Not be exactly what you're looking for as a label roll?
or martin does it in one line haha
Trying
ID != UUID and we're talking about Macros in Compendiums
totaly for my own learning here;
but doesnt that just mean you have to add a prefix of:
Compendium.<modulename or world>.<packName>.Macro.<uuid>?
It' would be
${(await fromUuid("Compendium.world.custom-macro.Macro.hm7r0eE5gwKdlyWi")).execute()}$
in a "label" in the "label roll message" field right?
Sorry what I posted was for my learning outside of the fromUUID function. I'd assume martin gave you exactly what you needed.
I'm sure that what he did was right but i don't get what I'M doing wrong because it is not working ๐
Thx very much, it works perfectly!
I get this error so i don't get what is wrong
i only asked about the %{}% because in your message you said ${}$
${(await fromUuid("Compendium.world.custom-macro.Macro.hm7r0eE5gwKdlyWi")).execute()}$
the % denotes regular JS while $ is CSB
thx I will try
Hello Again! 
I'm trying to add a condition to this item, to add +1 to the "IniciativaBase", but it would only be if the item's checkbox was checked, otherwise it would add 0 for example, how can I add a conditional, like this (python logic haha)
if Ativado:
IniciativaBase += 1
else:
IniciativaBase += 0
perhaps
lmfao. ^^ click the link and find out
Key = IniciativaBase
Value Formula =
${ref('Ativado') ? 1 : 0}$
Check the spelling of the values btw, i used what your message sent not what your image was ^^
It worked!!!, tyy 
From an actor sheet i call a macro trying to use values from the sheet
const roll = await Roll.create(`${Dices}$d20cs<=${Attribute_Selection_Value + Skill_Selection_Value}$`).evaluate();
const successes = roll.dice[0].results.reduce((acc,e)=>{
if(e.success) acc += 1;
if(e.result <= Skill_Selection_Value) acc += 1;
return acc;
},0);
roll._total = successes;
await roll.toMessage();
What i'm doing wrong?
I added a text field to an item container, but text storage isn't persistent. Anyone know a better way, or how to add storage to it?
the code creating it is just:
<input type="text" style="width:250px;">
the regularly created labels also seem to have id="Actor.ID" and name="SomeDir"? I'm at a loss how to recreate those
I'm really confused...
If in a "Label" component in the "Label roll message" i use this
%{new Roll('${Dices}$d20').toMessage();}%
it works fine.
If in the same component i use this instead
%{(await fromUuid("Compendium.world.custom-macro.Macro.glBVCukj47SUajVn")).execute();}%
calling this
new Roll('5d20').toMessage();
it works fine
If in the same component i use this instead
%{(await fromUuid("Compendium.world.custom-macro.Macro.glBVCukj47SUajVn")).execute();}%
calling this
new Roll('${Dices}$d20').toMessage();
it doesn't work.
What i'm missing?
Heya! Possibly a weird one here. Is there a safe way to transfer a compendium/module of items to another CSB game that has the same templates?
Everything works perfectly fine on my friend's world which has the same templates, except when dragging items into character sheets, it nukes them from the with the error Item template has been deleted for item Brick on a Rope {actor id nonsense} used in Character {more actor id nonsense}
Have you tried with the "adventure" function?
I transferred them over using an adventure compendium yeah ^^'
Hello, sorry to bother you but I would like to know if it is possible to add an element of all the objects in my list of objects
Should I have put the sheet templates in the adventure too, or should they be exported via the json exporter? The answer was yes, templates go in the adventure. Apologies and thanks a bunch ๐
Mmmmm, got another a problem here. I have a macro that manages multiple targets damage (think of a fireball). The macro works perfectly per se, but i need to send to the macro a value in the character's sheet defined in this way in the Label Roll Message: ${Danno:=[:sameRow('Danno_Inc'):]}$ ------> refers to a dice roll inserted by the player in a dynamic table (e.g. 4d4)
% {return await game.macros.getName('MacroDanniMultipli').execute({damageFormula: '${Danno}$'})}%--------> this should send the dice roll to the macro setting 'Danno' as 'damageFormula' '****************************************************************************const args = arguments[0] || {};
const damageFormula = args.damageFormula ****************************************************************************These are the two lines of the macro that should receive the damage value the macro should consider. Obviously something went wrong because the macro won't read the correct value and considers it as undefined. I think there is some syntax error in the game.macros.getName formula, peraphs the last part .execute({damageFormula: '${Danno}$'}). Any suggestions?
on what might be a related note (?), is there a way to delay the execution of a "%{}%" script inside a roll message until after a user input has resolved? so that it can make use of values from the input
I don't know if is what you need but you can call a macro with a button and i use this
const dice = await foundry.applications.api.DialogV2.prompt({
window: {title: "Roll Dice"},
position: {width: 400},
content: "<input type='number' step='1' min='1' max='10' placeholder='3' name='dice' autofocus>",
ok: {callback: (event, button) => button.form.elements.dice.valueAsNumber || 3},
});
if (!dice) return;
Roll.create(`${dice}d6`).toMessage();
I was hoping to avoid messing with manual dialogs tbh
Then sorry i'm not able to help
kj,
can you just not prompt for the input?
?{<varName>[:<varType>][|<choice1>[:<display 1>]|<choice2>[:<display 2>]|<choice3>[:<display 3>]|...]}```
I have a prompt that asks for any bonus modifiers then rolls the dice and adds the mods to the result.
gah dam thoth going ham on the chat over there
i have items which have full descriptions of spells and such (img 1) and was wondering if it's possible to display all those features in a separate tab inside my Actor's sheet (img 2) that lets me send the feature to chat (a label roll message ${!feature2}$ works perfectly from within the item) and without needing to display each individual feature, feature name, etc. in an Item Displayer since that would get very crowded.
i've tried variations of ref(), ${Class.item.feature2}$, ${item.feature2}$, etc. but none seem to work
each row would be a separate panel too with visibility limited to only show up if the item hasFeature1, hasFeature2, hasFeature3, etc., I assume that solution is adjacent?
yeah i just want to try to explain as best as i can :p i'm not super knowledgeable but also want to avoid a convo that ends with "have you turned it on and off again" :p
well.. have you?
idk what the equivalent would be in this case but yes i've reloaded actor and item sheets and the whole world for non-related reasons and i've never come back to my errors going away :p
unless you count clearing the console so that all the red goes away
Heads up before i tell you anything.
I am the technical equivalent of a butter knife trying to hack into a bank vault. Determined but hilariously ineffective.
-- it may work if you don't look at it too hard, say nice things to it, and then close the door and never look inside again.
I assume the 'shoot a ball of fire text' is a label?
that's basically my whole m.o. for this custom system haha
that is a Rich Text Area with key feature1
Legally Distinct... is a label that refers to a Text Field (key feature1Name) I hid in a separate tab
so featureXName would be what I want displayed in the Actor sheet, and featureX would be what I want to send to chat if I press the message icon from the Actor sheet
I know you can output a label or text area into the item contianer - martin's mentioned a cleaner syntax but I use
${ref('item.itemKey')}$
I don't think the ref() is necessary but I use it to remind me of what's going on when i go back when it inevitablly breaks
point being it should would work a rich area
as for sending to chat,
you do the same thing in the label roll message
I'll try it again to see what the output is but I think that would run into an issue since in theory I'd have multiple items (for Class, Subclass, etc.) with the same keys
oh, gotcha
The thing is if I put it all in an item container they will get really cluttered
so i want to reference the item directly from a label in the actor sheet
i'll send an example
'-' lemme ask this
would you then not need a new label for each item you want to reference - thus having x2 the content - 1 item and 1 related button? How would that be any less cluttered?
so img 1 is a example item on the shorter side. img 2 is how I'd format the Item Displayer to display everything. img 3 is the result, error bc no feature 3. I can obviously remove the featureX columns like img 4 but then I don't think I'd have the option to send the feature to chat as a message
wrong img 4 :p
First question is how many features does each spell have? Max 2?
Max 3
Okay and what is wizard and foundation conveying?
Wizard is the name of the item
Foundation is if the item is a Subclass, it would have a different tier. It shouldn't show up there since Wizard is a Class but I'll get to that later. The solution is probably splitting the Class Item Displayer and the Subclass Item Displayer but then the Subclass Item Displayer would be the one with a tier displayed
Hmm.. alright with wizard being the item name that makes it a little harder to style.
But at least for the features I'd use three labels within the item displayed and use code like this
<div style="overflow: scroll; max-width: 300px; max-height: 50px"><H1>${ref('feature1namekey'}$</H1><div class="classname">${ref('feature1key')}$</div></div>
That should set up a smallish box with a scroll bar displaying both the feature name and content and be easy to style
I'll play around with that, thanks
Also beware typos in that code lol, I'm on mobile rn ๐ฉ๐คฃ
It also seems like I can set a visibility formula and it becomes hidden in the Item Displayer and does show up on a label in the actor sheet, but then I have an empty column ๐ค
I already see one missing ; haha
Correct it hides the content not the column.
I assume there's no way to actually hide the column outside of getting into the CSS, right?
Maybe i could leave the columns unlabeled
I'll see which option looks best, thanks :))
Honestly I can't even think of a way to hide it conditionally in css off hand ๐คท
I don't have mine labeled for that exact reason.
fair, idt custom css is in my plans anytime soon anyway
Lol it will be.
I'm putting that off until the last possible moment
I wouldn't advise that simply because as you figure out what you want and what's possible it'll change haha
I haven't don't any JS, I refuse. It's defeated me too many times in the past
But css is fairly easy and makes a massive difference quickly
That's true
Definitely something I'll consider at some point, same for getting more into JS, but by the point I'm comfortable with it I'll probably want to make the system from scratch. CSS I can probably add in with CSB sooner
Yeah that's sort of what I'll aim at when I get into styling
Oh hah yeah I'm good on writing the baseline system. ๐คฃ I'm gonna have my hands full making items and macros for the foreseeable future
Item => Actor (outside of ItemDislayer). You have 2 options here:
- You use Item Modifiers to override the content of the Label in the Actor
- You use a Script: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Scripts/Scripts-for-Items
Yeah, that is possible:
${?{...}}$
%{doStuff()}%
Either scope.damageFormula or damageFormula, not args
Martin is back to bring order in this cursed land ๐
Execution context is the keyword here. Macros are written in pure Javascript, you can't use CSB-specific syntax there. And your Macro doesn't know what Dices is
Praise be martin, my best wasn't good enough ๐คฃ
Any ideas?
Ah, ok.
~~I actually tried to do this in a button from an actor sheet
%{const roll = await Roll.create(`${Dices}$d20cs<=12`).evaluate();
const successes = roll.dice[0].results.reduce((acc,e)=>{
if(e.success) acc += 1;
if(e.result <= 6) acc += 1;
return acc;
},0);
roll._total = successes;
await roll.toMessage();}%
It rolls the dices but ignores completly the success count part~~
It was a module problem, sorry.
In an item you can set a field as "Item Displayer" inside a table or dynamic table but trying to add other items is not working, when you try to add another item in to that, it doesn't appear. What i'm doing wrong?๐ค
I don't know how it possibly use that? I think I just need to get the actor id and the correct directory but I have no idea how to get those real-time for the correct sheet
I'm trying to create a macro that finds all the tokens in the active scene and changes the value in one number field by referencing the value in another number field within a dynamic table. My very limited coding knowledge is essentially useless in figuring out where to even begin. It took me 4 hours to figure out where in the data structure to even locate and console.log() the value I want to reference ๐ I'm not even sure I got the right one for making a macro
I also need one that'll just do selected tokens
Do you downloaded the example module? It can be helpful, i did my game sheet using it and was useful reference. There is an example on how to locate a value in a dynamic table.
I've only gotten as far as I have thanks to the example sheets, but since I need to write a custom script for a macro outside of the character sheets, I don't know where to begin. I can correctly console.log() the number I'm trying to reference, but that's as much as I know to do. Need a button that does a specific thing to a bunch of tokens at once, but since I don't understand the API documentation, I don't know what functions do what, or how to point to the right data, or how to even find any of this information. I see stuff like async/await in other people's scripts, but I have no idea what that means or if I need to implement it hereโwhy or why not.
Guys i need your help: I made some changes in an item template and reloaded all corresponding items.
Items that are already inside my actors arent reloaded automatically. I would have to do this manually and that would take me hours.
Is there a better way to automate this step? Can i create a Button with a label roll message that executes a script that reloads all items inside my current actor or something like that?
That would save me a lot of time. Thanks in advance!!!
Disclaimer: i don't know much about coding so i can't be of much help but for what i have understood sync means that the code is executed in order, so every task wait for the one before to be completed and then execute. Is linear in sequence. Async means that tasks can be executed at same time, so in parallel. What you usually want is the linear, much easier to manage.
About the "await" for what i have understood is the async thing, so the task know to wait for the one before to be completed.
Now, this will help in the immediate to code? I don't think so, but it's what i got for now ๐
I'm still in the actor sheet phase, so i did not start to wrestle with the tokens, yet.
I appreciate you trying lol I've read those things, but I just have no idea when it's relevant or useful. So much of this is counter-intuitive to me
No idea why this works
const thisActor = game.actors.getName("Actor"); console.log(thisActor.toObject());
but this doesn't:
const theseActors = canvas.tokens.controlled; console.log(theseActors.toObject());
Uhm, interesting question. When you put an item in an actor it changes UUID, it's not only CSB related, it does it in other systems too, so i think is a Foundry behavior. Maybe it's worth try to ask in macro-polo.
Every time I drag an item from my compendium I get something like this. It is no longer deleting the item from the character sheet but the pop up is annoying.
Logger.js:33 Custom System Builder | Item template has been deleted for item Longsword - Actor.UtEWQdEmhDMxXkN3.Item.VdXruWmJQzj06YfL used in Test 1 - Actor.UtEWQdEmhDMxXkN3 foundry.js:72076 Item template has been deleted for item Longsword - Actor.UtEWQdEmhDMxXkN3.Item.VdXruWmJQzj06YfL used in Test 1 - Actor.UtEWQdEmhDMxXkN3
Create an Item Displayer with no filters and delete/reload the Item
In the console: game.actors.filter(a => !a.isTemplate).forEach(a => a.items.forEach(i => i.templateSystem.reloadTemplate()))
Because theseActors is not a single Actor, it's an Array of Actors. You can't use toObject() on an Array
<input name="system.props.itemDisplayerKey.${sameRowIndex()}$.newColumnKey"></input>
Something like this. No guarantee though, because I've never done it this way.
Hi @formal goblet sorry but i tried to create an "item displayer" in a table in an Item template. But even if i select the correct type in the filters, when i try to add an item to another one, nothing appears. What i'm missing?
What i'm trying to do is to create a set of "Qualities" and add them to weapons, armor and the likes, without recreate them every time i create a new item but simply add them from the existing ones.
has anyone managed a template button on an item's chat message?
Which version are you using?
4.2.0
The feature is available for 4.3.0 (Beta)
Ah, ok
I imagine it would require a custom script to check item properties and make the template, no idea how you'd go about doing that though
I don't know what you mean with that
like you'd specify on the item that it has a template, what kind (circle, cone, square, line) and what size the template is, and then when you use the ability, a button in the chat message pops up with a "Place 20ft Circle" button that calls drawMeasuredTemplate with the args from the item properties
Yeah, Script it is. We haven't done anything in that direction
Sorry, where i can find the formula for the calculation of total weight of items in a container in the inventory, please? Found it.
I have a problem, I would like the Meter to show me the addition of all the numbers and not one after the other like here (I am in 4.1.1)
Wrap the formula that outputs the array into sum(). I think that should do the trick. Like, ${sum(formula)}$.
There is a way to sum the values in the same column of a table dinamically, please?
Struggeling with a User input in a label roll message:
What is the error please? I dont get it
The original roll message is much longer, but after i noticed the error message i reduced it to the part that causes the error
You probably can use a lookup() inside a sum(), since lookup() returns an Array of value.
Something like :
sum(lookup('tableName', 'columnName'))
Try to remove "|KOE_ATH_erschwernis" to see if it works without, I suspect it is causing the problem, but I'm not sure.
What are you trying to do ? Are you trying to let the user choose between a subset of numbers ?
Thank you but it doesn't seem to work like that ๐ค
The console is screaming but i'm deaf
What version of CSB do you use ?
4.2.0
Can you show your formula ? Because with only the error message it's hard to tell. It seems like lookup() is not recognised, but I cannot tell why
Sorry, sure
${sum(lookup('TabTest', 'Colt'))}$
is just a counter to try in a dinamyc table with only 1 column of number input field
Ok, that's strange. I changed a value in the table and now it works
Adding rows with only default value don't make it recalculate, maybe?
Oh, it probably threw an error because the table was empty and it cannot sum something empty.
With values from items in item displayer give an error too ๐ค nevermind, i can't write, sorry.
these are possible modifications for a later roll check. prefilling the first field with a variable and asking for more more modifications with the checkbox
Hello! Is there a component or "standard" way to create lookup tables, variables or formulas that are reused across different templates? Something like a mini custom library of values or formulas?
For example, I'm building out a system for old school Stormbringer. I have a Demon Sheet and a Character Sheet. In each I need to make a calculation of hit points based on CON and then adjusting for SIZ over 12 or under 9. I'm doing that with hidden attributes:
hidden attribute 'siz_over_12' is defined as:
${number_siz > 12 ? number_siz - 12 : 0}$
But, that hidden attribute is defined in one sheet, and I'd like to have it defined somewhere neutral or common so I can reuse it in the other sheet.
So I'm banging my head against the wall here... completely having no luck with the lookup function. I am trying to perform a lookup on an item displayer keyed as 'ammo' within my actor sheet. I should be able to call ${lookup('ammo',<field>)}$ and have it return an array of <field> data, correct, which would be displayed on the sheet as-is (just for sanity checking/debugging purposes), right? Similarly I could also call ${count(lookup('ammo',<field>))}$ and get the number of discrete objects within the item displayer, right? Or am I completely out of the solar system on this one? I've been working with computers since the late 1980s but just trying to filter through all the cruft to remember half the stuff is exhausting lol!
Can someone help clue me in, please and thank you? ๐
I figured it out. I had to recreate the filters in the new world.
Just create a global Actor, which contains central data
I see, thank you! If I made that into a function, is that how I'd store it - on a global Actor?
Functions are a different topic. I think you can use math.import() in this case
Question, I'm working with a label and I'm trying to link my rolling macro to each of the attributes and pass their values in... so what am I doing wrong here?
%{return await game.macros.getName('Test roll').execute({bonus_to_roll: '${att_Heart_Score}$'})}%
"bonus_to_roll" is the const in the marco I'm trying to edit through "att_Heart_Score"
I am referring to "4.5. Scripts" from the Docs:
This appears to be a downgrade, as the system no longer even keeps the text upon clicking elsewhere yet alone when closed.
I may be doing something wrong with "new column key"?
I targeted the column with the text field itself.
<button onclick="${#%{let templateData = { user: game.user._id, x: canvas.mousePosition.x, y: canvas.mousePosition.y, distance: ${item.template}$, t: '${item.templateType}$' }; let theTemplate = await MeasuredTemplateDocument.create(templateData, {parent: canvas.scene}); return '';}%}$">Place Template</button>
ok so I'm trying to make a button in a roll message to execute a script that creates a template but what I have isn't really working, it just places the template immediately when the chat message is created and then outputs this to the button:
is there anything obvious I'm doing wrong here?
This won't work. All event listeners in the HTML will be removed when created. You need a world script to attach a listener right after the creation of the message.
That's correct. I hope you also used quotes for the column key of the lookup function
Is there a way to "pre-fill" an Item Displayer?
i.e. I have a certain Template that is intended to ALWAYS start with a few specific entries.
You'd need a WorldScript to do that which creates EmbeddedDocuments whenever a new Actor is created
little bump
The syntax is correct. What's the error in the console?
It executes fine, but it's not pulling the value of "att_Heart_Score" and assigning it to "bonus_to_roll"
Is att_Heart_Score in the same entity context as the Label? And what does it return?
@formal goblet Martin kannst DU Dir vielleicht einen Reim darauf machen, was hier das Problem ist?
Zeilenumbrรผche rausnehmen
att_Heart_Score is in the same entity. And what would be the best way for me to check?
A simple ${att_Heart_Score}$ in the Label Roll Message is enough
It does denote [3]
Seems fine then
What about a console.warn(bonus_to_roll) in the Macro?
gerade versucht, fehler besteht weiterhin
Mit string() die einzelnen User Inputs umranden
concat() mag es nicht, wenn man zahlen darin verwendet
[0] and this:
It's not undefined, so the value is actually present
Is there something I should be adding to bonus_to_roll when declaring it?
In the marco is:
const bonus_to_roll = 0;
const roll = await new Roll(``4d6cs>2 + d8 + ${bonus_to_roll}``).roll();
It should already be declared when passed as an argument. You overrid your value with a new one
Btw, why double-backticks in Roll()?
Oh sorry, trying to format for Discord Lol! It is only one in the macro
So am writing this correctly? Both in the macro and Label? It's just not wanting to pass the value over for some reason?
No, delete the line with const bonus_to_roll.
You override your 3 with 0 in this line
Oh ok, yep it works! Thank you and I'm sorry. Not used to all of this. I still have ptsd from C++ and not assigning values
Yeah, JS is a bit different with var, the window-object and some more stuff
Now say I wanted to pass two augments in game.macros.getName, how would that look?
getName() only accepts one string
Ah got ya. Thank you!
You can create an array of strings and do a forEach-loop
How do you mean?
Basically what I'm trying to do now, is pass my attribute as a flat bonus to the roll, and get [x] value for the number of d6s rolled.
I tried adding <button id="template"></button> to the roll message and then adding this as a world script:
document.getElementById("template").addEventListener("click", templateFunction)
async function templateFunction() {
let templateData = {
user: game.user._id,
x: canvas.mousePosition.x,
y: canvas.mousePosition.y,
distance: 10,
t: "circle"
}
let theTemplate = await MeasuredTemplateDocument.create(templateData, {parent: canvas.scene});
}
but the event listener is not being applied to the button, the button doesn't have any functionality at all
anything that looks off there?
It's not enough to execute this script once when the world loads. You have to do it every time a Chat Message is created
You need something like this here:
Hooks.on('renderChatMessage', async (chatMessage, content, speaker) => {
content['0']?.getElementsByClassName('world-apply-effect-on-targets')['0'].addEventListener('click', async (ev) => {
// Whatever you need here
});
});
Hooks.on('renderChatMessage', async (chatMessage, content, speaker) => {
document.getElementById('template').addEventListener('click', async () => {
let templateData = {
user: game.user._id,
x: canvas.mousePosition.x,
y: canvas.mousePosition.y,
distance: 10,
t: "circle"
}
let theTemplate = await MeasuredTemplateDocument.create(templateData, {parent: canvas.scene});
});
});
I've tried this but I got the same result, button does nothing
getElements
You have multiple Chat Messages at the end
you mean something like what you did here? content['0']?.getElementsByClassName
I think I see, hold on
yup, that did it! needed elements by class names since getElementsById doesn't exist
then just changed id="template" to class="template"
You should use world-template by convention, because classes can collide if system/modules use the same one
now the only problem is the template automatically spawns at the cursor, whereas I need it to attach to the cursor and then place on the canvas where the user clicks
I can't help with that
which is done by multiple systems but I have no idea if that's custom functionality or if it's foundry core behaviour
not expecting you to ๐ thanks for the help with the script!
oh I did have another question regarding CSB though. If I need to reference ${item.key}$ in the world script, how would I do that? Could I use system.props.componentkey somehow?
Yeah, but you have to get the Item first
no Idea how I'd do that
Likely another simple question I can't quite figure out.
Say I have a character in the game and want to use one of its properties in a non-system function. How could I find out the data path of, say, a property called player_id ?
Check this: https://github.com/GamerFlix/foundryvtt-api-guide/blob/main/macro_guide.md#updating-sidebar-documents
...system.props.player_id
Thanks, that worked โค๏ธ
the thing is I can't figure out how to get the item from the chat message data per se. I'm trying to create the templates with data from item keys, if the spell has a 20ft radius circle I need that data to be in the spell itself as size: 20, type: "circle" component keys, but I've searched the data of renderChatMessage and I can't really find a reference to the item that the roll message was attached to
Hello there!
I am in the process of creating an inventory and items to place in this inventory.
ITEM
The item I am creating has a dynamic table with the key beneficios.
It has two columns:
The first column is a dropdown with the key beneficio_armadura.
The second column is a numeric field with the key modificadores_bp.
INVENTORY
In the inventory section, I have an item displayer that includes a column labeled beneficios.
FORMULA
The formula I need should display the list of benefits from the dropdown column alongside the modifier from the numeric field.
It should appear like this (for example):
โข Strength +1
โข Dexterity +3
โข Power -2
thanks in advance for your help!
Wait a bit, you're mixing a few terms together.
Items are ... Items like Weapons, Inventory and stuff, that you can drag to Actors. These have system-properties (like Actors), which can be used by Formulas (or Scripts with ...system.props.componentKey)
Chat Messages on the other hand are a different concept. They don't contain the same system properties like Items and Actors, so you have to handle them completely different in that regard.
So the context is I want players to be able to place measured templates from the spells they cast. The spell item itself needs to hold the template type and size among its keys: ${templateSize}$ and ${templateType}$ for example.
Then the items are in an item displayer on the actor of course, and that item displayer has a roll message to be able to cast the spell, sending a chat message with the spell's to hit, damage, etc... data.
That roll message has a <button> tag which has the added event listener from a world script that spawns a measured template. But I need the world script to know what the spell's radius and form is (cone,ray,circle,rect) which comes from the item.templateType, item.templateSize keys.
Use the data-attribute in HTML
Save the UUID and get that in the HTML-Element and pass that further to your Macro or whatever you do
I think I understand.
To get the UUID in a roll message, is data-item-key="${item.key}$" enough or do I have to do like fetchFromActor or something to find the uuid
${!%{return linkedEntity.uuid;}%}$
oh of course
Well feel awfully guilty about coming back around on this but I've got Actor.dWusIrzf0UIwQLb1.Item.gWzNTyTpytnm5SVx stored as data-item-key but I've looked in the api until my head started to hurt and I just can't figure out what to do with it.
End result obviously is that I need to make a variable out of the id
let item = ??? ("data-item-key") somewhere in there
but I just have no idea where to even start
documentation on the data- attribute hasn't really helped at all
HTML is designed with extensibility in mind for data that should be associated with a particular element but need not have any defined meaning. data-* attributes allow us to store extra information on standard, semantic HTML elements without other hacks such as non-standard attributes, or extra properties on DOM.
Just wanted to let you know that I read the documentation, figured it out and I'm really grateful for the pointers and directions! Thank you Martin!
let id = content['0']?.getElementsByClassName('world-template')['0'].getAttribute('data-item-key');
let item = await fromUuid(id)
let templateData = {
distance: item.system.props.template,
t: item.system.props.templateType.toString()
}
I am still unsure what you mean here sadly.
['name1', 'name2'].map(name => game.macros.getName(name))
This will retrieve 2 Macros in an Array
If your question is about the execute()-function, then it should be this way: ...execute({arg1: 'hello', arg2: 'world'})
Perfect! Thank you!
Ok so it works when passing a flat number like ...execute({arg1: 'hello', arg2: 'world'})
But trying to pass in a variable like ...execute({arg1: '${text_1}', arg2: '${text_2}'}) Gives me the following error
Something simple as:
%{
return Object.values(linkedEntity.system.props.beneficios)
.filter(row => !row.$deleted)
.map(row => row.beneficio_armadura.concat(' ', row.modificadores_bp >= 0 ? '+' : '', row.modificadores_bp))
.join('<br>');
}%
You have an issue in your Macro itself
Or your passed value is undefined
CSB Formula syntax is ${...}$, not ${...}
Thank God it works! Thank you @formal goblet for putting up with my dumbass
Good Morning Europe, maybe this question is trivia but I cant figure out by myself: How can I add a custom font? I already found it in core but I dont know how to add it in CSB
If you want to change text in your sheets use the custom css module or add your own css file then add
{font-family: "yourFont"}
to the classes where you want it to apply
You could also do:
:root {
--font-primary: "yourFont";
}
to change all cases of that primary font being used to your custom font. Of course the font needs to be a filepath to where the font is within the foundry data folder "fonts/yourFont.TTF" for example
maybe it needs to be url("fonts/yourFont.TTF") actually
Perhaps another simple one from me. I have someone who will write me a more complex script macro for a combat resolution that has some interesting niggles and wiggles.
To do so, I need to call the macro and give it a list of arguments, say attacks, accuracy, damage and ap.
In turn the macro will return me an array of data I then want to read in a formula (if possible).
So basically... a roll formula on a template button calls the script and executes it, gives it the arguments I mentioned before.
As output it should return hits, damage and final_accuracy_rating
The actual questions:
-
How do I call and feed the macro the data I want as input.
-
How do I take the return array and get the right data? For example, get
hitsback from the macro and input it into a variable calledoutput_data_hitsfor later use?
- https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#334-calling-macros
- Return an Object instead of an Array and add it to
localVarsin the Script:
const returnValues = {var1: 1, var2: 2}; // Return of Macro
localVars = {
...localVars,
...returnValues
};
Vielen Dank!
I add this in a richtext format?
I'm not sure what you mean. What's the context. Where do you want your custom font?
For the start in Labels
then you add it in a css file. Either make a text document, rename it to .css filetype, and put it in the foundry data folder somewhere, then point to that file in the CSB system settings, or you just use the Custom CSS module. Then all of your custom stylings need to go in that css file / custom css window in the css markup format.
https://www.w3schools.com/Css/
if you want it in a specifc label you can use the component key of that label as your class:
.myLabel {
font-family: url("fonts/yourFont.TTF")
}
or if you want to change more at a time you can inspect elements in F12 console (for chrome browser) and look at their styling to see where they get it from. Many text elements in foundry use var(--font-primary) and can be changed with
:root {
--font-primary: url("fonts/yourFont.TTF")
}
or this for example:
body {
--font-body: "Signika", "Palatino Linotype", sans-serif;
--font-awesome: "Font Awesome 6 Pro";
--font-awesome-duotone: "Font Awesome 6 Duotone";
--font-monospace: monospace;
--font-blockquote: "Signika", "Palatino Linotype", sans-serif;
--font-h1: "Modesto Condensed", serif;
--font-h2: "Amiri", serif;
--font-h3: "Signika", "Palatino Linotype", sans-serif;
--font-h4: "Amiri", serif;
--font-h5: "Signika", "Palatino Linotype", sans-serif;
--font-h6: "Modesto Condensed", serif;
}
oh and for example you can do:
@font-face {
font-family: 'myFont';
src: url('fonts/myFont.ttf') format('truetype');
}
.myLabel {
font-family: 'myFont';
}
After you make some actors, items, etc., how does one package them up to be used in different foundry worlds? Do you make an adventure module? If I wanted to source it out of say gitlab or github, how might I go about that? (I'm currently developing w/CSB using a self hosted instance out of digital ocean - I'm comfortable w/unix, setting up and maintaining various things, etc.)
I would guess I'd want to follow these instructions? https://foundryvtt.com/article/adventure/
The official website and community for Foundry Virtual Tabletop.
You can either use an adventure type or the corresponding compendium types for each Document type, that's entirely up to you.
That's how I've done it:
Nice, thank you!
And thank you for this tool - after a few hours of learning and tinkering, I have a reasonable, totally usable character sheet and some auxiliary sheets and items. I'll be able to use this with just a little bit more work. It's mostly a duplicate of a paper character sheet, but has some bells and whistles like skill and damage rolls.
I salute you! ๐
You should only make sure, that you preserve Document IDs. Otherwise, you'd have to reconfigure some stuff. And Templates should be loaded first into a world
CSB doesn't read Templates from Compendiums
As a programmer myself, mostly back end and infrastructure focused, it's totally obvious that this is a labor of love that started out scratching your own itch, and sharing it with the community is extremely generous. Thank you.
Sure, you're welcome. There's still some work left in the system to be "ideal", but it's taking a good direction
At least it's waaaaay more open for modification than 2 years ago, where you couldn't even do calls to the Foundry API from the sheet
hey, awesome setup but I am reading through the documentation and I am trying to figure out how to send data from a label call to a custom user input?
user clicks roll next to a skill and I need to prompt them to select an attribute to pair for the roll the skill selection should be known based upon what button they press
also I tried to download the example module but it wants version 4.3 but the latest version is 4.2
hi, sorry it took me forever to get back to you, here can i find information on this function?
is is a CSB thing or a general fundry thing?
csb is built on math.js
I am trying to get text instead of numbers though
i mean, entries from a dynamic table
Is there a way to get Tactical Grid's range finder function to work with CSB items and spells and stuff? Or at least, is there anything like it compatible with CSB? Seems support for ranges has to be hard-coded, unless I'm missing something.
right use the rand function to get a number, and then conditional logic to determine which string of text to use.
let x = random() * 2;
x == 0 ? doThis : ''
x == 1 ? doThis : ''
x == 2 ? doThis : ''
So, been a while since I asked anything. CSB has been working reasonably well for me. ( Been running a Hyperborea 3E campaign in it ) So much so, that I haven't bothered to move to the now official mod for that system. ๐
Anyway, I've been expanding on my templates, and had a dread thought about possible trouble in the future. I setup a tab for each PC as an XP journal, implemented as a Dynamic Table. Each entry is a log of XP earned, and at the top, I have a label that runs through all the entries and sums them up. So far, so good. works like a charm. But now I'm wondering if this will eventually bite me in the butt. Has anyone had any trouble with large numbers of entries in a DynamicTable? ( like 100s of entries? ) I figure it's probably good to know now, so I can work on a solution before things get busted.
from a UI perspective that sounds awful for each player to have to keep up with their XP in a "journal entry" style in perpituity. Even businesses make a new journal every month, and clear out the back log once a box gets between 3-5 years old to prevent lists getting too long or annoying to find items in.
Is there a usecase for you having a ledger that spans like that?
note: after its even 1 year old it gets thrown in in the 2024 box and subsequently thrown into a closet to be forgotten about till say 2029. Didgital copies are kept in the same way.
Yeah, that's high on my list of possible solutions. I implemented it mostly as a learning experience for CSB. most of my players in the past would just keep an excel or google calc spreadsheet going back forever. We usually would get a kick out of going over the early days of a campaign.
do you mate - idk if there's any issues with collecting that much data or not within the system,
i'd advice using a per XP section and exporting to a more stable system like a DB or at minimum excel post session
it appears that there's a hold up regarding the js events - specifically keydown not being imported when just the html and classes are called within the item displayer ๐ฆ
a similar issue occurs when trying to re-create a dropdown box, it'll simply delete the stored data on select.
Is there a way to use something like sameRow on a normal non-dynamic table?
nope
May somebody can provide me some Help with the math? I have an value that equals 1 or 2 or 3. Lets call it A. I need an formular/equation that solves to 2 when A is 1, to 4 when A is 2 and to 4 when A is 3. I tried several Things but somehow I cant wrap my head around it. Unfortuneatly I need it in an conditional formular so I cant use that ๐
You can nest conditionals
a > b ? x : a > c ? y : z
Ah yes I know but I need it within a conditional. Like
a > b ? y > z : 0
a > b ? (y > z : 0) : 0
Holymoly! Thats awesome easy!
Is there a way to create an array of information within/utilizing the system?
I have a series of "keywords" I want to pass to a script, and I'd prefer to create an array for that ๐
It's only easy when Martin or Nat tells you how to do it, else is a nightmare...
Maybe it's just me...
I will somehow add him as helping Charakter in my Games. And we all should kofi him
@formal goblet How to Kofi you?
Nope, we all struggle while learning.
At which level? An array for each Actor or one for the whole world?
I want to get various pieces of information put into a single array.
All sourced from one actor
A Label with %{return [x, y, z];}%? The result will be a comma-separated value, but that shouldn't be too hard to convert to an Array again
Dynamic Tables would also be an option
Thank you, I think I can work something with that! ๐
Ever since the big update to csb and foundry my trusted players are unable to edit items in folders. Is there a setting in CSB that changed? Or is this a Foundry thing, and if so anyone have a clue where to fix it? I can't see any relevant permission settings in the config.
Should be a Permission setting of Foundry
Your players should be owner of the Items
Sadly true
Bruh once I start working again I got you โฅ๏ธ
Btw I have two feature requests if possible ๐ฉ
One should be very easy.
- make a csb "companion module" that has all the template actors and example sheets made with those templates in a compendium for testing and viewing. Have a popup on csb world first launch asking users to install it - this may help cutdown on user questions if they have accessible and easy examples.
Two is certainly a small pain (sorry!)
- add more options for columns in dynamic tables, and item containers (etc), having to improve meters, dropdown, and text storage has been the bain of my existence haha.
Or at least make a callable function that can be placed into the existing labels to create them figuratively anywhere as an "advanced option". Even exactly recreating how the system appears to do it causes errors with the JS functions used on them within the system. ๐ฅ
The first point is actually not easy. I wouldn't even know how to install a module from a world without having the module in the system data itself. And I need more details for the second point though, I don't get what you want there
Oh I didn't mean for the module to install itself, though you could technically just list it as a dependancy and foundry should handle that natively.
I meant just a simple prompt on the first time that a world is loaded to check if it's installed and ask the user to install it if they want it.
Good point. I think that optional dependencies are possible within it
As to the second point, more options within columns of item containers specifically. When I try to create a new column I can only choose label or meter, I'd love to have access to more stuff like dropdown, text field, etc.
I know Hikanx also was mentioning something along those lines.
My usecase is simply the ability to make quick notes about where stored items are located. Though I could see uses for all sorts of other stuff.
I tried calling both <input> and <select> with the appropriate classes and everything but they seem not to trigger the native JS functions, and thus dont save the data even if they match how CSB builds them natively.
Every time it deletes the contents with an AlphaNumeric Error - despite only being simple "111" or "ttt" without the quotes
same with the <select> and <option> tags once an item is selected it sets back to blank and the same error occurs
The reason only these 2 Components are possible, is because they are computable Components. All other Components (especially the Input Components) are non-computable ones.
Item Displayers work different in terms of persisting data in the Actor (especially the old version, where the container didn't even have own system.props in the Actor). The count of rows is dependent on the amount of Items an Actor has (unlike a Dynamic Table, where the count of rows has no dependency).
I don't exactly know if the current version of the Item Displayer still has the restriction or not. It'd need a test
I think I follow: effectively there's no way that a non-computable token would be able to modify the item so there wasn't much of a reason to re-make those "elements" for a item container?
*i'm not on the beta if that helps at all v4.2.0 ๐ฌ *
I've considered switching to the beta for the item in item storage. ^^ but am worried things will break lol
I'm talking about Item Containers from v.3.0.0 vs. 4.0.0
Would making a display component be easier? display a parent component of the same type from the item within the item container -> Potentially even having the option to update its parent within the sheet?
@brittle moth do you have more insights on why column Components in Item Displayers are restricted to computable Components only?
I've approximated just the display result with a ${ref(item.Key)}$ haha. My original way of doing the location dispaly was exactly that, but having players open an item to change its storage location was a bit non-ui friendly
i've cut every corner so far to minimize user-clicks where possible, and to increase useabiltiy.
๐คฃ oh i see you requested that 2 years ago haha
I'm having an issue. again... lol. This 4.x update changed so much.
anyway, my weapons (items) have different attack options. Example: a sword could have slashing or thrusting damage. These options are on a dynamic table inside the item. How do I get the top option in the dynamic list to show up on the item container? I thought first() was supposed to do this, but it is not. I think its just picking the first option that was ever created. (the funny thing is, CSB 3.X did this perfectly, it always updated the sheet container to show what was first in order on the table)
Or is there just a better way to go about this?
Well, a better way would be to use a Dropdown to actually select the Damage Option. We changed the sorting behavior of entries inside ExtensibleTables from actual sort to clientside-sort only to enhance performance when switching the sort. That means, that all entries inside those tables will stay in insertion order internally
ok, that works. Wasn't sure what was best, so thank you. Item containers are pretty limited. Just curious, are there any plans to increase their capabilities beyond labels and meters?
Hi, sorry, is there a way to get an actor sheet content all bigger by a %, please?
HA. i literally had just asked that haha
martin probably still had it in his clipboard
'-' not one that would be simple
You could install the popout module, and then use your browser's default zoom property
Well, this will do, thank you very much.
I thought about it a bit,
I know css has a (rarely) used transform scale property...
You could select the character sheet class then all it's children using *
So
. Character-Sheet * {
Transform: scale(1.2);} for 20%
Idek the actual class name off hand, you'd need to find that
I'm not familiar with css and the module works good so I'll stick with that at least for now. Thank you.
Tbh i'm really grateful about all the help i got but it's really time consuming adapt Foundry to a new system. I can't invest to much time on it, i'm still fine tuning my system, developing the first setting and a second is scheduled, plus i still need to write some adventures and i'd like to GM it sooner or later ๐
Holydays are about to finish i will not have that much time for a while ๐ญ
Sorry, is there a way to move an entire table from a tab to another in an actor sheet?
Just drag it
Uhm sorry, maybe i'm not understandig something basic but if i get a table from, let say, "main" and i drag on "magic" nothing happens
Move it out of the tabbed panel. After that select the new tab
Oh sorry, i'm an idiot. Thank you very much.
Sorry, i have a mixed bag here so i probably making a mess but i don't really know how to make it work
%{const data = await foundry.applications.api.DialogV2.prompt({
window: {title: "Roll Dice"},
position: {width: 400},
content: `
<div class="form-group">
<label>Dice:</label>
<div class="form-fields">
<input type='number' step='1' min='1' max='10' placeholder='es. 1' name='dice'>
</div>
</div>
<div class="form-group">
<label>fumble:</label>
<div class="form-fields">
<input type='number' step='1' min='1' max='30' placeholder='es. 1' name='fumble' autofocus>
</div>
</div>`,
ok: {callback: (event, button) => new FormDataExtended(button.form).object}
});
if (!data) return;
const roll = await Roll.create(`${data.dice}d20cs<=${Talent_Roll_Total}$`).evaluate();
let failures = 0;
const successes = roll.dice[0].results.reduce((acc,e)=>{
if (e.success) acc++;
if (e.result <= ${Skill_Selection_Value}$) acc++;
if (e.result >= data.fumble) failures++;
return acc;
},0);
roll._total = successes;
const msg = await roll.toMessage({flavor: `<h1 style="font-size: 20px"><div style="color:green;"><b>Successes: ${successes}</b></div> <div style="color:red;"><b>Failures: ${failures}</b></div></h1>`});
msg._rollExpanded = true;}%
What i'm doing wrong this time, please?
In theory it would show a prompt with 2 value to insert (with a default value for each) and then roll the input number of dices and use a value from the actor to check success, another value to count critical success (count double) and the other manual input to count critical failures, giving the 2 totals (success and failures) back in the messagge chat.
Using it wit all 4 as manual input works, but when i try to use value from the actor sheet it fails somehow
Having a bit of a weird issue with radio buttons.
I have a group of two things set up. They are in the healthType group. One radio button is keyed as key_manpower the other as key_structure.
key_manpower is "checked by default".
Any time I open the sheet of a unit based on the template containing this radio button group... it's got structure activated. Changing it in the sheet gets reset on opening it up again.
Any idea as to the cause here? ๐
Do you have a Component with the same key as the group?
I dont think so. Lemme swap the group key name to something unique and see
That wasn't it, sadly. Behaves the same after giving it a random unique id
I think your string literals like ${failures} are causing issues, because it clashes with the CSB-Formula-delimiters ${}$
I though it can be that one but how do i make it work please?
const roll = await Roll.create(data.dice + 'd20cs<=${Talent_Roll_Total}$').evaluate();
...
const msg = await roll.toMessage({flavor: '<h1 style="font-size: 20px"><div style="color:green;"><b>Successes: ' + successes + '</b></div> <div style="color:red;"><b>Failures: ' + failures + '</b></div></h1>'});
Othwerwise I need your error message
This?
Sorry no, the error is this using your edit
The first one is using ${} for data values, the second without those
Okay my issue is solved.
My dumb <bleep> didnt give a value. Added in value and then checked for equalText. Now it resolves.
@formal goblet Otherwise there is a (simple) way to get 2 different
${#?{userInput|2}}$
In the same dialog?
${#concat(string(?{...}), string(?{...}))}$
It works, thank you very much!
I am using wounds as items in my system. Now I would like the wound "item" to have a clickable button or something interactive that would apply a condition to character. What would be the best way to approach this?
A little big problem here. In order to use switchCase formula, in the carachter's sheet i've set a simple dropdown (component key Liv_Inc) like this in the picture. Then i have a Label, named Costo PM , and in its label text i wrote this formula: ${switchCase(Liv_Inc, '1', 1, '2',5 ,0)}$. The purpose of this system is that, when i select 1 in the dropdown list, the label Costo PM should assume the 1 value, and when i select 2 in the dropdown list, Costo PM should assume the 5 value. Probably something went wrong, because the Label value is always 0, no matter what i select in the dropdown list. Console says the value is 'uncomputable'. but i don't understand why.... please help!
Must be Input Components, not Labels
Ah, okay - thanks!
Might have to do some sorcery then, since I don't want them to be editable by players ๐
Dynamic table where the GM enters the data and another one for players to peruse and use the attack function maybe.
You can create a column with invisible Text Fields and let your Labels reference that
That would work as well, yeah. Thanks ๐
Is there a way to easily "turn on/off" light for a token, please? Or i need a macro to do that?
You'll need to edit the jason file
Thank you
Uhm it works even without editing the json. Sorry, why i need to do that?
I have no godly clue how. Csb isn't integrated and even if it were it'd be a custom item?
Ah the first paragraph of the git, if no recognized system is in play it'll use no item and have a self property.
Aka your character is radioactive and glowing.
ah lol
make sure you refresh your sheet. also there's a mising space between '2' and 5.
this worked perfectly
Hey, its possible to change a label in a dynamic table with an itemmodifier?
I don't believe so.
You can change a input component like a number field. Use a hidden one that that then adds to the label?
So the displayed label in your field would be
(Original value)+${ref('newValue')}$
Yeah, you can. Retrieve the key with fetchFromActor('attached', "lookupRef()") in the item modifier
It only changes one label, I want to change the label for all rows in the dynamic table
That's currently not doable
Except if you modify a Label outside of the table and reference that in your rows
Thanks for your answer Scyrizu. I followed your suggestion to respect the spaces... and i found that switchCase seems to work as intended in a panel, but not in a dynamic table (in your exemple, if 'test' and 'test1' are in a dynamic table you get always 0, no matter what value you select in the dropdown list). Anyway i post you the image of the Label Costo PM in which i wrote the switchCase formula (respecting the spaces this time, or so i hope...). 'Incantesimi Offensivi' is the dynamic table, Liv_Inc and costo_pm are two of the columns.
The spaces are irrelevant, but the Dynamic Table changes a few things. The data inside Dynamic Tables cannot be access with only a Component Key, because all rows share the same key. That's why you have to use sameRow('columnKey') to retrieve the value of the same row in the specified column.
Got it Martin, but the problem here is that switchCase allows you to set the value dynamically (e.g. a first level spell costs 1 mana point, a second level spell costs 5 mana point... etc.). Using sameRow means i have to insert only one specific value. I can try to create a panel (hiding it to players by permission or visibility settings) in which for every spell level you get the mana point cost. In the 'original' dynamic table, i could use the 'ref' formula (or another suitable formula) to obtain the value i want pointing at it outside the dynamic table (in this case in the invisible panel).
You know that you can combine it?
${switchCase(sameRow('Liv_Inc'), '1', 3, '2', 5, 0)}$
Oh, wow.. that seems cool! I could give it i try (probably i'll fail as always) ๐ . Thanks! No surprise if i'll be back (and no, i'm not Schwarzenegger).
When first building the item container, the goal was to display info about the item. Making editable fields was not prioritized, and even the computed fields in the container were not referencable outside of it.
Mirror components are in the ROADMAP, when I get to it ^^
So it's just a historical reason instead of real restrictions. Gotcha
It seems somehow I cant get my Itemmodifier to check for an checkbox in a dynamic table.
${fetchFromActor('attached', "lookup('Languages', 'ReadWrite', 'Name', '6')") == 'true' ? 1 : 0}$
Something is wrong but I cant figure out :/
With your current Formula, you're doing the following check: Array == string, which won't work. Checkboxes return booleans, not strings. And lookup() returns an Array instead of a single value
is the roadmap publicly available? The one roadmap.md is blank
Yeah it is. It's just blank ๐
So what how to Check then if the checkbox is checked? ๐
I think there will be a new poll after we've finetuned the Items in Items-feature
Use find() instead of lookup() and remove the equality check. It's enough to check for a truthy value
Further I need a value but I could use an condition for this, right?
You already get a true or false from find()
true == true can be shortened to true
Yes, but I need to assign a numeric value if the checkbox is checked and another if its unchecked
true ? 1 : 2
Ah thats what I meant
Replace true with find() and that's it
So... I'm not sure if this is addressed anywhere as I feel like it's an edge case, but the system I'm trying to build here counts Initiative from low to high. Does anyone know how to flip the combat tracker to start from 1 (ascending order)?
(it is not an option in the given Core Combat tracker settings, I checked)
You could invert Initiative by*-1
And then you get the same effect
yeah, I have considered something like that, as we do have a ceiling for round segments. I can technically do (20 minus the roll result) and let the combat tracker count down, but I was hoping to have it work "naturally"
Maybe a module can help you out. CSB itself has no option for that
Hello there!
I'm trying to get de defense value of an item (armor). The fetchFromActor is returning error and i can't figure it out.
thanks in advance ffor your help
you're using fetchFromActor on an item? that'd be your issue.
'item.componentKey' should be what you want
I used 'item.componetKey' here and it works. What I've been trying to do is get the value of 'Defesa' (attached to the item) and use it somewhere else
then you'll need to make an "armor class" label or something somewhere that is modified by the item when it's equipt.
that's what I'm trying to do. For some reason I cant figure it out
Make a label somewhere on the sheet.
Go into the item and make it Equipt ? +4 : '' and set the key to the key of the label you want to modify
Defesa is part of your Item Displayer, so you could perform a lookup() on it. The alternative approach would be via Item Modifiers or with a Script
Martin ๐ go to bed haha
Wdym, already there
Bro haha isn't it like 2 am for you ๐
Almost 3
๐คฃ you're not helping your case
I've created an attack macro that's intended to automatically update the targeted token's currenthp value and subtract the damage, but the player/trusted player role doesn't have permissions to alter said hp.
Here's the specific section of the code,
game.user.targets.first()?.actor.update({'system.props.currenthp' : (game.user.targets.first()?.actor.system.props.currenthp - totalDamage)});
and attached is the error, if any of that helps.
I'm not sure what permissions would needed to be changed to fix this, or if it could be done without allowing players/trusted players access to the sheets themselves, or even if this is a more general issue I should probably have taken elsewhere, but any information on the subject would be helpful!
I always forget to update the file ><
In my mind, the main missing features right now are :
- Mirrored components in Item Containers
- Ability to create custom active effects / manage the active effects, from CSB itself or by supporting another module doing that
- Formula refactoring to allow async operations everywhere (for example : rolls)
- Application V2 full support (scheduled for end v12 as opt in, and v13 as opt out for now)
I don't think I forget anything, but maybe I do ^^
But I guess I'm finally getting to a feature complete CSB! \o/
This is an intended limit by Foundry itself. The only way to solve this, is to let the GM perform the update.
Gotcha, fair.
No luck with that combo formula to use in the dynamic spell table, Martin. I have also tried converting the 'Liv_Inc' column from dropdown list to number field and using lookup in the 'costo_mp' column, inserting 'Liv_Inc' (now renamed 'Liv_Inc2') as a field filter for another dynamic two-column table, where the first column is the spell level and the second contains the cost in spell points... no way. It is as if the values entered in the 'Liv_Inc' column refuse to be read as numeric values in more complex formulas than just 'ref' (which works by itself, but in this context it does not work e.g. using it to define the lookup filter field pointing to the second dynamic table 'SpellCost'). I finally had to give up and am creating a normal table for spells. This is an acceptable workaround, however I felt it was only fair to let it be known should someone else bump into it.
Is the following possible, and if so - how? ๐ฌ
A dynamic table that starts empty.
Players can pick entries from a dropdown menu and hit a label-button to add a predefined entry from the dropdown to the dynmic table.
You need a Script for that.
Add a few random rows to the Dynamic Table and check the data structure in system.props.dynamicTableKey in the console. With that, you should be able to update your Dynamic Table with the right data
Thanks o/
I am grabbing a bunch of data with a lookup function. Is there an easy way to add them together when they get returned as array?
sum(lookup(...))
I tried something like it but it didnt work, was perusing the math.js API ๐
Thanks again Martin, you're a great help. Gonna have to support ya for sure ๐ค
See if you get a result with sameRow('Liv_Inc2')
can a visibility formula for tabbed panel look for an item.name to be shown? if so, how?
does the find() function work for this?
Yeah, it does
find(perkContainer, Name, "Arcane Gift") made the tab dissappear, but having the item with name Arcane Gift on the actor doesn't make it visible. What am I missing?
Find has always 4 args, not 3
Oh, 3 of the arguments are listed as optional so kind of confusing that 4 are required. Could you give an example for how this is to be written out? Examples in the guide go a long way for dummies like me lol.
2 are required, the next 2 are optional, but required in a pair and the last one is optional by itself
The equivalent for SQL would be SELECT targetColumn FROM extensibleTable WHERE filterColumn = filterValue
Heck yeah, I do have a question about that.
Is there a difference in how foundry handles active effects vs just using an item called poison for example?
It is in some regards similar, but not equal
Sadly '${switchCase(sameRow('Liv_Inc2'), '1', 3, '2', 5, 0)}$' returns 0 in a column of a dynamic table. No matter, i used a normal table instead of a dynamic one.
Is there somewhere I can see the difference? I've been planning to do it using items in the near future.
Good afternoon! I'm very new to programming, so I need something very simple. I'm using the Custom System Builder and created an actor for global character resources called "Group." One of the attributes in this sheet is "LUCK." I want to set up a rollable table to roll 1d12 + LUCK. Could someone help me with the formula for this?
I think the best would be to try it out
Trial and error lol that's how this whole sheet has been built so far ๐
[#rollTableName|1d12+:LUCK:]
So levels don't require set mana and need to be adjusted real time in gameplay?
Have you considered adding a popup prompt on roll asking for the modifier to that roll?
For example lvl 2 spell takes 5 mana but for whatever reason this time it'll take 7 - so you can have the popup ask to modify the mana consumption by +2
That's how I handled situational bonuses and damage modifiers
I have given the setPropertyInEntity instruction (which is in the die roll label at the end of each row), the task of handling the curtailment of spell points. In the 'Label Roll Message' I have in fact inserted several formulas (to set the chat output i need whenever a player cast a spell) and a macro to handle differential damage between different targets depending on whether they pass the saving throw or not. Of course, entrusting the macro also with the task of curtailing magic points would, among other things, allow the cost of spells to be determined dynamically, although my system does not provide for this. I actually wanted something much simpler: making a dynamic table would allow players to add spells they want at will. By entering the level, the spell point cost field would automatically populate with the cost relative to the level, and this value would then serve to setPropertyInEntity to determine how many spell points to scale from the character. The switchCase formula would have served precisely to vary the magic point cost depending on the level entered by the player without bothering with any macros.
So wait you're using a dynamic table for a spell list?
Actually, I want to set the LUCK modifier to the rollable table itself
But I don't know how to refer it from the Actor file
The two main differences, in my opinion, are that
- Other modules which rely on active effects would not be able to get the items acting as those effects
- Active effects can be set on the token as little icons, items can't
Ahhh I see.
I mean the little icon could be toggled using a world script. But that is additional labor to consider there.
The modules is a fair point. I need to think if I'll be using any ๐ thanks link!
Yeah, you have way more module support there with Times Up (having Timers for Effects), Status Icon Counter (Stacks), and so on
๐ oh automation effects too. Crap.
Hey guys, how can I set the roll so that it uses the LUCK modifier from the GROUP Actor file?
Maybe with the Foundry syntax 1d12+@LUCK? Dunno, never tried it this way
But will it understand from which Actor it will take the LUCK modifier? ๐ค
Uh... You can roll it directly from the directory, right? I doubt it
I see! Thx
Precisely
I see. I'm handing that with an item container, you can just have a default item mana value that can be changed too
In the case of spells I haven't made yet I have a unfilled out spell item with blanks a player can enter in the meantime.
It's just about 15-20 days i'm into Foundry and CSB. I'm not very familiar with item containers (except for inventory use, i just finished to set an encumbrance table). I was discussing yesterday with a friend of mine about the 'item' approach to spell compendium. We were wondering if it would be possible manage spell casting relying on the combat tracker instead of the character sheet. Ideas are pretty confused right now, but the purpose should be to make possibile cast spells directly from CT without linking a spell (or a spell compendium) necessarily to the character's sheet. You know, inserting two hundred spells in a sheet it's a sort of PITA, as they say ๐
๐ whatever works for y'all, but I feel the same issues with inserting 200 rows into a dynamic table.
A lot of how I'm doing things is based on how the 5e system and pathfinder made it work within foundry ๐ I found they had some good ideas for functionality haha
Many things are possible. The real question is, how much effort does this require. And the devil is always in the details
Yep, and the problem is, the more automation you get, the more lazy you get and want more...๐
Thing is, once you insert in your world all the spells you need, the work is done once for all. That's why we were thinking about 'spells as items' approach. The player would choose only the spells he would need directly from a sort of spell compendium (which could be a sort of item container). We will see what mess we can make, and rest assured you will be properly informed ๐
I mean, you can literally create an Item Compendium and roll from there
Yes, we were discussing about that. But (because these sort of things are full of 'buts') what if that particular spell deals damage depending of the caster's level? If we keep the spell compendium outside the character's sheet, the spell would'nt know how much damage needs to be dealt.
Yep, as soon as you need the context of the character, you probably also want Item Displayers for your Actors
Indeed. And think about the spell points management also....
I feel like the solution to this is a macro, or even a rollable table result
Why Rolltables? It won't solve the issue of missing Actor context when executed directly from a Compendium
Oh no I'm still saying items added to a tab in a character sheet, use item containers with filters to organize them somewhat reasonably.
I don't I now exactly how it was done but I've seen roll tables give items before, and even multiple items in a single roll...
So that being said have a roll table with 1 possibility that gives the user alo the spells in a click.
Yo community, what type of formula functions do you miss in CSB? I'm currently adding a few new ones, including:
fetchFromParent(formula: string, opt?: {fallback?: Primitive, top?: boolean}): Basically likefetchFromActor('attached', ""), but only the next parent in the hierarchy iftop == falseinstead of the top-level parent, which is always the ActorfetchFromId(id: string, formula: string, fallback?: Primitive): Fetches the item based on the IDfallback(value: Primitive, fallback: Primitive): A bit likefirst(), but instead sets a fallback ifvalueis eitherundefinedornullconcat(...values: Primitive[]): An override of themathjs.concat()to get rid of the nasty overloads for numbers and those custom typesalookup(extensibleTableKey: string, targetColumn: string, ...filterArgs: Primitive[]): Likelookup(), but this time with infinite filter criteria if you like
What about a contains?
To check if a certain item is in the inventory, or even if a value is >0, like spell slots?
Not necessary. You have find() for that. And if you want to check if a value is > 0, then you only need the comparison operator
What about conditions with array?Sort of ${lookup('extensibleTablekey','Column1','Column2',Filter_field)<=Valuekey< ('extensibleTablekey','Column3','Column4',Filter_field)? 'Yes': lookup('extensibleTablekey','Column5','Column6',Filter_field))}$
What should be results for these?:
[3, 5, 7] > 5
[1, 2, 3] > 5
[6, 7, 8] > 5
Sorry, I'm having a brainfart and can't seem to get this to work. What do I put in the visibility formula in order for the tab to be revealed when a particular item is loaded onto a sheet?
How do you determine the particular item?
It would be useful to comparing different values obtained by the lookup formula belonging to the same or different tables
I need returns for these 3 cases, otherwise I won't know what exactly you plan to do. Because you can't just use comparison operators (except the equality ones) on Arrays (that's simply illogical)
by name. if the item called "Arcane Gift" is loaded onto the sheet then it should reveal the tab. I dunno why I'm having a hard time figuring this out, but I also just had a baby and am getting no sleep lol, thats my excuse.
find('table', 'name', 'name', 'Arcane Gift')
Thats all I had so far and it returns Arcane Gift in a label, but it doesn't do anything as far as tab visibility. Does it need to be part of a another formula like a condition?
Nope, should be as is in the visibility formula
does nothing, no error in console either.
Does simply false work in the visibility formula?
ok well, changing the target column to capital Name now makes the tab disappear but only when the item is loaded, and then reappear when the item is gone. The opposite of what it should do...
Yeah, false removes the tab.
And this? find('table', 'name', 'name', 'Arcane Gift') ? true : false
Yeah, that worked
which makes sense, cuz the find function was returning either the name "arcane gift" or Error. Now its returning true/false which is what the visibility formula wants. Not sure if thats what you and linked intended but it works this way at least lol.
It's a side effect of undefined values, which will return the Label ERROR. Funnily enough, which is not the same, as an actual error.
I suppose in your example the first case should return 7, the second 0 and the third all three values, but this is not what i was thinking about. The comparison isn't between a value and an array, but between specific values, some belonging to a dynamic table and the others outside of it. Assume you have 'TotWeight' value, which represents the total Weight carried by your character with 18 Strenght. Now you have this encumbrance table, as in picture. As you can see, with 18 Strenght your character could carry until 50.4 Kg without being encumbered. Between 50.5 and 100 Kg the character has medium encumbrance and between 100.5 and 150 has heavy encumbrance. The question the formula should answer is: a character with 18 strenght who carries 120 Kg (value 'TotWeight' outside the dynamic table, e.g. at the bottom of your inventory) has 'Medium' or 'Heavy' encumbrance? So you tell the formula: 1) go to the Encumbrance table and read the 18 Strenght row 2) is TotWeight equal or greater than 50.5 AND lesser than 100.5? 3) If the answer is yes write in Label 'Medium Encumbrance', if the answer is no check if TotWeight is equal or greater than 100.5 4) if the answer is yes write in Label 'Heavy Encumbrance', if the answer is no it means the character doesn't have medium nor heavy encumbrance TotWeight, so in Label you can write 'Not Encumbered'.
I'll let find() return null instead when nothing is found. Problem solved
Hey, someone know if there's a good way to add roll buttons in chat. I want to add the check, damage and critical damage of the attack item in the chat. This is what I have so far, but doesn't work yet
Hehe. Pain
You need this in a World Script (or something similar, could be optimized):
const hook = Hooks.on('renderChatMessage', async (chatMessage, content, speaker) => {
content['0']?.getElementsByClassName('world-apply-effect-on-targets')['0'].addEventListener('click', async (ev) => {
// Do stuff
});
});
What about 100.2kg? You have undefined ranges
And well, I wouldn't know a proper function implementation for this case. Only multiple find() or a script, which is a bit more efficient
This is a good question too, what is a world script and how it works?
I Know, i didn't write those table, tell it to the Pathfinder guy ๐ In any case i consider only the minimum values, so i consider 100.2 belonging to the medium encumbrance range.
Then delete the column, that contains redundant information
Nobody will miss that ๐
Will do!
so i was wondering how would i roll 3d12 and look for dice 9 or higher and report the amount of successes
3d12cs>=9
thank you
is there some where i can go to look up basic roll expressions so i dont have to bother yall with basic stuff i have recently moved from sandbox to CSB
so i was looking thru this and maybe im missing it but how do i ref different selections from a drop down to grant differnt modifiers based on the entry from the drop down
Is that same thing possible, a hidden tab, with an item on the character in general? rather than in a specific table/container?
No, because then you'd need a Script, because there's no other way to reference Items without a Table
nvm i think i found it
Go to the Foundry page and look for Roll Modifiers in the knowledge base
switchCase(expression: *, case1: *, value1: *, [case2: *, value2: *, ...], [defaultValue: *]): *, so in this string case 1 is the key?
expression is the dropdown key and case the option key
switchCase(powrank1, 'npow1', 0, 'ipow1', 1, 'bpow1', 2, 0), this is what im using and i keep getting a value must be numeric error, powrank1 is drop down and the npow1, ipow1,and bpow1 are differnt entry keys
Is that the whole Formula?
${[:spdscorepc:+:spdrankmodpc:d12cs>=9]}$, so why wouldn't this work. spdscorepc=3 spdrankmod=1, but it only rolling three dice instead of 4
spdrankmod vs. spdrankmodpc?
its the one with pc