#Custom System Builder
1 messages Β· Page 36 of 1
Is there a way to remove a selection from a radio button after it has been selected?
I made one part of a template that sets a radio button as being Checked by default and created items with that template, then I changed my mind so I went back and unchecked the default checkbox and clicked on Reload all item sheets but the items still show the selection.
You can try to reset it with setPropertyInEntity(). Otherwise, Radio Buttons are not meant to be unselected once you select one of the group.
After messing with the checkbox thing for hours and coming very very close, I decided to just scrap the whole idea. It would've been nice, but it just wasn't working for me.
What's the reason you can't have checkboxes as a viable option for item containers, anyway? Why restrict only to labels and meters?
Item Containers were unreferencable before 3.1.0, so Input Components were useless at that time. Now it's a different matter and could be changed. It just needs some testing.
Aha! Something to look forward to in future versions.
Hey guys, this might seem very basic, but... can I copy/paste an element? Either that or move an existign element into a panel. Said element is a dropdown with a LOT of choices that I would prefer to not have to type up again lol
CTRL+move to copy the component.
hmm I think it might be different on a Mac keyboard
CMD, then.
I don't know what's going on with my character sheet template, but I'm not able to reorder items within a tabbed panel.
Also, can a meter's max value be accessed directly?
I was typing a really long reaction with every option i tried and the errors I got. Then I used the formula ${fetchFromActor('attached', "lookup('allskillstable', 'allSkillsTableSkillRanks', 'allSkillsSkillname', '${itemsWeaponsSkill}$')",'0')}$ and it worked. Thanks for the pointer on the quotes around the inner formula! <3, that was where the issue was at.
How do I access the initiative formula as a string, please?
The one in the game settings?
Yes, I'm trying to pass it to a world script so that it rolls initiatives for each actor in combat. But I can't seem to find it on the actor(?)
Not directly.
Hooks.on("combatRound", async (combat, round) => {await main();});
async function main() {
game.combats.active.combatants.forEach(async (combatant) => {
const newInitiative = await new Roll**(combatant.actor.getInitiativeRoll().**formula.replace().slice(4))
await newInitiative.toMessage({
speaker: ChatMessage.implementation.getSpeaker({ actor: combatant.actor })
})
await combatant.update({ "initiative": newInitiative.total });
});}
I put in bold what I wish to get a value for
game.settings.get(game.system.id, 'initFormula')
ty π
Currently a bug. But you should be able to create a Panel in it and organize your order there. Or change it in the Json
Thwnk you! That worked.
using google translate
How do I make a label become a roll?
Images of my attempt
Hi everyone, I'm using Google Translate to communicate, could you help me?
I want to use macros to create "Skills" in my campaign using the "System Custom Builder" system. However, I am unable to extract a certain value from a character's sheet as an attribute.
Example: "for" attribute of a certain character to enter the damage formula
Thanks, your solution is CLEARLY better than mine. Thank you for taking the time to help me ππππ.
Whenever anyone opens one of my players sheets. it spits out a ton of this one error. How can I go about fixing it?
A Label becomes rollable if you have defined a Label Roll Message.
Your Label Roll Message contains a syntax error. You're missing :: around the variable name. Explanation: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#322-dynamic-roll-formulas
That means that the Template of one of your Items got deleted. To get rid of it or fix it, you should create an Item Container without filters, so that it becomes visible.
I don't really get the question. Are you trying to find out, how to get the data of a character sheet within a Macro? If so, the answer is: actor.system.props.componentKey
I sorted it out, thank you β€οΈ
Excellent, cheers
Hello π
Thanks to the help I got here I was trying to make my tokens roll initiative:
game.combats.active.combatants.forEach(async (combatant) => {
const newInitiative = await new Roll("2d20")
await newInitiative.toMessage({
speaker: ChatMessage.implementation.getSpeaker({ actor: combatant.actor })
})
await combatant.update({ "initiative": newInitiative.total });
});
looking at the part in bold: putting a string there works.
I also managed to make it work by calling a token "2d20" and using
Roll(combatant.name)
I'm now trying to access values using
Roll(combatant.actor.name)
Which works if the actor name is a valid roll formula.
So my next stell was making a variable in the template called "InitiativeFormula", giving it a valid roll string as value.
But that gives me an error:
Take a look at the formula in the error message
So I guess the short question would be: How can I access an attribute?
It's saying something that I can't understand π =!0
Properties are stored under actor.system.props
Well, that's one of your Formulas and that is invalid
Makes sense as it's within the system
Ah that error is unrelated to the question (I didn't know that a few seconds ago)
using actor.system.props worked π
ty vm π
i wanted to try a new foundry world from v11 to v12 (has nothing on it, same for CSB elements)
got the migrate options, migrate finished, but when i try use a new template to add a new element with the + i'm getting this error:
[Detected 1 package: system:custom-system-builder-beta(4.0.0-rc1)]
at Function.entries (<anonymous>)
at getLocalizedPermissionList (utils.js:235:38)
at Object.component (template-functions.js:118:25)
at Panel.openComponentEditor (Container.js:116:27)
at HTMLAnchorElement.<anonymous> (Container.js:97:18)
at HTMLAnchorElement.dispatch (jquery.min.js:2:40035)
at v.handle (jquery.min.js:2:38006)```
not sure how to fix - any help would be awesome~
I've probably already asked this before, but how would I sum up the values of a column in an Item Container? (For example, an Item Container contains a list of Force Fields, each with an Armor Rating, and I want to have a field that totals up the Armor Rating of all the Force Fields.)
nevermind - i was able to sort it. the export const getLocalizedPermissionList = (keyType) had the error. swapped to below and it works great so far now.
if (!CONST || !CONST.DOCUMENT_PERMISSION_LEVELS) {
console.error("CONST.DOCUMENT_PERMISSION_LEVELS is undefined or null.");
return {}; // Return an empty object to avoid the error
}
return Object.fromEntries(Object.entries(CONST.DOCUMENT_PERMISSION_LEVELS).map(([key, value]) => [
keyType == 'number' ? value : key,
game.i18n.localize(`OWNERSHIP.${key}`)
]));
}; ```
sum(lookup(...))
...Oh. Thank you!
So how do i get this to work, cause it ain't rolling dice
One issue I keep having is that when I have a hidden attribute that's basically the sum of some other attributes, and I use that in the char sheet, the values are always one change behind.
For example:
dr_physical (hidden attribute) = ${dr_physical_origin + dr_physical_armor + dr_physical_temp}$ (each of which is a number field)
dr_blunt (label) = ${dr_physical + ....}$
dr_blunt is always one value "behind" dr_physical, so when I set it from 0 to 1 it's still 0. If I then set it to 2 it becomes 1.
@formal goblet
Are you on V11/latest csb stable?
I have something similar but I didn't notice any problem yet
Remove ref() from the first line
so this? ${#Dice_Formula:= sameRow('Dice')}$
This is a known render-issue (the actual value in system.props is still correct)
well i tried but it didn't roll. here's the roll formular i'm using, note this is just to test the first one ${(:Dice_Formula:)}$
Show me the error in the console
bottom most error here is the most recent, and here's the formula i'm using for it on the left.
and here's how i set up the aformention things
Do you use end somewhere?
no
Ah, you forgot to use [] in your last line
so this? ${[:Dice_Formula:+:Stat_Formula:]}$
cuz i tried it and it still didn't work
okay i got rolls when i use ${[:Dice_Formula:]+:Stat_Formula:}$ but can't actually see the result
@formal goblet so the idea is that the stat variable is supposed to referance an actual character stat elsewhere.
This one is correct
okay, but why can't i see the die result on the left here?
Is there a different error now?
also i still can;t get a roll with this version of the formula
Remove # to check the intermediate values
Formula.js:665 Uncaught (in promise) Error: undefined. Uncomputable token "Stat_Formula" [Detected 1 package: system:custom-system-builder-beta(4.0.0-rc1)] at mathInstance.SymbolNode.onUndefinedSymbol (Formula.js:665:27) at math.js:26377:89 at Object.evaluate (math.js:24162:45) at r.evaluate (math.js:24139:55) at Formula.computeStatic (Formula.js:669:27) at Formula.compute (Formula.js:363:21) at processFormulas (ComputablePhrase.js:106:35) at async ComputablePhrase.compute (ComputablePhrase.js:160:34) at async computeRollPhrase (Formula.js:727:13) at async Formula.evaluateRoll (Formula.js:738:29) at async Formula.compute (Formula.js:349:30) at async processFormulas (ComputablePhrase.js:106:21) at async ComputablePhrase.compute (ComputablePhrase.js:160:34) at async Label.js:596:13
and still no roll
Okay just has to use ${Stat_formula:= ref(sameRow('Stat'))}$ and able to see the bravery score, but the roll is still not being made
What do you have now in the Chat Message?
the die and the stat are showing in chat, but its not adding them up properly or rolling for that matter.
Remove :: from Stat_Formula (:: is only allowed within []. And Stat_Formula doesn't match with Stat_formula.
that fixed it.
also rolled snake eyes and 2 6s in a row
Is there any way to add a tooltip to the item reference column of an item container?
As in hovering on the name of the item reveals the description.
Nope, the name column has a hardcoded tooltip. You can open a ticket if you want this to be implemented.
It would be great, will do!
At the moment I am showing a dialog to each actor which has a choice (say Choice1, Choice 2, Choice 3)
Depending on what is picked I pass it to a custom formula that I import in the world script and run that...
However it's very janky and I was wondering if there's a better way to go about it.
FindFormula(dialogResult, actor.name) -> switch actor.name -> nested switch for dialog result
The description is a bit unclear. Do you mean that the Dialog is shown to all Players or that the Dialog shows all Actors (in the current Scene or whatever) with their respective choices? And what is the difference between the different choices?
Sorry. I'll try again and if that fails hop on my PC.
Every player is shown a dialog with three choices. Their choice is combined with their character name to find out what script I will run.
The choices are just 1, 2, 3 for the macro responsible. The player are asked which action they want to perform from a list that I store in the actor itself
What I actually wished to do was to have items with a "show in dialog choice?" flag and a macro that runs if that option is chosen. But I can't do something so complex yet
Do you collect the choices of the multiple Actors or do the Macros execute independently from each other?
I need more details, because I still don't get what you want π
Each player choice -> macro runs on its own.
Turning on the PC. I should have done that to begin with lol
math.import(
{
FindFormula: (N, Name) => {
var pick = N;
switch (N)
case 1:
return(game.actors.getName(Name).props.items.getName('Ability1').system.props.MacroText)
break;
case 2:
return(game.actors.getName(Name).props.items.getName('Ability2').system.props.MacroText)
break;
case 3:
return(game.actors.getName(Name).props.items.getName('Ability3').system.props.MacroText)
break;} })
@formal goblet
I wished to make it dynamic \ scalable by adding ability items and flagging them to be shown in the dialog instead of having manually added 1, 2 and 3
atm the dialog just lets you pick N and calls FindFormula with N and the actor name
You should have the context of the calling Actor when the Dialog opens for the respective players. So why don't you fetch the Item Names (or even better, the IDs) of the Actor in question and have as many options as Items in question?
Just because I 'm not able to construct a dialog well enoughπ€£
How does your Dialog look like?
Btw, macro-polo is the better channel for such questions, because you're operating directly with the Foundry infrastructure instead of with the structure of CSB
Ok, I'll close with something on the matter that's CSB-specific.
Can't I show item containers with their label in a dialog? And have it close after they pick one
Nah, Item Containers cannot be part of a Dialog (issue with Items in Items)
Good afternoon. I'm currently having a problem. I made some macros to emulate pathfinder rolling dice feature.
I wrote this for the label roll message:
${%{
const docId = 'BkXvGLu6wGvyxvJc';
const compendiumKey = 'csb-remasters.scripts';
return await (await game.packs
.get(compendiumKey)
.getDocument(docId))
.execute({entity:entity.entity,linkedEntity: linkedEntity});
}%}$
Is there a way to avoid the behaviour in the video? Where when i click the button, CSB sends a message to the chat?
The reason i did this it was to reduce the code in the label roll message. It was a hell to navigate the labels
Tick of the option in the Component config, which generates a Chat Message
custom system devs when don't read
And you can omit ${}$ π
lol
tyty
@formal goblet sorry to bother you again, but, i'm having a problem in passing entity.system.props to the next macro.
My attack macro use this scructure
main();
async function main() {
//i use this variables to manage the code better
const actorStats = entity.system.props;
const weaponStats = linkedEntity.system.props;
//some code, before i create the dialog.
new Dialog({
title: "Rolando ataque",
content: attackInput,
buttons: {
attack: {
label: `Rolar (${rollFinalModifier >= 0 ? '+' : ''}${rollFinalModifier})`,
callback: async (html) => {
// before the hook there is a code to create the buttons, it work
Hooks.once('renderChatMessage',(chatItem,html)=>{
html.find("#createDamage").click( async ()=>{
const docId = 'BkXvGLu6wGvyxvJc';
const compendiumKey = 'csb-remasters.scripts';
const document = await game.packs.get(compendiumKey).getDocument(docId);
await document.execute({ actorStats: actorStats, weaponStats: weaponStats })
}}}})
The macro I use, is the one to roll damage
//macro to roll damage
main();
async function main() {
const actorStats = entity.system.props;
const weaponStats = linkedEntity.system.props;
const additionalDamage = weaponStats.additionalDamage != 0 && weaponStats.additionalDamage != null ? ` + ${weaponStats.additionalDamage}[${weaponStats.baseDamageType}]` : '';
const damageRollString = `(${weaponStats.baseDamageDieQuantity}d${weaponStats.baseDamageDieSize} + ${actorStats[weaponStats.baseDamageAttribute]})[${weaponStats.baseDamageType}]${additionalDamage}`;
let roll = await new Roll(damageRollString).roll();
//rest of code
The roll damage macro works when i use it from the sheet, but not when calling another macro
i tried removing the variables actorStats amd weaponStats, but the console return this: ReferenceError: entity is not defined
entity and linkedEntity is only provided in sheets, not in Macros. That's why you're passing both to your Macro and that's why it works when you call it from a sheet.
If you call the Macro outside of the sheet, you have to pass the actor and item-context somehow or fetch them on your own.
i see, thanks
π€‘
Me when i found the problem was that i was recaling strike macro instead of roll damage macro, that was the reason entity was not defined
now it works
Weird, this was already fixed. Are you on the beta version (4.0.0-rc1) or on the stable version (3.2.5) ? 3.2.5 is not compatible with v12, you should have been using 4.0.0-rc1 for it to work
That being said... little tease for everyone : soon...β’
Don't worry. I spent 1 hour trying to figure out why my
use SomeLib 'function1';
didn't work. Well, guess what...
package someLib;
use Exporter 'import';
our @EXPORT_OK = 'function1, function2';
I fucking used a scalar instead of an array...
From the log above, the version is 4.0.0-rc1
yeaaah it was the 4.0.0-rc1
Indeed... Well, that's weird, both the tag on gitlab and the package downloaded on one of my instances refer to the right property for v12, which is CONST.DOCUMENT_OWNERSHIP_LEVELS...
The full function should be
export const getLocalizedPermissionList = (keyType) => {
return Object.fromEntries(Object.entries(CONST.DOCUMENT_OWNERSHIP_LEVELS).map(([key, value]) => [
keyType == 'number' ? value : key,
game.i18n.localize(`OWNERSHIP.${key}`)
]));
};
If you made no other changes, you can try to uninstall the system and reinstall it, it should fetch the latest package π
nah that was the only one since i wanted to start off fresh~ not sure if it's a beta issue or a foundry one, but the only other problem i've come across so far is being unable to drop token actors onto a scene
I have a number of item templates that use a dropdown to a dynamic table in the parent with all the skills. This means that when the item is not (yet) attached to a character, I cannot select a skill, which is a bit annoying. Is there an (easy) way to add all those skills (about 55) quickly (maybe through a formula or something), or will I have to add them all manually?
Might be related to the system. What does the console say?
I just saw I can just add a formula with an array of all the skills, it so obvious it even has an information button on how to do it π€£
That's mine π€£
You answer my questions before I even ask them π
I think I can also answer most questions with this one here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System
ha yeah this one is weird
at new PlaceableObject (foundry.js:26078:13)
at new Token (foundry.js:58252:5)
at TokenLayer.createObject (foundry.js:34020:12)
at TokenLayer._onDropActorData (foundry.js:41525:20)```
Ehhhh, excuse me?
That is an interesting error...
ah, i reinstalled foundry -- had the same error but i've got this one too
at Object.fn (custom-system-builder.js:340:23)```
Can you click on the line number and show me the line it points to?
Cause line 340 in the source code is literally just a comment π
That would be the closest thing to line 340 with Actor: https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/beta/src/module/custom-system-builder.js?ref_type=heads#L367
@brittle moth this guy has some weird shenanigans going on
This is an error that was present when using the current stable (v11 only) on Foundry v12
Reading from the source, this definitely looks like you have installed the main CSB package, and not the beta version :/
Actually... Is it maybe the browser cache again? Try out CTRL + F5
haha i realized...i am indeed a fool. i was not using the Beta folder. i'm assuming the System does not need to be changed if that's the case if it's a fresh download? or does it need to be replaced still?
The stable and the beta-version are technically different systems, so you don't have to fiddle with system folders. The only thing you'd need to edit is the world.json to point to a different system (if you want to switch a world from stable to beta). Everything else stays
starting off with no worlds/no other systems, etc. i'm unable to create a new world while now having this issue from just the Beta folder download:
Metadata validation failed for system "custom-system-builder": The file "lib/math.js" included by system custom-system-builder does not exist
when i try to hit the reinstall there, i get an error and it doesn't flow through.
You're stumbling on issues I've never seen here. And I've seen A LOT.
i chalk it up to being super unlucky π
let me try on my laptop and see if i catch the same issue
Hello! I have a player that has set drop downs, that set the training in a skill. However, when I load their sheet, it does not show their entries on my end. This is after a reload of the page, and restarting the game world.
Hey guys,
does anyone know of a macro to update all the keys for specific items to a certain value?
For instance I want all the items that have the item_desc value to change to let's say 1 (or whatever I put in).
It would also need to affect the items not attached to characters as well (or the compendium).
Any ideas?
(I'm using CSB with Foundry v11)
Hello, is it possible to populate a dropdown list in a UserInputTemplate with data from tables/ItemContainers of the actor?
Discard this, yes it is possible I just suffer from idiocy
Is it possible to add an option to a dropdown list that looks for items in an item container? I want to add "None" to the list.
Use the Dropdown formula option and lookup()
Good morning all!
First, I wanted to say that this is awesome. I really wanted to bring my WoD vG system into Foundry, and now I can! I threw you guys a 20 this morning just to say thank you for doing all this.
OK, onto my quesiton.
I wish to write a macro for Custom System Builder that allows players to click a button on their sheet to spend XP. I intend on embedding this code into a Label.
The macro should:
- Increase "willpower" by 1
- Decrease "experience" by (willpower + 1) x 3
For reference, in Roll20, it would look like this:
!modattr --name|@{character_name} --willpower|1 --experience|[[[[@{willpower}+1]]x[[-3]]]]
Thank you so much for any help that can be given π
Then you should read this section here: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#33-script-expressions
Oh, this is great:) Thank you! π
I have question, might be stupid
If I have FetchFromdynamictable()
Functions on my sheets can this result in performance issues ?
I'm planning on changing them to lookup() anyway, just curious
lookup() is just an alias, no functional changes
Oh okay, thanks
I'll add that you'll need to change it to lookup() when upgrading to v12 π
Hello, I know I can toggle the Checkboxes with SetPropertyInEntity like so ${SetPropertyInEntity('self', 'CheckboxExample', CheckboxExample + 1)}$ but I had no luck with setting a specific Radio Button to become active. How would I do something like that?
Casing is important. All function names start with lowercase
And to set the value of a Radio Button, you simply have to do setPropertyInEntity('self', 'radioButtonGroupKey', 'radioButtonValue')
Oh so it does work like that after all, I may have just made a typo somewhere then, thanks!
OK, I took a 4 hour course on Javascript, read all the documentation, and read all the Foundry documentation, and none of that told me how to update an attribute on the actor π Can anyone give me an example of the code used to do this?
(Nor did any of the macro examples contain such an example.)
I did that to pull up all of the items already, but I'm not sure how to add "None" to the top of that list, if that's possible. My players might not want to use an item every time the prompt appears.
OK, so, I've made some headway, but the macro I'm trying to use within a label is throwing an error, and I don't know why:
const { willpower, experience } = entity.system.props;
entity.update({"system.props.experience": parseInt(experience) - ( ( parseInt(willpower) + 1 ) * 3 ) });
entity.update({"system.props.willpower": parseInt(willpower) + 1 });
}%```
It works great as a separate macro but won't execute from inside a label. Any thoughts?
OK! I got it to work by calling it from outside...so...Yay! β€οΈ
Because entity is an instance of TemplateSystem and entity.entity an instance of CustomActor
Maybe ask in the Macro Polo channel? They are very helpful there.
#package-releases message
Hi everyone π
**Version 4.0.0 is now generally available, with the following changes : **
Warning ! As usual, please make a backup of your world before updating Foundry to v12 and CSB to v4.0.0. With the major Foundry version came some changes in Foundry VTT's API, so be aware that your scripts (as in
%{}%formulas) may break, with no fault to CSB.
Technical Features
- Refactored CSB-specific functions in Formula.js to FormulaFunctionImporter.ts
Features
- BREAKING - V12 compatibility - System is no longer compatible with v11
- BREAKING - V12 compatibility - Grid settings have been removed in favor of core Foundry's settings
- BREAKING - Removed deprecated fetchFromDynamicTable and getRefFromDynamicTable functions
- Added
TemplateSystem#throwUncomputableError()to force recomputation when encountering undefined properties in the current computation cycle
If you encounter any issue with this new version, please post an issue on Gitlab : https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/new
@formal goblet ${applytrait ? (traitbonus):0}$ So is this formula correct, wanna double check. the idea is that i check a checkbox that adds applys a number field value.
In a formulae how do you add another value to the array returned with lookup() in a dropdown?
Never mind I figured it out.
${skillArray:=lookup('skills_container', 'name')}$
${',None'}$
Hey All,
How can I change a game system?
I had the beat verison for 4.0 and now I want to add the v12 one.
Hello π
The current beta version matches the stable π
Atlernatively, you can follow this guide to swich to stable :
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Switch-to-Beta
Although it is stated as unsupported, it should work with a system that was in beta 4.0.0-rc1 to go to stable 4.0.0
Hello everyone, just updated to v4 and I don't seem to be able to make "Dice so nice" work with CSB.
The 3D dices are showing perfectly when I roll directly from the chat (with /r 1d10 for exemple) but whenever I'm trying to roll from a CSB sheet the 3D dices won't show up. The roll is still resolved in the chat though.
I tried creating a clean world with just CSB and "Dice so Nice" but to no avail.
I would like to know if I'm missing something or if someone got an easy fix before submitting an issue on gitlab.
Easy, thank you
Indeed there is an issue, compatibility with Dice so nice is broken... I'll fix this π
is there a quick way to make a lable into a "long rest?" essentially healing hp and mp to full? I assume maybe through a label roll message?
Is there anything to add in for version control? I would like to stamp something on there the last template edited or something like that.
return (`Last edited: ${lastModified}`);}%```
This provides a date and time but updates everytime the sheet refreshes
Are you trying to have it as a button to click or a script to run by the GM?
Do you mean to say that I should replace "entity" with "entity.entity" ? I tried that, but the error is the same.
It should work that way
I made a mistake. It works like a champ! Thank you! β€οΈ you guys rock, by the way. This thing is amazing!
For some reason, by the way, it says literally "Error" in the chat, but it works all the same...
a button to click
the component keys for hp and mp are "hpcurrent" and "mpcurrent"
Your problem kinda makes me wonder if we're able to access proprieties in an array, for each -> and change them accordingly
@formal goblet yo
If applytrait is truthy, will show value of traitbonus, otherwise 0
ya, thats kinda what its meant to be, so i just want confirmation if this works
it should, yeah
Is there anything in my code that's causing these error messages in the chat. It works perfectly. So, it's not a big deal. But, it would be preferable to not see them.
%{
const { willpower, experience, rank } = entity.entity.system.props;
if ( ( parseInt(willpower) + 1 ) <= (rank*2) ) {
await entity.entity.update({"system.props.experience": parseInt(experience) - ( ( parseInt(willpower) + 1 ) * 3 ) });
await entity.entity.update({"system.props.willpower": parseInt(willpower) + 1 });
} else {}
}%
CSB handles undefined returns as errors. And because your Script doesn't have a return-statement, it returns undefined
Thanks! π
If you don't need the Chat Message, you can tick of the creation of the Chat Message in the Label Component config
Ahh, ok, thanks:)
BTW...due to this, I no longer have need of Roll20 at all, because I can create everything I need with this. So, I'm reallocating the value of my Roll20 subscription to you guys. Very well earned!
They had a large team building for 15 years, and this is better, and it's not even a little close.
Make a lable, in that lable paste this. You will need to play with it since I am not able to get it to sync unless I update the sheet so there is a trigger point I am missing.
onclick="${setPropertyInEntity('self', 'hpTotal', 'hpMax')}$;"
>Long Rest</button>```
HpTotal is your hpcurrent
HpMax can be replaced with a value but I have it set to use the Max HP
I also moved from there because I simply couldn't do stuff I wanted to do (and I like self-hosting more)
Self hosting is sooo good! π
The onlick will not work. The Formula will resolve first
And community contributed modules is a killer feature. It's insane how much functionality you have there
what would be your suggestion then?
Yes, it's amazing!
Everyone can kind of work together, one way or the other, to make the whole system better.
I get this anytime I create a new pc
[Detected 1 package: system:custom-system-builder-beta(4.0.0-rc1)]
at Hooks.onError (foundry.js:654:24)
at πHooks.onError#0 (libWrapper-wrapper.js:188:54)
at CustomActor._safePrepareData (foundry.js:10801:15)
at CustomActor._initialize (foundry.js:10630:19)
at new DataModel (foundry-esm.js:10182:12)
at new Document (foundry-esm.js:10955:3)
at new BaseActor (foundry-esm.js:13233:7)
at new ClientDocumentMixin (foundry.js:10594:7)
at new Actor (foundry.js:15521:1)
at new CustomActor (actor.js:13:8)
at #preCreateDocumentArray (foundry-esm.js:56385:17)
at ClientDatabaseBackend._createDocuments (foundry-esm.js:56347:58)
at ClientDatabaseBackend.create (foundry-esm.js:12281:19)
at async CustomActor.createDocuments (foundry-esm.js:11423:23)
at async CustomActor.create (foundry-esm.js:11567:23)```
Do you have to defer it until you click the Button in the Chat Message?
Do you get the same even if you clear the cache with CTRL + F5?
original code came from someone else
onclick="this.style.backgroundColor = (this.style.backgroundColor === 'blue') ? 'red' : 'blue';">
Click to Change Color
</button>```
Was attempting to instead change color to set values to max/another value
yes same error
Once I close the actor I can never open it again
throws ``` foundry.js:655 Error: An error occurred while rendering CharacterSheet 26. Cannot create property '0' on number '0'
[Detected 1 package: system:custom-system-builder-beta(4.0.0-rc1)]
at Hooks.onError (foundry.js:654:24)
at πHooks.onError#0 (libWrapper-wrapper.js:188:54)
at foundry.js:5795:13
This is something completely different. The Script within the click-handler refers to the same HTMLElement the click-handlers resides in. That's why you can simply access the style of the Element with this.
If you want to access the properties of the entity, which sent this Chat Message, you'll need a completely different approach. In this case, you don't have direct access to the entity context, so you have to store unique information (like the document UUID) to fetch it later and work upon that.
understood
Now if I could gain access to creating new characters that would be grand.. atm, I cant do much
I need a detailed description of what you're doing
Basically every click you do
Yep
Create actor = error
Thats it
I get a blank page originally,
actually hold on
I will screen grab it
@formal goblet Alright to explain in more detail,
- Actor is created - Produces error on the right
- Actor gets closed and opened without issue
- Open Actor and select PC Sheet (any sheet that has formulas) - Produces error
- Close Actor and is never able to reopen again
Restart
- Create a new actor - Produces error
- Select blank template, Loads fine
- Select the PC template - Loads fine
Upon initial load of the PC file it will produce a multitude of errors but thats because the formulas are not seeing values until others calculate. This is normal behavior in this case
The sheet currently doesn't have any consistent errors upon already loaded PCs
Any modules active? Try to deactivate them?
There are a few but even disable the error persist.
It almost seems like its looking for an initial sheet but IDK thats just me grasping at straws.
Safe mode produces the same error
If you want to take a look at the actual sheet..but I dont think that is it.
How about a new world with nothing in there?
Attempted that as well, no luck
Which browser are you using?
I appreciate that. It works. Is there a way I can add mp to it as well?
And is there a way I can add a "short rest" version via dice rolls instead of just max heal?
Well, then idk what is causing the issue to be fair. I simply cannot reproduce it
You can use setPropertyInEntity multiple times (once for each key). And yeah, you can also use dice rolls instead
Yeah no clue, happy to invite you in if you feel extra helpful lol
Thx β€οΈ
I can't delete tabbed panel
I can't drag some panels above things, only inside other panels or down
Maybe I can't drag above tables or right below tabbed panels
I've been able to work around this sometime by creating a new panel and seating all this into it.
Essentially using the panel as a container or seperator.
how do you put pictures in a panel? I've been trying to do this for awhile.
you need to copy and paste images
ctrl + c
ctrl + v
ok cool. Copy from where exactly? do I need a module to do so? Or something like a compendium.
Also how did you change the bg of the character sheet? I appreciate the help π
custom css module -> change the bg and all you want
just copy and paste images. Screenshot something and paste it
or copy images from discord
you don't need modules to do this
thx!
you need to press f12 and inspect elements and then edit these elements in custom css module
awesome. Thanks, I'll give it a try later
Is the copy and pasting a module too? It doesnt seem to let me copy and paste. I know "clipboard images" allows you to paste into a tile, but not the character sheets
Thanks.
Any idea how I can write the macro so it only updates items of a particular template, whose names also end with a particular string?
For example, I want to update all items with the weapon template that end in (Q1).
Yeah, I'm aware of that one.
But how do I make it search for items that end in a certain string?
Any idea why this doesn't work?
const itemTemplateName.substr(-5) = ' (Q1)'; const itemTemplateId = game.items.getName('weapon template11 - alt').id; entity.items .filter(item => item.system.template === itemTemplateId) .forEach(item => { const newValue = "no bonus or penalty"; item.update({'system.props.damage_info': newValue}); });
Is there a way to tally a column of checkboxes for use in a number calculation? Either from a table or dynamic table?
I'm trying to add a "level up" section to a sheet, where players can have a list of their levels with which options they chose to upgrade at that level (hp, power, etc) and I'd love for them to be checkboxes that auto-calculate their max HP or PP in another part of the sheet.
Is that do-able with checkboxes? Or radio buttons?
I guess I could do a dropdown choice too, since they only choose one. But I'm also not sure how to reference those as math in a formula elsewhere on the sheet
I used calculations of other stats in the labal text to make mine like this:
${9 +Levelnumber +sum (Resolve)}$
That makes it so every level and point of resolve they have adds 1 to their hp total
Oooh this might be me running into syntax problems again, I can never remember which and how many variables get what.
if you're trying to make them checkboxes, you can use this example:
Path Points ${Levelnumber - sum(cbc1 ? 1:0, cbc2 ? 1:0, cbc3 ? 1:0, cbc4 ? 1:0, cbc5 ? 1:0, cbc6 ? 1:0, cbc7 ? 1:0, cbc8 ? 1:0, cbc9 ? 1:0, cbc10 ? 1:0, cbc11 ? 1:0, cbc12 ? 1:0, cbc13 ? 1:0, cbc14 ? 1:0, cbc15 ? 1:0)}$
essentially i made a lable that shows points they have available to spend. Every time they check a box it minuses a point. It's a bit tedious for a lot of boxes, but it works well
That may be the best option
I assume under that you have each checkbox with its own key in a table (cbc#), rather than something like a synamic table?
just change the "-" to a "+" and make sure the component keys all match your boxes
yeah, I'm using their direct component keys. It may not be the best way, but it works.
Yeah, That's a good idea, I can tally them in their own label then use that key in math elsewhere
Hello, i finished my game and now invited the first friend. i Created some macro and send him the code so that he can use it. he can create the macro and it works but he cant upload a picture. when i click on the white dice a windows open to upload an imagine. not not when he does
do i have to upload somehow the picture for him? If yes, how?
thats what I do. I have a lot of links to other things. Every time they level it adds points to multiple tables, and it does take a second or two to update when things are clicked, but it works well enough
Yeah, I was hoping to avoid the "create 30 checkboxes" in favor of something that could grow with a dynamic table, but not only is it functional, it's also the most straightforward
Hope it works for ya. If you find a neater way to do it lmk. π
I'm still learning myself, and am not the best with syntax and such as well lol
sure thing!
this is currently working for a "long rest":
`<button id="Long Rest" style="padding: 10px; font-size: 14px; background-color: green; color: white; border-radius: 10px; border: none; cursor: pointer;"
onclick="${setPropertyInEntity('self', 'hpcurrent', 'hpmax'); setPropertyInEntity('self', 'mpcurrent', 'mpmax');}$
Long Rest</button>`
but I'd like to make a "short rest" where it will roll 1d10 for every "Levelnumber" and heal their "hpcurrent" and "mpcurrent" for the value rolled.
Anyone have an idea how to do so?
@last mirage
I think I got something a bit more elegant for our checkbox.
Again, I'm just trying to tally the amount of checkboxes ticked in a certain column. I prefer the dynamic table so levels can just be added as they go, tick their choice checkboxes, and it'll auto add to their HP and stuff (kinda a weird game system ,lol)
but ${10 + sum(lookup('player_leveltable', 'player_leveltable_hp'))}$
Works to make their HP 10 plus the amount of checkboxes in the hp column of the leveltable.
Nice! I'll see if I can put this to use too.
do you know the syntax to clear all checkboxes in a table? Would be nice to have a "Reset Talents" button.
If you figure that out let me know! lol I was just asking myself the same thing π€£
hahaha ok
Anyone a Answer to this? Does this hase to Do Anything cause i use the forge?
Now I'm trying to figure out how to make Dynamic Table rows automatically count-up when you add a new one. So that each time they add a row it will label that row with the level 1, 2, 3, etc.
π€
ooh. thats far beyond my knowledge haha. I'm experimenting with resetting checks still xD
itemTemplateNameshould be'weapon template11 - alt'- revert the change in line 2
- append the filter:
.filter(item => item.system.template === itemTemplateId && item.name.slice(-5) === ' (Q1)')
Like this?
const itemTemplateName = 'weapon template11 - alt'; const itemTemplateId = game.items.getName(itemTemplateName).id; entity.items .filter(item => item.system.template === itemTemplateId && item.name.slice(-5) === ' (Q1)') .forEach(item => { const newValue = "no bonus or penalty"; item.update({'system.props.damage_info': newValue}); });
Console throws an error:
caught (in promise) ReferenceError: undefined. entity is not defined [
Are you executing that as a Macro? Because Macros do not know what entity is. You can use actor instead, which is provided if you have a Token selected or if the player has a configured player Actor
I'm trying to execute it as a macro that updates all items in the item section that fit the criteria.
Not on the actor.
You mean in the Item directory?
Yes
These items are stored under game.items, use that
const itemTemplateName = 'weapon template11 - alt'; const itemTemplateId = game.items.getName(itemTemplateName).id; entity.items .filter(item => game.items.system.template === itemTemplateId && game.items.name.slice(-5) === ' (Q1)') .forEach(item => { const newValue = "no bonus or penalty"; item.update({'system.props.damage_info': newValue}); });
Like that?
no, game.items instead of entity.items. The rest should stay
Holy shit that finally worked.
Thanks a lot π»
Is there a way to use setPropertyInEntity within a roll message execution?
Like if a player uses a charge it can decrease the component on the sheet, or if a value comes back under a certain amount they can generate a resource point,
setPropertyInEntity('target', 'Health', "target.Health - Damage")
Is what I'm working off of, but I'd like it to adjust the value on the current sheet, this one isnt working:
${!paragonuse == true ? 'setPropertyInEntity('self', 'player_paragon', "self.player_paragon - 1")'}$
(and I've messed with the syntax a bit, changed the self and Actor and stuff like that... no luck)
Or is there a different way to do this better?
Just one more question: If I wanted the macro to affect the equipped items on actors what would I have to change?
Which actors?
There's no self.-prefix, only target. and item.. The ternary-operator comes with a mandatory else-case, which you're missing. The paragonuse-part can be shortened to not(paragonuse) ? ... : ...
Yeah, that's what I was thinking with the prefixes from what I read. But even without them it doesnt seem to be affecting the character
Hi all, so I'm not a coder by any stretch, but I've kludged a basic system or two together in Simple Worldbuilding system and the Pbta system before with only minimal trouble.
Recently, my players have asked me to run a new system for them, one I'm relatively familiar with and I figured that I'd try out again this time with CSB considering it seems like it has the most active team and most flexibility of any of the system builders I've seen so far.
I've mostly got the appearance of the CS I want down, but I've run into trouble when it comes to actually making things roll. I'm just not really able to parse the wiki on how any of that stuff works, it's a bit above my skill level as it were.
Would anyone be willing to help me along?
... literally a syntax issue again. no ' around the parameters fixes it...
I am so bad at understanding what needs what quotes and syntax π
quotes are used to tell the code, that this is text, nothing else (no number, no variable)
But I think that every beginner tutorial for JS can explain things better than me
haha, idk I think you do a decent job!
I understand the "text" need for quotes but why do some component keys need them in certain places?
For instance, the above code player_paragon needs ' around it inside the setentity
You'd need to explain what you want to achieve.
The simplest roll formula would look like this:
${[1d20]}$
The system I'm working on has an odd dice pool system where it rolls multiple dice and keeps only the highest.
I'd like the sheet to be able to reference the number set in the various skills and roll the appropriate dice as well as learn how to set up other items that reference those numbers and modify them and/or set the difficulties based off the numbers on other "actor" sheets.
To give a specific example:
- I have an actor attacking with a straight sword.
- Straight Swords are mapped to using the Medium Melee skill (labeled: mmelee) and give +1d10 on rolls to hit as well as Damage
- The actor has 2d10 in Medium Melee and 3d10 in Muscle
- With the equipped sword, they should roll 3d10 to hit and 4d10 for Damage
- For the Sword attack to hit, 1 or more of the die needs to meet or beat the enemy actor's Parry (which is 6)
- Assuming the attack lands, the actor should then roll their 4d10 against the enemy actor's Hardiness (which is 4), and if any of the die meet or beat 4, and for each die that rolls a 10 specifically, the roller should record a wound.
I'd like the character sheet to be able to do those calculations
setPropertyInEntity() is a function, which expects input arguments (usually 3 different arguments). The first 2 must be strings, while the 3rd one can be any primitive (string, number, boolean). If you'd use a component key (keyword: variable) in one of the input arguments instead, it would resolve the variable to the value it holds before it gets passed to the function. That's why some functions expect the keys to be strings, so these are not automatically converted to their respective values.
Oooooh
I seee
Yeah I'm pprobably never gonna figure that out to a point where it's intuitive for me, but at least the concept makes sense!
I mean it's the same with math.
Assume that we have a variable x, which has the value 5. With the function y = x + 3, it will automatically convert x to 5 and resolve the function to 8 and assign it to the variable y. But if you simply want to tell, that y should be a text with x + 3, then you need quotes around it: y = 'x + 3'
fair
While I've got your attention, perhaps you have an answer for this idea?
Trying to have a label component increase by one for each row added to the table. so the first lists 1, 2nd '2', etc.
sameRowIndex()
Is it difficult?
Being such a genius sometimes?
π€£ I swear i read past the "samerowindex" a thousand times on the wiki
Does that make sense?
All of them.
There are a few things, that come together, so I'll try to start simple.
We're working with Dice Pools, so we'll need the kh (keep highest) - modifier (see here: https://foundryvtt.com/article/dice-modifiers/). A simple example:
${5d10kh}$
This one rolls 5d10 and only keeps the highest of these 5.
Now let's go into Detail:
- I assume the following keys and values within your Weapon-Items:
{
"skill": "mmelee",
"hit-bonus": "1d10",
"damage-bonus": "1d10"
}
- I assume that your Skills of your Actor are within a Dynamic Table and have the keys
name, value - I assume that your Label with the Roll is within an Item Container, which displays your Weapons
${#hit:= concat(ref(item.skill), '+', item.hit-bonus)}$
Hit-Roll: ${hit_roll:= [:hit:kh]}$
Does it hit? ${hit_roll >= fetchFromActor('target', "parry", 0)}$
${#damage:= hit_roll ? concat(ref(item.skill), '+', item.damage-bonus) : '0'}$
${#damage_roll:= [:damage:kh]}$
Wounds: ${damage_roll >= fetchFromActor('target', "hardiness", 0) ? 1 : 0}$
I'll leave out the count of 10s, because that will require a Script, which is more complex. You can tackle that case when you have more knowledge.
The official website and community for Foundry Virtual Tabletop.
Too vague. Do you mean all Actors within the Actor tab? Then game.actors
I assume that your Skills of your Actor are within a Dynamic Table and have the keys name, value
They're in a panel? will that break things?
I probably should've shared this earlier. I was cribbing off the notes of someone who worked on a similar system, but I couldn't quite make the actual roll thingy work
Well, that's fine too
I actually forgot to use the case with the Dynamic Table, so my example should still be valid
so I don't actually have anything labeled "skill" I'm not even sure where I would.
In that case, should I just replace "skill" with the actual label?
If so, what do I do for the sections that reads "item.skill"?
oh right, those are labels that should be on the item not the base character sheet
The item has to know which skill you want to use
I'm now confused on where this label should be? Is it supposed to just be a button on the specific weapon? something extrinsic on the character sheet?
I suggest to create a Dropdown in the Item, which contains a list of all your skills
Currently weapon template looks like this
Looks good. It has everything it needs
at what location should the actual thing that rolls it be?
Yeah all the actors in the Actor tab. I tried switching out game.items with game.actors and it didn't do anything. Didn't print out anything in the console either.
Yeah, because actors and items are not the same things. All actors contain the items-array, so you have to iterate over each Actor and then over each Item. You know what I mean?
Oh. So there's no way to automate it so it updates all the equipped items at the same time?
Did I do that right? It's not rolling anything
ok, so error message reading...
a syntax error which means I wrote something wrong. The 39th character is a space
That's not what I've said...
game.actors
.filter(actor => !actor.isTemplate)
.forEach(actor =>actor.items
.filter(item => game.items.system.template === itemTemplateId && game.items.name.slice(-5) === ' (Q1)')
.forEach(item => {
const newValue = "no bonus or penalty";
item.update({'system.props.damage_info': newValue});
}));
See the formula below in the error message. It's missing a closing parens at the end
Like this?
${#hit:= concat(ref(item.skill), '+', ref(item.wacc))}$
Hit-Roll: ${hit_roll:= [:hit:kh]}$
Does it hit? ${hit_roll >= fetchFromActor('target', "parry", 0)}$
${#damage:= hit_roll ? concat(ref(item.skill), '+', ref(item.wdmg)) : '0'}$
${#damage_roll:= [:damage:kh]}$
Wounds: ${damage_roll >= fetchFromActor('target', "hardiness", 0) ? 1 : 0)}$
alright so that didn't work
With the 2nd ref()
You only want to use ref() with item.skill. Because item.skill contains e.g. arm_strike. But we need the value of arm_strike, not just the string.
All other refs are not needed
I think we're getting somewhere, 2 new errors
Ahh, surround the ref() with string(). Just a conversion thing
alright so it didn't like that
Current code is...
Hit-Roll: ${hit_roll:= [:hit:kh]}$
Does it hit? ${hit_roll >= fetchFromActor('target', "parry", 0)}$
${#damage:= hit_roll ? concat string((ref(item.skill)), '+', item.wdmg) : '0'}$
${#damage_roll:= [:damage:kh]}$
Wounds: ${damage_roll >= fetchFromActor('target', "hardiness", 0) ? 1 : 0)}$```
You deleted the () from concat. That's also a function
concat(string((ref(item.skill)), '+', item.wacc)
Alright, we're moving right along. New Error
That's one of the Roll Formulas. Should contain a Roll Formula and not only a 2 ofc
all of them have #d10 instead of just flat numbers so far as I can tell
ah
I see the issue
the item won't let me add a formula in that area since I made it a number box
Suggestions on what I should change it to?
Text Field. These are simply not numbers
You can split it up and merge it together into a Roll Formula, but for now, let's just do a Text Field
changed that, but still getting the same error
even changed the one in my actor sheet being referenced for good measure
Replace the Roll Formulas with a static value. We can handle that later
so just 3 instead of 3d10?
[3d10kh] e.g.
I wanted you to do this: Hit-Roll: ${hit_roll:= [3d10kh]}$
Same with the other one
wanted?
Yeah, so we get rid of the error and can check what the Chat Message outputs
ah yes, we got past the error and did make sure it output a roll that is mostly correct
Your Text Fields should only contain 3d10 e.g.. The kh-modifier should only be part of the Label Roll Message
That's why we see kh twice in there
I removed the excess "kh" from the fields, but it's still not actually keeping the highest
I think it should be [(:hit:)kh] with the parens
Hit-Roll: ${hit_roll:= [(:hit:)kh]}$
all I did was enclose :hit: in parenthesis
works if you take em off
Is it always d10 you're rolling?
yes
Then we can simplify a few things.
- We'll change the content of your Input Fields, which contain a Roll Formula (e.g.
2d10) to only the amount of dices (e.g.2) - We change the
concat()-thing to something like this:${#hit:= ref(item.skill) + item.wacc}$ - The Roll Formula will change to this:
${[:hit:d10kh]}$
So can I return the fields to Number instead of text?
Yeah, now they are real numbers
Changed code:
${#hit:= ref(item.skill) + item.wacc}$
Hit-Roll: ${[:hit:d10kh]}$
Does it hit? ${hit_roll >= fetchFromActor('target', "parry", 0)}$
${#damage:= hit_roll ? concat (string(ref(item.skill)), '+', item.wdmg) : '0'}$
${#damage_roll:= [:damage:)d10kh]}$
Wounds: ${damage_roll >= fetchFromActor('target', "hardiness", 0) ? 1 : 0)}$
What should I do for :damage: since that still has a concat?
Something like ${#damage:= ref(actor.Muscle), '+', item.wdmg}
Same as above
${#damage:= hit_roll ? ref(item.skill) + item.wdmg : 0}$
Hit-Roll: ${hit_roll:= [:hit:d10kh]}$
ok, so that's rolling again
A few things to patch up now.
Firstly, looks like it's not actually checking to see if it meet/beats the target's parry
I'm also not actually sure where it's getting it's number of die to roll for damage either
oh, it's actually just using the exact same dice as the "to hit"
Thanks for your help so far
I'll need some help ironing out the weirdness on the Damage side of the calculations
but I think I at the very least it's fairly easy to tell use this as a template to figure out how to make weapons work
I think I'll futz with basic rolls for a bit
Would it be possible to add a section into the code to ask for a target number that it will then input into the roll?
So for example,
If I want to roll Athletics (ath) on the character sheet to climb a building. In this game I might say that it's a fairly easy roll, and require the player to make the roll at a Target Number of 4 (meaning that in their dice pool, that any die that outputs a 4+ counts as a success)
${?{challenge[number]|5}}$
${roll_formula:= ath == 0 ? '2d10kl' : '${ath}$d10kh'}$
${result:= [:roll_formula:]}$
${result >= challenge ? 'Success' : 'Failure'}$
I was more asking for soemthing that would allow the player to click to roll the action and it open a dialogue box asking them to input the difficulty
That's what it is doing
then what's the "5" in the first line for?
oh... you wrote the whole thing
I tried writing the basic roll dialogue and then just adding in what you wrote
b4 realizing you wrote out the entire code for it
ok, so now I've a request that's going to make things likely a little more complicated
I'd like an "if" formula.
Essentially, the way the game works, whenever you have a rank in a skill you roll that many d10s to determine whether or not you succeed keeping the highest.
But for skills you have no ranks in you roll 2d10kl.
So if I have 0 ranks in Muscle and try to lift something heavy, it'll roll 2d10kl.
Is there a way to include that in the above code?
Edited
what part of that rolls 2d10kl?
I think I see how it reads if you have 0 then it rolls 2 dice
but I don't see anything that'd tell it to keep the lower in that case
Fixed for the kl-part
damn dude
you're magic
alright, my brain is officially fried so I'm gonna take a rest
I really appreciate your assistance
Call me Elias Ainsworth - sensei
Do anyone know if someone takes commissions to craft character sheets using this system and how much people usually charge for this?
if its is a real thing, i might just get myself something like this as a christmas gift
because everyone just get money in dollars and thats extra expensive
EDIT: SNIP! I figured it out on my own β€οΈ Thank you anyway!
I deleted my message earlier because I wanted to make sure it was about CSB and not native Foundry. Posting again because I believe it's more relevant here as it has to do mostly with paged panes and setproprietyinentity
If I could change an element from label to entry field during runtime it would be great
What I did was working with visibility:
- A button, which toggles between edit and read-only-mode
- A Panel (vertical) with 2 Components (Input Field and Label)
- The Input Field is only visible in edit-mode
- The Label references the Input Field and is only visible in read-mode
There's no need for setPropertyInEntity() because the Label updates automatically
I understand what you described but I'm at work atm. Would that work with the usual way that items modify attributes in labels?
The reason I was using setProperty is that as I understand it, I can only modify label keys with attribute modifiers
Yep, your Item Modifiers would still modify your Labels
Oh. Then I'm not sure what you mean by a label referencing an input field
They definitely cannot reference the same key
How does the input field modify the label without
Setproprietyinentity
?
It doesn't. The Label itself fetches the value of the Input Field with a simple Formula
Oh I totally didn't realize I could do that and still modify the label itself. Thought it had to print its own key
Then your version is much leaner. Ty
anybody know something about it after update to 4.0.0?
it happen after i use items in characters
It means that you have orphaned Items (Items without a reference to an Item Template) in your Actors. To remove them, create an Item Container without Filters and remove them from there.
i dont have filters on containter or i need disable sorting?
and now this buttons doesnt work
i think i found problem... Thanks for help anyway :3
I am using this to pass data to a macro, I have put that same macro in a compendium. how would I call the compendium version?
%{return await
game.macros.getName('ActionDice').execute({nameValue: '${name}$', classValue: '${chr_class}$', stringValue: '${attk_value}$',actionType: "attack",rollType: "dh"})}%
you are awesome.
Is there a way to make a Label Roll Message roll with Dice So Nice? Mine just outputs directly to chat without the dice roll. Works fine but doesn't have the satisfaction of seeing the actual dice roll
Also need to figure out how to get the Label Roll Message to do a call out when the dice roll doubles π€
Side note: Thank you so much Martin (I assume it's Martin) for making this β€οΈ not having a native system is a pain but this allows my group to play Daggerheart and while it takes a bit of learning and work it has been a fun experience to do so β€οΈ β€οΈ β€οΈ
for combat tracker I can seem to edit the initiative is there a way to allow typing in?
How can i use setPropertyInEntity multiple times? every time I try it only updates the first property...
There is a known issue with Dice so Nice! in CSB 4.0.0. It will be fixed shortly, don't worry π
Wait, does that mean there's a stable release for v12 now
Thanks, but LinkedFluuuush is the one who made the system. I do many different things for this system (also developing), but most functionalities come from him
Yeah, it's released
The CSB-Version would be interesting, because this function had MANY CHANGES within V3 (and I still think it has bugs...)
When it comes to helping the community, you do all the heavy lifting. We appreciate you everyone else so much!
Yep, I can take that one
Agree I owe you being able to run my game β€οΈ
Thanks
Well, and of course the system existing is needed to run the game π€£ but I'd have given up and looked for a different system
Foundry VTT was my last resort, but the flexibility in Foundry and CSB made me feel like an idiot for not making it my first choice
I finally got around to giving this a try. but it seems that Healers tools don't show up in the item container with all items shown
Show me the config of the Item Container
Ok, try out game.actors.getName('actorName').items in the console and see if you can find the item
4.0.0 in Foundry V12
its there
Delete it with await game.actors.getName('actorName').items.getName('itemName').delete()
I actually found a bug. Let's see if that will fix it...
If I get to finish that... I'm getting sick rn...
I thought it was native to Foundry, but it's actually a module. The name is Clipboard Image
or chat images, try both
awesome. thanks!
is it possible in CSB to have any kind of interactive bars like checkboxes that fills previous ones or drag a meter to change value?
like this
I bet you can do it with a custom script and css
I'm moving from sandbox and that was something really easy to do
I just asked an AI and gave me a css code that works in codepen I'll try it later with CSB
I'm facing issues with the default values in the sheet fields, as shown in the video.
By default, in the Rich Text field, I set that light magic image, yellow. By default, I also set the name "Luminancia" in the Text Field.
However, whenever I add a new item to the table that starts with these default values, it isn't sent to the chat unless I manually update the item's name again and open and close the Rich Text with the image to save it again.
Another example
I need to open the description Rich Text field and save it again
Formula that reads the value for the HP and returns the corresponding css -> print the CSS in a label
I was looking at the documentation but it's not clear to me what's the supposed use case for a dynamic table
We only have a Slider for Number Fields at the moment
how do I do derived calculations in CSB
?
i want a mod field displaying str-10
Seems to be a bug. Can you open a ticket in GitLab?
Hey guys, how are you?
Could anyone help me with this?
I wanted to do something like PokΓ©mon, when I identified the type I would take double or half the damage.
Label text: ${str - 10}$
Derived calculations means that you'll need a Formula and not all fields allow Formulas. Check the description of the Components to see, which ones allow Formulas: https://gitlab.com/custom-system-builder/custom-system-builder/#3-component-library
You'll need a Dynamic Table, which should look like this: https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/Pokemon_Type_Chart.svg/1024px-Pokemon_Type_Chart.svg.png. Based on that, you should be able to identify the modifier
I was trying something like this I'm kinda lost XD
That won't work. The default value is only relevant at the time of the creation of the Component. Besides that, it has no effect
I'm used to work with sandbox and things work quite different here
I think I can sort out some kinda numeric radio buttons with css
Well, we separate derived from non-derived values (you cannot have both in a single field)
so I can recall values from labels in formulas right ?
Yep
The go-to structure for most cases is: baseValue (input-field) + modifier (label) = total (label)
so for what is used recalculate?
When you have a Formula in a Text Field, which you want to resolve in a Label
and a common value like "target value/difficulty level" field for all players is possible in CSB? something that i can change in a common place that affects all rolls
You can create a global Actor and fetch your values from there. But changes in the global Actor won't perform an update on the sheets (which is fine if you only need those values in Label Roll Messages)
ummm can do the trick, thanks !!
Could someone show me how to use a dynamic table to roll the correct attributes on an actor?
atm I'm storing the value to be rolled in each item and the actor references its string when rolling. But I feel like there's a better way
so the roll formula has ${${item.Roll1Ability$}}$ -> a number
Selected Attribute: ${selectedAttribute:= sameRow('attribute')}$
Value of selected Attribute: ${ref(selectedAttribute)}$
This?
No, I'm storing directly in Text Entries and It's a lot less clean. screenshotting brb
item:
formula on the actor:
where item.Roll1 is "MuscleTotal"
and actor.MuscleTotal is "5"
so it rolls 5
Can be changed to ${#rollFormula:= ref(item.Roll1)}$
ok, I was wondering if there's a better way to do it. I have a foggy understanding of dynamic tables but I feel like they should help here
ideally I'd like to calculate the number within the Dagger at the very least
can I limit max rows of a dynamic table ?
Not without a World Script, which enforces this
sameRowIndex()
A script, that is executed once the world is loaded (vs. a Macro, which is executed manually): https://foundryvtt.wiki/en/basics/world-scripts
encumbrance is based on equip slots
and you have max of your strenght
i can flag it as overcharged
Don't mean to ping ya a day later, but how do you get the item names to look like that? Bold/orange but otherwise normal text?
Mine always appear with the explanation/clickable box thing,
A module is causing this (the module contains global CSS-rules)
Ahh k, it looked like the formatting I've seen in other systems like 5e and I thought maybe it was something configurable in CSB. But a module CSS change makes sense
on a dynamic table if the first column is an item can I retrieve a value of that item on next column?
Do you mean sameRow('columnKey')?
i want to display in another column properties of ther item in the first column
is a dynamic table with an item container in the first row
I want to add a second column with the damage of first column item
When attempting to open an item container component
Is fixed with the next version
Dynamic Tables and Item Containers do not work together
Ic now
can item containers be inside objects ?
I want to add tags to an object
and seems Item container is available only if i add dynamic table first
You mean Item Containers inside Items? That will also not work: https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/198
Yup, I cant create a bag for example
#package-releases message
Hi everyone π
**Version 4.0.1 is now generally available, with the following changes : **
Fixes
- Fixed Dice so Nice! integration
- Fixed
setPropertyInEntity()for unlinked Actors
If you encounter any issue with this new version, please post an issue on Gitlab : https://gitlab.com/custom-system-builder/custom-system-builder/-/issues/new
Hey kinda new to CSB labs. I have made a simple character sheet for my players and we have been pretty okay with it. Next, I want to work on automating Long-Resting (and others like Partial Rest, and short rest, but I feel like it would be easy once I get that) and charges for spells/abilities/features. Is that something I can do in the editor, or is this when I need to start working with CSS? (Since different classes have different charges for spells, and skills i can't just put it on the template) Any help would be great thank you! (I came from Quest Bound & DND Beyond if you have heard of it, and it was great but the product is very limiting) This is what I got so far!
- For resting, you can use
setPropertyInEntity()for each field, which should be updated. If you have many fields, which should be updated, then you can use a Script instead (check the Wiki for this case) - I'm actually not that familiar with DnD, so I can't really tell, what would be the best here. I can think of a few possibilities (simple number fields for each spell slot grade, Items, ...), but each with pros and cons
Thank you for the response! I am having my own custom classes, so I am not sure how I would go about: when choosing a class, that will provide them with the "charges" or "slots" for their abilities. The thing is its different for each class, so I couldn't just put it on the template. Specific Examples to make it clear:
-Protector Class has 2 Spell slots they can use per long rest
-Conjurer Class has 2 Spells Slots and 2 (proficiency) Slots for their Conjuring
-Operator Class, that one has like 3 different slots for different things.
And I would want to connect that to a Long-Rest Button, Partial-Long-Rest, and for some a Short-Rest Button. I feel like I got the hand of the Template, but this doesn't seem like I could do with the Template itself. I don't really mind the method meaning: if its the "3/3 and reduce it to 2/3, or 3 Checkboxes and marking each one" . What do you think?
How would I make it so this roll syntax automatically adds the rolled number to a "Initiative" number field?
initiative:${roll:=[1d100] + Finesse}$
or I can change it to a label if it's easier.
It allows me to paste it to the canvas or to chat, but not to a character template. How do you go about adding it to a template?
initiative:${roll:=[1d100] + Finesse}$
${#setPropertyInEntity('self', 'Initiative', "roll")}$
thanks a lot
Hello!
First time reaching out, and first time using this application, so please forgive the lack of knowledge!
I'm playing a custom system that has each stat set using an S-F system that I'm likely going to have selected using a dropdown with the hidden Values being 1-7, but each stat and Value has a specific written description.
My main idea on how to do so is to have a label lookup another few tables that have all of the information stored, but I want to know if it's possible to call said info from a compendium of some sort, rather than having the table directly in the Sheet.
If that didn't make sense, please let me know.
Thanks in advance for any Advice!
I updated from v11 to v12, but now all of my scripts that use entity.items.filter() aren't functional. Is it an outdated way to filter items?
Thanks @brittle moth for fixing Dice So Nice issues. Hero!π
This should still work, from what I see... Can you give a more complete example of a script ?
Is it possible in the journal to make hyperlink to other journal entrys? for example if in a sentence there is the word "Status XY" to make a hyperlink to an other journal or Page?
Yes
I just sent it on GitLab.
How do I find paths for attributes?
Generally possible, but you'll need a script to achieve that: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#33-script-expressions
let score = ${strBonus}$;
const skillsTemplate = game.items.getName("_SkillsTemplate").id;
const skillRank = entity.items
.filter(item => item.system.template === skillsTemplate).map(item => item.system.props.rank);
const skillType = entity.items
.filter(item => item.system.template === skillsTemplate).map(item => item.system.props.skillType);
for(let i=0; i < skillType.length; i++)
{
if(skillType[i]=="str"){ score += Number(skillRank[i]); }
}
return score;```
It's for a hidden attribute
Seems fine from the first clance. Can you show the error message?
You can also simplify this a bit:
- You can return an Object with the 2 props you're collecting, making the second mapping obsolete
- Take a look at what
Array.reduce()does. That one should be able to eliminate the for-loop
I'm no good at understanding these error messages
It doesn't seem to be related to the script at all. It seems to be something with a Dynamic Table
I believe I found the right error. Apparently there's a lot, but so many are repeats.
strMax couldn't be computed because it used variables, which are undefined.
No idea how that's happening. I changed score to a static 0 to see if ${strBonus}$ was the problem, but I still have the error. I removed all items from the character sheet and even tried a new sheet. When it should return 0, "NAN" shows instead.
NaN means Not a number, so something expected a number but got a text instead
That's what I thought too. So I just used "return 0" in the script and still get the error.
I'll try reverting back to v11 then to v12 again
For some reason, the problem was with a boolean for turning the character creator I made on and off. Removing that allows all hidden attributes to work as normal. Not sure why, since it's not referenced in them, but it works now.
I spoke too soon. Refreshed and they fell apart again. But I don't really have anymore information. I might redo it or just stay on v11.
Another hopefully simple question.
I've been banging my head against the wall to get a clickable inline roll in a text Label.
I've added ${Roll:=[1d20]}$ as a test but it seems to automatically roll it rather than act how Foundry's inline rolls normally do, showing as a clickable element. I have read through https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#32-roll-formulas but nothing in it is showing me this, and looking at the examples in the addon, but I don't see any thing inline.
What do I seem to be missing?
Inline roll example is from a Journal, the other two are from a character sheet.
hey does anyone know how to get the radio buttons in a tab to be progressive? ie when i click the second one in the row, the first one gets ticked automatically and when I tick the 9th one, 1 through 8 gets ticked
i know absolutely nothing of formula writing so I'd really appreciate some help or any tutorials you know of to help use this
or grouped checkboxes would be good too
[[1d20]]
CSB doesn't have that feature
what about a formula that'll get one box to tick if a certain number field reaches a certain number?
Checkboxes cannot react on changes, you'd need a world script to achieve that
is it at least possible to tie a formula to roll as many dice as there are ticked boxes or also not?
You have to check each checkbox in the formula, but that is possible
oh perfect. could I ask for help with a base formula for me to edit? the idea is that I want the text (when clicked) to roll as many d6s as there are checked boxes.
${dices:= checkbox5 ? 5 : checkbox4 ? 4 : checkbox3 ? 3 : ...}$
${[:dices:d6]}$
thank you very much
yeah i can't get it to roll at all. that's on me thank you stiull though
is there a way to get a radio buttin to untick? clicking it doesnt work
Hey, is there an option to use an itemcontainer as a source for a dropdown-menu?
That didn't seem to work.
(Error is on the Actual sheet, formulas are on the template)
Rolls are meant to be used in chat messages only, it will not work in the sheet display π
Edit : Sorry didn't read through everything. I'm not sure qhat you want is doable in a Label, it should work in a Rich Text Editor though...
Hi - I wanted to ask, is there a way to add images/graphics to the background of panels etc on the Actor Sheets?
Ah, understood.
I'll just add another column then and see if I can use the roll message function with switchcase
My switchcase doesn't quite seem to be working how I expected / hoped.
I have the following in my Label roll message:
${switchCase(aura_speed,
'S', '${roll:=[2d20kh1+3]}$',
'A', '${roll:=[2d20kh1]}$',
'B', '${roll:=[1d20+3]}$',
'C', '${roll:=[1d20]}$',
'D', '${roll:=[1d20-3]}$',
'E', '${roll:=[2d20kl1]}$',
'F', '${roll:=[2d20kl1-3]}$',
'Lookup Failed')}$
But when I click on the Label, it rolls all dice at once.
My desired effect was that it would only roll the matching selection, rather than rolling all dice, and selecting the correct result.
Fixed using the following, for others that may stumble across this:
${roll:=[${switchCase(aura_speed, 'S', '2d20kh1+3', 'A', '2d20kh1', 'B', '1d20+3', 'C', '1d20', 'D', '1d20-3', 'E', '2d20kl1', 'F', '2d20kl1-3')}$ ]}$
Yeah, this is a "quirk" of the system, every dice is resolved before the switch is made. So it rolls everything.
What you can do is getting the roll Formula from the switchCase and roll it afterwards:
${#rollFormula:=switchCase(aura_speed,
'S', '2d20kh1+3',
'A', '2d20kh1',
'B', '1d20+3',
'C', '1d20',
'D', '1d20-3',
'E', '2d20kl1',
'F', '2d20kl1-3',
'0')}$
${roll:=[:rollFormula:]}$
That's a much cleaner version, thank you!
And looking at that, is #tempVariable a standard way of making variables?
The # at the start of a Formula just prevents it from being printed in the Chat
What you provided gives the char13 error, which seems to be : in ${#rollFormula:=
Removing the : removes the first error, but still produces
Remove the new-lines (\n)
That worked, interestingly enough.
Is there a specific reason the newlines don't work?
They are interpreted by mathjs as a new statement (like in JS)
Understood.
Javascript is a new Language for me
Only other question then, Is there a way to copy / paste components?
CTRL + Drag
My absolute Godsend
To create a custom input component, do I need to follow the coding tutorial on the wiki, or use the userInputTemplate template type? (I'm good with either.)
It depends, do you want to create a new component to add in your sheet or display a dialog box on a chat message trigger ? ^^
Oooooh, so that's the difference. I want to add a new component to put on a sheet.
Then the coding it is ^^"
Is it possible to create a button or checkbox in the chat window using a label roll message?
Thank you!
The label roll message contains HTML, so really you can output anything, but I'm not sure if that'll be easy ^^"
For a button, I guess you could add a button and onclick call a macro via Foundry's APIs
For a checkbox, that should be easy but I'm not sure what you would do with it :/
Button is ideal. After rolling, players can choose how to spend dice that "hit." I thought having a button that pops up a prompt window or something like that could be useful.
I mean...doesn't the Label component type have an option to display it as a button or something?
Oh, wait, just understood what you meant. Not sure you can display a Label component inside chat message.
Yes by making a CSS.
I see, Im new to this so what exactly is a CSS? Right now I have alot of the overall layout functioning, just need the actual numbers to work if that makes sense
CSS = Cascading Style Sheet. It's what's used to style HTML.
For example:css div { background-image: url("image.png"); }will set the background image of the <div> element to image.png. Though I forget whether relative pathing uses the path of the CSS file or the HTML file it's attached to as an origin point.
CSS if fun once you get the hang of it. F12 is your friend.
I see. Il give a look into it deeper when I can, for now I have a bit of a new problem - how do I add an increasing counter to an item container, so if there is 2 of the same item it will go up on the item container?
You could either use a Number Field and manually enter it or install the Item Piles module with the Number Field.
I cant seem to change the item container to anything but a label or a meter, so il try the module
He means Number Field in the Item, which value can be increased
I see.
So, got directed to roughly around these threads lol. So I'll start here for now. Currently trying to port a character sheet from an English translation of the Japanese TTRPG Dracurouge. Would this be a good system to use to do this? How would I go about doing this?
I have some macros that kick on on label roll message with the PC data passed through it. Is there a way to make it so players can pull the process off and set in their macro bar? image is from my PC template. want to be able to drag the red words to the macro bar
Right-Click it
the input fields represent how many dice that red button rolls
its that easy... wow
Thank You
hmm right clicking doesn't seem to do anything. maybe i need To reload
It has to be a character sheet, not template
Well, you can build your own sheets with this system. But if it meets your needs is up to you. I suggest to read a bit here and maybe try out the example-module, which contains a ready-to-use example:
Custom System Builder - Example, an Add-on Module for Foundry Virtual Tabletop
Thank you, thank you. I'll give it a go, see if I can wrap my head around it, get back to ya if need be
I have a problem with an template of an item requesting informations from an diffrent itemcontainer. I have a field with the key Sphere and a label with the following formular:
${fetchFromActor('attached', "lookup('Classes_Container','Level', 'name', Sphere)")}$
but the label always returns nothing. Checked spelling multiple times. When I enter the Name of the requested -Item manually it returns me the correct value. What am I missing?
Is there a specific place where there is a list of helpful syntaxs used in rolls? I'd like to just trial and error myself instead of bothering people here every time.
I'm trying to find out how to clear checkboxes when a label's roll message is activated.
Sorry for two questions at once, but is there also a better description of how to set up item modifiers? I'm simply trying to make it so when a character has an item in their inventory they gain a + to a number field.
Thats possible. You name the component key in the column 'key' and the value in the column 'value formular'
You cannot modify Input Components, only Labels
I could add it to a roll formula for another label though correct?
I'm looking through the links you just sent. Thanks.
I'm using a Tabbed Panel. Is it possible to use CSS to fade in/out the transition between these tabs?
I cant seem to find how to use the item modifier table through these pages.
Would you be able to help me make it so when a character has an item, it adds the bonus to the "stealth_modifier" label? and when Stealth is rolled, it would add the "stealth_modifier" to it?
Hello, another question from me today.
I'm wanting to have a conditional argument based on weather an Item is present or not in the Character sheet.
I can tell ${return if(object exists on actor) { ans = true } else { ans = false}}$ is likey the answer, but I can't figure out how to specify what object to look for.
This may allow you to do it (My shot in the dark):
https://www.geeksforgeeks.org/how-to-create-fade-in-effect-on-page-load-using-css/
And inspecting the elements from https://www.w3schools.com/w3css/w3css_animate.asp, you might be able to just use something like: animation: opac 0.8s;
You go to the Item, open the Item Modifier config and enter the following values in it:
- Prio:
0 - Key:
stealth_modifier - Operator:
+ - Value:
1
Your Label with the key stealth_modifier should have a default-value of 0. That's it
In your example, it considers the Sphere of the Actor.
The fix:
${fetchFromActor('attached', "lookup('Classes_Container','Level', 'name', '${Sphere}$')")}$
I'm using a module called Party HUD which shows active players/characters in a side panel. It's supposed to show stuff like HP and the like in a tooltip when you hover over them using their attributes. The configuration for the tracked resources only show some generic looking attributes, and I don't know how to modify these attributes to reflect the values on the character sheets in CSB. Can someone point me in the right direction? See attached images for context.
Don't think you have a chance to provide the right attribute if it's only showing these
Ah, sadness. That's okay. Party likes being able to see their images in a line at any rate ^_^
Does party hud have a github
I don't believe so. It's a premium module by TheRipper93
Though, actually, now that I'm thinking about it... Party HUD just yoinks the values from Carousel Combat Tracker, which does have a github. Here's the link: https://github.com/theripper93/combat-tracker-dock
Alright so the config carousel has some configs to it. You could attempt to update those to include the attributes needed
There is a script file thats in the repository
Without dinking around with it, my guess is you could add your own system values in the world script file and reload.
Can item containers be a scrollable list that only displays (x) number of items at a time?
EDIT Never mind, my brain cells woke up and did it.
Awesome, thanks so much.
I am so close to done.
I'm still stuck on my if else statement to get a true false on whether an Item is present.
I currently have This, but have some issues with it:
%{return wantedActor=game.actors.getName("Test")
wantedItem=wantedActor.items.getName("Damage Reflection")
if (wantedItem != undefined) {console.log("Feature Found!")} else {console.log("Failure")}}%
Main issue is it relies on knowing the actor name, and I'm not sure how to have it automatically search the actor that it's running from. Other part is I'm unsure how to have it output a True or False statement rather than directly to the console
Unsure why inventory items only appear in the token sheet and not the main sheet when picked up
Was the token linked to the main sheet before it was placed?
Is it intentional for us to be able to have a dynamic table within a dynamic table? I can't figure out how to make labels for the second table.
The "Effects" column is the second dynamic table.
Nope π
Can switchCase() be used to test whether a number is within a certain range? For instance, I need to specifically be able to test if a number is 0, 1, 2, or >= 3.
Nope, only equality-checks
Man, I feel like I need a CSB mentor to address all of the things I want to do lol. So many questions but I feel as if I'd be annoying if I asked them all here @_@
Technically you can do it with switchCase, since the last parameter is the default
Doing something like switchCase(myvar, 0, 'value if 0', 1, 'value if 1', 2, 'value if 2', 'default value, aka >=3') would work in your case
Hmm. All right, thank you both for the help.
This is a workaround though, be aware that the last value matches everything that didn't match before π
So it will match >=3 but also <0
I'm trying to test it against an absolute value.
I put this onto the label in a userInputTemplate, but as I change the value of Roll_Modifier, the label text isn't changing:
${concat(switchCase(abs(Roll_Modifier), 0, 'Normal Roll', 1, 'Minor ', 2, 'Major ', '${Roll_Modifier}$x '), Roll_Modifier > 0 ? 'Edge' : Roll_Modifier < 0 ? 'Obstacle' : '')}$
What it should do is display "Normal Roll" at 0, "Minor Edge" at 1, "Major Edge" at 2, "<number>x Edge" at 3+, "Minor Obstacle" at -1, etc.
Though I suppose I could use switchCase(sign(Roll_Modifier), ...) instead of the chained ternary operator for that second one.
Also, would I need to create a macro and propagate it to every other friend who wants to use this system if I want to easily be able to roll this with a single command?:
${rollFormula := concat(2 + abs(:Roll_Modifier:), 'd6', switchCase(sign(:Roll_Modifier:), 1, 'kh2', -1, 'kl2', ''}$
${[:rollFormula:]}$```
That explains a lot then! π€£
This is incredibly frustating. I can't find the right way to edit only a portion of a roll formula based on a switchCase.
This is the formula you're looking for :
${rollFormula:=concat(string(2 + abs(Roll_Modifier)), 'd6', switchCase(sign(Roll_Modifier), 1, 'kh2', -1, 'kl2', ''))}$
${[:rollFormula:]}$
- It was missing two parenthesis to close the switchCase and the concat
- You should not use colons to denote variables in a standard formula, only in rolls
- The first parameter of the concat should be string, else the formula interpreter wants to concat only numbers
Oooooooh, now I understand! Thank you so much!
That's expected, the UserInputTemplate does not automatically recalculate based on its content. It is computed only once at rendertime π
Makes sense, I guess.
YES! It worked perfectly! Thank you again! The major problem was not knowing I needed to convert the first term in concat() to a string. Also forgetting about the last two closing parentheses.
You can often find error messages in the browser console by pressing F12 π
Little tech savvy trick, but most messages are explicit
It did give me helpful messages, I just wasn't sure how to fix many of them.
That took way too many hours to get the way I wanted it. π©
Well, Roll Modifier was 10 when I actually rolled it.
I'm trying to execute a macro from a label but seems arguments aren't passed
}%}$
can't get args inside macro
1: check f12 for errors
2: I think you need to remove the ";". Since it isn't a JS command
3: you have ${ within an already started "${". Since you aren't using it everywhere, remove the outer one
Here's an example I made
%{return await game.macros.getName('Base Roll check').execute({S: '${Snapp + KastvapenS}$', V: '${KastvapenN + Kastvapen}$'})}%
Need help with this one, I have no errors and it prints 0. Want it to switch between 0-1 when clicked.
${setPropertyInEntity('item', 'EQ', (item.EQ ==0 ? '0':'1'))}$
NVM, I was too tired 
The call seems fine though, so you should have access to atributo in the Macro
I veto the 2nd one. Everything within %{}% will be treated as JS
is called scope >_>
You defined one parameter as atributo, so you can access atributo in your Macro. There's no args-Array or Object if you don't define one.
Huh, didn't know about the scope-object. So both scope.atributo and atributo are valid
How do you change the default settings for Grid Scale in foundry?
Sounds like more a question for #core-how-to than CSB.
Here breaking my back, does anybody know any common things that might cause this error in the VTT Console: {description: undefined, fileName: undefined, lineNumber: undefined, endLineNumber: undefined, message: 'An error occurred while rendering CharacterSheet 4β¦d 1 package: system:custom-system-builder(3.2.5)]',Β β¦} (basically one of my players character sheet isn't opening, while some are)
Trying to fix that now I am getting
"An error occurred while rendering CharacterSheet 34. Missing helper: "range""
π
nvm i think i am good? it seems to work lol
I think I've fried my brain. How do I add to a string in an item? The item has a script that brings up a user input window. The player types what they want into it, and then it's added to a label within the item. I tried a few things...
setPropertyInEntity('self','original-key',"original-key + userInput")
setPropertyInEntity('self','original-key',"original-key" + "userInput")
Neither do anything.
concat() does concatenation, + only performs additions
Okay, can you give me an example of what that would look like?
I'll use 3 types (Water, Fire, Plant):
# type water fire plant
1 water 1 2 0.5
2 fire 0.5 1 2
3 plant 2 0.5 1
The columns are type: TextField, water: NumberField, fire: NumberField, plant: NumberField
Attacker is of type water, defender of type fire:
${first(lookup('table', defender_type, 'type', attacker_type))}$ // Result is 2
Is it possible to copy paste the layout of a table and replace the keys on its components, rather than remake the same format every single time? I need to use this table and a format exactly like it, its a tad tiring to have to repeat so was just checking before I continued
CTRL + Drag
Oh nice, that will allow me to replicate the table and then just change the key? excellent
Excellent, thank you!
why is this giving 12 ?? Am i slow?
Is proficiency a string maybe? π
Okay I see what you are saying, but the class_ope one worked lol
What are you doing btw?
Basically whenever someone chooses a class, it sets an amount of spells slots or charges depending on the class chosen. Here the class_ope has two types of charges, and same for class_mar. for some reason the "specialAbilityCharges" is returning the right amount and the "IWFCharges" is also, but specifically the 1+proficiency isn't giving me 3, but instead a 12.
If it was a string, how can I multiply 2 * proficiency
Because there's no operator overload for * for strings, so it tries to convert it to a number (which succeeds). + on the other hand has an overload for string concatenation, so it will use that if one of the operands is a string.
Implicit type coercion is a funny rabbithole in JS, so you'll find a lot of stuff about that in the web
Interesting, thank you!
Small question, hopefully easy. How do I add [ and ] to a string without making CSB think it's for a roll formula?
New question. I have an item with a dynamic table, and that item is attached to an actor. I want the Item Container to list all of the effects from that dynamic table. To do that, I'm using const effectList "${lookup('item.dynamicTable','effectName')}$" and a for() loop to separate each element into different lines. But it's putting each character on a new line. Also, it's carrying over what's in the previous item's dynamic table to the next one.
I'm very clearly doing this wrong, but what's the correct way to do this?
Wow!
So... I open a dynamic table and inside it I open a normal table?
Then I do what you did?
And this command below, where do I put it?
Yay! That worked. TY π
I'm trying to achive this in CSB without luck https://jsfiddle.net/j43ox1ze/1/
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
No, you create a Dynamic Table with these columns and rows in the template
You're looping over a string instead of entries π
How would I fix that? And would doing that stop the script from duplicating text to the next item?
Is there a way to add more door sounds should I find any online?
Uhm, CSB is not responsible for that π
Yep, that's Foundry-stuff
Thanks
return "${lookup('item.dynamicTable','effectName')}$".replaceAll(',', '\n');
Hi everyone! π I have a question to those that use the Item Piles module in their CSB system.
It appears that I have not set it up correctly. Items of the same type won't stack on piles and will always be depicted as "free" in the merchant screen as it detects neither the amount nor the value of my items from the item sheets.
For my items I have made various templates (Ammo, Consumable, ...) that all have an "amount" and a "value" label. In the System Specific Settings of Item Piles I put in system.amount and system.value respectively, which is probably the culprit. How do I correctly refer to my fields?
Additionally, I have created a currency here ("Caps"), that I also save in the pc_template as "caps". In the Item Piles config I refer to it as actor.caps, which also does not seem to work.
If it helps, I have attached my Item Piles settings. Please lmk if you have any pointers for me
How did you integrate it?
Then let me rephrase it. What did you try?
Typed it wrong at first, but still getting "ERROR" and this in the console
A nice feature to have could be to reorder name and picture as you do with other elements
Do you use quotes in the effect name?
No, I do not
return Object.values(linkedEntity.system.props.dynamicTable)
.filter(row => !row.deleted)
.map(row => row.effectName)
.join('\n');
That works, but only if there's one or fewer elements in that column.
Try out \\n instead of \n
Hi you analized in my ticket that for some reason i generate strings in place of numbers, all fields i adres here are set to numeric (item fields)
game.macros.getName('Rana').execute({x: 0, y:${calc}$, k:${Typ}$, enit: entity.entity});
for some reason it fills numeric fields with strings, how to avert it?
full code bellow: ```${#concat(
?{ObraΕΌenia|0},
?{Typ:"Typ obraΕΌeΕ"[check]|0,"StΕuczenie"|1,"Rana"|2,"OpaΕΌenie"}
)}$
${#calc:=ObraΕΌenia-RES}$
%{
if (${calc}$ <= 0) {
return 'Tylko muΕniΔcie';
}
return await game.macros.getName('Rana').execute({x: 0, y:${calc}$, k:${Typ}$, enit: entity.entity});
}%
${ HPL>0 ? (calc-HPL>0 ? calc-HPL : 'Nie'): calc }$ Krytyczna w ciaΕo
It works, but it's all on the same line instead of a new line. Should I just throw <br> in there to split it?
Number Fields actually generate strings and not numbers in the props, so you have to take that into consideration. So expect that you get a mixed type
i tried number() them without result. do you have any idea?
Give it a try
Type conversion should be fine tho
type where. im still to green im trying to learn it as i go. cant find where i should put it
In the switchCase-formula
${switchCase(number(item.BP), 0, 'CiaΕo', 1, 'GΕowa', 2, 'Lewa rΔka', 3, 'Tors', 4, 'Prawa rΔka', 5, 'lewa Noga', 6, 'Prawa Noga', item.BP)}$
Oh on reader side ill try thank you
Adding it in works just fine. Thank you!
I would like to know how I can put a button on the roll message label to apply damage
Is it be possible to take an item container and use transform-style: preserve-3d to turn each row into cards with a backside that provides more information?
I thought maybe I'd have to make two item containers (one for the front, and the other for the back) then overlap them using CSS.
Now I'm having trouble returning a string from a rich text field. %{return "${item.description}$";}%
Can you make a visibility formula check two check boxes and appear if either are checked?
Has some thing changes that I can't drag things into tabbed panel sections?
Try putting everything in that tab into a panel. You should be able to drag them after that.
Like make a panel in tabbed panel, or drag existing panel in? I tried the latter and it didn't work. I will try the first once I'm home.
The first one.
Will try it. Thank you for the help.
It worked. Thank you
Hello again, I poked my head around here a lil over a week ago. Since then, I've made a bit more progress on my Character Sheet, but I've run back into the issue of still not really understanding the coding bits.
Right now, I have 2 Core issues that I'd like assistance with.
-
Finishing the Combat functionality #1037072885044477962 message
-
- so that the roller not only identifies the right amount of dice to roll to make an attack (this works properly), but also can properly register the difficulty of an attack roll based on a value on a target's sheet (the framework is there afaik but hasn't been touched), can judge the correct amount of damage dice to be rolled based off weapon properties actor traits (which Is where I left off last time), and finally should be able to determine the target number of damage rolls based on a value on a target actor's sheet.
-
Create a similar framework as above for "techniques" (which is likely going to just be a copy/paste from the above with adjustments)
Right now, my code for weapon attacks looks like this:
Hit-Roll: ${hit_roll:= [:hit:d10kh]}$
Does it hit? ${hit_roll >= fetchFromActor('target', "parry", 0)}$
${#damage:= ref(item.dmg_att) + item.wdmg}$
Damage-Roll: ${#damage_roll:= [:damage:d10kh]}$
Wounds: ${damage_roll >= fetchFromActor('target', "hardiness", 0) ? 1 : 0)}$``
Weapon Traits
not sure if related to CSB or just calling compendium macros but in my hero sheet I am using this as the Label Roll Message:
%{return await
game.packs.get('Compendium.heroquest-assets.hq-macros').getName('ActionDice').execute({nameValue: '${name}$', classValue: '${chr_class}$', stringValue: '${attk_value}$',actionType: "attack",rollType: "dh"})}%
When its set to a local macro it works but i would like to leverage data in compendiums as much as possible. Am I calling it incorrectly?
I have also tried this with no luck:
%{return await
game.packs.get('Compendium.heroquest-assets.hq-macros.Macro.eXsBJgVq87TCwW6j').execute({nameValue: '${name}$', classValue: '${chr_class}$', stringValue: '${attk_value}$',actionType: "attack",rollType: "dh"})}%
thank you
Is this correct?
numberx is unnecessary, you can delete that if you want. Rest is fine, although I'd use more meaningful key names for the types and not type1, type2, etc...
Ah ok, I'll take it out... the names are just provisional for testing.
And about that here:
${first(lookup('table', defender_type, 'type', attacker_type))}$ // The result is 2
Where do I put it?
Whereever you're calculating the damage. It's your damage modifier
Right, then do I put a space in the pokemon's card field for "type" and in its damage too? To be able to identify?
Yep, you have to provide the attack type and the type of the defender
Does anyone know if 1. foundry can detect the number rolled on a die, then have an effect happen based on the number, like a +1 to a mod, or whatever... and 2. if foundry is capable of re rolling a die if a 1 is rolled?
I am trying to use fetchFromActor to grab a stat from a player to use in the Item sheet, what am i doing wrong ?
${#scale:=switchCase(sameRow('simplemagic_scaling'), 'forca', 'Forca', 'agilidade', 'Agilidade', 'constituicao', 'Constituicao', 'inteligencia', 'Inteligencia', 'sabedoria', 'Sabedoria', 'carisma', 'Carisma', 0)}$
${#playerstat:= fetchFromActor('attached', ${scale}$)}$
${concat(
'<div>',
'<h2>${playerstat}$<h2/>',
'<div/>'
)}$
All i want to do is to grab the value of the character stat based on what is selected in a dropdown menu
Here is the Character Stats
Here is the weapon dropdown and label that runs the script
${#playerstat:= fetchFromActor('attached', scale)}$
Can i make it so when people click a label it plays a mp3 sound ? If so does anyone have a example on how its done ?
Can be done with a script or via executing a macro.
But I donβt have an example.
Maybe ask in https://discord.com/channels/170995199584108546/699750150674972743
Can i roll a RIch Text Area with a Label ? I saw people doing all kinds of crazy abilities and skills in their sheets using them. I have tried it for some time, but i cant make them work...
Also, if i write something like this:
Can i get it to actually roll a dice or something ?
Never mind, figured it out
So - when it comes to making a dice roll check, how do I make a pop up table akin to say, pathfinder which contains all the modifiable values?
A way to automatically fill in the stuff on a sheet that matters and add the other modifiers to the roll
Hello,
Thank you for CSB, after trying Simple Worldbuilding, I found out it was a bit lacking in what I wanted. However, it seems I hit a roadblock in my quest.
I want to add a simple effect of shooting bullets against an enemy using Sequencer, and incorporate it into a macro using an editable text field. I do that so can use one item template and change the values for different effects on different items. Seems like that was a bad idea, as it doesn't work.
My macro is simple and only outputs the raw data (Image 1):
${#Effect}$
"Effect" is a Text Field where I put the actual Sequencer effect in %{script brackets}%
I tried the following:
- If I change ${#Effect}$ to %{Effect}% and remove the %{brackets}% in the text field, the macro does not trigger at all.
- When I make a hotbar macro with the exact same script, it works flawlessly. Using Advanced Macros to then input /macro "macroname" only pastes a chat message without triggering the macro.
- If I put the whole %{script}% into the Label roll message, it displays the effect and produces an ERROR message into the chat (Image 2). That also doesn't give me the flexibility I wanted, as I need a different template for different weapons, or a lot of Effect macros in each item.
Is there a sane way to make the macro output a chat command and play this script?
How I did this:
- Programmed the effect in a macro. The macro needs a specific name und has to be owned by every player who is allowed to use it. It is not necessary to have the macro inside the hotbar, it is enough that it exists inside the macro directory.
- Inside the weapon items I paced a textfield with key βweaponmacroβ. In this textfield I put the macro name for the specific weapon item.
- Inside the weapon item container of the character sheet I have a label with %{return await game.macros.getName('${weaponmacro}$').execute()}% inside the label roll message. Deactivate the βSend roll message to chatβ button for this.
So if a player wants to execute his specific weapon effect, he just needs to klick the label of this weapon inside his weapon container.
I had no idea this article was a thing, thank you - I'll make sure to read on it in a free moment
That's very helpful, I'll try to use it... I had no idea you could just have a macro directory without the hotbar, this should make it easier
Learning new things every day
is there a way to edit the size of the user input templates? just CSS im assuming?
Can rich text fields use formulas in them? I tried ${key}$ and had no luck.
They don't resolve formulas
hello, I'm trying to add an item to a character sheet using this script in a roll message:
%{actor.createEmbeddedDocuments('Item', game.items.getName('ITEM NAME HERE').toObject())}%
but I'm getting "undefined. actor is not defined". Any ideas?
The current actor is reffered as entity in scripts. Plus, according to the API docs, the data should be an array of items.
So the script should be :
%{entity.createEmbeddedDocuments('Item', [game.items.getName('ITEM NAME HERE').toObject()])}%
thank you! I'll give that a go
well it's an improvement but now I'm getting 'undefined. entity.createEmbeddedDocuments is not a function'
Should be entity.entity.create...
That did it! Thank you both <3
Do you know how I'd need to change it for deleting the item? Basically I want one roll message to delete an array of existing items and then create/add a new one.
I tried changing it just to '%{entity.entity.deleteEmbeddedDocuments('Item', [game.items.getName('Resilient').toObject()])}%' and got:
undefined id [[object Object]] does not exist in the EmbeddedCollection collection.
I made the item unique so there should only ever be one that exists in the sheet
You should read the foundry-docs to see what deleteEmbeddedDocuments expects. I suspect that it expects an Array of IDs instead of the whole Object
That's exactly it : https://foundryvtt.com/api/classes/foundry.documents.BaseActor.html#deleteEmbeddedDocuments.deleteEmbeddedDocuments-1
Documentation for Foundry Virtual Tabletop - API Documentation - Version 12
My guess is I need something other than .toObject then, what would I use to get the id of the item when I just have it's name? I tried just doing an array of the names and that didn't work
Every Document has an ID and a UUID: game.items.getName('Resilient').id
I see, well with %{entity.entity.deleteEmbeddedDocuments('Item', [game.items.getName('Resilient').id])}% gives the error 'undefined id [kwofPSEyjzbBLcPa] does not exist in the EmbeddedCollection collection.'
I wanted to try "GetEmbeddedDocument" but that requires the id lol, I'm guessing the ID is different for the out of sheet item vs when it's embedded/added to the sheet
Yeah it is. You probably want to use entity.items
aha that did it! Thank you!
anyone noticed that core settings expanded doesnt work anymore with Foundry V12
Yip, i tried to made mine working but it has broken every of my scenes. So I had no choice than kicking it off.
Is there a way to add "stats" or even "abilities" via item containers when you make a selection from a dropdown menu?
I'm trying to add background bonuses when someone chooses a background.
If not, what's a better way of doing this?
I tried it out, but to be honest, it leads me to the same place. If I uncheck "Send roll message", the entire chat message gets hidden, which I don't want. If I leave it checked, it still outputs the "ERROR" message that doesn't get hidden, even if I use # to hide it. I was looking for a way to play the effect alongside the chat message instead of "either".
The error comes from the undefined return of the Script. So you should either return something or you can hide the result with ${#%{...}%}$
Uh... and how would I make a simple return, something like a spacebar? I can hide it, but it still shows in my GM chat and gets in the way a little bit (Unless there's a way to disable that)
Or use the module βMonkβs Little Detailsβ for adding own effects.
@formal goblet would you be willing to help me work out the above issue? Presently, I've separated the "accuracy" and "damage" portions of the code between the Label Roll Message and Label Alternate Roll Message so I can focus on testing the part that's not working
One more small thing, because I can't seem to get it to work - how would I go about an item modifying the actor's attributes? I want to make it so using an item reduces fatigue by X. I used:
${setPropertyInEntity('attached', 'fatigue', "attached.fatigue- ${Fatigue_Cost}$")}$
Where:
- Lowercase fatigue is the actor's attribute
- Uppercase Fatigue_Cost is an item's property (The cost of using the item)
All I got is this error:
Uncaught (in promise) Error: undefined. Uncomputable token "attached"
Also tried "selected" for both, didn't work. However, if I put in "target" in both places, it starts to work, meaning my little atrocity actually works... I just can't get the "attached/selected.fatigue" to read the actor's data
On an unrelated note... How do I make it so a button will not trigger if the player has no target chosen? I ahve no idea where to start with this one.
It's target (in terms of source/target), not targeted Token (that's only true for the 1st argument)
Post again what you currently have and what you're trying to achieve
The system I'm working on has an odd dice pool system where it rolls multiple dice and keeps only the highest.
I'd like the sheet to be able to reference the number set in the various skills and roll the appropriate dice as well as learn how to set up other items that reference those numbers and modify them and/or set the difficulties based off the numbers on other "actor" sheets.
To give a specific example:
~~* I have an actor attacking with a straight sword. ~~
* Straight Swords are mapped to using the Medium Melee skill (labeled: mmelee) and give +1d10 on rolls to hit as well as Damage
* The actor has 2d10 in Medium Melee and 3d10 in Muscle
* With the equipped sword, they should roll 3d10 to hit and 4d10 for Damage
* For the Sword attack to hit, 1 or more of the die needs to meet or beat the enemy actor's Parry (which is 6)
* Assuming the attack lands, the actor should then roll their 4d10 against the enemy actor's Hardiness (which is 4), and if any of the die meet or beat 4, and for each die that rolls a 10 specifically, the roller should record a wound.
^ was the original post, I've crossed out the things that the code currently does correctly and underlined the parts that I'd like to add.
Accuracy Roll
Hit-Roll: ${hit_roll:= [:hit:d10kh]}$
Does it hit? ${hit_roll >= fetchFromActor('target', "parry", 0)}$```
## Damage Roll (Does Not Currently work at all)
```${#damage:= ref(item.dmg_att) + item.wdmg}$
Damage-Roll: ${#damage_roll:= [:damage:d10kh]}$
Wounds: ${damage_roll >= fetchFromActor('target', "hardiness", 0) ? 1 : 0)}$```
I swear, initially it didn't want to work, but now it works flawlessly - thank you for your help!
Hello, is it possible to make items that bring other items along when added, such as "Fire elemental" species item that has "Fire Resistance" piggybacking on it?
Weapon Sheet has also been mildly updated
how can in insert stuff in a map that are not actors? for example i have a map and what to add a picture of a chest. i tried it with "items" but cant drag the into the map
try making them as an item tile instead
what do you mean with that?
ah ncie thanks!
Hello I have an Problem with a Label and the following formular:
${fetchFromActor('attached', "lookup('Classes_Container','Level', 'name', '${Sphere_Value}$')")}$
It should return me a single Value, in this case '10' as in the column 'Stufe', but it returns me in some cases an array with gibberish as showed in the first picture.
I guess its something wrong with my Item Template, but I cant figure out where this formular fetches that many values from. And it gives me hard headaches. Any Idea whats going on here?
Surround lookup() with first(), because lookup() does always return an Array. But it's a good question why it returns more values than you can see there
I tried, it returns me a 3 then if the the value is 10
I really dont know whats going on
And as I play around with three diffrent templates and itemcontainers Im kinda overwhelmed now to figure out the problem
@formal goblet was this enough information or is there anything else I can provide to make helping me easier?
Sry, got interrupted...
Alright, what error do you get with the damage roll?
hm.. so I tried this with 2 different actors
The first was my built to screw around test actor and I got the following error
The 2nd time was with a fresh npc actor I made yesterday on a whim and it actually just... worked (minus not being able to calculate wounds)
Did you reload your Actor + Items in the Actor?
Reload all Items doesn't include those inside Actors
And if we interpret the error message correctly, it tried to find something with the name na but couldn't find anything.
which means I'm now vaguely capable of parsing the code
let me put actors down on the sheet and see if it's actually trying to grab the data
alright, just tested
neither the "accuracy" or "damage" are pulling data from the target actor's sheet
I found the current issue with wounds. You have a closing parens at the end, which is too much
Did you target (not select) the Token in the Canvas?
Yes, that being said, the damage (in it's current form), did stop spitting out "error"
now it's just not reading the data and counting anything over 0 as a success
We can introduce an intermediate step. Extract the part with fetchFromActor() and save the result in a variable. The variable should replace the part in the last calc.
With this, we should have more info on what is calculated.
How do I do that?
I get taking it out
and it seems like you're saying to save it as something like...
Damage Threshold: $ {(dmg_thresh: = fetchFromActor('target', "hardiness", 0))} $
Your Formula delimiter is wrong. It's always ${}$
That better?
Yep
${#damage:= ref(item.dmg_att) + item.wdmg}$
Damage-Roll: ${#damage_roll:= [:damage:d10kh]}$
Damage Threshold: ${(dmg_thresh: = fetchFromActor('target', "hardiness", 0))}$
Wounds: ${damage_roll >= :dmg_thresh: ? 1 : 0}$
No :variable: if you're not within []. It's just variable
And you can remove the outer parens
Which outer parens?
From Damage Threshold. Right after the Formula delimiters
Updated Code and Error Message
${#damage:= ref(item.dmg_att) + item.wdmg}$
Damage-Roll: ${#damage_roll:= [:damage:d10kh]}$
Damage Threshold: ${dmg_thresh: = fetchFromActor('target', "hardiness", 0)}$
Wounds: ${damage_roll >= dmg_thresh ? 1 : 0}$
No whitespace between : and =
fixed but got same error
${#damage:= ref(item.dmg_att) + item.wdmg}$
Damage-Roll: ${#damage_roll:= [:damage:d10kh]}$
Damage Threshold: ${dmg_thresh:= fetchFromActor('target', "hardiness", 0)}$
Wounds: ${damage_roll >= dmg_thresh ? 1 : 0}$
Give me the new error message
Do you use newlines within Formulas? If so, remove them.
Also, try to expand Object at the end of the error message.
That's still the old one. You even have a \ at "hardiness.
Do you use the Rich Text Editor?
only in the text areas
I've definitely been refreshing the sheet
I might need to make a new actor to see if that changes anything
Is your Token linked to your Actor? If not, then each Token will have its' own sheet
it's not
Yep
tried it on a new actor and it worked
so... lemme just copy the changes and apply them to the "accuracy" formula
Actually, is there a way I can set the field to look at the weapon type to see if it's meant to check against "parry" or "evade"?
Too unclear, more details pls π
In this game certain weapons (as well as techniques) determine whether or not they hit a target based on one of their defenses. Most melee weapons target an enemy's "Parry" and most ranged weapons target an enemy's "Evade"
Is there a way to add a step in the process for the weapon to check and see which of the two it should be searching for?
Like say, reading the "skill" line in the weapon sheet to determine which it should use?
Doable, yeah. So the targets defense stat is dependent on the weapon skill? Or are there other dependencies?
Usually, the only other dependency would be if you're using a technique, but while those use weapon attributes to boost them, they will likely need their own code to function properly that we can sort out after the basic weapon attack part is in working order
Then you only need to decide, where you want to store the information, which skill type uses which defense stat (either in the Skills Table itself or in a switchCase()-formula).
- Parry = Arm Strike (astrike), Leg Strike (lstrike), Grapple (grab), Throw (throw), Light Melee (lmelee), Medium Melee (mmelee), and Heavy Melee (hmelee)
- Evade = Small Ranged (srange) & Large Ranged (lrange)
I'll leave the data stored in the weapon
Alright, reading through what switchCase does it seems like exactly what I'm looking for
but I don't know how I'd implement it
Right now, the code for accuracy is:
${#hit:= ref(item.skill) + item.wacc}$
Hit-Roll: ${hit_roll:= [:hit:d10kh]}$
Accuracy: ${accuracy:= fetchFromActor('target', "parry", "evade", 0)}$
Does it hit? ${hit_roll >= accuracy}$
${target_defense_stat:= switchCase(item.skill, 'srange', 'evade', 'lrange', 'evade', 'parry')}$
${accuracy:= fetchFromActor('target', target_defense_stat, 0)}$
${#hit:= ref(item.skill) + item.wacc}$
Hit-Roll: ${hit_roll:= [:hit:d10kh]}$
${target_defense_stat:= switchCase(item.skill, 'srange', 'evade', 'lrange', 'evade', 'parry')}$
${accuracy:= fetchFromActor('target', target_defense_stat, 0}$
Does it hit? ${hit_roll >= accuracy}$
Like that?
Small edit, but yeah
Fixed it
Alright, one last thing I'd like to see about getting settled with Damage if possible
The core is very good
However, the damage should record a wound:
- Whenever any of the Damage Die are greater than "hardiness" (Currently Correct)
- Whenever any of the damage die roll a ten
So you can accumulate a max of 2 wounds?
It's a Dice pool system
so if any die is successful you score a wound, but also for each 10 you score an additional one
Ok, that wording is clear
so if I have a pool of 6 dice (and the target's defense is 5) and the results on the dice are:
5, 4, 3, 10, 10, 9
Then I'd deal a total of 4 wounds
but yeah, should just need to count successes on the damage formula instead of keeping highest tbh
You mean 3, right?
So it's also relevant how many non 10s there are, which meet the criteria (instead of at least one that meets that)
If any are =>, then you earn a wound. Furthermore, every 10 score an extra
So for example defense is 6 and you have 1, 8, 9, 7, 5, this would result in 3 or 1?
1
ah, you're right