#Custom System Builder

1 messages · Page 17 of 1

fair yoke
#

1d6+4 for instance

#

nvm that done it, worked it out

fierce harbor
fair yoke
#

and we now have a working foundry sheet for the Legend RPG

#

not open legend, which already has one 😛

fierce harbor
glad spade
#

According to @blazing ibex, they've set it up all correctly, but when I try to get the templates through game.system.template.Item, it doesn't have any of their configured props

blazing ibex
#

You can actually see it working, but not where it should be

#

The "Qty" is a custom column that's supposedly checking the same variable as the default "Quantity" column

#

Were you having the same issue?

solar zephyr
#

All my CSB Worlds' launch icons have vanished, replaced by a "Requires Dependencies" icon ... did I delete a Module that's required or somethign?

formal goblet
#
  1. It is compatible with V11 and is also under active development
  2. Well, I don´t know how to answer that... If you want to know what is possible, then it might be worth to check the sheet-library of CSB: https://gitlab.com/custom-system-builder/custom-system-builder/-/tree/develop/sheet-library?ref_type=heads. It´s also worth to take a look at the Example-Template
  3. I´m not familiar with Midi, but you´re able to integrate own macros and scripts if you like
  4. Well, CSB lacks a bit of performance optimizations... But I´m able to run Shadowrun-6 with tons of Items on a Raspberry PI without many performance-drops. Only the initial load takes a few seconds.
formal goblet
solar zephyr
#
  1. yes, writing your own code will always be more flexible than using someone else's sub-framework. But if CSB can do what you need it's a lot faster.
  2. this isn't CSB specific, right? Yes, in Foundry in general, if you have "tons" of Actors or Items, it will be more performant if you put many into Compendia.
solar zephyr
#

Thanks.

#

For CSB to do that I think you'd need to Extend it with a Module of your own make.

formal goblet
#

That´s doable, yeah

solar zephyr
#

Are lighting rules more of a System thing or more of a base Foundry thing? Like the dark/dim/bright light division.

formal goblet
solar zephyr
#

what do you mean by Status and Visuals?

#

and, if I want to make a change to lighting from the way CSB has it, I assume that's within the scope of a Module without making a whole new System?

spare sky
#

Although I have read through the wiki, I have not been able to find a solution when multiple conditions must be true. My approach:

${Bedingung-1 ? Bedingung-2 ? Bedingung-3 ? mach das : mach nix}$

${item.key_item_phiole_effekt_dauer_label >= 1? item.key_item_effekt_auswirkung_lp == true ? item.key_item_phiole_wirkung_plus == true ? setPropertyInEntity('self', 'numberfield_lpakt', "numberfield_lpakt+item.key_item_phiole_effekt_aktiver_wert_label"):0}$

Where is my mistake?

And is there the possibility to define OR-conditions as well or are all conditions always AND?

Thank you very much!

formal goblet
spare sky
#

This way:

${item.key_item_phiole_effekt_dauer_label >= 1 AND item.key_item_effekt_auswirkung_lp == true AND item.key_item_phiole_wirkung_plus == true ? setPropertyInEntity('self', 'numberfield_lpakt', "numberfield_lpakt+item.key_item_phiole_effekt_aktiver_wert_label"):0}$

spare sky
#

${item.key_item_phiole_effekt_dauer_label >= 1 and item.key_item_effekt_auswirkung_lp == true and item.key_item_phiole_wirkung_plus == true ? setPropertyInEntity('self', 'numberfield_lpakt', "numberfield_lpakt+item.key_item_phiole_effekt_aktiver_wert_label"):0}$

Although all three conditions are true, 0 is output.

#

Or of course key_item_phiole_effect_duration_label >= 1 😉

formal goblet
#

Versuchs mit Klammern um die Bedingung, also alles vor dem ?

jolly stone
#

I'm having some trouble with the attribute bars. I want to do one for HP, with HP and maxHP as the component keys to use for the value and maximum for it. But I can't figure out what format it wants. The fields keep coming up blank, so the token claims NaN.

regal whale
#

No luck even with 'self'. I continue to just get a chat message of 5 and the function does not change the value of AmmoCountPrimary. Can anyone post an example of a working setPropertyInEntity() ?

fierce harbor
formal goblet
#

Every function has examples btw

regal whale
#

Thanks Martin and Torlan. I have tried that example Martin initially and had no success. I started to trying other examples from the documentation and when i still had problems, i posted here. Here are some screenshots showing all the components and syntax i am using. These components are simple ones so i can figure out what i am doing wrong and are not what i plan on using setPropertyInEntity() in the future.

fierce harbor
regal whale
fierce harbor
formal goblet
fierce harbor
#

Oh well, my bad

plucky canyon
#

I'm building myself a system to play Heavy Gear 2e. Started out thinking I'd just put all the right fields in, and then play it pretty much manually. But of course... it's hard not to try and make it smoother. 🙂

I'm trying to figure out if there's a way to track the number hexes an actor moves during a combat turn. Preferably through core Foundry/CSB, but I know Drag Ruler has movement history so that's an option as well (I just don't know how to access that data).

Basically I want to track movement so I can use it for modifiers when attacking/defending.

formal goblet
plucky canyon
#

Ok, so that leaves the data in Drag Ruler. Another (less satisfactory) option would be to have a prompt asking you to enter the number of hexes moved after you release an actor during combat, that could then be used for mods etc. 🤔

formal goblet
#

That would be system.props.key

plucky canyon
#

What would that be? Drag ruler data?

formal goblet
#

Yeah

plucky canyon
#

Ok, I could try digging around there and see what I find. Thanks!

formal goblet
#

Well, you basically tell Drag Ruler how far a character can move. For that, you can use data from CSB directly

plucky canyon
#

Yes, drag ruler works fine right now. I just want to track the number of hexes moved in a label key so I can use it for attack modifiers, ie "Jaguar has moved less than half it's Combat Speed so get +1 on attack rolls" etc.

formal goblet
#

That one would be trickier. You´d need 2 things:

  1. You need to check if Drag Ruler is even providing that data (how far did my character move in this round...)
  2. You need to update the actor sheet accordingly (changes in drag-rulers data are not mirrored to CSB automatically, this will be your responsibility)
plucky canyon
#

It feels like it should be doable somehow... just need to figure out where that data is located (if it even is!). A bit too late today though, but thanks for the pointers.

#

By the way... I've cobbled together a script for the fairly unusual dice roll formula. Basically it's a keep highest d6 dicepool, except each 6 beyond the first adds +1 to the result, and if you roll all 1s the result becomes 0. I've got it working reasonably well, but it produces two logs in chat - one from the GM and one from the actor just containing "Undefined".
I guess it's something about the script not containing triggering actor data so the roll output doesn't include it, but I'm not sure how to go about fixing it. First calling the actor somehow and then having the script include it somehow...

The macro looks like this:
const roll = await new Roll(`${amount}d6kh`).evaluate(); const numDice = roll.dice[0].results.length; const sixes = roll.dice[0].results.filter(r => r.result === 6).length; const ones = roll.dice[0].results.filter(r => r.result === 1).length; const bonus = !!sixes ? sixes - 1 : 0; const fumble = ones === numDice ? 0 : 1; roll._total = (roll._total + bonus + Number(`${mods}`)) * fumble; await roll.toMessage({flavor: "<h2>Attack!</h2>"});

And the label roll message:
%{return await game.macros.getName('Perfect!').execute({amount: '${gunnery_lvl_actual}$', mods: '${attack_mods_total}$'})}%

And chat output (numbers all correct, it just looks a bit weird).

formal goblet
plucky canyon
#

Ah, cool! Thanks!

I mean, this perfectly fine and means I can play without having to check the ones and sixes. But it woudl be nice to have the chat message be from the actor whose sheet triggered the script (in this case the Iguana).

#

That worked nicely! I guess I could try and get the actor name into the flavor text somehow. Or even better, if I could get the actor name, and also the name and damage value of the weapon used.

mental rose
#

I'm wondering if someone can help me...I'm using the custom system builder 3.0.0. What I want to do is create attribute values on the tokens that are calculated from items dropped into an item container on the token. Like ARM = SUM(maxarm + maxstrut) / 3
How should I go about doing this?

grave ether
#

So dropping in items add to a total bonus or total stat?

#

Arm lable should be ${sum(${maxarm}$ + ${maxstrut}$)/3}$

#

What I would do is edit one of the _templates for items to match the field names with and adjust the values based on your desired number. Then create a container matching and adjust sheet accordingly.

I havent gotten fully into making items but thats briefly how I read they worked. @mental rose

mental rose
#

hmm

grave ether
#

If you havent already installed them, grab the templetes that are in the example file. use the armor one and adjust to you needs and make a piece of equipment that would adjust as such

#

or creature

#

creature maybe your better options since its already fleshed out for the most part.

#

@formal goblet Can you hide fields from users in a dynamic table or is it broken atm?

#

setting the visibility for ownership doesnt seem to do much

#

Also, isnt there a way to reference dynamic table fields by using table.field? I thought I saw that somewhere

mental rose
#

example file?

mental rose
#

ah thank you

grave ether
#

darn ok,

formal goblet
mental rose
#

Okay, I'll try to find that on the wiki

regal whale
hollow dew
#

does anyone know why the value for currentHP doesnt get updated within the roll message for the purposes of referencing it, even if the value does get updated on the sheet? the functionality of this rest button does work, except the message at the end always says "Character heals 0 hitpoints." because currentHP is considered to have the same value by the end as at the start

formal goblet
hollow dew
# formal goblet Missing double-quotes for the 3rd parameter in `setPropertyInEntity()`

well, even with double quotes, it's not fixing the problem. setting the property works fine (and worked without the quotes too). i've modified the output a bit to show the problem. so, i started with 7/12 hitpoints (currentHP). after my dialog pops up, i choose to rest for 1 hour, which heals two hitpoints. i setPropertyInEntity, which works, leaving me with 9/12 hitpoints. however, when i check the value of currentHP afterwards, it still thinks that currentHP is 7

#

maybe the code after is executing too quickly, before the change is applied?

formal goblet
#

You can just get the result from setPropertyInEntity() btw

river sierra
#

So, the property accessors access the view (character sheet)'s, not the model's values?

formal goblet
river sierra
#

It actually seems to be more complicated. Updating the hidden input fields in the browser inspector does something, but it's delayed.

formal goblet
#

I checked it. It's a race condition, the update is not awaited 😅

hollow dew
spare sky
#

Hi Martin,
ich hänge gerade an folgender Umsetzung, die leider nicht funktioniert:

${item.key_item_phiole_effekt_dauer_label >= 1 ? setPropertyInEntity('self', 'key_item_waffe_schaden_mod', "key_item_waffe_schaden_mod+item.key_item_phiole_effekt_aktiver_wert_label"):0}$

Das Item mit dem Mod-Wert "key_item_waffe_schaden_mod" (Nummernfeld) liegt in einem ITEM-Container. Diesen Wert möchte ich durch einen Wert ändern "item.key_item_phiole_effekt_aktiver_wert_label". Ich bekomme bei der o.g. Anweisung weder eine Fehlermeldung in der Console, noch eine Ausgabe im Chat.

Für andere Werte, wie LP oder RW funktioniert es sehr gut...

Kannst Du mir hier weiterhelfen?

formal goblet
spare sky
#

${item.key_item_phiole_effekt_dauer_label >= 1 ? setPropertyInEntity('self', 'key_item_waffe_schaden_mod', "item.key_item_waffe_schaden_mod+item.key_item_phiole_effekt_aktiver_wert_label"):0}$

#

