#Custom System Builder

1 messages · Page 49 of 1

icy panther
#

I don't understand lookup, I thought it returned comma seperated text

formal goblet
icy panther
#

even though I only have 1 element, it's still not text

formal goblet
#

It returns an Array

icy panther
#

however find() will only be text right?

formal goblet
#

That will actually return a scalar value (string, boolean, number or undefined)

icy panther
#

but then i can use string() on the find

formal goblet
#

It's sufficient to only use find() if your entry in your column is a string

icy panther
#

ok

formal goblet
#

And UUIDS are strings

icy panther
#

right, I am just trying to get a step to work, will figure out how to break and use the arrays from lookup later

formal goblet
#

To what Component does Dynamic_Equipment_Table refer?

icy panther
#

a dynamic table on an item

#

find didn't work either 😦

formal goblet
icy panther
#

cool

formal goblet
#

Do you like puzzles?

icy panther
#

yes

#

I am making a huge one right now 😄

formal goblet
# icy panther I am making a huge one right now 😄

Don't worry. I'll tell you how you adhere to signature contracts.

Every function has inputs and outputs. For example: equalText() This one has 2 inputs, 1 output. 2 Inputs of type string and 1 output of type boolean.

The definition of a function with the definition of inputs and outputs is called a signature, e.g. equalText(text1: string, text2: string): boolean. Every function in our Readme has that. As long as you match those signatures, you're more or less good to go.

#

If you nest functions, the output of the inner function becomes the input of the outer function. That's where the puzzle begins.

icy panther
#

right

formal goblet
#

Now with some special cases like fetchFromUuid(). The first argument is the uuid, pretty straight forward, nothing special here. But the fun starts with the second argument. That one is a string, which will be interpreted as a formula and executed with the properties of the Document your UUID refers to.

#

You refer to a Dymamic Table there. Now the thing is, that will return you an Object. Do you have any function, that can accept Objects?

icy panther
#

I have not seen a function within CSB that takes an object

formal goblet
icy panther
#

I should pay more attention to the "return' statement in the wiki

#

@formal goblet thank you, so I have a question, what would be the correct way to reference a dynamic table on an attached item with alookup() being called from a user input template?

formal goblet
icy panther
#

it is not the same item

formal goblet
#

So your reference point is your Actor

icy panther
#

the uuid contains the actor id aswell

formal goblet
icy panther
#

right

#

reading fetchFromActor()

formal goblet
#

Generally speaking, Formulas are always computed with the properties of the entity, where the Formula is being executed.

#

So if your Formula is executed within a Label of an Actor, it will be computed with the properties of the Actor.

icy panther
#

i understand that

formal goblet
#

Now, there are exceptions to this rule, an that is if you use the fetch-functions. The formulas inside those functions are calculated with the properties of the entity you are actually targeting with the fetch-function. In case of the UUID, it will compute the formula within it with the properties of the Document, that has the matching UUID.

icy panther
#

allowing to fetch data from other documents

formal goblet
#

Not only that. You can execute whole formulas with the properties of the Document

icy panther
#

oh

#

thought this would work
${fetchFromUuid('Actor.dh9JW0tEZfCwSTU9.Item.327ZLTDjKyTcbhof', alookup('Dynamic_Equipment_Table', 'mount_location', 'Mount_Light_Weapons', '===', true, 'Mounted_Weapon_ID', '===', ''))}$
but I must still be missing something

formal goblet
icy panther
#

ahh

#

ty ty ty

formal goblet
#

Now you solved the puzzle

icy panther
#

I solved a piece of the puzzle, now I just have to create a loop and put the array output to a drop down

#

that can then update a text box

#

but I appreciate you stepping me through this

spark lotus
#

Hi. I'm making a character sheet for a game called Neon Skies that requires players to roll a pool of dice where they succeed if they get at least one 6 out of the roll. I tried creating it but it's not working. I'm sharing screenshots of the components and notes on what I'm trying to do. Any help would be greatly appreciated 🤓

formal goblet
spark lotus
mental jay
#

Hi, is anyone out there familiar with Chivalry and Sorcery 5th edition?

icy panther
#

stuck on order of operations, how to get things to compute in the correct order, and whilst I understand the purpose of ComputablePhrase(), I cannot wrap my head around using it correctly,
heres what I have

localVars.whyDoesThisError = "alookup('Dynamic_Equipment_Table', 'mount_location', 'Mount_Light_Weapons', '===', true, 'Mounted_Weapon_ID', '===', '')";
}%
%{
//get uuids
const tempuuid = "${lookup('spawned_vehicles', 'uuid')}$";
const myUuidArray = tempuuid.split(',');
//check each table for empty slots
let dropinfo = '';
for (let i = 0; i < myUuidArray.length; i++) { 
dropinfo += myUuidArray[i];

let phrase = new ComputablePhrase("${fetchFromUuid(refuuid, whyDoesThisError)}$"); 
await phrase.compute(localVars.refuuid = myUuidArray[i]);
dropinfo += phrase.result;
dropinfo += " , ";
}
return dropinfo;
}%```
no errors, but missing middle section
should be 
```Actor.dh9JW0tEZfCwSTU9.Item.327ZLTDjKyTcbhof , Left Wing,Right Wing,Hood,Roof,Left Side,Right Side , Actor.dh9JW0tEZfCwSTU9.Item.3ImG9zMqPXJyXds3 , Left Wing,Right Wing,Hood,Roof , ```
but it shows this
timid marten
#

Could you then show me where you added it please?

mental jay
# icy panther what's the issue?

Hi Nosferato, the issue is I am a computer user, not much of a technician or engineer or anything. Add to that I am an old dude, and it equates to I do not know how to modify the template (example 2) to create a C&S 5e character sheet. I really need someone who understands how to create the sheet, and I am willing to pay for the effort.

limpid gull
#

Is something wrong with radio buttons in dynamic table? this doesn't saving after update or reopen sheet

#

created radio button component in dynamic table, but when creating new rows and choose radio button, im reopen sheet and it doesnt saved coosed variant

#

ah.. okay...

icy panther
mental jay
icy panther
#

@mental jay click on the link 🙂

formal goblet
icy panther
#

yes, I understand the order, not how to change step 3 to step 5

#

I thought that was what the ComputablePhrase was for

formal goblet
#

It can do that, but you also have to pass props to the phrase, otherwise your formulas won't have any variables that they should reference

#

And you can use ComputablePhrase.computeMessageStatic(phrase, props, options) for simplicity

icy panther
#

I don't see any refence to function computeMessageStatic()

formal goblet
#

That's a static function

icy panther
#

🙂

#

I don't even know how to begin to figure out adding props

formal goblet
icy panther
#

yes

#

I need to learn more

icy panther
#

ty, going to let the last couple of days info settle in and do some more reading, been alot of brick walls to break through 🙂

#

@formal goblet can you explain why

${actor.system.props.Strength}$ // And that's how you don't

you don't, aren't both the same?

formal goblet
#

In Scripts and Macros, you have to use the full chain like entity.system.props.Strength

icy panther
#

Scripts would be javascript in a label for example?

#

because CSB automatically adds the props?

#

just realised CSB is doing a lot of heavy lifting

formal goblet
formal goblet
# icy panther just realised CSB is doing a lot of heavy lifting

Yeah, we've abstracted quite a lot, so that starting with system development doesn't overwhelm you at the beginning. That's why we primarily use Formulas with such an abstraction layer. Compatibility with JS came way later, but allowed the more experienced audience to break some limits we had there.

icy panther
#

yeah, I have been watching and trying to build my system for a very long time, stopping when I reach a limitation that CSB couldn't do

#

or figuring a way around the limitation, like complete redesign my structure

#

this is the last problem I have to making everything work, at least for the character sheets

#

wouldn't

Formula-Computation, which will be based on a UserInputTemplate (an Item-Template). The component keys in the
UserInputTemplate can be used by other Formulas in the Label Roll Message further down.```
 this read better as
```?#{<userInputTemplateName>} in a CSB-Formula ${?#{<userInputTemplateName>}}$: This will open a Dialog during
Formula-Computation, which will be based on a UserInputTemplate (an Item-Template). The component keys **used to call** the UserInputTemplate can be used by other Formulas in the Label Roll Message further down.```
#

that had me stumped when i read it

lean bone
#

how do I roll something that I already scripted from another label?

As in, on my Stats tab there is the CQB skill, which you can click and roll. I want to roll that from my combat tab, when u click the Attack Button.
Do I just have to copy paste it in the Attack button, or is there a way to call the CQB skill?

icy panther
#

copy and paste

lean bone
#

dang

#

ok ty

formal goblet
#

That or a semi-complex script

icy panther
#

if it's on an item, use a sub-template

#

or have both use the same userinput template

formal goblet
formal goblet
icy panther
#

it depends on what he is doing with it when hitting roll

formal goblet
#

From what I understand, is that he wants to execute the Label Roll Message of a different Label

#

Which is doable with this:

// The key to the Label, which holds the original Label Roll Message.
// The Script assumes, that the Label is in the same Entity
const labelKey = 'phrase';