So bekomme ich eine Fehlermeldung im Chat...

spare sky
# formal goblet Statt `self` `item`

Leider immer noch eine Fehlermeldung im Chat...

${item.key_item_phiole_effekt_dauer_label >= 1 ? setPropertyInEntity('item', 'key_item_waffe_schaden_mod', "item.key_item_waffe_schaden_mod+item.key_item_phiole_effekt_aktiver_wert_label"):0}$

formal goblet
#

Und der Fehler?

glad spade
#

So, I'm still looking into Item Piles compatibility - since all default props are stored in the flags of the item templates, how would I construct a data-only representation of the different item templates?

#

Ie, if a setup has an item with system.props.quantity, how can I know if that type of item has that setup without checking the items' props?

#

Checking the flags.custom-system-builder.templateHistory seems a bit complex for this, I'm curious if there's a simpler way

formal goblet
#

Items have a link to the Item Template (ID) (Item Templates are also Items). So one way would be to find the item template via game.items.get(templateId).

glad spade
#

yeah, but I can't seem to find the properties on the template item

formal goblet
#

I think at least the Item Keys are defined in the Template, but I'd need to take a closer look when I'm home.

#

@brittle moth feel free if you're faster 😅

spare sky
# formal goblet Und der Fehler?

In der Console: Error: Cannot convert "ERROR" to a number

Liegt es evtl. an der Struktur?

Diese Anweisung

${item.key_item_phiole_effekt_dauer_label >= 1 ? setPropertyInEntity('item', 'key_item_waffe_schaden_mod', "item.key_item_waffe_schaden_mod+item.key_item_phiole_effekt_aktiver_wert_label"):0}$

führe ich über "Anwenden" in dem ITEM "Effekt" aus (Effekt.png).

Dieser Wert soll sich auf den MOD-Wert (Number field: key_item_waffe_schaden_mod) einer Waffe (Waffe.png)
auswirken, die in einem anderen ITEM-Container liegt und diesen Wert entsprechend ändern.

formal goblet
glad spade
# formal goblet I think at least the Item Keys are defined in the Template, but I'd need to take...

I have to basically recurse through each template item to find out 😄

function findKeyInContents(elem, key){
    if(Array.isArray(elem)){
        return elem.some(subElem => findKeyInContents(subElem, key));
    }
    return elem.key === key || (elem.contents ?? []).some(subElem => findKeyInContents(subElem, key));
}

const templateItemId = game.items.getName("test").system.template;
const templateItem = game.items.get(templateItemId);

console.log(findKeyInContents(templateItem.system.body.contents, "quantity"))
runic condor
#

is there a way to check 2 conditions in the roll message? like ${r1 >= 5 && r2 >= 5 ? "success" : "fail"}$

#

I have a bunch in a row its checking but only one of them has 2 conditions. I could break it out more but I was hoping for a cleaner way

#