// You can use 'alternative' instead of 'main' if you have an alternative Label Roll Message
const phrase = await entity.getCustomRoll(labelKey, {})['main'](false, {
   ...options,
   explanation: false
});

const speaker = ChatMessage.getSpeaker({
  actor: entity.entity,
  token: entity.entity.getActiveTokens()?.[0]?.document ?? null,
  scene: game.scenes.current
});

phrase.postMessage({speaker});
icy panther
#

cool, i didn't know about that option

icy panther
#

oh I haven't even looked at dice handling yet

#

only so much my tired brain can take

#

and besides, my system is simple on dice use, roll 1d* and do something

lean bone
formal goblet
#

And the script delimiters with %{}% ofc

lean bone
#

what

#

whats a script delimiter?

#

the whole thing?

formal goblet
#

CSB-Formula-delimiters ${}$ vs Script delimiters %{}%

lean bone
#

so i need to %{the message you sent before}%, at the start of the label roll message, then under i put ${}$ with the rest of the stuff i have?

formal goblet
#

The part with the script delimiters is right

lean bone
#

i try

#

it doesnt work, oh well ill figure it out

sinful spade
ornate haven
#

Hi there! I am runing into some serious performance problems, and it seems to be caused by two people opening a character sheet, or constant recalculatons upon sheet load. Is there any settings that should be adjusted for this? Or suggestions to optimized?

misty terrace
#

If I'm trying to sum the values of a field (named "invSlots", for example) in an item display, is there a shortcut, or do I do a lookup into an array and then sum the array?

manic crypt
#

The second option is what I'd do.

misty terrace
#

How can I sum the array in a label text? trying the following. Line 1 is getting the array, the javascript isn't firing correctly. Anyone got an idea to save me tinkering into the wee hours? The following works, but it returns both the array values and the sum. If I try to hide the output of 'slots' with '#slots', the second line errors.

%{return localVars.slots.reduce((acc,num) => acc + num);}%``
dense pine
#

I would like to change the Value of a label depending on a textfield. So i build a ternary operator and now imstruggeling with the code: The Condition is if a text field that has text. By default it is empty. If it is empty, i want to display the Text "no value"
How do i do this?

${ equalText(textfield, ' ') ? 'No Value' : textfield}$

This works except the middle part. It displays nothing at all

formal goblet
misty terrace
obtuse birch
#

guys is there a componet that lets me put a image inside it?

#

rich text area (?)

formal goblet
waxen thorn
versed notch
#

Is there an easy way to sum up the column of a dynamic table?

formal goblet
vapid jackal
#

hi, probably a dumb question and i hope is just a limitation of foundry, but i find that calculations of formulas are quite slow to update. is there a way to fix this? is there some kind of way and can apply more resources for foundry to use to speed it up?

formal goblet
vapid jackal
#

every time i increment the level it takes a bit to update to the next factor of 3. oh well.

formal goblet
vapid jackal
#

how do i access that? is that a keybind?

formal goblet
vapid jackal
#

cheers

vapid jackal
runic geode
#

Hi, i wanted to use 2 different Dice modifiers but it seems not to work properly. i want to count all successes that are "even"(2,4,6,8,10..) and greater than "target_number". So with Target_number=4 A roll with [2,6,8] should count 2 successes.
{ROLL:=[!:Dice:d12cs>=:target_number:=even]}$ gives me 3 successes as the cs modifier is ignored.
{ROLL:=[!:Dice:d12even=df<=:target_number:=even]}$ gives me 1 success as the df modifier reduses the successes.
is there a possibility that i'm missing?

silver lake
#

How do I make items added onto the sheet add 1 to the quantity (making a stack) rather than adding a copy?

sinful spade
#

Your best bet is to add a quantity number label in your items if you want to support that as a feature and have players manually controll it.
That or maybe a world script that adds to it if the item was already present.

#

if it helps you could add that quantity label into the item displayer as a column, maybe code simple macro buttons styled as arrows to increase and decrease that label from the displayer without opening the item.

icy panther
#

I'm trying to pass a variable from javascript to csb which I have done before, but in this instance it doesn't work, could you look over my code and help me figure it out?

${?#{_Diag_Move_Weapon}}$
%{
// UUIDs of involved actors/items
let oldItemToDeleteItemUUID = "${fetchFromUuid(sameRow('uuid'), 'Dupe_Uuid')}$"; // Item UUID from old actor
let baseItemUUID = "${sameRow('uuid')}$"; // Item UUID from Base actor
let newItemToCreateActorUUID = "${diagdropdown}$"; // Actor UUID for new destination

if (oldItemToDeleteItemUUID === 'Base') {
oldItemToDeleteItemUUID = baseItemUUID;
}

Promise.all([
  fromUuid(oldItemToDeleteItemUUID), 
  fromUuid(baseItemUUID), 
  fromUuid(newItemToCreateActorUUID)
]).then(async ([oldItemToDeleteItem, baseItem, newItemToCreateActor]) => {

  if (!oldItemToDeleteItem) {
    ui.notifications.warn("Item not found on oldItemToDelete.");
    return;
  }
  if (!baseItem) {
    ui.notifications.warn("Item not found on Base Actor.");
    return;
  }
  if (!newItemToCreateActor) {
    ui.notifications.error("New destination actor not found.");
    return;
  }

  const baseActor = baseItem.actor; // Get the "Base" actor
  const oldItemToDeleteActor = oldItemToDeleteItem.actor; // Get the original actor that owns the item

  // Clone data from oldItemToDelete's item
  const newItemData = foundry.utils.deepClone(oldItemToDeleteItem.toObject());

  // Update Base's item with the old item’s data
  await baseItem.update(newItemData);

  // **Don't delete if the item is from Base**
  if (oldItemToDeleteActor.id !== baseActor.id) {
    await oldItemToDeleteItem.delete();
    console.log('Item deleted from old actor.');
  } else {
    console.log('Item belongs to Base, skipping deletion.');
  }

  // **Don't copy if the target is Base**
  if (newItemToCreateActor.id === baseActor.id) {
    console.log('Target is Base, skipping item creation.');
    return;
  }

  // Clone the updated Base item to create a new, independent copy
  const clonedItemData = foundry.utils.deepClone(baseItem.toObject());

  // Attach the new copy to the target actor
  const createdItems = await newItemToCreateActor.createEmbeddedDocuments("Item", [clonedItemData]);

  // Retrieve and log the new item's UUID
  const newItemUUID = createdItems[0]?.uuid;
  console.log("New Item UUID on target actor:", newItemUUID);
  localVars.new_id = newItemUUID;
  return;
});
}%
${setValues(sameRow('uuid'), 'Assigned_ID', 'diagdropdown')}$
${setValues(sameRow('uuid'), 'Dupe_Uuid', 'new_id')}$
mental pagoda
#

Hello! Any tips to getting my table to condense a bit? I want the empty spots to just... condense kinda...

#

Like, the text box to just show more kinda? But the ones that are smaller should just... be next to each other kinda?

sinful spade
#

And use empty cells as spacing??

#

You won't have much sizing control with that method, it'll be very... Ridged which may have it's benefits for certain use cases... But this feels excessive

#

Try using panels if you want more of a flex approach

mental pagoda
#

Yeah, that's what I did. I guess I did use the header section? I wasn't aware of other places D:

sinful spade
sinful spade
mental pagoda
#

Ahhhh, I see I see...

shy osprey
#

Is anyone using item based currency in Item Piles with CSB? I can set up primary currency that is on the actor sheet but would prefer stackable item.
Mastercrafted and Griddy both recognize "props.Quantity" as path to quantity, so I assume it is correct, and I use that
After dragging the currency item to the "configure secondary currency -window" it shows the item there and I can set the price value at shops to that.
However, when test shopping the item and seconday price are not available, it seems that Item Piles does not recognize the currency item in my inventory as the same as the one in Item Piles settings.
Anyone found a work around to this or am I doing something wrong?

misty terrace
#

If I wanted to distribute the templates and macros and graphics that I've made for a system built with CSB, is there any guide on best practices/how to?

sinful spade
#

foundry UI supports this

formal goblet
sinful spade
marble mural
#

Anyone know if you can change the font color in the below roll message to green for success and red for failure? I can't figure it out...

<p>Dice in Sling: ${bodysling:=body+bbody-(pbody+bodys)}$</p>
<p>Sixes Rolled: ${result:=[:bodysling:d6cs=6]}$</p>
<p style="font-weight:bold;font-size:200%;text-align:center">${result>=1?'Success':'Failure'}$</p>```
sinful spade
#

if so, change success to:
'<span style="color: green;">Success</span>'
and the same for failure

marble mural
#

It is, and I tried span and it didn't work.

sinful spade
#

lets try overriding csb default

#

'<span style="color: green !important;">Success</span>'

formal goblet
sinful spade
sinful spade
#

is that code not just changing the color of the same text?

formal goblet
#

Yeah, and?

sinful spade
#

... ok

formal goblet
#

He already has the part about changing the text, so just applying it shouldn't be an issue

velvet heron
#

What sort of code would I need to put into this Label text to get this Next Round button to 1) increment the Round Number by +1 each time it is pressed, and 2) clear any checked checkboxes in the Done column?

Similarly, I would need to know what to put so that the Reset button takes the Round Number back to 1.

vapid jackal
#

is there a way i can make this MORE* aligned?

velvet heron
vapid jackal
#

is there a section on the guide that explains the basics of doing that? sorry if thats an obvious question im just unsure about such things.

velvet heron
#

I'm pretty sure CSS class stuff is outside the scope of the CSB system and guide. But Martin would know for sure.

formal goblet
sinful spade
vapid jackal
#

thanks for the responses gentlemen!

sinful spade
#

And they're right it is outside of the scope so you won't find info on the wiki, BUT there's always people asking about it here and I'm happy to point you in the right direction so don't feel weird about it ♥️

misty terrace
#

Ok all, anyone here get Automated Animations to work with CSB? I'd be happy with code for a macro that fires an animation matching the name of the item/spell, but the code below isn't actually firing anything.

            AutomatedAnimations.playAnimation(actor, target, "'" + rollName + "'");```
#

The console log bit works

formal goblet
sinful spade
formal goblet
misty terrace
#

Happy to post the entire macro here, it's a doozy that needs to be cleaned up

formal goblet
misty terrace
#

oh, hang on

#

This is from TheRipper's Wiki


Automated Animations provides the AutomatedAnimations class to access the Automatic Recognition menu or play animations from an external source.

AutomatedAnimations.playAnimation(sourceToken, item, options)

-sourceToken: Object - The token using the item.
-item: Object - The item being used or a pseudo item object with a name for Automatic Recognition as {name: "Dagger"}.
-Options:

    -playOnMiss: Boolean - Determines whether "miss" type animations should play for melee or range attacks.
    -targets: Array or Set - Targets for the animation.
    -hitTargets: Array or Set - Tokens that were "hit" during an attack.
    -template: Object - An optional parameter to send a Template object or document to the handler.
    -reachCheck: Number - Additional range a token/item has for reach in melee attacks.
#

there is some guidance on adding system support that I'm trying to wrap my head around as well

formal goblet
#

The description says, it needs a Token. You provided an Actor (I assume)

misty terrace
#

Oh, probably!

#

let me try that!

#

getting a different error, so progress!

#

thanks Martin

willow birch
#

How do I get the token img? I'm using the wildcard option and I only know about return entity.entity.img

willow birch
#

I'm getting it in a label roll on the character sheet to put in the chat

#

<img src="${!%{return entity.entity.img}%}$" width="50" height="50">

#

Gets the character image, but I need the token one

formal goblet
#

Because 1 Actor can have multiple Tokens

willow birch
#

Ah, that sucks, but ok I'll do it another way then 😄

sinful spade
sinful spade
#

try uh
<img src="${!%{return entity.entity.img}%}$" style ="width: 50px; height: 50px;">

sinful spade
#

Has anyone figured out how to use a text field as a check box? like - if it has contents, true, if not false.

misty terrace
#

Can you check the length of the value to see if it has contents?

sinful spade
#

it works if a number is input but the second a letter is input it tries to convert to a number for some reason

#

For the ref function for example, this is a problem : ref(attribute) aims at getting the value of the field referenced by the attribute field. If attribute's value is str, ref(attribute) is equivalent to ref('str'), and will return the value of the field str. And ref('attribute') will return the string str.

#

whats weird is just ref('val') will mirror the contents no problem without conversion so i guess it's an issue with the logic of
ref('val') != "" ?

#

i need to find the "value" of an empty container i guess. null? undefined? 0?

misty terrace
#

!val ?

sinful spade
#

Value expected (char 1) lol

#

if inspected empty fields are just ""... but checking if ref('val') == "" tries to convert to a number 🤔

sinful spade
#

${count(ref('key')) == 0 ? "false" : "true"}$

velvet heron
sinful spade
velvet heron
sinful spade
#

not a hidden attribute so to speak.
a number field that has it's visability formula set to false

velvet heron
#

I see.

sinful spade
#

i dont actually know how hidden attributes work 🤣 never had to use them

velvet heron
#

And I don't know very well how visibility formulas work, haha

sinful spade
#

just sets the css display property to none unless it resolves to true

#

still functions and can be referenced normally, just not visible outside of the template

velvet heron
#

I remembered that I had help setting up a hidden bit of character sheet several months ago, so I looked at that.

There was a hidden attribute of isDisplayed of 0, which I used the formula of isDisplayed > 0 for the label, which disappeared the number (and still shows in the template.

#

But the button still doesn't work.

velvet heron
#

Still, looking at the wiki for setPropertyInEntity, it appears to me that

${setPropertyInEntity('self', 'round_counter', "+1")}$

should work to increment it, but doesn't.

icy panther
velvet heron
icy panther
#

have you tried, ${setPropertyInEntity('self', 'round_counter', 'round_counter+1')}$

velvet heron
#

Yes.

#

Still no dice.

icy panther
#

ok, it needs a formula, this tripped me a few times, ${setPropertyInEntity('self', 'round_counter', sameRow('round_counter')+1)}$

#

umm

#

I should not be trying to code when this tired lol

velvet heron
icy panther
#

ahh

#

${setPropertyInEntity('self', 'round_counter', "item.round_counter + 1")}$

#

Decrease the ammunition total by one in the current item in an Item Container : setPropertyInEntity('item', 'Ammunition', "item.Ammunition - 1")

velvet heron
#

I already know that won't work because I'm working solely within the actor and its template. No items involved.

icy panther
#

then just needs formatting correctly

velvet heron
#

That's what I'm struggling with. I feel like it's so close

icy panther
#

${setPropertyInEntity('self', 'round_counter', "target.round_counter + 1")}$

#

formula: string: The formula which should be calculated on the referenced actor or item. It can also just be a key. Inside Item Displayers, item properties should be targeted with the item. prefix, just like in other parts of the formulas. If you need to use the properties of the target-actor, you can achieve that by using the target.-prefix. ⚠️Only these 2 prefixes exist (there's no attached.-prefix)!

#

but that is a targeted actor

#

so wont work

velvet heron
#

I thought target means-- yeah, exactly.

#

This actor isn't a typical token, obviously, so it won't be on the board.

#

Thus won't be targeted.

icy panther
#

right

velvet heron
#

Anyway, I'm giving up for tonight, my brain is fried. If Martin comes back and knows how to solve it, I'd love the assist. Otherwise, I'll deal with it tomorrow.

Thanks for trying to help! 😄

icy panther
#

np

icy panther
velvet heron
#

Unless I didn't understand?

icy panther
#

you mentioned it was on an actor

velvet heron
#

The initiative tracker itself is an actor is what I meant, yes.

icy panther
#

so it's a label roll message?

velvet heron
#

That's what I assume it has to be for the label to function as a proper button.

icy panther
#

ok figured it out

velvet heron
#

Oh?

icy panther
velvet heron
#

All that in the label roll message as is?

icy panther
#

yes

#

I just quickly set it up and works fine here

velvet heron
#

Doesn't seem to be working for me. I'm certain I reloaded the actor sheet and everything.

I wonder if the secondary formula is messing with it?

icy panther
#

any errors in the console?

#

why do you have a lookupref?

#

your trying to set the value of 'init_drag', which doesn't exist

velvet heron
icy panther
#

what is the second part supposed to do?

velvet heron
icy panther
#

ok

#

i see

velvet heron
icy panther
#

right

#

yet it's still not incrementing?

#

can you show a screenshot of the round_counter componant?

#

here's mine

velvet heron
icy panther
#

yeah thats normal behaviour

sinful spade
velvet heron
icy panther
#

aha

#

it's a label

#

has to be a number field

sinful spade
#

you can set the numberfield = to the referenced value + 1

#

which seems crazy but it's the same thing, displays the same way

icy panther
#

yes

sinful spade
#

but avoids recursion and actually works with the setProperty

velvet heron
#

Yeahhhh, now it works.

icy panther
#

well the whole problem is trying to update a label, which you cant do

sinful spade
#

...yeah.

velvet heron
sinful spade
#

like i mentioned a few hours ago

icy panther
#

yes

sinful spade
#

🤣

icy panther
#

i wsn't here then 😛

sinful spade
#

didnt mean you lol

velvet heron
sinful spade
#

😬 i even said it's an important step

icy panther
#

so this would have worked just fine from the offset
${setPropertyInEntity('self', 'round_counter', "round_counter+1")}$

velvet heron
sinful spade
icy panther
#

tested, it, it works just fine

sinful spade
#

in a d.table?

icy panther
#

thats what was throwing me off, I thought it would work, then told it didn't, messed with my head, and went off on a tangent, which is normal for me and CSB

#

no just regular number componant

velvet heron
#

Sorry for accidentally making it extra frustrating.

icy panther
#

np, I am still learning

sinful spade
#

ah yeah i was about to say, i'm 100% sure i've tried it from a table and it didnt work till i made an invisible label to reference outside of the table

icy panther
#

froma d.table, I would imagine you'd have to use a lookupref to get the cell to update

velvet heron
#

I was so intent on trying to make it show as a label because I didn't want to have a visible number field on the sheet. Guess I can just CSS it away.

sinful spade
#

just make the numberfield...

#

invisible

#

and reference it in the label

#

😠

icy panther
#

you can use a label, doesn't need a key just put in the label text ${round_counter}$

sinful spade
icy panther
icy panther
#

it's a little more than I care to try right now

sinful spade
#

🤣 i feel that

velvet heron
sinful spade
#

ive been fighting with this meter for about 4 hours now and im about to throw something

velvet heron
#

Anyway, I'm super thankful for you guys for the help. I'm off to bed for real now. o7

sinful spade
#

ciao

icy panther
#

have a good night

sinful spade
#

sorry nosferato but i read "javascript" and it's already not my area man

#

I'm powering through on 90% will power and 10% luck

#

i dont do JS

icy panther
#

hahaah, I do that with css

sinful spade
#

now, css i can do

icy panther
#

I know, i might get you to help me pretty up my char sheets when I have the fundamentals working

sinful spade
#

have you been lurking or something? o3o i dont remember talking to you before

#

and im usually pretty good about that

icy panther
#

been lurking for over 2 years

sinful spade
#

i dont see any uh %{}%

eager pewter
#

Forgive what I'm sure is introductory level ignorance, but I am trying to call the number from a number field to be used in a formula for my default and maximum values for another number field on the same sheet and I am stumped. I am successfully using it for rolls elsewhere, so I know it must be how I'm formatting the formula. Any suggestions?

${NumberFieldStat * 3}$

icy panther
# sinful spade i dont see any uh %{}%

it's at the bottom,

  return;
});
}%
${setValues(sameRow('uuid'), 'Assigned_ID', 'diagdropdown')}$
${setValues(sameRow('uuid'), 'Dupe_Uuid', 'new_id')}$```
sinful spade
icy panther
icy panther
eager pewter
sinful spade
#

(and by that i mean typos)

eager pewter
eager pewter
sinful spade
icy panther
eager pewter
#

Just a regular panel as well, not a tabbed panel.

sinful spade
# eager pewter

default values Only apply once when the character is first made

#

it's the sheets first time default, it never applies again ❤️

#

so unless you're making a new actor to test it each time you wont notice a difference

#

if you want somethign that updates automagically -- use a label ^^

eager pewter
#

Ah ok, so it should be working, I'm just not seeing it.

icy panther
#

@sinful spade can't ask chatgpt for CSB problems, it just doesn't understand them

eager pewter
sinful spade
icy panther
#

for JS yes, but not for CSB

sinful spade
#

it's not perfect but it does work

icy panther
#

let me put it another way

#
myfunction {
}
localVars.something = blah;
}%
${blah}$

works just fine

myfunction {
localVars.something = blah;
}
}%
${blah}$```
doesn't, however you have just made me think maybe because it within the function and I cannot return the variable out fo the function
eager pewter
#