oh nvm figured it out using ${min(r1,r2) >= 5

blazing ibex
#

for the visibility section, whats the code you use to hide a component if a checkbox is empty?

blazing ibex
#

including space?

fierce harbor
# blazing ibex including space?

Yes. But now that I read it you said 'hide if empty', so just leave checkboxkey and the field will show only when the box is checked.

#

I'm a little lost. It says 'visible if checked'...

#

Doing what?

blazing ibex
#

deleting so this doesnt confuse anyone else

summer berry
#

Hey, I want to do a roll, depending on a value on an item. This is my formula

${switchCase(item.stufe, '0',setPropertyInEntity('self', 'chaoswert_aktuell', "chaoswert_aktuell-1"), '1',setPropertyInEntity('self', 'chaoswert_aktuell', "chaoswert_aktuell-[1d8]"),'2',setPropertyInEntity('self', 'chaoswert_aktuell', "chaoswert_aktuell-[2d8]"),'3', setPropertyInEntity('self', 'chaoswert_aktuell', "chaoswert_aktuell-[3d8]"), '4', setPropertyInEntity('self', 'chaoswert_aktuell', "chaoswert_aktuell-[4d8]"),0)}$

Sounds weird but I'm pretty sure it worked as intended two days ago. Now it will evaluate the switchCase as if every item has 'stufe' == 4. Any ideas what the problem could be? No errors are thrown.

#

And the chat shows that every roll is thrown but only the 4d8 is applied

grave ether
#

I have a dynamic table that I want to reference to come up with a value but running into a bit of a wall.

SL_Chart <-- name of table
Chance <-- referenced by stat
SL-5 -> +10 returned

Stat identifies Chance
Roll identifies SL based on that chance number..

I have attempted this a couple of ways

${max(${Target_Number}$ >= first(fetchFromDynamicTable('SL_Chart','Chance', 'Chance')))}$ <-- returns true or false based on number

${fetchFromDynamicTable('SL_Chart', 'Chance', '100','==')}$ <-- populates blank.

Thought about using a switchCase but in this example I am trying to validate 3 values so wasnt sure..

Any suggestions would be welcome

#

Just for context

formal goblet
grave ether
#

Your correct, I missed it earlier lol

#

${max(fetchFromDynamicTable('SL_Chart', 'Chance', 'Chance','${Target_Number}$','>='))}$

the max formula doesnt work as intended with this use case.. value of 60 produces a 90 which it should produce 65, 150 produces 500...

It should be providing the max number during the look up with the targeted number..

formal goblet
grave ether
formal goblet
grave ether
#

OK good to know

#

Pulling the array, using sort to sort the array and having it return the max doesnt seem to work either lol

formal goblet
#

And the function is designed to return all values which meet the criteria

grave ether
#

Ultimately, I need to take that single value closes to the target number and reference it again another 15 times against the same dynamic table. and return the Row Name

#

Sorry, trying to describe the full intent and use case for full understanding

formal goblet
grave ether
#

I am putting it on paper, will get you a full understanding here in a second

#

Hope this makes sense

formal goblet
# grave ether

fetchFromDynamicTable('SL_Chart', Success_Level, 'Chance', floor(Target_Number / 5) * 5) with Success_Level being the key of one of the columns?

grave ether
#

Hmm let me take a look and see if that will work

latent sorrel
#

Has anyone used html enrichers to modify the rendered actor sheet or item sheet? I am hoping someone has an example.

runic condor
#

on a checkbox is there a way to put a label icon?

#

I want to use a dice icon like you can on a normal label

grave ether
#

Are you saying if the check box is checked it would be an icon instead of an empty box?

grave ether
#

Can you reference a Component key of the label by using the %{return await game.macros.getName('YourMacro').execute({name: '${name}$'})}%

#

IE I dont want to have to modify the call since this could be going on something like a Dynamic table, and I want to roll from it

formal goblet
grave ether
#

hmm ok

runic condor
formal goblet
grave ether
#

Yes without having to manually designate it.. IE if a lable is listed as Str_Total, I dont need to hardcode the ${Str_Total}$ during the call

formal goblet
#

Do you have a text field which contains the key of a component?

grave ether
#

%{return await game.macros.getName('macroName').execute({name: entity.entity.name, strength: ${Strength}$});}%

yes

formal goblet
#

Just use ref() then?

grave ether
#

Can you do that as a call like above?

formal goblet
grave ether
#

ok

#

Let me fool around with that

#

TY

runic condor
#

I'll simplify my question:

how do you put rollable tables in conditional outputs like this:

${r1 == 0 ? "@UUID[RollTable.kWkgUoxqDkufFKIJ]{Conditions: Immediate}" : ""}$

fierce harbor
runic condor
#

Thanks for looking, yea Im stumped lol.

#

Trying to speed up the injury system in my game by linking the roll tables in chat

fierce harbor
#

What's the outcome of that code?

runic condor
#

It doesnt execute

#

nothing displays to chat

fierce harbor
runic condor
fierce harbor
#

Could it be RollTables instead of RollTable? Just guessing...

runic condor
#

nope, same error

#

with RollTables.#### instead

fierce harbor
#

Well, I cannot test anything till tomorrow but I'll let you know if anything pops up.

runic condor
#

If I just put that straight in the roll message it works but inside the conditional it breaks

#

like if my roll message is just "@UUID[RollTable.kWkgUoxqDkufFKIJ]{Conditions: Immediate}" it'll display normal, just cant get it to show selectively.

fierce harbor
fierce harbor
formal goblet
#

No, for the whole Formula. ! is meant for removing the box in Label Roll Messages

#

Small hint:

  • JS: Single Quotes
  • HTML: Double Quotes

Just a conventional thing.

runic condor
#

So are you saying put the ! here: ${!r1 == .......}$

formal goblet
#

y

runic condor
#

still not working, gives that same error in the console.

#

Heres the whole roll message for context:

`<p>Fatigue result = <strong>${r1:=[:FatigueCurrent:d6cs=1]}$</strong></p>
<hr>

${!r1 == 0 ? "@UUID[RollTable.kWkgUoxqDkufFKIJ]{Conditions: Immediate}" :
r1 == 1 ? "<span style='color: darkred;'>Lingering Condition</span>" :
r1 >= 2 ? "<span style='color: darkred;'>Critical Condition</span>" :
""}$`

#

Basically I want all of those results to be roll tables, only the first one is now while im trying to get it to work

formal goblet
#

Does ${!'RollTableId'}$ work?

#

If not, then it will not be doable with CSB-Formulas

runic condor
#

are you saying replace "@UUID[RollTable.kWkgUoxqDkufFKIJ]{Conditions: Immediate}" with ${'kWkgUoxqDkufFKIJ'}$ ?

formal goblet
#

Although... The example sheet uses a link as well. But the link is stored in the text of a RTA-Component and the Label Roll Message is just referencing that

#

Na, the whole UUID-thing

runic condor
#

gave the same console error

hollow dew
#

maybe try with the module inline table rolls?

runic condor
#

Ill try that

grave ether
#

I cant even get it to use the RollTableId as a command via lable..

#

I know I remember seeing the wiki reference @UUID but I cant find it anymore

formal goblet
grave ether
#

Might of been where I saw it but I couldnt find it again lol

runic condor
hollow dew
#

it's good that the module recently changed the syntax, I can imagine the old [[ ]] causing problems with roll messages from CSB

grave ether
#
(
function roll1d100() {
  return Math.floor(Math.random() * 100) + 1;
}

const Chance = 85; // Replace with your Skill Value (Chance)
const roll = roll1d100(); // Roll a 1d100

let SL;

if (Chance >= -5) {
  SL = Chance + 170;
} else if (Chance >= -4) { 
  SL = Chance + 120;
} else if (Chance >= -3) {
  SL = Chance + 110;
} else if (Chance >= -2) {
  SL = Chance + 60;
} else if (Chance >= -1) {
  SL = Chance + 50;
} else if (Chance >= 0) {
  SL = Chance;
} else if (Chance >= 1) {
  SL = Chance;
} else if (Chance >= 2) {
  SL = Chance / 2;
} else if (Chance >= 3) {
  SL = Chance / 4;
} else if (Chance >= 4) {
  SL = Chance / 4 - 10;
} else if (Chance >= 5) {
  SL = Chance / 4 - 20;
} else if (Chance >= 6) {
  SL = Chance / 4 - 30;
} else if (Chance >= 7) {
  SL = Chance / 4 - 40;
} else if (Chance >= 8) {
  SL = Chance / 4 - 50;
} else if (Chance >= 9) {
  SL = Chance / 4 - 60;
} else if (Chance >= 10) {
  SL = Chance / 4 - 70;
} else {
  SL = 'Invalid Chance'; // Handle invalid Chance values
}

console.log(`Chance: ${Chance}, 1d100 Roll: ${roll}, SL: ${SL}`);

// Determine the result
let result = '';
if (SL >= -5) {
  result = 'Succeeded';
} else if (SL <= 1) {
  result = 'Failed';
} else {
  result = 'Undefined';
}

console.log(`Result: ${result}`);```
#

Quick question here:

but trying to get this to trigger and replace Chance with whatever my lable will be .. lets say Skillfor the this example

%{return await game.macros.getName('Rolling').execute({name: entity.entity.name, Skill: ${Skill}$});}%

Would this be correct?

I dont quite understand the name: entity.entity.name entry in the wiki explaining it.. Does that reference the function to start?

#

I am working on the script above now so figured I would ask before everyone disappears

formal goblet
grave ether
#

Baby developer here ... still learning things

#

Created ChatMessage with id [SqiL1Sw4sL0cmeSE]

#

logger[level](${vtt} | ${msg});

formal goblet
#

Hide log-level debug and info

grave ether
#

I dont see how to hide them but I enabled verbose
Computing %{console.warn(entity.entity.name)%
console.debug('Computing ' + this._rawPhrase);

formal goblet
grave ether
#

yep

formal goblet
#

This is what should come

grave ether
#

hmmm

#

I dont get that

#

at all

formal goblet
grave ether
#

let me try again hold tight

#

populating now

runic condor
#

how do you set the value of another component on the sheet with a roll formula?
I have an initiative button that I want to set a hidden variable to the result.

rustic void
#

is there a way to use a dropdown list's keys to change the value of a label ?

runic condor
#

Yea if its label is ${DropDownComponentName}$

#

I have that for my weapons where there's a dropdown named WeaponTwoHanded

rustic void
#

in this case your label would just became the name of your key right ?
In my case I have 3 weapons type in a dropdown list, and each type deal 1d6, 2d6 or 3d6 damage.
I want the damage to change when I change the weapon type in my dropdown list ( that's useless automatism I know, I just want to know if it is possible.
I tried with condition but it didn't work because it wasn't value ^^

runic condor
#

I have something kinda similar but its manually typed in for damage

#

It works with a drop down too

#

Then I have that as the roll message

#

does that help? @rustic void

#

${[:DamageFormula:]}$ is the key to getting it to roll, you need [: :] around the variable name and itll treat it like a roll.

rustic void
#

nop but it gave me another idea and this one working ^^

#

I'm not yet at the "rolling part" for now but I'll keep it in a corner for later 🙂

runic condor
#

Im having an issue with my script where it cycles through each of these options instead of only doing the one that matches the condition:

${min(r1,r2) >= 5 ? "${#setPropertyInEntity('self', 'InitiativeCurrent', "6")}$" : r3 <= 3 ? "${#setPropertyInEntity('self', 'InitiativeCurrent', "1")}$" : r3 == 4 ? "${#setPropertyInEntity('self', 'InitiativeCurrent', "3")}$" : r3 >= 5 ? "${#setPropertyInEntity('self', 'InitiativeCurrent', "5")}$" : ""}$

formal goblet
# runic condor Im having an issue with my script where it cycles through each of these options ...

https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#314-conditions

The ternary will execute all parts regardless of the condition. For example:
isActive ? notify('info', 'This is active') : notify('info', 'This is not active') will execute both
notify()-functions regardless of the condition it will evaluate to. You should use it this way instead to prevent the
problem of double-execution: notify('info', isActive ? 'This is active' : 'This is not active'). This is a limitation
by the system, so be careful with that. Usually it´s not a problem, because most of the time CSB-Formulas are not
performing any active actions, but it will become one if you combine conditionals with actions (like notify() or
setPropertyInEntity()). If you still need short-circuiting conditionals, use
Script-Expressions instead.
runic condor
#

Whats the easiest way to change the font of the whole character sheet?

grave ether
#

Edit the json?

#

Idk the actual answer but assume the font is listed somewhere in the json. I can check in the morning if you cant figure it out

runic condor
#

I found a way in a custom css module

oblique spear
#

Can I add a new entry in a dynamic table from code?

Since there is no possible to add in the hotbar a macro from a item container, I think to put a button in the item container that copy the info of the item to a dynamic table. It is possible?

Thanks in advance

grave ether
#

Is there a place to share our macros, sheets and code? I know github has sample sheets but being this is a purely custom system it would be nice to have a place where people can contribute. Just my 2 cents

drowsy rune
#

Hey, can I get a little help to create at least 2 attributes regarding this issue ?

#

I don’t think I need much more than that.

formal goblet
plucky canyon
#

Fiddling around with a row of checkboxes for HP, and trying to make a formula that an earlier checkbox if a later checkbox is checked.
Just having this as a separate label/secret attribute doesn't work, although it seems to me it should. 🙂

${inf_member_01_dambox_02 == 1 ? setPropertyInEntity('self', 'inf_member_01_dambox_01', 1) : ''}$

plucky canyon
formal goblet
runic condor
#

Struggling with this:

${setPropertyInEntity('self', "EntityInitiative1", "fetchFromActor("${EntityName1}$", "InitiativeCurrent")")}$

#

Goal is I hit a button and it fetches the last rolled initiative value from each sheet written in the text boxes

#

fetchFromActor() bit is working, it grabbed the right number

#

I just cant figure out how to then set it as the label next to the text box.

grave ether
#

I like the buttons.. hmmmm

#

maybe I should impalement that into my sheet.

fierce harbor
runic condor
#

it wont replace that "None" text with the number it grabs

grave ether
#

OK I have a macro that works but it doesnt post correctly in the chat

#

Here is what I got,

Top one is executing the macro by itself, the second is the call from the lable

fierce harbor
# runic condor just tried that, nope

Thing is double quotes for the third argument and inside it might be not correct. I'm just depending on my memory, so I might be wrong.
I usually do setPropertyInEntity('self','key', value) or `setPropertyInEntity('self','key', 'string').

fierce harbor
grave ether
#

%{return await game.macros.getName('111').execute({roll: true, Chance: (${Target_Number}$)}% <-- throws error about syntex

%{return await game.macros.getName('111').execute({roll: true, Chance: (${Target_Number}$%)} <-- rolls but prodces the same log in chat

%{return await game.macros.getName('111').execute({roll: true, Chance: (${Target_Number}$)%} <--- rolls as above

runic condor
fierce harbor
#

Try this maybe:

%{return await game.macros.getName('111').execute({roll: true, Chance: (${Target_Number}$)})}%

For @grave ether 😅

grave ether
#

This produced an error but different than expected..

#

Let me diagnose ..

grave ether
runic condor
#

thats a typo woop, thats not in my code now

formal goblet
# grave ether

That comes from your macro. This here is not allowed:

const a;
a = 1;
grave ether
#

Just in CSB not in Foundry correct?

fierce harbor
fierce harbor
grave ether
#

Macro executes by itself in foundry

#

ITs just executing it via the lable I am having issues with

#

The call portion

#

If you can identify where in the code I made a mistake I can fix it but everything resolved in node..

fierce harbor
runic condor
#

I broke out the functions, setPropertyInEntity isnt working at all but fetchFromActor is.

fierce harbor
grave ether
#

Alright, that cant be it..

New code (gutted)

function roll1d100() {
  return Math.floor(Math.random() * 100) + 1;
}

let Chance = 100; // Replace with your Skill Value (Chance)
let roll = roll1d100(); // Roll a 1d100

ChatMessage.create({ 
    speaker: { alias: "Not Bob, definitely not Bob" }, // Add a comma here
    content: `
      <p>You rolled a 1d100 Roll: ${roll} with a Chance: ${Chance} and got a SL:</p>`
    
});```
#

%{return await game.macros.getName('post').execute({roll: true, Chance: (${Target_Number}$)})}%

same call

formal goblet
runic condor
#

Basically its a list, and when I click initiative at the top it should check the names in the text boxes, look at those sheets, grab a variable called "InitiativeCurrent" and then set that as EntityInitiative#

grave ether
#

Macro is in a compendium since I dont know where else to store it.

runic condor
#

My game uses a weird phase based initiative system so thats why im making a sheet to track it lol

fierce harbor
runic condor
#

"Akkar (Dan)" is his sheet name, and it correctly is able to fetch his initiative value.

grave ether
#

Oh mine does as well, I havent figure out a way to implement it yet.. everyone goes on different counts based on what you do.

runic condor
fierce harbor
#

My bad, did not read your message

grave ether
#

I could say they are similar

fierce harbor
grave ether
#

Thats what I am about to do.. needed to talk away for a moment.. lol

fierce harbor
runic condor
#

well it set it to 5, I need it to be the fetchActor thing lol

#

... so if you have text in the label, you cant set it to a number it looks like

formal goblet
#

Labels are not changeable

runic condor
#

Because when I cleared out the "None" it worked lol

grave ether
#

Ok, looks like the macro pulls from the hotbar actually executes. How do I get it to pull from the compendium?

fierce harbor
grave ether
#

always too easy lol

fierce harbor
#

I do not know, then

grave ether
#

I am trying lol

#

nope doesnt like that either

plucky canyon
# formal goblet No, just put the condition into the function

Hmm... you mean something like this?
${equalText(inf_member_01_dambox_02, '1') ? setPropertyInEntity('self', 'inf_member_01_dambox_01', '1') : ''}$

Or did you mean using switchCase in some way? I'm new to all of this so kind of muddling along. 😄

fierce harbor
# grave ether nope doesnt like that either

Been tinkering around the web and maybe this could do the trick for you, but it uses a macro to do it:

const macroCompendium = game.packs.get("world.my-macros"); macroID = macroCompendium.index.find(t => t.name === "Echo Swap")._id; macroCompendium.getDocument(macroID).then(m => m.execute());

You may want to look at the full page: https://www.reddit.com/r/FoundryVTT/comments/sncnau/macro_to_roll_a_macro_from_compendium/

Or here: https://www.reddit.com/r/FoundryVTT/comments/ozrth6/can_i_use_a_macro_to_access_a_comendium_item/

Reddit

Explore this post and more from the FoundryVTT community

Reddit

Explore this post and more from the FoundryVTT community

grave ether
#

I will review that once I figure this out.. I think its %{return await game.macros.getName('dice').execute({roll: true, Chance: ${Target_Number}$})}%

It is coming up as undefined,

#

as a friend told me, 90% of the problem is getting it to post correctly lol

fierce harbor
grave ether
#

Its seeing the target number

#

its not seeing the chance

#

Target number registers as it should from what I am getting

#

Sorry I posted the wrong pic

fierce harbor
# grave ether

Looks like Result comes out undefined
Could it be something inside the macro?
But i cannot seem to find anything in it.

runic condor
#

is there a way to control the combat tracker initiative from the sheet?

runic condor
#

Ive got a fancy roll message that calculates initiative and it would be awesome to write that into the combat tracker

errant sapphire
#

Hey, is there some kind of limit to the number of formulas that can be executed from a rollable label? I've recently returned to a project from earlier this year that contains a rollable label to automatically perform an attack roll from within a character sheet. It uses a bunch of different formulas to do that, and it worked earlier this year (based on checking chat messages and the releases page of the gitlab, it looks like we were on version 2.2.7 at the time), but now clicking the label seems to give up on trying to calculate formulas after a few, simply pasting the remainder of the message as plain text. I've tried checking the console to see if there's an error with my syntax or something, but the only thing that comes up is Foundry's notification that it's creating a chat message.

errant sapphire
#

I know it's a big mess, but here's the message input vs the actual message when clicked. You can see that it just kinda gives up after a few lines. The consoleLog I put at the start for debugging works no problem too, so it's not like it's not executing the first few either.

formal goblet
errant sapphire
#

Hmmm, any better way to do that then?

errant sapphire
formal goblet
errant sapphire
formal goblet
#

So the crit-bonus is just the maximum roll possible?

errant sapphire
#

Exactly

formal goblet
#

oof

errant sapphire
#

I suppose if push comes to shove, I can make a switch case since there's a limited number of possibilities. Let me try that now and see if I can get the whole message to work again or if it still gives up partway through

formal goblet
#

You can store ${ and }$ in temporary variables and use the variables instead in the concat.

errant sapphire
#

Holy cow, OK, perfect

errant sapphire
#

I think what was actually the issue was the '${'. Regardless of if it's already in a formula, that seems to make it give up for whatever reason, but I stored two variables that use replace functions to get to the same string and it worked perfectly

#

Thanks again, that helps a ton. I'd been trying to figure that one out for a while now.

grave ether
#

getting an undefined after the script runs, in the console log its {name: undefined}

#

I am not defining a name in the script but seems like I need it somewhere?

#

Also, how do IU get the name to display on the top tag?

#

%{return await game.macros.getName('rolling').execute({ replaceMe: ${Target_Number}$});}%

static cargo
#

Can anyone help me understand what's not lining up here?

${rollformula = '[3d6kh2]';
chatstring = `rolling minor edge:{:rollformula:}`;
ChatMessage.create({content: chatstring});
}$
#

Dice-so-nice sees the instruction to throw d6's which is great, but the chat log is not happy.

grave ether
#

having similar issues what does your console say?

#
let rollFormula = '[3d6kh2]';

// Define the chat content
let chatString = `Rolling minor edge: ${rollFormula}`;

// Create a ChatMessage
ChatMessage.create({
  content: chatString,
});```
#

try that?

#

comma after chatstring?

static cargo
#

Ok, well, among other things console is telling me Update Foundry!! pls stand by.

formal goblet
formal goblet
formal goblet
static cargo
#

Foundry, systems, mods... all updated. Still not working out. should there be an await in there somewhere?

grave ether
#

Will pass the speaker through in the morning.

#

I threw your code against chatgpt and it spit out everything was fine but rewrote it

#

So not sure

#

Still dont know why my code is throwing errors but will figure it out. It is passing the variable through which is good

formal goblet
static cargo
#

For me, the most recent version of this character sheet label (button) has:

${rollformula = "[3d6kh2]";
chatstring = `rolling minor edge:{:rollformula:}`;
ChatMessage.create({
  speaker: ChatMessage.getSpeaker({token: actor}),
  content: chatstring});
}$
formal goblet
static cargo
#

Hmm... ok, Can I have a button on the sheet that sends an inline dice roll to the chat?

#

Console said that btw...

formal goblet
#
  • ${}$ -> CSB-Fornula
  • [] -> Roll-Formula
  • %{}% -> Javascript
#

You used the wrong delimiters

static cargo
#

... in the chatstring initialization?

static cargo
#

So... %{}% instead of ${}$

formal goblet
#

Yeah

static cargo
#

Broke before the foundry chat log got anything.

#

It feels like I should be seeing the issue here... (grumble, grumble)

formal goblet
static cargo
#

Is that syntax wrong?

formal goblet
static cargo
#

Yeah, ok, I don't retain well trying to book-learn, but this readme you mention is CSB, Foundry, Javascript? ... do you have a link for me?

static cargo
#

Yeah... 40 mins later all I know is that the readme I found got me more confused than when I started.

dusky mauve
#

How from macros I can access to the token item container and specific item?

jolly stone
#

I think the answer to this is no cause I'm not seeing it in the documentation, but I wanted to double check. Can you take information from a spreadsheet outside of Foundry VTT and import it to a table or dynamic table?

fierce harbor
jolly stone
#

Yeah, that's what I expected.

fierce harbor
latent sorrel
# jolly stone I think the answer to this is no cause I'm not seeing it in the documentation, b...

You can but you will need to write a macro to do so. I would probably export the spreadsheet as CSV and than paste that into a text field within the macro (because I am lazy and dont want to bother figuring out how to directly import a file). I have a macro that writes to a dynamic table and I can post it tonight, if you like. It wil get you half way there. Ping me in about 7 hours as I am at work now and will likely forget.

fierce harbor
jolly stone
plucky canyon
#

Is there a quick way to fetch range to target token?

static cargo
#

Oooh... I just asked that in Macro-Polo...

#
const distanceInUnits=canvas.grid.measureDistance(token,game.user.targets.first())

This is what they gave me.

plucky canyon
#

Ah, ok... so macro is needed. I'll look around some more.

#

I'm still fuzzy on how to return macro results into sheets or dialogue windows. 🙂

static cargo
plucky canyon
#

An actor making a ranged attack against another actor.

Came across this which works, but it seems like hexes are tricky since it's off by 1 now and then.

const target = Array.from(game.user.targets)[0]; // only uses the first target
if(!target) return ui.notifications.info("You have no target");
const distance = Math.ceil(canvas.grid.measureDistance(token, target)); //gets the distance between to tokens, rounded to 1 decimal place.
const content = `${token.name} is ${distance} units from ${target.name}`;
ChatMessage.create({content});```
#

Feels like there should be an easy way to get this info from Foundry since it's built into the core system.

static cargo
#

Mmmm... I'm sorry to say that my use of a hex grid in foundry is practically non-existent. Maybe if we look at it done up in js coloring something will pop.
```js
Code
```

if(!token) return ui.notifications.info("no token selected");
const target = Array.from(game.user.targets)[0]; // only uses the first target
if(!target) return ui.notifications.info("You have no target");
const distance = Math.ceil(canvas.grid.measureDistance(token, target)); //gets the distance between to tokens, rounded to 1 decimal place.
const content = `${token.name} is ${distance} units from ${target.name}`;
ChatMessage.create({content});
plucky canyon
#

Aha! I was wondering how to get code to look all nice like that. That's good to know. 🙂

static cargo
fierce harbor
plucky canyon
#

Yeah, sorry I put the ceiling in there as it first showed decimals, but didn't edit the comment.

I wonder if I should use something like "hexgrid" instead of just grid.

runic condor
#

Ok so I know CSB cant control the initiative in the encounter tracker directly and I have to use a macro. How would I make a macro that updates the initiative of selected tokens in the tracker using a specified value on the character sheet?

static cargo
runic condor
#

Every sheet has a value called "InitiativeCurrent" that Id like to send to the combat tracker, ideally trigger it with a roll message

plucky canyon
fierce harbor
scarlet skiff
static cargo
#

So, yeah, @plucky canyon, if you're using math.ceil for your rounding and the number is occasionally off by 1... try math.round instead.

runic condor
#

Anyone know how to make a macro that does that?

#

I just need it to set the initative in the combat tracker to a value from the selected tokens character sheet

static cargo
#

I haven't yet worked on interacting with the initiative tracker, but I would start by looking at this, perhaps the content of a number field could be referenced here like [:CalculatedInit:] (Colons inside are very important.)

runic condor
#

I didn't think to try that. Its grabbing the number that they rolled from the sheet now which is cool

#

Is there a way to trigger a roll message?

static cargo
#

Glad I could help as much as that, but I don't know about including a roll message, the game settings box does explicitly say "No ${}$s"

runic condor
#

Right now they roll from the sheet, it displays to chat, and then if they roll in the combat tracker it sets it to what they rolled last on the sheet.

grave ether
#

rolling int should be standard inside of Foundry

static cargo
#

Do you mind sharing that @runic condor ?

grave ether
#

That should be right, if you roll via combat tracker it rolls the int that is displayed in CSB like above

#

mine is set 2d10

runic condor
#

My initiave isnt a single roll is my problem, its a D6 that sorts you into a phase. 1-3 goes last, 4 goes in the middle and 5-6 goes first

#

So I have a really long roll message on the sheet that displays what they rolled and what phase that puts them in and then stores the phase as a variable.

grave ether
#

Ahh thats right, I forgot about your combat tracker development

#

I would suggest writing a macro for it

static cargo
#

Ok, sounds very specialty... 🙂

grave ether
#

Well

#

Your tracking is very special lol

runic condor
#

lol yea it seems overly complicated but I love how it plays out.

#

Enemy always goes at the same time so you're basically rolling to see how you do vs them and if you get to act before they do.

#

I think there is a way to trigger a roll message, I cant remember how

grave ether
#

I am looking lol

runic condor
#

/sheetroll

#

I found it

#

I wish I could put that in the initiative formula lol

#

or If I can idk how,

grave ether
#

does /sheetroll not work

icy panther
#

How do you show item values in a container?

runic condor
#

/sheetroll InitiativeRoll works if I type it in chat, but I cant put that as the initative formula it yells at me

grave ether
#

Can you make that a rollable field on your sheet

runic condor
#

wym

#

InitaitveRoll is the name of the label that has the roll message to display to chat and updates a variable on the sheet called InitiativeCurrent

#

If I set the formula to "InitiativeCurrent" it grabs that number but they have to roll from the sheet still

#

Itd be cool if they could roll from the tracker and it triggeres the roll on the sheet

#

How it is rn is pretty close though just grabbing that value is nice

grave ether
#

ok hold on, lets back up a moment because I dont understand.

I am trying to understand use case and here is my understanding.

You want to roll either via the combat tracker or by /sheetroll InitiativeRoll to use your custom value that is dice + other things correct?

runic condor
#

So right now, we've been ignoring the combat tracker bc my silly initiative system.

I have a button on the sheet that rolls and outputs to chat how you did on the initiative roll and stores that number in a hidden variable on the sheet.

My goal is that they could click the roll button in the combat tracker and it triggers the roll on the sheet. Right now all it does when they roll initiative through the tracker it grabs the number they rolled last time.

grave ether
#

ok what is the name of the button

runic condor
#

InitaitveRoll

grave ether
#

InitaitveRoll put that in the box by itself

runic condor
#

Alternatively, if when they hit InitaitveRoll , if combat tracker somehow knew that they rolled so it doesnt show the D20 symbol in the combat tracker

grave ether
#

I cant help the d20 symbol but if your looking to use that button as your trigger to roll then you need to call it via the InitaitveRoll inside your initiative formula

#

example

runic condor
grave ether
#

ok what is the button doing?

#

I am assuming its calling other values?

#

example STR+STR+DEX+DEX

#

that will add all those values up to output a number

runic condor
#

So the button the press is InitiativeRoll, and it has this ass the roll message:

`Initiative:
${#r1:=[1d6]}$ ${#r2:=(ImprovedInitiative? [1d6] : [0])}$
${r3:=max(r1,r2)}$ =
<hr>
<div style='text-align: center; font-size: 1.2em;'>
${min(r1,r2) >= 5 ? "<span style='color: darkblue;'>Crit Success</span>" :
r3 <= 3 ? "<span style='color: darkred;'>Failed</span>" :
r3 == 4 ? "<span style='color: darkgreen;'>Standard</span>" :
r3 >= 5 ? "<span style='color: darkgreen;'>Success</span>" :
""}$
</div>

${#setPropertyInEntity('self', 'InitiativeCurrent',
min(r1,r2) >= 5 ? "6" :
r3 <= 3 ? "1" :
r3 == 4 ? "3" :
r3 >= 5 ? "5" :
""
)}$
`

grave ether
#

hmmm

runic condor
#

Basically it rolls a D6, and checks if you rolled a 1-3, a 4 or 5-6
Then it sets a hidden variable "InitiativeCurrent" based on that result.
And it outputs to chat if your roll was "Failed, Standard, Success, or Crit Success"

grave ether
#

thinking through this give me a moment

runic condor
#

That last bit is in there twice and doesnt need to be, fixed

#

Theres an improved initative feat that lets you roll 2D6 and take the better. And if you roll both as a 5 or 6 you get bonuses to your actions on your turn

#

Thats what that first ternary is at the begining

grave ether
#

OK So, I dont think you can call a macro from the init or through the roller without actually modifying what it does

#

can it be done, I am sure it can with someone that is smarter than I

runic condor
#

Lol well thank you for checking. Im happy with it just fetching the number after they roll from the sheet, easy enough for me to click "roll all"

grave ether
#

ACTUALLY!

#

but [] around it

#

see if that works

runic condor
#

Uncaught (in promise) Error: Unresolved StringTerm InitiativeRoll requested for evaluation

grave ether
#

dang

#

It works for calling a macro

#

[%{return await game.macros.getName('rolling').execute({ replaceMe: ${Target_Number}$});}% %{throw "Done";}%]

runic condor
#

So if I made a chat macro that was /sheetroll InitiativeRoll ?

grave ether
#

That works

#

output would need to be adjusted to output a reult that matches the init but...

#

putting roll InitiativeRoll in the box works fine but this is a button right

runic condor
#

So If I had a macro that did /sheetroll InitiativeRoll
And then fetched "InitiativeCurrent", could it put that in the initiative track?

#

Yea If I put InitiativeRoll in it gets mad at me. If I put the variable in that it updates after rolling, it sets the initative to that

grave ether
#

yeah

#

give me a second

#

see pm

plucky canyon
#

Figured out how to measure range with hexes. Apparently distanceS and counting actual gridSpaces is the key:

const ray = new Ray(token, game.user.targets.first());
const target = (token, game.user.targets.first());
const segments = [{ray}];
const dist = canvas.grid.measureDistances(segments, {gridSpaces:true})[0]    
ui.notifications.info(`${token.name} is ${dist} hexes from ${target.name}`)```
pale tusk
#

Does anyone know if it's safe to update to the lateast Foundry build for CSB?

grave ether
#

Updated fine without errors on myside

pale tusk
#

Good deal

latent sorrel
# jolly stone Yeah, that sounds way easier. I'd appreciate you sharing it. I'll try to remembe...

Here is (the important parts of) the code I use to add to a dynamic journal. This is designed to place that entry at the top of the list. For CSV, grab the contents of the text box (maybe use CSS to make it multiline /w scroll), split each line to an array and then reference each element in the JSON. @fierce harbor

// create table entry
updatedJournal = addNewRecord(message, xpSpent*-1,stat,stat,itemType);
//update journal
await actor.update({ "system.props.xpjournal5": updatedJournal });
// Function to add a new record at position 0 and renumber <var> sequentially
async function addNewRecord(message, xpSpent,itemName,itemID,itemType) {
    // Find the highest value of "sn"
    let highestSN = -1;
    for (const key in xpjournal) {
        if (Number(xpjournal[key].sn) > highestSN) highestSN = Number(xpjournal[key].sn);
    }

    // Insert a new record at the beginning with key "0"
    const newRecord = {
        "objectName": itemName,
        "itemID": itemID,
        "deleted": false,
        "predefinedIdx": null,
        "message": message,
        "xpSpent": xpSpent,
        "itemIncreased": itemType,
        "deleteXPentry": "Delete"
    };

    // Create a new JSON object with updated keys
    const updatedJSON = {};
    updatedJSON["0"] = newRecord;

    // Renumber subsequent records
    let index = 1;
    for (const key in xpjournal) {
        if (xpjournal.hasOwnProperty(key)) {
            updatedJSON[index.toString()] = xpjournal[key];
            index++;
            xpjournal[key].sn = index;
        }
    }

   return updatedJSON;
}
latent sorrel
#

I have button that calls a macro which displays a dialog box. The "undefined" chat message appears along with the dialog (which eventually generates a chat message). Throwing an error doesnt seem to work nor any attempt to delete the chat message via JS except via a "hook on chatmessage" in world script module and that only deletes previous undefines, not the current one. Any suggestions on how to suppress this? Thanks

jolly stone
#

I don't understand how to get item containers to work. I can't get anything to show up in them

grave ether
#

@latent sorrel add this at the end of the call %{throw "Done";}% - My understanding is its an error that is being worked on

#

@jolly stone - Item containers require items to be created and dragged into the container.. IE make a torch and then drag it from the compendium into the container. The containers can be setup to hold different things..

#

think of containers not as just inventory but also races, classes, ect

latent sorrel
grave ether
#

populating as undefined is not an error?

formal goblet
#

No, because your return of the Script is undefined. And CSB will always create a Chat Message on its own

grave ether
#

hmm ok, sorry to say Lyinggod thats the extent of my coding knowledge to assist

plucky canyon
#

Messing aroudn with itemTemplates. Just making soeething very basic at first to try it out, with player inputing mods and the template adding up those mods. However, it doesn't add up anything when referencing the relevant keys. What am I missing (tried item.<key>)?

latent sorrel
#

Using JS, how can I reference a calculated label from within a macro? This is for my initiative formula so I think I need to retrieve all relevant data based on the actor id from the tracker object which I can do up to getting the calculated label.

static cargo
#

This is just a guess, but [:CalcLabel:]?

latent sorrel
plucky canyon
formal goblet
latent sorrel
formal goblet
plucky canyon
#

Aha...

formal goblet
static cargo
#

Is it just me or (myself included) is there a lot of begging for interacting with the CT lately?

latent sorrel
# formal goblet Should still be doable I think

Do you have a suggestion as to how? I dont know what field to reference since it is calculated and not static (ie system.props).
If the actor sheet had label of component name brawn with a calculation, how do access the calculated value via a macro?

latent sorrel
plucky canyon
#

Hmm... how about regular user input? Can that have calculations?

runic condor
#

Having a hard time with setPropertyInEntity() on a checkbox.

#

none of the examples have a checkbox in the documentation

#

its seems to only be able to check the box but not uncheck it

static cargo
#

How are you trying to unset it? ... what value is being passed?

runic condor
#

oh nevermind I was sending false but if you send 0 it works

static cargo
#

There you go. Good job.

runic condor
#

Lol thanks

static cargo
runic condor
#

I tried all false, 'false', and "false". all of those check the box lol

#

I think if it gets any value other than 0 it gets checked

static cargo
#
let x = false;
let y = 'false';
let z = "false";

Do you notice how x's false is colored differently? That's the keyword false and means the same as 0 and (1 > 1).

formal goblet
static cargo
#

y and z's false's are strings, strings have meanings, something that has a meaning == true

latent sorrel
#

I have a initiative formula macro which calls a dialog for user input. To pause the initative roll to wait for the dialog, I have let myDialog = Dialog.wait() which seems to work (except the "character rolls initiative" chat message appears at the same time as the dialog), except it throws the following console error. Is this is a bug or something I need to correct?

runic condor
#

How do you get the total number of items in an item container? I have a counter value on items I could use to sum but IDK how to grab it

runic condor
#

Ok I see the FAQ for that, im still confused as to where to put what info

#

Oh no. Are Item Modifiers not part of a template?

#

Oh ok it does carry item modifiers from templates. Man that FAQ would really be helped by some picutres lol

jolly stone
#

So, I'm a little confused on how to fetchFromActor to use a piece from that in a macro. For example, I'd like for players to be able to click on the macro and roll 3d6 + their accuracy modifier (we'll call it 'Mod' here for the sake of ease). How do I indicate that I want it to use the player's character sheet to pull 'Mod' from and get the value of that key from there?

fierce harbor
jolly stone
fierce harbor
jolly stone
fierce harbor
fierce harbor
# jolly stone I did see that in the documentation. Would that be where they just need to click...

This code gives you an idea of how to access the actor:

`//Is a token selected? If not, error
if(canvas.tokens.controlled.length == 0 || canvas.tokens.controlled.length > 1){
ui.notifications.error("Please select a single token");
return;
}
let actor = canvas.tokens.controlled[0].actor

//Does the token have a torch? Otherwise error
let torch = actor.items.find(item => item.data.name == "Torch")
if(torch == null || torch == undefined){
    ui.notifications.error("You don't have a torch in your inventory!");
    return;
}`
jolly stone
fierce harbor
jolly stone
#

Oh, there's a sheetRoll option. I didn't remember that being a thing, but that's good to know.

jolly stone
#

Are players supposed to be able to put their own tokens on the board? The ones in the game I'm running aren't able to, so I'm wondering if I have a setting wrong?

fierce harbor
formal goblet
formal goblet
lyric swan
glad spade
#

I am, but not had a breakthrough yet. Traversing the template item structure is... inconsitent. No real way to get the props of template items to verify whether it has a certain property

plucky canyon
#

I'm close to get my roll dialogue and result working as intended. I'd just like the modifiers in the final line to multiply by 0 if the silroll macro returns 0 (which happens if all dice come up 1). I could do it by feeding them all as arguments into the macro, but I'd prefer to keep them outside to more clearly show the roll in chatt.

${#concat(?{speed:"Speed Modifier:"[number]|0}},
{?{obscurement:"Obscurement Penalty:"[number]|0},
{?{accuracy:"Weapon Accuracy:"[text]|inf_weapon_acc_actual},
{?{range:"Range:"[number]|(%{return await game.macros.getName('get_range2').execute({short: ${inf_weapon_range_short_actual}$, medium: ${inf_weapon_range_medium_actual}$, long: ${inf_weapon_range_long_actual}$, ex: ${inf_weapon_range_extreme_actual}$})}%)})}$
${
%{return await game.macros.getName('silroll').execute({amount: '${inf_skill_actual}$', mods: '${inf_skill_mod_actual}$'})}% + inf_weapon_acc_actual + speed + obscurement + range
}$```

I tried using Roll:= to save the silroll result and reuse it in a conditional, but that didn't work. Tried simply going `<returned silroll result>  > 0 ? (+ inf_weapon_acc_actual + speed + obscurement + range) : 0`, but of course that doesn't work as the actual roll gets discarded. Feels like I need a way to save the roll.
formal goblet
glad spade
# formal goblet Wouldn´t it be something like this? ```js game.items .filter((item) => item.is...

That seems to give me the correct templates, indeed! My current implementation looked akin to this...

function hasTemplateItemQuantity(templateItemContents) {
    if (Array.isArray(templateItemContents)) {
        return templateItemContents.some(subElem => hasTemplateItemQuantity(subElem));
    }
    return (templateItemContents?.key && game.itempiles.API.ITEM_QUANTITY_ATTRIBUTE.endsWith("." + templateItemContents.key))
        || (templateItemContents?.contents ?? []).some(subElem => hasTemplateItemQuantity(subElem));
}

export function getItemTypesThatCanStack() {
    if (!itemTypesWithQuantities) {

        itemTypesWithQuantities = new Set();

        if (game.system.id === "custom-system-builder") {
            const itemTemplates = game.items
                .filter(item => item?.templateSystem?.isTemplate)
                .filter(item => hasTemplateItemQuantity(item.system.body.contents));
            for (const item of itemTemplates) {
                itemTypesWithQuantities.add(item.name);
            }
        }
        ...
#

I had no idea about getKeys on the template object, thanks!

blazing ibex
#

where is the best place to post about bugs, here or gitlab?

static cargo
#

Hey guys, can someone give me a fresh pov on this?

const pogs = %{fetchFromDynamicTable('pogTable', 'pogFilename')}%;
const src = token.document.texture.src === pogs[0] ? pogs[1] : pogs[0];
AudioHelper.play({
    src: "C:\VTT Assets\Foundry\Data\Sounds\TF\conversion-grind-LR.mp3", 
    volume: 0.8, 
    autoplay: true, 
    loop: false}, 
  true);
return token.document.update({"texture.src": src});

Console says "SyntaxError: Unexpected token '%'..."

#

If I remove the %{}% delimiter the error becomes "fetchFrom... is not defined"

past ivy
#

where is that located? in a script or on the sheet?

static cargo
#

It's a macro on the bar.

#

The actor pog is selected... but that's probably not enough, eh?

fierce harbor
static cargo
#

Right.

fierce harbor
#

You do not need %{}% in the macro, only in label roll messages.

static cargo
#

It's a Transformers RPG, and so 90%+ of the pogs can go to an alt mode.

#

so would the function then be called by:
selected.actor.fetchFromDynamic.....

fierce harbor
#

I think you cannot use that function in a macro, unless you create the function string and you put it in a label roll message via macro.
At least this is what I've found so far.
I'll look further into it and let you know.

static cargo
#

I would still very much like to use one macro for any & all Transformers... but I've got a good Band-Aid for now... Copying the macro 800 times and hard-coding the image path/filename's.

fierce harbor
static cargo
fierce harbor
static cargo
#

The character sheet has a tabbed panel called GM (Visibility is for Assistant GM and up). The Dynamic Table is in there and the Path/Filenames are listed, one per row.

The controlling user highlights the token and runs the macro. if the existing name is for the Bot Mode, the token.document.texture.src becomes the Alt Mode, and vice-versa.

#

btw: this is what one of the Band-Aids looks like...

const pogPath = "Tokens/_TFOR/_Bots/Shinobi/";
let pogs = ["shinobi", "Shinobi-Alt-2"];

let pogBot = pogPath + pogs[0] + "-min.png";
let pogAlt = pogPath + pogs[1] + "-min.png";

const src = token.document.texture.src === pogBot ? pogAlt : pogBot;
AudioHelper.play({
    src: "Sounds/TF/conversion-grind-LR.mp3", 
    volume: 0.8, 
    autoplay: true, 
    loop: false}, 
  true);
return token.document.update({"texture.src": src});
#

I have the Tokens folder, then the Campaign folder and then Faction... After Faction comes the PC name as another folder, and lastly the actual image name.

fierce harbor
#

So if the pog is in Bot state, it goes into Alt state and vice-versa. And from what I read each bot-mode has a corresponding alt-mode, correct? Or can this be a n-to-m relation?

static cargo
#

Nearly all Cybertronians are limited to a single Alt, but then there are 'Triple-Changers' which need special handling anyway.

#

Being conservative, the ratio of single-alts to multiples is at least 50:1

fierce harbor
static cargo
#

Hmmm.... wait a minute.... The Selected Character Name... a macro can dig that up.... If I build pogBot and pogAlt around the selected name.... I just need to be sure the paths in the file structre line up.

fierce harbor
static cargo
#

Hehe... esp for 1:30am. 🙂 👏

lyric swan
#

Hi guys, my players can edit item modifiers with the "configure item modifiers" in the item sheet, is that normal? I can't find a way to prevent that.

vagrant hollow
#

Yes, that is normal for modifiers set in the item itself.
If you set modifiers in the item-template they can not reach them.

timid glade
#

Is there a way that I can have items go into an item table, but then some of the information of that item appear in like a weapon's tab automatically where it can be rolled on?

formal goblet
rustic void
#

Is something like this possible ${Roll:=[:item.dmg_arme+dmg_supp:d6x:explosion:]}$
Or I'm just trying to make the impossible ? ^^

#

I know the :item.dmg_arme+dmg_supp:d6 work. I just want to know if I can use a variable for the explosion part

#

and to add difficulty, I'm doing this in an item container 😄 ( I'm suspecting it don't work because of this )

formal goblet
rustic void
#

I managed to do it with a roundabout way.
My problems come from ignoring how to use a variable created in an item container ^^
So I stored all the formula in the item template and just use the label :3

dense pine
#

Inside an item i have an empty number field. With a label next to it i would like to start a label roll message to roll a d6 and store the result of this roll in my number field. The number field has the key "result" What would be the Label roll message please?

formal goblet
static cargo
#

Hey guys, I had an issue about 9h ago involving getting info from a Character Sheet Dynamic Table into a Foundry Macro. By accepting certain limitations I have a band-aid solution, but I'd love to make this happen instead...

#

The ultimate goal is one macro that goes on the button bar that I or my players can use to "transform" all selected pogs under the users control... with the freedom to have dynamic choices for image path/filename.

grave ether
#

Question,

Use case: Players have a skill list that they can populate themselves with variable skill names. The table is created as a dynamic table because the calculation for each line is the same but references the skill name as a reference. I habe broken the table apart into entries vs calculations since I can not hide the calculation fields from the players onto another dynamic table.

So the question looms, is there a way for me to populate the second calculation table with names from the first when they add a row and it be filled/changed in as we go?

If not is there away for everytime a field is added it adds a number to a field.. ie 1,2,3,4,5,6,7, ect...

-- Found a work around, seems like hiding does work for players so thats a plus but would still like to know the above.

sage wave
#

Is there a way within a character sheet to get it to recognize variable that are in different tabs of a tabbed panel?

formal goblet
formal goblet
sage wave
formal goblet
static cargo
#

Thanks @formal goblet, I knew it had to be possible. thxblob

formal goblet
#

Or you log the game-object and literally see everything.

sage wave
#

Hello, I'm trying to make a formula that sees a number then prints a corresponding test phrase. In this case -1 weak, 0 is neutral, 1 is resist. How would I go about doing that?

static cargo
#

Anyone still up?... 👀

static cargo
#

Need a little help with a Macro that's not quite hitting the mark. I'm starting with "A", I want "B", but I end up with "C".

fierce harbor
static cargo
#

The Macro looks like this:

AudioHelper.play({
    src: "Sounds/TF/conversion-grind-LR.mp3", 
    volume: 0.8, 
    autoplay: true, 
    loop: false}, 
  true);
// Sound plays just once, then change images.
for(const token of canvas.tokens.controlled) {
  let pogImgs = actor.system.props.pogTable;

  let pogBot = pogImgs[0].pogFilename;
  let pogAlt = pogImgs[1].pogFilename;

  let src = token.document.texture.src === pogBot ?
                pogAlt : pogBot;
  token.document.update({"texture.src": src});
}
return true;
fierce harbor
static cargo
#

pogFilename is from a Dynamic Table in each individual actor sheet. And they are distinct from each other.

#

In fact, this is flawless if only one token is selected...

#

(Fun fact: even after the multi-select screws it all up, single selected macro runs undoes the damage.)

#

Haha!!! Solved it!
let pogImgs = actor.system... edited to
let pogImgs = token.actor.system... because for loop focus.

#

Thanks for listening. I'm not sure I'd have seen that if I wasn't trying to explain to someone else. 🙂

fierce harbor
static cargo
#

46 test versions can finally make way for v.1.0

fierce harbor
static cargo
#

I was really, really hoping not to hit the infamous Star Trek Number of fails. 🖖

static cargo
#

Ok, new stumbling block: is it possible to select the next dropdown list item because a checkbox is ticked?

formal goblet
plucky canyon
#

Hmmm... why isn't this value modifier working? both keys are simple labels with value 1. It works when I used = operator, but not +.

formal goblet
plucky canyon
#

No errors. Target label(s) look like this:

fierce harbor
plucky canyon
#

Tried it, no change. Very weird.

fierce harbor
plucky canyon
#

Yeah, no difference

fierce harbor
#

Oh well, this is weird...
Only other thing that comes to mind is removing the spaces from the formula 🤷🏻‍♂️

formal goblet
#

Is your group-field empty?

#

Otherwise change 0 to 2 in the else-part to see if your condition is evaluated correctly

plucky canyon
#

Yes, group-field is empty. When else is 2 it actually adds it, so it seems to be working backwards...

plucky canyon
#

Seems like else fires no matter what I put before it.

formal goblet
#

crew_test is the key of the item?

plucky canyon
#

Yes

formal goblet
plucky canyon
#

No, sorry action_test is what I want to modify, if crew_test is over 0.

dense pine
#

I have an item template with lots of number fields. i would like these fields to changes the background to a predefined color when the number entered is != 0 in an item. Is this doable with CSS?

formal goblet
runic condor
#

question about actor.roll

#

actor.roll(rollCode: InitiativeRoll, [{ postMessage: true }])

#

is this typed right or am I not reading the wiki correctly?

formal goblet
runic condor
#

its in the csb yea

#

its the macro version of /sheetroll that Im trying to use

formal goblet
#

I actually forgot about that thing 🤣

#

Chances are high that it moved to the templateSystem instead of being in the Actor-class

runic condor
#

ok so if I copy the button as a macro it gave me this:
`let rollMessage = await actor.roll(
'InitiativeRoll',
{ postMessage: false}
);

let speakerData = ChatMessage.getSpeaker({
actor: actor,
token: actor.getActiveTokens()?.[0]?.document,
scene: game.scenes.current
});

rollMessage.postMessage({speaker: speakerData});`

#

I want to add one line that grabs a value from the sheet and sends it to the initiative tracker

#

but idk how to do that

#

that or have it trigger the initaitve roll and then I set the initative formula as the variable.

grave ether
#

Can someone help me a moment,

Use case: I got a dropdown list that list MG1 -MG15, G1-G15, and blank.

${max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', switchCase(sameRow('General_Skills'),'G1', 'G1', 'G2', 'G2','G3', 'G3', 'G4', 'G4','G5', 'G5', 'G6', 'G6','G7', 'G7', 'G8', 'G8','G9', 'G9', 'G10', 'G10')))}

and

${max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', sameRow('General_Skills')))}$

These 2 do the same thing but basicly it matches the G1s and pulls highest value. The issue I have is that blanks and - cause errors and I would like them to be validated as 0, same with MG.

I attempted to do a If else statement but for some reason I cant get it to compute..

examples
${equalText(sameRow('General_Skills') = "-" ? 'yes' : 'no'}$

If anyone can think of something I didnt please let me know

#

end of the day, I need a way to filter the blanks and MG~ (does ~ work) to = 0 but for the life of me its being stuborn

fierce harbor
grave ether
#

Sure, happy to try that

#

I suspect that because blanks are text its causing the issue since its trying to find values of Max, thats my guess tho

grave ether
#

so wouldnt I technically, have to put the switch case first,, ie switchCase( ' ' || 'MG~' , 'MG~', 0, ' ', 0,)

#

something like that?

#

I feel like I am missing something in that equation

#

Hell, I would use switchCase(DropdownKey, 'a', 1) but its not registering my drop key..

#

I feel like a If statement would be better, {fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', sameRow('General_Skills')) === ' ' || 'MG~' ? "0" : max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', sameRow('General_Skills')))}$

#

It states if the table = blank or MG[number] ? Yes : no

fierce harbor
grave ether
#

Just talking it through helps sometimes so would like feedback lol

formal goblet
#

equalText() is the magic word you're seeking

grave ether
#

I tried that as well but didnt compute either, but will try it again lol

#

Does the ~ and || statements work?

formal goblet
#

~ doesn't exist and the equivalent for || is or

grave ether
#

Compares each filterColumn with the filterValue by this operator. Default comparison is ===.
You can use every comparisonOperator described in Conditions together with ===, !== and ~.

#

Saw it available so thought I would ask

formal goblet
#

That's only for this function and just tells, that it should be interpreted as a Regex

grave ether
#

now I gotta learn what an Regex is, thought it was a number at the end counting.. ie M1 M2 M3 ... instead using M~ would capture all ... ok no worries there I will figure that piece out

#

equalText didnt do it either

grave ether
#

What is the command to run in the console to see if it resolves?

formal goblet
grave ether
#

Thanks because running just {'-' === '-' ? 'Yes' : 'No'} resolves in the console but doesnt on the sheet

grave ether
#

Yep, I saw that but the equalText wasnt resolving either

#

so I was confused

formal goblet
#

I think your issues lie within fetchFromDynamicTable() and max()

grave ether
#

I might be dumb, I was still using the =, staring at this for hours just bashing it to get it to compute broke stuff

#

Oh I agree with you Martin

#

${max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', sameRow('General_Skills')))}$ < -- computes fine, but it returns a number, what I suspect I need to do is say if General_Skill is -, assign it a 0 value upon return

formal goblet
#

That 0 gets passed to fetchFromDynamicTable(). If it doesn't find a value with 0, it will return an empty array.

grave ether
#

Correct

formal goblet
#

Empty array might clash with max()

#

Btw, what was the error in the console?

grave ether
#

${max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', sameRow('General_Skills')))}$

Max(table, skill(array 1,2,3,4,5,6), location, filter) = returns 6 becauses thats the highest

#

Thats how its written and works as intended. I need to it to pass a 0 to several of those values in filter to still return a max of 0

#

Issue is, blank doesnt carry a value, and - while it matches doesnt return anything either

#

even if I have multple - with skill ranks

#

if I could pass a value of null = 0 that would solve for both I think

#

hence is why I was going to go with the if and statements, but that doenst work either lol

formal goblet
#

Wait, you are misunderstanding the fetch-function a bit. To explain it in plain words: "Get all values from the column Skill_Rank in the table PCF_Table where General_Skills equals whatever you are comparing with."

grave ether
#

Correct

#

thats what I am doing

#

Get everything in Skill_Rank and provide me with the highest value

#

${max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', sameRow('General_Skills')))}$
${max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', switchCase(sameRow('General_Skills'),'G1', 'G1', 'G2', 'G2','G3', 'G3', 'G4', 'G4','G5', 'G5', 'G6', 'G6','G7', 'G7', 'G8', 'G8','G9', 'G9', 'G10', 'G10')))}$

Both of those are doing the same

formal goblet
#

Well, the one with the switchCase is completely useless

grave ether
#

I figured giving you a picture will help understand

#

Group skills take the highest skill rank that is produced on Test on the right

#

So if I have 17 G1s and the highest is 9 it will return 9

formal goblet
#

How did you even get multiple numbers under 1 column?

grave ether
#

Yes, if I remove the max it will return the array

#

Sorry, typing and talking lol

formal goblet
#

That one is correct. We need something like if empty array return 0 otherwise return the max

grave ether
#

Yes

#

Thats what I need

#

How do I do that

formal goblet
#

Wow, you need a Script 🤣

grave ether
#

ugh

#

Nooooo

#

Array just FYI

#

I am not the greatest at scripts so it would take me a bit longer to write lol

formal goblet
#
%{
const skillRanks = '${fetchFrom...}$'.split(',');
if (skillRanks.isEmpty()) {
  return 0;
}
return Math.max(skillRank);
}%
grave ether
#

TY Sir

#

I will see if I can get this implamented

grave ether
#

You can run scripts on a lable right?

bright berry
#

So I'm digging into doing coding stuff in this system, but I have next to no coding experience at all. If I had a good idea of what I wanted a thing to do and could describe it decently, could I be pointed to examples of what I'm trying to do or get help with it? This is dangerous close to "asking to ask" so I'll specify by saying I'm looking to have the sheet I made roll a die and checking it against a given number, with success and fail states for that roll

#

I want to say simple, but you never know with this kind of thing

grave ether
#

Have you looked at the example sheet?

#

What your asking for is already built in there

#

for the most part, unless its custom then it may require a macro to script things out

bright berry
#

I... May have missed that there's an example sheet

bright berry
#

that makes a lot of sense, yeah. I have the Fabula Ultima sheet in my game which I was using as an example, but couldn't quite figure it out

#

Part of the problem is I don't understand the variables being used in the syntax, I think. Gotta read over the documentation

grave ether
#

Start with the Example sheet first, then look at what you want to do and either gut or make your own

bright berry
#

Gotcha. Thanks!

grave ether
#

Both are good resources to start

#

the formula System uses ${}$

#

calling values are fairly straight forward, name the value, garbageCan and pull ${garbageCan}$ <-- in lable field will return whatever you made that value to be

#

Values and return

#

anything is red is in the roll field

#

I use the roll field as a place holder to validate after I am done with a formula

#

So ignore all my red lol

#

Happy to help where I can but I am no expert and rely on others for help when it requires scripting

bright berry
#

Wow

#

lol

#

I'll take a look!

grave ether
#

🙂

bright berry
#

completely unrelated to the above about scripting: is it possible to change the styling of a number field, or text field?

grave ether
#

I know that there is a way but I couldnt tell you how

bright berry
#

The sections for those in the documentation only speak about what they do, not whether that's possible. I do see some notes about bringing in your own CSS styling, but I'm not sure if it extends to those

#

Ah, okay

grave ether
#

I was looking to see if there was something in the config

#

It might be in the CSS file section tho

#

or additional Fonts

bright berry
#

Right

#

I'll check that after

#

Totally not procrastinating on, you know, actually prepping my upcoming game by focusing on making this sheet. No sir, not at all

grave ether
#

lol

#

I been taking a part a Excel file and putting it into foundry

#

A LOT of formulas to sift through

#

convert and rework

#

I am almost done tho

bright berry
#

That's where I'm comfortable actually! I made a pretty snazzy sheet once for a PbtA game in google sheets

#

So like, I'm sure I can figure Foundry out. I'm just not familiar with it

grave ether
#

Yeah, I am too but because this game relies on a Success Level value and skills that are not out of the box (ie anything is a skill) it was too much to deal with

#

I wanted to make it easier for the player

bright berry
#

Ah, yeah

grave ether
#

Foundry is fun 🙂

bright berry
#

I'm pretty proud of myself already for what I've managed with this system. It's really cool

#

pulls up example sheet, is immediately stumped by how it's doing something

#

How the heck is clicking this red d20 icon pulling up a popup window with buttons in it, what the heck

grave ether
#

Your in the template

#

suggest making a test character

bright berry
#

I did

grave ether
#

view from the test character and the go from there

#

in the default version of the roller there is a modifer added in

#

you can remove that

bright berry
#

This little dooder here opens the dialog window

grave ether
#

Yep

#

If you look at the rolling fuction in the GM(editor) you will notice in the rolling section there is a modifer verbage and some coding..

#
<td>${?{Modifier[number]|0}}$</td>
</tr>
<tr>
<td><strong>Result</strong></td>
<td><strong>${Roll + Modifier}$</strong>```
#

Its also on the wiki

#

My suggestion if your starting out

#

Create you a compendium, pull a copy of the _template in there that hasnt been touched, dup and change the name of the template to _gamename V.0 or whatever

#

that way if you mess up you can always go back

#

Save often

#

keep backups often

bright berry
#

oh yeah, definitely

#

Oh, wait

#

${#?{Dice_Modifier:'Skill Check Modifier'[number]|0}}$

grave ether
#

yep

bright berry
#

Dice Modifier isn't calling something from the sheet is it, that's just a thing the system can do

#

I see

grave ether
#

correct

bright berry
#

Okay, cool

#

I was scrolling through the <table> stuff trying to find how the dialog box was built, so this makes sense. Cool cool

grave ether
#

gotta jet but if you need help let me know, I am happy to look at something for ya

bright berry
#

sure thing, thanks again

grave ether
#

ended up doing this

(equalText(sameRow('General_Skills'),  'MG12')) ? '0' : (equalText(sameRow('General_Skills'),  'MG15')) ? '0' : (equalText(sameRow('General_Skills'),  'MG14')) ? '0' : (equalText(sameRow('General_Skills'),  'MG3')) ? '0' : (equalText(sameRow('General_Skills'),  '-')) ? '0' : (max(fetchFromDynamicTable('PCF_Table', 'Skill_Rank','General_Skills', sameRow('General_Skills'))))}$```
grave ether
#

Is there a way to to reference the column kinda like sameRow but down lol

#

was trying to get rid of the PCF_Table name since its referencing the inside the table

formal goblet
formal goblet
formal goblet
grave ether
#

Is there anyway to use truncate?

formal goblet
#

You have access to Javascript, so yeah

grave ether
#

Lol was talking about through the csb but i get it

formal goblet
#

CSB has only access to functions mentioned in the Readme and in math.js (excluding loops and functions with lambdas).

grave ether
#

I am getting failing calculations within my sheet that werent there before

#
    at M (math.js:6437:59)
    at Function.oe (math.js:6725:51)
    at Function.addScalar (math.js:6740:54)
    at Function.oe (math.js:6724:82)
    at add (math.js:6740:54)
    at math.js:25781:48
    at Object.evaluate (math.js:24162:45)
    at r.evaluate (math.js:24139:55)
    at Formula.computeStatic (Formula.js:858:27)
    at Formula.compute (Formula.js:442:21) {formula: 'PSD + pcf/10', props: {…}}
#

I can make a change to any field and refresh and it will populate correctly then error out on the next open

formal goblet
grave ether
#

There both definded unless something happened and was dropped

#

let me review, searching through the Json now

#

pcf is defined

#

PSD is defined

#

I am also noticing in the json everything deleted or changed still gets noted, is there a way to clean that up? IDK if memory for the scaler is an issue

formal goblet
grave ether
#

Populates fine after I update a field

#

but then I refresh again, it goes back to errors

formal goblet
#

Do you use setPropertyInEntity() in a Label text (not Label Roll Message) somewhere?

grave ether
#

Not at this moment

formal goblet
#

Not recommendable anyway

grave ether
#

gotcha

#

Yeah only thing I was going to do is break down the containers allowing races to modify things as well as weapons and what not

#

I dont know if that will cause issues but thats a issue for later Dragius

#

right now, I cant continue forward until I resolve what this issue is

#

I got a lot more calculations to do

formal goblet
#

You can validate your values with the Label prefix in the target-Label. Just do ${componentKey}$ and see if it is present after a reload.

#

Otherwise you can also check your props in the error message.

grave ether
#

I get this also

#

IDK if it references anything

formal goblet
#

That's irrelevant. You only have to look for errors and uncomputed-props-warnings

grave ether
#

Outside of it being a lot of calculations, there shouldnt be anything weird

lyric swan
#

Hi guys, trying to get my head around item pile with CSB. Everything seems to work, except for quantity related features. Is it a compatibility thing or am I doing something wrong (I know that this module is not natively supported yet so i'm not sure).

vagrant hollow
lyric swan
#

I saw a few days ago that wasp was working on compatibility between CSB and item pile so maybe that's what he was talking about.

#

So it's not me doing something wrong, that's what I wanted to know so thanks 😘

marsh totem
#

Hey, I never used/tried csb , but I was wondering if it was working with the Currencies brought by monks enhanched Journals ?

grave ether
#

I dont have a answer for you but I would suggest trying it out

errant sapphire
#

Hey, I'm back with another weird question. This one seems like it might've been tried before, but I couldn't find exactly what I was looking for by searching this chat so sorry if this is a repeat.

Is is at all possible to define a custom part of a roll message with a formula in an item itself? As a simple example, I have a rollable label in my character sheet's item container which puts out a message. This message is

${!item.use_text}$```
where `item.use_text` is a short string defined as `Dealing ${([1d10] + STR)}$ damage.`. As you can probably expect, I have no trouble retreiving the string, but I'd really like to have it actually execute that roll instead of pasting it as text. The ideal final message would be something like:
```Used [Bomb].
Dealing [(rolled number)] damage.``` Of course, the benefit of this is that I could have a custom part of every item's usage message that contains that item's unique damage number/formula
#

I tried using recalculate in various places (recalculating the item.use_text call, recalculating the actual roll formula itself, both), keeping in mind the quirks that that function likes to have, but I either get it to print the message normally or it throws an error that stops it from printing a message at all

ornate junco
#

Hi. I just started using CSB after I was told sandbox is no longer being actively developed. Any tips or tricks? I am trying to get my sheet built before my next session with my players and this seems like so much more compared to sandbox.

errant sapphire
# ornate junco Hi. I just started using CSB after I was told sandbox is no longer being activel...

I don't have any experience with sandbox whatsoever, but taking a quick look at it it looks like everything you know is here just with a slightly different look. Some very light coding experience will likely be useful to you (mainly just understanding the basics of syntax), but nothing heavy if you're not doing anything too weird. I imagine you've been to this page if you've made it here, but I'd make this a permanent resident of your browser tabs: https://gitlab.com/custom-system-builder/custom-system-builder/. It's pretty comprehensive about what everything does with pretty good examples of how to do it.

#

Also when you're starting out, keep ref(' on your clipboard lol. Any time you need to have something check the value of something else, you've gotta use ref. Minor trick there, always include a fallback value if possible (ie, don't just ref('strength'), do ref('strength', 0)). Pages will try to skip calculating things they don't think they need, but in my experience, they're really not perfect at guessing what is or isn't a useful value.

#

More a best practices thing than anything else, but it's a tip I wish I could've given myself when I started using CSB

ornate junco
#

Do you know if there any custom css sheets out there that I can just look at? That aren't the export and import ones.

latent sorrel
#

Consider the Custom CSS Module. Its makes applying CSS very easy.

#

The only custom css sheet that I am aware of is for the setting Household. Its posted here, so you can search in the channel.

errant sapphire
# lyric swan Hi guys, trying to get my head around item pile with CSB. Everything seems to wo...

Also, you just happen to have mentioned Item Piles while I'm trying to get it to work, do you happen to know if there's a way/how to configure currencies on Item Piles with CSB sheets? I tried making a hidden attribute of my currency then pointing it to that (in this case I made the attribute credits and told it the currency was props.credits), but every time I try using it it just reports that it can't find the attribute.

bright berry
#

How would I set up a roll that would check against a number, so I can see if it's rolling under that number?

#

Can't seem to find an example of that in the example template

#
2. Roll is over stat being rolled. FAIL
3. Unmodified roll exactly matches stat is a Crit```
are the states I need to check for... This can't possible be difficult
#

I say to myself, bad at coding

#

lol

formal goblet
bright berry
#

I mean.. Yeah, probably

#

Ok so

#

Was about to ask what the := does, but I just got to that paragraph in the documentation

#

Thanks! I'll give this a spin

lyric swan
#

Should work

bright berry
#

Ahhh, okay. So the ? is testing each event, the : is an Else... I see

errant sapphire
waxen sequoia
#

Hey all, how wouldI calculate if a d100 roll is double numbers (11,22,33, etc.)?

errant sapphire
bright berry
#

yeah

#

lordy lordy...

#

Okay, tell me what I'm doing wrong here

#

custom dropdown list key testchoice
keys are Check and Fight
I want the label at the top of a table to change from Bonus to Penalty depending on which is chosen. Bonus if it's on Check, Penalty if it's on Fight.
${ref(testchoice) == Check ? 'Bonus' : 'Penalty'}$ this returns an answer, but only "Bonus," and doesn't change when I change the dropdown option

#

I've tried checking with the key and the label from the dropdown list, but neither work properly

formal goblet
bright berry
#

Ahhh

#

That did the trick! Thanks much!

#

A quick ctrl+F in the documentation for "equalText" returns nothing, so at least this time I can't blame being blind

formal goblet
#

It' part of the math.js-library (the library itself is mentioned). You will also find examples with it in the Wiki.

bright berry
#

There's a wiki? Is it different from the gitlab page?

formal goblet
#

Yeah. It has some more information 😅

bright berry
#

That will probably help!

bright berry
#

Oh, that, yeah

#

that's where I am now

#

... Or not

#

Okay, good to know

formal goblet
#

Wiki != Readme

bright berry
#

Yeah

#

Oh wow yeah this is way easier to follow

#

lol

#

Well, props to me for figuring stuff out with the readme I guess

bright berry
#

it works

lyric swan
#

Is there way to display the status list and edit it? Like adding custom status or something like that? Or does it take a module to do that?

lyric swan
#

I'm sorry maybe i'm not using the correct term, i'm talking about that

formal goblet
lyric swan
#

Thanks, I will look into it ! 👌

plucky canyon
#

I've been looking at math functions but unsure how to make it round any negative numbers to zero. If weapon has 5 ammo left and a burst attack subtracts 10 it should go to 0, not -5.

Could do it in other ways of course, but it feels like there should be a math function for this that I'm just missing.

quasi summit
#

Take the max between 0 and (current ammos - ammos used)

plucky canyon
#

Aha, like max(0, (max_ammo - ammo_used))

quasi summit
plucky canyon
#

Thansk!

lyric swan
dense pine
#

Can i manipulate a hidden Attribute with a number Field? Would like to add +1 to my hidden attribute as Long as the number HP_current if 5 or less. I know how to do this with items or Status effects But These are Not involved here

plucky canyon
#

Having an issue with radio buttons when they have the same value. Four buttons in the same group, all with different component keys. When two have the same value in the resulting sheet, the clicked button jumps between them. In a switchCase the ones with the same value act like the same component key.

formal goblet
formal goblet
dense pine
errant sapphire
# dense pine So i could build a condition. How Can i increase its value by +1 if condition is...

Sadly, I don't think that exact thing is possible. I was actually just trying something similar so it's fresh on my mind. Anything other than a hidden attribute, it works fine, but a hidden attribute has a static formula. There are 2 ways to accomplish it with a hidden attribute that I've used though

  • Incorporate the condition into the attribute formula - Let's say your condition is twohand. If it's true, the player's strength increases by 1. Set the attribute formula for strength to [normal strength formula] + (twohand ? 1 : 0)
  • Use items - If this is a conditional that's more like a status condition than something the players will edit in their sheets, use an item with a stat modifier. Stat modifiers are applied after the normal formula, so equipping an item can add +1 to your hidden attribute as much as your heart desires. Just set the item's modifiers, make sure the character sheet has an item container that can hold that type, and drag it in.
formal goblet
plucky canyon
formal goblet
plucky canyon
#

Oh, haha! ok

dense pine
#

it this a valid visibility formula: AND(KU > 0, HU=0)

#

?

formal goblet
#

No, you´re using an assignment-operator =, which is not allowed

#

=, == and === have different meanings 😅

plucky canyon
#

Are opposed rolls possible (in a reasonably straightforward manner)?
Something like actor roll > await target roll > result...

formal goblet
plucky canyon
#

Ok, thanks

#

I'm now at a stage where everything works as I want (or I know how to make it work as I want) and looking mostly at nice-to-have stuff. 🙂

rustic void
#

can you change a specific value in a DynamicTable using an itemModifier ?

formal goblet
rustic void
#

damn, if it look like what I guess it's gonna be a long ass key for just a +1 XD

formal goblet
#

Yeah...

bright berry
#

Question time!
<td><p><b>${! equalText(testchoice, 'Fight') ? string('Attack bonus:') (first(fetchFromDynamicTable('weapons_table', 'attackbonus', 'Weapon', aptchoice))) : string('')}$</b></p></td>
I am trying to have it so if testchoice is not showing Fight, then the string Attack bonus: X won't show up in the table that gets output to chat.

Right now it's throwing an error. I think it's because it doesn't like that I'm saying its True statement is both to output a string AND include a fetchFromDynamicTable. Is there a way I can have both?

#

The conditional statement is working in that if testchoice isn't on Fight, it won't show the thing at all, so at least I've got that

fierce harbor
bright berry
#

The second part isn't a string though, it's a number being pulled from a dynamic table

fierce harbor
bright berry
#

it did work, but the styling in the chat window shows it as text rather than as the grey box number thing it does for other numbers...

#

Hmm

fierce harbor
bright berry
#

I've got my modifiers/bonuses showing up like that

#

Like this

#

I want that 5 to look like the 0 next to it, is what I mean

fierce harbor
fierce harbor
bright berry
#

appreciated

#

but there's gotta be a way to stick these two things together in the true statement, it would be insane if there wasn't

#

Like the & function in Excel

fierce harbor
bright berry
#

Hmm. Well, I'll have to try and figure it out later

formal goblet
brittle hamlet
#

~~Apologies if this has been asked before, I've been searching but couldn't find anything directly related to this issue: when I switch tabs on this sheet, the image for the actor jumps around, is there something I can do to keep the image fixed near the top?~~Scratch that, I figured it out, I'd been putting the tabs in the header which was messing with the formatting

bright berry
#

Unless...

#

no, the problem remains

#

Damn damn damn...

grave ether
#

Excuse me if this has been covered.. just getting to chat

#

How is the condition being set?

bright berry
#
<tr>
<td><p>Bonus/Penalty: ${bonusmalus}$</p></td>
<td><p>${attbon != 0 ? string('Attack bonus: ') attbon : string('')}$</p></td>
</tr>
</table>```
So I've got this. `attbon` is a `fetchFromDynamicTable` call. If `testchoice`, a dropdown box, is set to `Fight`, `attbon` will pull an attack bonus from the table. Otherwise it'll set to 0. 
I want the above to send to the chatbox the table showing both the bonus/penalty as well as the attack bonus if the sheet is set to Fight, or not send it if it isn't.
#

So it'll look like this if testchoice (the dropdown on the left) is set to Check or Contest

#

And this if it's set to Fight

#

The error is where I want Attack bonus: X to show up, where Attack Bonus is a string and X is the attbon stat pulled previously

#

<td><p>${attbon != 0 ? string('Attack bonus: ') attbon : string('')}$</p></td> so the problem is here, where the true function needs to be both a string and a variable

#

If I get rid of attbon after the string, it obviously gives me this. I just... Want that extra bit, lol

#

Screw it, I'll just have it always appear

#

.. Oh wait, I could have two conditionals

#

HA

#

It worked

#

thank you random thought

grave ether
#

Sometimes talking through it helps

bright berry
#
<tr>
<td><p>Bonus/Penalty: ${bonusmalus}$</p></td>
<td><p>
${! attbon != 0 ? string('Attack Bonus: ') : string('')}$
${attbon != 0 ? attbon : string('')}$
</p></td>```
#

Just made it do it twice, lol

errant sapphire
grave ether
#

I am reading Ry

#

give me a second

#

Ohhh Item stuf... I am not quiet there yet.. LOL

#

Would love to see or hear your solution tho

bright berry
#

Awwww damn, doing that though leaves a little dooder showing up when I don't want anything showing up.... Oh well

grave ether
#

I think there is away to not put something.. let me look

bright berry
#

I could put a ! at the start of the function but then that gets rid of the little box style I like

grave ether
#

the '' is what is causing it

#

can you put a ! at the beginning of the string

#

!string('')

#

BTW I dont think you need to add string to the code..

bright berry
#

gives an error

grave ether
#

interesting

bright berry
#

I probably don't, yeah