You guys are life savers, thanks!

icy panther
#

so the problem with chatgpt's output is here

  const newItemUUID = createdItems[0]?.uuid;
  console.log("New Item UUID on target actor:", newItemUUID);
  
  // Set the new UUID in CSB after it's available
  ${setValues(sameRow('uuid'), 'Dupe_Uuid', newItemUUID)}$;```
newItemUUID is a created variable in JS and CSB cannot understand variables from JS, so you need to convert it to CSB with localVars, however the CSB script within JS will be execute first and so the var doesn't exist
sinful spade
#

I've read that 6 times now and it's not made any more sense to me.
Maybe I've been staring at screens too long today.

However, I can assure you - the chat i've trained has made several functional macros and scripts tailored to CSB limitations/requirements.

I know AI code is ... trash 🤣 even i can see that and i cant write my own code, but it does tend to work with a few regenerations.

icy panther
#

so I have to put the CSB script after the JS script, just got to figure out how to get the variable out

#

Oh I use chatgpt a bit, but I have to correct it alot

sinful spade
#

so im not sure if this is relevant, again this is out of my dept -
CSB isn't compiled in regular JS but the math JS variation.
I had to beat that into my GPT's head for things to start working.

icy panther
#

I actually had an argument with it regarding clone in foundry api, as chatgpt says the function doesn't exist, even though I have used it

sinful spade
#

oh yeah it does love to do that

#

i've fought with it a few hundred times now and it's stopped making those complaints

icy panther
#

You said:
replace deepClone() with clone()
ChatGPT said:
Actually, clone() is not a function available in Foundry VTT for duplicating objects. The correct method to use is still foundry.utils.deepClone(). If you saw clone() mentioned somewhere, it might have been a misunderstanding or a reference to a different API.

So, you should continue using deepClone(), like this:```
icy panther
sinful spade
#

it's all witchcraft in the end

#

did you at least try the outputted code?
no promises either way but if it magically works, it works.

icy panther
#

the problem I am having is I know JS, not great, but enough to muddle through, but it's the interaction with CSB that just thwarts me

sinful spade
icy panther
#

i did, but at the time, it wasn't the right approach

sinful spade
icy panther
#

it wont work, I can see that by looking

sinful spade
#

ok 🤷

icy panther
#

i appreciate it though

#

in JS i have the freedom of using loops, but I cannot use loops when interaction with CSB

sinful spade
#

🤔 you cant?

icy panther
#

so I am constantly running into "I can just iterate over these values and loop through and output my values", then "nope, cannot iterate or loop"

sinful spade
#

hey actually, @misty terrace you have any input here?

icy panther
icy panther
sinful spade
#

now dont go saying that or open AI will get a big head

#

i'm on... tack.... to solving it

#

i think

icy panther
#

you can always bounce ideas off me, I find I learn more when I can throw ideas at someone

sinful spade
#

whenver i set
width: ${ref...}$%;
and the ref adds up to 100% and is showing so in the chat, it's not displaying as 100%

#

it's supposed to evenly divide the spans in the div to proportional %s.

icy panther
#

ugh spans and percente

#

have you tried 99%?

sinful spade
#

lol

#

yep

#

and ${100}$%; also works

#

but the second i do:
${ref('healthMax')/(ref('healthMax')+ref('tempHP'))}$%

#

which is just what % of 100 shoud be taken up by the health section it... nopes out on me

#

i got it working fine with two bars

#

but the second i add a third 🤣

icy panther
#

have you tried,
${healthMax / (healthMax + tempHP)}$

sinful spade
#

syntaxtically the same

icy panther
#

I know

sinful spade
#

still breaks

#

🤷 i know the refs are ... erronious but they help me keep track that "THIS THING IS A KEY" lol

icy panther
#

surely though your dividing by 0?

sinful spade
#

how?

icy panther
#

healthmax = 20 and temp health = 5
it would be 20 / (20+5)
20/25 = 0.8 but rounded down to 0

sinful spade
#

oh i see what you mean

icy panther
#

so use roundup()

sinful spade
#

sorry i forgot to include that i am uh *100

#

before round()

#

so it'd be 80%

#

i've been trying every variation in the book 🤣 we're on hour 5 now

icy panther
#

or ${healthMax / max(healthMax + tempHP, 1)}$

#

will stop it dropping below 1

sinful spade
#

omg.
csb default styles absolute

#

the third bar was hiding behind the others

#

🙄

icy panther
#

hehe

sinful spade
#

now just to figure out how to get an absolute possitioned mess to right align

icy panther
#

well thats your area

sinful spade
#

🤣 I did it once earlier

#

flex-end was handy

icy panther
#

<element align: right>

sinful spade
#

but the same trick aint working.
time to click down arrow till something works

#

i tried align-self: end;

#

and justify-self: end;

icy panther
#

you don't just have align: right in a css?

sinful spade
#

no

#

you got like text align
align self
align contents
align items
justify self
justify contents
justify items

#

you have float: right;

#

and right: 0;

icy panther
#

and float doesn't work?

sinful spade
#

nope.
ive even overridden the absolute positon to be relative.

#

i'm going to try... pixel positioning it and hope it doesnt break when updating values

icy panther
#

so it's the overflow, and it's getting hidden?

sinful spade
#

😮‍💨 it does break if the value changes.

#

overflow?

icy panther
#

you didn't mention flex

#

you said the third bit is hiding

sinful spade
#

I did try flex 😦

#

im currently confering with the oracle

#

the oracle is not responding... 🤣 i have been abandoned

icy panther
sinful spade
#

huh? how so

icy panther
#

shouldn't it be * 100 to get %

sinful spade
#

it is?

#

round((x / (x + y))*100)

#

like everything works properly,
just for whatever reason, no matter what i change,
the only value that will change the dispalyed position of the meter fill is left: and right:
but if i set an pixel width with them, it changes as the meter values change so i cant use that method

icy panther
#

so forgive me, but I don't understand where the formula goes

sinful spade
#

omg 🤣

   position: absolute;
              right: 0;
              top: 0;
              height: 100%;
              display: flex;
              align-items: center;
              justify-content: flex-end;
              flex-direction: row-reverse;
              justify-self: end;">

CHRIST

#

changing nearly all the values at the same time works

#

none of them alone worked, doing it all does

#

whatever

icy panther
#

Foundry being pedantic

icy panther
#

oh your doing something fancy with that health bar

sinful spade
#

🤣

icy panther
#

now I get the formula

sinful spade
#

it took me 6 hours to figure out how to get the wound system working.
another 5 for the temp hp and shielding

#

jeezzzz

icy panther
#

uh huh, I been at my system 2 years

sinful spade
#

dude. lol.
i started writing the rules for this system in 2019

icy panther
#

total productive work time on it, maybe 3 days

sinful spade
#

i've been working in csb on and off as the ADHD allows for... nearly 2 years now 🤣
maybe 8 months of actual production

icy panther
#

we must be glutton for punishment

#

looks pretty though

#

is it totally custom system or based on another?

sinful spade
#

something along the lines of stolen from so many other systems that it may as well be 100% custom

icy panther
#

mines just stolen 🙂

#

but I want to make it custom, just now working on getting the basic mechanics working before customizing it

sinful spade
#

fair place to start

#

we started playing on roll20 back in like 2017 and modifying the rules there in rich text areas of the character sheets

#

adding additional stats like luck, then going to fallout's SPECIAL

#

eventually we were so house ruled that it was no longer 5e and so much was broken so i put the campaign on hiatus, picked up modules to keep us busy, and smoothed out all the rules

#

about 2 years ago i hit the point of "it runs smooth, its fun to play, lets add a GUI and really hit this thing"

#

ofc now im adding a whole magic system to it so 😩

#

time to break it all

icy panther
#

quite a few games systems started out as D&D and became something new

#

I just want to play a game from my younger years, but the biggest downside was it got bogged down by all the dice rolls, I see foundry automating all those, so should be a fun game without dice

sinful spade
#

honestly, i'd be willing to throw my entire system out the window if crucible is half what i think it'll be

icy panther
#

heard of car wars?

sinful spade
#

no? o3o

icy panther
#

nyway, it's not car wars, but is similar

sinful spade
#

i assume you're talking about your system?

icy panther
#

yes

broken quiver
#

Hiya! I need some help. I am currently trying to make it so that when a player clicks a skill, a roll prompt pops up and they can chose another "skill" from a drop down to add dice to the roll.

For example, there is a skill called "break" and purview (basically another skill to foundry but different mechanically) named "death". I want to make it so that if a player clicks "break", it'll open a popup that lets them chose "death" from a dropdown. the hope is that it will roll a number of d6s equal to the total of the skill+purview. If break = 3 and death = 2, i want it to roll 5d6.

I am also sleep deprived as all getout, so if any clarification is needed I'll do my best.

icy panther
#

I kinda understand

sinful spade
#

i've done exactly this from items but not user input templates 🤔

icy panther
#

I'm doing it with actors

#

and user input templates

sinful spade
#

you got this one then 🤣

#

user input tempaltes scare me

icy panther
#

lol

broken quiver
#

I've tried to reverse engineer some of the example sheets and userinputtemplates but it's just not doin what I want it to.

icy panther
#

yeah it's an intreapid adventure

#

however, we need to know where the values are kept first

#

are they in an item displayer?

#

because that would make it easy

broken quiver
#

Both skills and purviews are currently in a table, but i can switch them over to an item displayer if that's more streamlined.

icy panther
#

they are added as an item?

broken quiver
#

No, i have not fussed with items at all. they are labels and numbers displays

icy panther
#

ok

#

then we cannot use an item displayer

#

give me a sec

broken quiver
#

Thank you :)

icy panther
#

so the values are in a dynamic table?

broken quiver
#

If it's not possible the way it's currently set up, i have no issue switching over to items

#

Nope, just a regular old table

#

I'll show

icy panther
#

it should be fine, just trying to figure out your setup

#

ok

#

so we can directly call the variables

broken quiver
#

Here are the tables, they are each tucked inside a collapsible panel

#

skills, purviews, and callings should all be basically "how many dice are you rolling", so if a skill is at 3, a purview is at 2, and a calling is checked, the total will be 6 die

icy panther
#

ok, so start by creating a userinputtemplate

broken quiver
#

ayeaye captain

icy panther
#

then you can add a dropdown to the template with the options

#

then on the result of the dropdown you want it to do something?

#

also sleep deprived 🙂

broken quiver
#

Yes. if "artistry" has a 3 next to it in the table, and they select artistry from the dropdown, then 3 dice should be added to the roll

icy panther
#

ok

#

pretty simple

#

what did you call the userinputemplate?

broken quiver
#

"testinput" to be easy haha

#

the numerical values for skills and purviews are also just keyed as "brace" and "artistry", etc.

icy panther
#

so easiest way, you need the keys in the dropdown to match the skills on the sheet

#

then you can close the input sheet

sinful spade
#

you probably already thought about this, but can users check multiple boxes? if not would it be easier to use radio buttons?

#

you could also key the buttons to have specific values = to their row number and get that row as a result

broken quiver
sinful spade
#

got it.

#

going from a check box to the same row is going to be challenging, i'd think

#

but maybe there's an easier way nos knows

icy panther
sinful spade
#

right?

#

but since it's just a true false check box wont she have to manually key each one in a conditional?

icy panther
#

if i tell you how to with a single dropdown, you'll be able to figure it out with checkboxes?

sinful spade
#

ref('checkbox1') == true ? add Artistry : do nothing

broken quiver
#

I think so, yes

icy panther
#

where we at?

broken quiver
#

dropdown is in the testinput, testinput is closed

icy panther
#

forgot to ask what's the key of the dropdown?

broken quiver
#

just "purview"

icy panther
#

ok

#

ok, create a label on the actor, make it a button, some text to button, then in the label roll message add

${?#{testinput}}$
${purviem}$
broken quiver
#

that brings up the popout and allows me to select from the dropdown

icy panther
#

and it will return the selected key from the dropdown

#

@sinful spade see, simple

sinful spade
#

im too tired to uh

#

comprende

broken quiver
#

I assume so, when i press the confirm, nothing happens? no roll, no chat message (the button is clicked) nothain

sinful spade
#

savvie?

icy panther
#

you have an error somewhere

broken quiver
#

hmmm ok

sinful spade
#

push le f12

icy panther
#

only one reference, the purview

#

oh i just noticed i misplet it, so if you copy pasted it, it'll be that

sinful spade
#

ya

broken quiver
#

i fixed the typo already hehe

icy panther
#

it works?

broken quiver
#

the console also doens't show any errors

icy panther
#

should show as a chat message

broken quiver
#

hmm i might mess around with the items and see if i can get that to work that way.

#

Nope, no chat message

sinful spade
#

items are easy

broken quiver
#

I shall try that then. I'm sure i made a mistake somewhere on this sheet template so i will make a new one from scratch using items and dynamic tables and such

icy panther
#

it opens the user interface, so you can change the dropdown and press the button on it

#

so the only error it can be is the refernce to the dropdown key

#

can you show a screenshot of the dropdown component in the userinputtemplate

broken quiver
#

yupyupyup

#

Here is that

icy panther
#

and a screenshot of the chat messages

broken quiver
#

here's the whole screen

#

this time i actually got a message

icy panther
#

see it's working fine 🙂

broken quiver
#

but it does Not give me a Number

sinful spade
#

its giving you your dropdown key

icy panther
#

nope, you'll now have to setup the logic to get the number

broken quiver
#

got it boss(es)

sinful spade
#

👍 either hand code the conversion logic, or change your keys (i think)

broken quiver
#

oh my gosh. i forgot to refresh the sheet between tests. THATS why it didn't give me a chat message initially

icy panther
#

so if you use checkboxes instead, you'd then check each checkbox for true/false, and on each add the refences to the skills and turn them into dice rolls

sinful spade
#

dw i spent 3 hours today alone to find out that csb absolutely positions meter fills

#

we dont talk about that last one

#

in fact

broken quiver
#

lmao

icy panther
#

we all forget to refresh, it happens alot

sinful spade
#

eyo, nos

#

lemme get your eyes real quick

#

ignore the weird css, im breaking things to add a new column before i fix it back up right

icy panther
#

@sinful spade , the above code I was stuck on is my call to a user input, i have 1 actor that stores all the items, then the i spawn an actor that refernces an item attached to the first actor for all it's variables, then for the weapon items, i use the usrinputtemplate to copy the item to the newly created actor and update all it refernces based on a dropdown on the template

sinful spade
#

adding the proficency dropdown -- but i think it's too cluttered.

#

got any offhand suggestions?

icy panther
#

how do you mean?

sinful spade
#

i mean i threw in the dropdown on the table

#

and it's fine and all

#

but it made the table look like booty

#

too many words, yk?

#

like this was before:

#

well - the 0 column had a title that evened the spacing a bit more but that was close to the before

icy panther
#

here's what i would do, I have a seperate hidden tab for all my ugly stuff, only show the player whats needed, and refernce the hidden variables, that way you can remove the delete option from the displayer the player sees

sinful spade
#

this is the shown information lol

#

there's more

icy panther
#

yeah

sinful spade
#

but this is the things that my players want to see.

icy panther
#

i got that

#

they need a delete option?

sinful spade
#

yep

#

^^ skills are player to player and can be gained/lost

icy panther
#

right, my point is you can have more tabs for more options,

sinful spade
#

huh?

icy panther
#

also if you remove the base dice header, it'll allow it to collapse more

sinful spade
#

oh, the dice are buttons

icy panther
#

you can have more than 1 item displayer per item

sinful spade
#

sir

#

this is a dtable

#

not an item displayer

icy panther
#

oh

#

nm then lol

sinful spade
#

THOUGH converting skills to an item would let me give them little icons

#

oh i do love little icons

icy panther
#

I don't use d.tables, they never work right for my uses

sinful spade
icy panther
#

i have everything as items

sinful spade
#

in fact

#

that table you see

#

references another dtable 😄

#

its a nested dtable!

#

oh and @broken quiver
when you get ready to beautify your sheet hmu

icy panther
#

oh god

broken quiver
#

:>

icy panther
#

so let me ask, I know that you like pretty dice icons, but why not just make the formula a button?

#

then you can lose the dice

sinful spade
#

🤨

#

make the formula... a button...

#

replace my dice button...

#

im not following

#

also when i said i like little icons

#

i meant i could get a little running icon for the run skill

icy panther
#

well under the total column, you have 3d6+1, that could be a button

sinful spade
#

like so

#

oh i see what you mean.
Yeahh - i did consider it but the visual queue is consistent across the sheet

#

wanna roll your attack with a weapon?

#

dice button

#

would be weird to change it

#

guess i could prefix the total with a dice tho

icy panther
#

i mean to make it less cluttered, the only ways are to either shrink the column widths or lose a column, or widen the whole sheet

sinful spade
#

defo not widening the whole sheet

#

i hard locked it

#

i'd have to adjust (everything)

icy panther
#

i didn't think so, bet that would screw up all the other formatting

sinful spade
#

i even disabled the resize handle 🤣

icy panther
#

so we're down one option

sinful spade
#

oh.

#

dude

#

i got it

#

LITTLE ICONS

#

always the answer

#

custom made little uh... emblems showing the skill level

#

smaller than the dropdown, and less words

icy panther
#

see bounce ideas 😉

sinful spade
#

^^ 100%

#

now i just got to make... 10? little custom emblems

#

that sounds kinda fun tho

icy panther
#

oh you love it

sinful spade
#

i've had a desert theme for this sheet...
Hyroglyphs would be sick

icy panther
#

cool

icy panther
sinful spade
#

oh... right...

#

sleep

#

yeah that's a plan

void spire
#

Hi Everyone.
I have some issue with implemeting the roll. Basically, what I'm interesting in achieving would be:
player choose the Attribute or Skill. Then he is prompted to choose the secondary Attribute (or just an Attribute if he has choosen a Skill). The propting part is easy, I've managed it with ${#concat( ?{Attribute:'Choose Second Attribute' |"Strength"|"Dexterity"}, etc., but the roll composed of the pool of number of dices based on the Attribute + Attribute or Skill + Attribute is not working.
I'm using the roll formula ${Pool:=Attribute+Strength}$
${Pool:=:Attribute:+Strength}$
I'm almost sure, that the issue is with the choosing of the Attribute. The value field key for attributes are set as the Strength, Dexterity, etc.

void spire
#

Thank you 🙂

broken quiver
#

alrighty. I am using user input templates to do something very similar to the gn0me above me. I have two different lists of skills, each with a numerical level value. Using the input templates I made dropdowns for both lists. A key for one of the dropdowns is "selected_skill"

the "brace_level" key has a numerical value of 2.

I am able to use "ref(selected_skill)" to get the correct value (2, in this case) back. i am not able to use "[:selected_skill:d6]" to turn that value into, for example, 2d6.

but "[:brace_level:d6]" works fine.

Color me confused. Anyone have any insight?

#

here is an example of my roll message for the button I am wanting to program. I'm positive im just missing something obvious and need someone to point it out.

formal goblet
broken quiver
#

Thank you for the response! Is there any way I can use the dropdown value as basically a prefix to a roll? I.e. using the "selected_skill" value to add dice? Or is that not possible with how i'm doing it/at all? I've read through the faq and the wiki in general and it doesn't seem to mention anything like that.

#

The game system i'm trying to build is a bit confusing, it's written by a friend of mine, so if any more insight is needed please let me know :)

broken quiver
#

That was such a simple solution i might explode from embarrassment. Thank you so much.

sinful spade
#

Plus it clarifies that the thing being called is a key and not a function

formal goblet
sinful spade
#

If it doesn't work the first thing I try is removing the ' '

#

😅 it's very unoptimal but it's the only thing that makes sense

formal goblet
#

The only thing that helps, is thinking only in inputs and outputs, the most rudimental logic you can think about.

sinful spade
formal goblet
# sinful spade I'm familiar with formal logic but I'm not sure how that relates to the use case...

Then let's do an exercise. We'll assume we have the following values within our sheet:

{
"Strength": 7,
"SelectedSkill": "Strength"
}
  1. How do you get the value of SelectedSkill? (Input: SelectedSkill, Output: 'Strength')
  2. How do you get the value of Strength? (Input: Strength, Output: 7)
  3. How do you get the value of the property, that is referenced by SelectedSkill? (Input: SelectedSkill, Output: 7)
sinful spade
formal goblet
sinful spade
#

I'm on mobile 😅 it autocapa

formal goblet
sinful spade
#

So why would 3, with the single quote that's supposed to return a number return strength in quotes

#

That one seemed the most straight forward

formal goblet
sinful spade
#

As an output? Nothing? As an input ? Conversion to a number no

formal goblet
#

In programming languages, the former is a variable or a keyword and the later is a string (which is a data type for text).

A mathematical example:
Let's assume that x = 3. Given we have the linear function f(x) = x + 5. In this case, x will be replaced with 3 and the function would resolve to f(x) = 8. The equivalent in JS would be:

const x = 3;
const fx = x + 5;

Same case, fx would return 8. Now, what happens, if we use quotes?

const x = 3;
const fx = 'x' + 5;

In this case, the x is not a variable anymore, thus won't be automatically substituted by the respective value (3), because we told our programm that x is a text and not a variable. In this case, the result would be 'x5', because the + -operator does a concatenation instead of an addition, if one of the operands is a string instead of both a number).

sinful spade
#

Wait so in js quotes marks variables as strings?? But in csb they try to convert to numbers?

formal goblet
#
  • ${Strength}$ would return 7
  • ${'Strength'}$ would return 'Strength'
sinful spade
#

ref('selectedskill') returns str then
And ref(selectedskill) 7?

sinful spade
#

Strength also returns 7
But 'strength' str?

formal goblet
#

Well, if you have something like ${7}$, it would return 7

sinful spade
#

Right...? But can't that also be a character / string and not a number value?

#

And if I '7' it'll be a string

formal goblet
#
  • ${7}$ => 7 (number)
  • ${'7'}$ => '7' (string)
sinful spade
#

Ok that makes sense

#

Thanks for the clarification. I think I get it, but I'll need to try it over the next few buttons I add to see if I get it consistently

#

I do really appreciate you taking the time to help me out, even though it's not a csb issue ♥️

#

I've always been a power user at best 😅 never really one of those techy people

glossy hare
#

Hi, i'm having a hard time making an item displayer filter formula.

not equalText(item.custo,"reacao") or not item.acaoCheckboxAtaque

Why it is ignoring the second part of the expression?

sinful spade
#

I don't think "or" is code speak?

Try ||

formal goblet
sinful spade
#

😅

#

Nevermind then

formal goblet
#

Maybe an issue with operator precedence, but I'll take a look in the docs of mathjs

glossy hare
#

i will probably have to use ternary operators

formal goblet
#

The order is not > and > xor > or

glossy hare
#

i did this:
not (equalText(item.custo,"reacao") or item.acaoCheckboxAtaque)

#

i think it will work?

#

it works, but i don't know if this logic has a flaw

#

lol

#

Anyway, @formal goblet thanks 🩷

formal goblet
#

With the parens, the or will be evaluated before the not

glossy hare
#

I'm making this...

formal goblet
glossy hare
#

i'm doing this, because i have an item template called "action" and other called "weapon"

#

@formal goblet I was typping a long text, and then i realized. "Why i'm using not?"

sinful spade
glossy hare
#

i will later show a big showcase

glossy hare
#

you can make big things with CSB if you make a module that changes it.

sinful spade
sinful spade
glossy hare
#

@formal goblet i remembered why i put the not in the expression. The expression is for the "actions" tab in the sheet. I have one item template, "actions" , i want to organize it based them being attacks, reactions and other type of actions. The not is for excluding everything that is an reaction or an attack.

median mirage
#

Is there a way to reference the Actor object from sheet variables for passing into things like macro.execute?

median mirage
#

Ah, thanks

sinful spade
#

The librarian.... ARCHIVIST!!! YOU HAVE COMPETITION

median mirage
#

👀

sinful spade
#

Fight to the death now for our entertainment!

steep solar
#

Hey,

I am new to the Custom System Builder and some time ago made a character sheet for my own system. Now I wanted to improve it so I have small question before delving into looking specific formulas for that:

  • Can you actually make either a pop-up windows for skill or made description to them hide/show when clicked on some button?
median mirage
#

I'm working with a friend to get a macro working, we're having issues running this in the label roll message

%{return await game.macros.getName('MainRoll').execute({diceVal: ${sameRow("pow_val")}$, rollName: ${sameRow("pow_name")}$});}%

specifically we can get it to work with: %{return await game.macros.getName('MainRoll').execute({diceVal: ${sameRow("pow_val")}$});}% but the second calculated variable causes issues
The error we get is missing } after property list, but we can't see anything missing

formal goblet
steep solar
fringe silo
#

So i want to string multiple roll formulas togeather and have a drop down on an item checked to see what part to roll is this how i would do it. <th><tr> ${item.name}$ </th></tr>
<th> ${lastDOS}$ Degree's of Success! - ${switchCase(item.abilityrank, '1', "Iron" , '2' , "Bronze" ,'3', "Silver" , '4' , "Gold" , '5' , "Diamond" , "None")}$ - ${item.abilitylv}$ </th>
${equalText(item.ability_type_drop, ‘damage’, (<tr><td>Base Damage: ${!basedam:=item.damagedrop * item.abilityrank}$</td>
<tr><td>Total Damage: ${!((basedam + item.abilitylv) * lastDOS)}$ ${!item.damagetypedrop}$ Damage</td>
${#setPropertyInEntity('item', 'cooldown_active', item.cooldowndrop)}$
${#setPropertyInEntity('self', 'lastDOS', 0)}$) or ${equalText(item.ability_type_drop, ‘healing’, (<tr><td> Base Healing: ${!baseheal:=item.healingdrop * item.abilityrank}$</td>
<tr><td>Total Healing: ${!((baseheal + item.abilitylv) * lastDOS)}$ Healing</td>
${#setPropertyInEntity('item', 'cooldown_active', item.cooldowndrop)}$
${#setPropertyInEntity('self', 'lastDOS', 0)}$
</table>)

formal goblet
fringe silo
#

is there a way to string more than 2 togeather, there are 9 of them

#

i currently have 9 buttons and it makes the char sheet huge

formal goblet
#

It is used for comparing stuff, not for concatenation. Use concat() if you want to combine strings together.

fringe silo
#

so, concat{item.ability_type_drop, 'key' , (formula), or concat(item_ability_drop, 'key', (formula) ......repeat for each entry?

formal goblet
#

It just combines strings together. Nothing more, nothing less.

fringe silo
#

@formal goblet so pretend your talking to someone whos only coding experiance is CSB, (cause you wont be pretending) with 200 hours working on a system, all with help from the wonderful people on this channel, so when you are think this dude is stupid your prolly right....lol, im looking this page and it makes some sense to me but have no idea where to start.

formal goblet
#

Wait a sec, do you want to output a conditional message with either Damage or Healing?

manic crypt
#

As I understand it, he wants to have a single button column in an item displayer that will execute different code based on selections made in dropdowns on the item.

fringe silo
#

@formal goblet yes, im looking to output a diffent roll repending on a drop down entry all on a single button

misty terrace
#

I think I've asked this once, a long time ago. I'm using a Label Roll message to execute a separate macro to roll an attack and damage and build and show a chat message. That all works fine, but after the macro finishes, I get a separate, blank chat-card which is, I'm sure, coming from the label roll message getting the %{return}% from the macro.

Any strategies to conceal or prevent this?

sinful spade
#

you mean this message? 😄

fringe silo
#

this is the roll i have inside the new template for damage powers,<table>
<th><tr> ${name}$ </th></tr>
<th> ${self.lastDOS}$ Degree's of Success! - ${switchCase(abilityrank, '1', "Iron" , '2' , "Bronze" ,'3', "Silver" , '4' , "Gold" , '5' , "Diamond" , "None")}$ - ${abilitylv}$ </th>
<tr><td>Base Damage: ${!basedam:=damage_per_rank * abilityrank}$</td>
<tr><td>Total Damage: ${!((basedam + abilitylv) * self.lastDOS)}$ ${!item.damagetypedrop}$ Damage</td>
${#setPropertyInEntity('item', 'cooldown_active', cooldowndrop)}$
${#setPropertyInEntity('self', 'self.lastDOS', 0)}$
</table>
Getting a bunch of errors on it but id imagine that it is something to do with how im telling it to look for things but im a scrub lol

sinful spade
#

Do i have to do something different to <img src=""> in a dyntable?
I've put working links from other parts of the page to test but it's just giving broken link icons.

fringe silo
#

this is the orginal roll that was not on an item and worked, <table>
<th><tr> ${item.name}$ </th></tr>
<th> ${lastDOS}$ Degree's of Success! - ${switchCase(item.abilityrank, '1', "Iron" , '2' , "Bronze" ,'3', "Silver" , '4' , "Gold" , '5' , "Diamond" , "None")}$ - ${item.abilitylv}$ </th>
<tr><td>Base Damage: ${!basedam:=item.damagedrop * item.abilityrank}$</td>
<tr><td>Total Damage: ${!((basedam + item.abilitylv) * lastDOS)}$ ${!item.damagetypedrop}$ Damage</td>
${#setPropertyInEntity('item', 'cooldown_active', item.cooldowndrop)}$
${#setPropertyInEntity('self', 'lastDOS', 0)}$
</table>

#

but does not work on an item

#

some keys have been changed on the sheet

misty terrace
sinful spade
fringe silo
#

do i have to tell a roll on an item to look at self to get it to look on the character template for the info or can i just use the componet key of the componet i want to look at

raven raven
#

Is there any way to create a script that pops up a window for all my players?

formal goblet
dense verge
#

Apologies if this is a very basic question as I'm sure it is. I'm just trying to get my head around things I'm very new to this. In the Custom System Builder Example file I can see that they have a Mod column in the Attributes Dynamic Table, how is it possible to change a specific rows value dynamically based on a key elsewhere?

void spire
#

Hello.
I'm strugling with two topics:

  1. Trying to update the value of one tracker (for Homemade Mage the Ascension rules) - Paradox if the result of the roll is lower then 6. I came out with this, but it's not working:
    <p>Paradox check ${#Paradox:=[1d10]}$
    ${!Paradox > 5 ? 'successful' : 'failed'}$</p>
    ${Paradox < 6 ? setPropertyInEntity('self',ref(Paradox), "Paradox+1") :}$
  2. Is there any way to display with each roll based on a dynamic number of dice a number of 1 (so, in case of 5 dices, if the results would be 3, 7, 1, 8, 1 I would like to have a text message: Number of 1's: 2)? I have this formula and it's working as expected, but the results of specific rolls are hidden:
    <p>${#concat( ?{Attribute:'Choose Attribute' |'Strength'|'Dexterity'|'Charisma'|'Manipulation'|'Composure'|'Intelligence'|'Wits'|'Resolve'},
    ?{Modification[number]},
    ?{Specialization[check]})}$
    ${#Pool:=ref(Attribute)+Athletics+${Specialization?'1':'0'}$+Modification}$
    <p>Dices: ${!Pool}$</p>
    <p>${!Attribute}$+Athletics Roll: ${[:Pool:d10cs>5xo10]}$</p>
sinful spade
sinful spade
dense verge
void spire
sinful spade
#

Try changing the name of your saved variable to something else. It may be conflicting

#

ParadoxRoll?

void spire
# sinful spade ParadoxRoll?

Yup, tried this:
<p>Paradox check ${#Par:=[1d10]}$
${!Par > 5 ? 'successful' : 'failed'}$</p>
${Par < 6 ? setPropertyInEntity('self',ref(Paradox), ref(Paradox)+1) :}$

#

Still got an error

sinful spade
#

As far as hidden rolls # is what hides them -- also you can use js to count and filter?

#

Any error in console?

sinful spade
dense verge
sinful spade
dense verge
void spire
#

With this the same error:
<p>Paradox check ${Par:=[1d10]}$
${Par > 5 ? 'successful' : 'failed'}$</p>
${Par < 6 ? setPropertyInEntity('self',ref('Paradox'), ref('Paradox')+1 :}$

sinful spade
sinful spade
#

There's also a missing parenthesis on the setproperty

void spire
sinful spade
void spire
#

I'm not sure if this is what you meaned:
<p>Paradox check ${#ParadoxCheck:=[1d10]}$
${!ParadoxCheck > 5 ? 'successful!' : 'failed!'}$</p>
${ParadoxCheck < 6 ? setPropertyInEntity('self',ref('Paradox'), (ref('Paradox')+1)) : ''}$
The Paradox value is a number field in a table (the same, that has a ParadoxCheck field)

sinful spade
steep solar
#

Can anyone tell me what is the formula to reference the "component key" that is inside the item in item container?

I wanted to make in item container, columns that list few elements from the put there items, but whenever I reference key component, it only works if the said component is inside the sheet itself.

void spire
sinful spade
# dense verge Thank you!

didnt forget about you,
apparently i dont have that formula, Let's try something like this:

    sameRow('nameColumnName'),
    "Strength", ref('strength_mods'),
    "Dexterity", ref('dex_mods'),
    "Constitution", ref('con_mods'),
    "Intelligence", ref('int_mods'),
    "Wisdom", ref('wis_mods'),
    "Charisma", ref('cha_mods'),
    0
))}$```
void spire
sinful spade
void spire
sinful spade
#

oh wait i see ! avoids the explination, # avoids the roll value

void spire
sinful spade
#

yo dont yell /s

void spire
sinful spade
#

the /s meant i was kidding sorry

#

meant (sarcasm)

#

lol

sinful spade
#
<p>Paradox check: ${#ParadoxCheck:=[1d10]}$ 
${ParadoxCheck > 5 ? 'successful!' : 'failed!'}$
</p>

${#IncreaseParadox:=ParadoxCheck < 6 ? (Paradox + 1) : Paradox}$ 
${setPropertyInEntity('self', 'Paradox', IncreaseParadox)}$
void spire
#

You are trully a magical 😁 Just modified some details, but it worked 😆
<p>Paradox check: ${#ParadoxCheck:=[1d10]}$
${!ParadoxCheck > 5 ? 'successful!' : 'failed!'}$</p>
${#IncreaseParadox:=ParadoxCheck < 6 ? (Paradox + 1) : Paradox}$
${#setPropertyInEntity('self', 'Paradox', IncreaseParadox)}$

sinful spade
#

yeah i was debating if the ! was causing it or not so was gonna try it without it 🤣

void spire
#

Don't want to push my luck 😏 , but do you know a way to display a number of 1 in the roll, as discribed previously?
I got this formula, which is working, but the result is hidden, so it would be great if I could just have display of number of 1's rolled by a player.
<p>${#concat( ?{Attribute:'Choose Attribute' |'Strength'|'Dexterity'|'Charisma'|'Manipulation'|'Composure'|'Intelligence'|'Wits'|'Resolve'},
?{Modification[number]},
?{Specialization[check]})}$
${#Pool:=ref(Attribute)+Athletics+${Specialization?'1':'0'}$+Modification}$
<p>Dices: ${!Pool}$</p>
<p>${!Attribute}$+Athletics Roll: ${[:Pool:d10cs>5xo10]}$</p>

sinful spade
#

but you can try ^

#

actually math js has

math.count(x) Count the number of elements of a matrix, array or string.

#

and

math.filter(x, test) Filter the items in an array or one dimensional matrix.

dense verge
sinful spade
#

same with the nameColumnName for the column containing the value name

dense verge
sinful spade
dense verge
# sinful spade yep

${setPropertyInEntity('self', sameRowRef('pc_mod_attack_stats'), switchcase(
sameRow('pc_attack_stats'),
"Might", ref('pc_might_mods'),
"Agility", ref('pc_agility_mods'),
"Intellect", ref('pc_intellect_mods'),
"Insight", ref('pc_insight_mods'),
0
))}$

are the keys I am using

sinful spade
#

try replacing ref('strength_mods') with just
strength_mods
make sure it's all accuragte to the component keys you're actually using, also it is case sensitive so your text field, with saying this is the strength row needs to be exactly Strength

#

quick question but do you plan to add more stats during the game?

#

because you may be better off using a regular table if not.

#

wait im a fool, we dnt need to setproperty in a dynamic table

dense verge
#

probably making it a complete mess to work with in the process

sinful spade
#
    sameRow('pc_attack_stats'),
    "Might", pc_might_mods,
    "Agility", pc_agility_mods,
    "Intellect", pc_intellect_mods,
    "Insight", pc_insight_mods,
    0)}$```
#

generally speaking -- dynamic tables are meant for things that change a lot. Inventories, etc.
I use mine for my skills because skills change on a per player basis and may be gained during a session.

#

tables are for static elements that dont need more rows added / subtracted and are much easier to work with

void spire
# sinful spade try ${count(filter(arrayname))}$

Not working correctly, but I can live with this.
For this formula: <p><b>Correspondence Roll</b> ${roll:=[:Pool:d10cs>5xo10]}$</p>
<p><b>Number of 1's</b>: ${count(1(roll))}$</p> got always result "1", so something is wrong with it 🙂

sinful spade
#

count(1(roll)) doesnt reem right?

dense verge
sinful spade
#

anything useful in console? press f12 and look for red boxes

dense verge
sinful spade
#

if you will always have your 4 stats in this table, a regular table is 100% the way to go

#

but if you need the # of rows to change, e.g. inventory, gaining/losing skills/titles -- dynamic tables.

#

i wonder why it's erroring and not reducing to the fallback value 🤔

#

wait pc_might_mods doesnt exist for you does it

#

did you update all those values

#

bc what you sent back had the same component keys

#

as what i entered for the template

void spire
dense verge
sinful spade
dense verge
sinful spade
#

is it a number field or a label?

dense verge
#

it is a label

sinful spade
#

im so lost facepalmpicard

dense verge
#

both the column and the key reference are labels? could that be an issue?

sinful spade
#

probably doesnt matter but

sinful spade
dense verge
sinful spade
void spire
dense verge
#

do I perhaps need to reference the column name instead of the column key?

sinful spade
#

${sameRow('pc_attack_stats') == 'Might' ? pc_might_mods : ''}$
${sameRow('pc_attack_stats') == 'Agility' ? pc_agility_mods : ''}$

#

@dense verge ^ try something like thast.

sinful spade
dense verge
#

it now gives me 4 errors in each row in the mod column 😂

#

I added Intellect and Insight fyi

sinful spade
#

how tf

#

even then ??? if its not == it should just be nothing

#

can you copy exactly what you put here?

void spire
sinful spade
sinful spade
# void spire yes

ok i got fed up and asked the AI overlord.

${#onesCount:=length(split(join(roll, ","), "1")) - 1}$
${onesCount}$```
void spire
sinful spade
# void spire Oh, need to try this 🙂

you need to train your chat to understand the limits of CSB and foundry in tandem but once you do, it tends to be very helpful. Though you'll spend a long time telling it 'no not that'

#

Nosferato and i had this convo the other day lmao

sinful spade
void spire
sinful spade
dense verge
sinful spade
#

^^ i was gonna say lol you gotta refresh the character sheet

dense verge
#

I'll restart the software and try the ? logic again

sinful spade
#

we can try that, but i'd also need to see more of what you're doing to follow

sinful spade
#

if its 1 number it's not an array

dense verge
sinful spade
#

heyhey ! we're on the right track then

#

try just removing the uh ' '

sinful spade
dense verge
sinful spade
dense verge
#

I'm aware of an equalText ? Could it be that its a string?

dense verge
sinful spade
#

and 'Motor', the skill name, is just a text field.

dense verge
#

hmm

sinful spade
#

just for funsies,

${sameRow('pc_attack_stats') == "Might" ? ref('pc_might_mods') : 
  (sameRow('pc_attack_stats') == "Agility" ? ref('pc_agility_mods') : 
  (sameRow('pc_attack_stats') == "Intellect" ? ref('pc_intellect_mods') :
  (sameRow('pc_attack_stats') == "Insight" ? ref('pc_insight_mods') :
  0)))}$```
#

oh wait, csb needs parenthsis for that.

#

there

dense verge
#

I'll try with 'Might' and Might

sinful spade
#

can i have a screen shot?

#

of component labels

sinful spade
# void spire

yeah okay i have no idea how rolls are stored at this point. you'll need martin i think

#

just rememeber, i've only learned what i have by breaking everything. I cant code. he probably has something that'll work in a heartbeat lol

void spire
sinful spade
#

eh helping y'all really helps me understand more of what im doing lol

#

its no problem

dense verge
sinful spade
#

Comparison operators don´t work on string-values, so ${DropdownKey == 'Dexterity' ? 1 : 0}$ for example would
throw an error. You should use equalText() instead if you want to compare 2 string-values on equality. Example:
${equalText(DropdownKey, 'Dexterity') ? 1 : 0}$

#

you were right about equalText 😩

#

weird that i was able to == outside of the table

#

but inside i guess you're stuck with that

dense verge
#

DropdownKey sounds like its going to be very useful! I'll test that out now, thank you so much, you've been incredible helpful

sinful spade
#

so that'd be...?
${equalText(sameRow('pc_attack_stats'), 'Might') ? dothis thing

sinful spade
sinful spade
#

🤣 oh.

#

@late heart ^^^

#

@dense verge

${equalText(sameRow('pc_attack_stats'), "Might") ? ref('pc_might_mods') :
  equalText(sameRow('pc_attack_stats'), "Agility") ? ref('pc_agility_mods') :
  equalText(sameRow('pc_attack_stats'), "Intellect") ? ref('pc_intellect_mods') :
  equalText(sameRow('pc_attack_stats'), "Insight") ? ref('pc_insight_mods') :
  0}$