#Custom System Builder
1 messages · Page 49 of 1
That only happens at the end of all, not immediatly
even though I only have 1 element, it's still not text
It returns an Array
however find() will only be text right?
That will actually return a scalar value (string, boolean, number or undefined)
but then i can use string() on the find
It's sufficient to only use find() if your entry in your column is a string
ok
And UUIDS are strings
right, I am just trying to get a step to work, will figure out how to break and use the arrays from lookup later
To what Component does Dynamic_Equipment_Table refer?
You have multiple mismatches, that was just one of them
cool
Do you like puzzles?
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.
right
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?
I have not seen a function within CSB that takes an object
Right. Your fetchFromUuid() would return an Object, which would get passed to alookup(). That's your second mismatch.
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?
The user input template doesn't matter. The properties it is calculated with stay the same.
it is not the same item
So your reference point is your Actor
the uuid contains the actor id aswell
That doesn't matter. The UUID is a chain of all Document IDs
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.
i understand that
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.
allowing to fetch data from other documents
Not only that. You can execute whole formulas with the properties of the Document
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
The second argument of fetchFromUuid() must be a string in form of a formula
Now you solved the puzzle
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
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 🤓
2 and 3 can be merged to ${result:= [:cyber_total_val:d6cs=6]}$
That fixed it! Thank you!
Hi, is anyone out there familiar with Chivalry and Sorcery 5th edition?
what's the issue?
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
Could you then show me where you added it please?
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.
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...
I am pretty much the same way, just not have the money to pay someone
maybe this will help
#systems message
Ah yeah, Martin had mentioned that second channel, thanks!
@mental jay click on the link 🙂
This is the order of execution:
yes, I understand the order, not how to change step 3 to step 5
I thought that was what the ComputablePhrase was for
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
I don't see any refence to function computeMessageStatic()
That's a static function
These are usually the same as system.props in any entity, where the formula is being resolved
The links in there should help you getting familiar with the data structure of Foundry: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Guides/Formula-System#33-script-expressions
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?
${}$ are normal CSB-Formulas. These are computed with the properties in system.props. Because the relative path is already set in system.props, you have to use Strength instead of actor.system.props.Strength, because you can't go backwards in the property chain
In Scripts and Macros, you have to use the full chain like entity.system.props.Strength
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
Everything inside %{}%, so yeah JS inside Labels or any kind of computable field
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.
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
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?
copy and paste
That or a semi-complex script
That is effectively copy & paste
And that only helps with dialogs
it depends on what he is doing with it when hitting roll
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});
cool, i didn't know about that option
Just scraped it from the workaround with dice pools: https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Handling-Dice-Pools
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
so I need to replace 'phrase' with the key of the label roll message i want to role, then copy paste the rest and it works?
ngl idk how any of this works
Basically, yeah
And the script delimiters with %{}% ofc
what
whats a script delimiter?
the whole thing?
CSB-Formula-delimiters ${}$ vs Script delimiters %{}%
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?
I mean you can try, but the result will be not as you'd expect at first
The part with the script delimiters is right
mine changes the values of dropdowns and i dont think it'd be helpful to you but i'll get it to you next time i open the server. It may not be today though
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?
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?
The second option is what I'd do.
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);}%``
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
sum(lookup())
textfield ? textfield : 'No value'
Thank you!!
The Label lets you do that if you use HTML. Same as with the RTA
Maybe he wants to store the image in the field and not upload in foundrydatapath and use with <img …>
Is there an easy way to sum up the column of a dynamic table?
^
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?
It's a complex issue, there's no easy answer for this
I see, thanks for a quick response. This is what I'm currently working on. Really enjoying using this tool btw its very cool.
every time i increment the level it takes a bit to update to the next factor of 3. oh well.
You can open the console to see what happens. That might help you a bit to understand, what is going on under the hood
how do i access that? is that a keybind?
F12
cheers
it seems that using the increment and decrement buttons (show field control) makes it take a bit. inputting a number manually and hitting enter does it instantly.
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?
How do I make items added onto the sheet add 1 to the quantity (making a stack) rather than adding a copy?
I dont think that's natively supported.
You'd effectively have to code your own item displayer with different properties.
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.
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')}$
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?
Did you build the whole sheet on a table in the header section?
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
Yeah, that's what I did. I guess I did use the header section? I wasn't aware of other places D:
Generally use panels for flexible content and tables for rigid displays.
Then use CSS to make it look the way you want it
Generally use panels for flexible content and tables for rigid displays.
Then use CSS to make it look the way you want it
Ahhhh, I see I see...
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?
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?
likely several compendiums bundled into a module
foundry UI supports this
The most up-to-date guide teaching you how to quickly and easily create a Shared Compendium module for your FoundryVTT games! Share all your custom content across all of your games, and always have your most important scenes, actors, and items on hand! All from within Foundry V11!
CHAPTERS
0:00 - Intro
0:23 - V11 Navigation
0:55 - Create Module...
I'd bundle Templates into Adventure packs and the rest into their respective packs
oh wow i never knew that was a foundry native feature.
I thought house divided custom coded that
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>```
i see you have result >= 1 ? 'success' : failure
is this part of your code working properly?
if so, change success to:
'<span style="color: green;">Success</span>'
and the same for failure
It is, and I tried span and it didn't work.
lets try overriding csb default
'<span style="color: green !important;">Success</span>'
<span style="color: ${!result >= 1 ? 'green' : 'red'}$">Your text</span>
i think he wants it to say success or failure in green or red respectively.
Yeah, and?
is that code not just changing the color of the same text?
Yeah, and?
... ok
He already has the part about changing the text, so just applying it shouldn't be an issue
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.
is there a way i can make this MORE* aligned?
Probably need to use some css to align it
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.
I'm pretty sure CSS class stuff is outside the scope of the CSB system and guide. But Martin would know for sure.
Yep, it is. We ensure, that you can provide your own CSS-classes, but that's it. Fiddling with CSS is your own responsibility.
You're probably going to want to use the vertical align property
thanks for the responses gentlemen!
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 ♥️
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
Can you post the signature/description of this static function?
I'd make an invisible number field, that's referenced to display as the label you have now.
Then have the next round button
Set property to Ref the display + 1
For part 2:
${setPropertyInEntity('self', lookupRef('dynamicTableKey', 'targetColumnKey'), false)}$
Not sure if I fully understand what you're asking. I set up an animation in Automated Animations named "Rifle". The macro that contains the code above is called from a Label Roll Message on the item in the character sheet. The rollName parameter contains the ${item.name}$ from the sheet (in this case it is "Rifle")
Happy to post the entire macro here, it's a doozy that needs to be cleaned up
I need to know what AutomatedAnimations.playAnimation() does
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
I'd say a mismatch between Actor/Token in the first argument
The description says, it needs a Token. You provided an Actor (I assume)
Oh, probably!
let me try that!
getting a different error, so progress!
thanks Martin
How do I get the token img? I'm using the wildcard option and I only know about return entity.entity.img
From?
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
There's no direct connection from Actor to Token, only the other way around
Because 1 Actor can have multiple Tokens
Ah, that sucks, but ok I'll do it another way then 😄
you can use prototype token i beleive
but i think the issue with this is actually with your styling?
I use <img src="${!%{return entity.entity.img}%}$"> just fine from character sheet -> image in chat
try uh
<img src="${!%{return entity.entity.img}%}$" style ="width: 50px; height: 50px;">
Has anyone figured out how to use a text field as a check box? like - if it has contents, true, if not false.
Can you check the length of the value to see if it has contents?
i mean that'd logically work, how to implement? no clue.
I've been trying things like
ref('val') string(ref('val))
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?
!val ?
Value expected (char 1) lol
if inspected empty fields are just ""... but checking if ref('val') == "" tries to convert to a number 🤔
count(ref('val')) seems to be working
${count(ref('key')) == 0 ? "false" : "true"}$
Or just not(textfieldKey)
Not sure what I'm missing or doing wrong here.
The second half of this roll message works as it should - it clears out the checkboxes. But the first half doesn't seem to increment the referenced round number. round_counter is the key resolving to 1 under the Round Number table on the right.
the number field that wasn't visible was an important step.
When you said invisible, I assumed you meant hidden attribute.
not a hidden attribute so to speak.
a number field that has it's visability formula set to false
I see.
i dont actually know how hidden attributes work 🤣 never had to use them
And I don't know very well how visibility formulas work, haha
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
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.
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.
to be more correct, your code will set the value in 'round_counter' to string("+1"), not increment it by 1
'round_counter+1'
I feel like I've tried dozens of permutations of that, and none of them actually work to increment.
have you tried, ${setPropertyInEntity('self', 'round_counter', 'round_counter+1')}$
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
It's not a Dynamic table, sameRow won't work.
I even tried ${setPropertyInEntity('self', 'round_counter', (ref('round_counter')+1'))}$
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")
I already know that won't work because I'm working solely within the actor and its template. No items involved.
then just needs formatting correctly
That's what I'm struggling with. I feel like it's so close
${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
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.
right
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! 😄
np
How are you triggering the round increment?
Manually pressing the Next Round button.
Unless I didn't understand?
you mentioned it was on an actor
The initiative tracker itself is an actor is what I meant, yes.
so it's a label roll message?
ok figured it out
Oh?
All that in the label roll message as is?
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?
any errors in the console?
why do you have a lookupref?
your trying to set the value of 'init_drag', which doesn't exist
No errors
what is the second part supposed to do?
That was what Martin suggested here #1037072885044477962 message
init_drag is the dynamic table name. The second part is supposed to clear the checkmarks off the boxes below, which it does.
right
yet it's still not incrementing?
can you show a screenshot of the round_counter componant?
here's mine
Still no.
With the console open, each time I try clicking Next Round this line just keeps adding +2 to the number on the left but no errors.
yeah thats normal behaviour
this is the point of the invisable numberfield.
Perhaps that's why. Mine's not a number field, it's a label referencing the attribute.
you can set the numberfield = to the referenced value + 1
which seems crazy but it's the same thing, displays the same way
yes
but avoids recursion and actually works with the setProperty
Yeahhhh, now it works.
well the whole problem is trying to update a label, which you cant do
...yeah.
but you can update an invisable numberfield that's referenced by a label
like i mentioned a few hours ago
yes
🤣
i wsn't here then 😛
didnt mean you lol
And here I thought that was an extra unnecessary step. Derp, oops!
😬 i even said it's an important step
so this would have worked just fine from the offset
${setPropertyInEntity('self', 'round_counter', "round_counter+1")}$
I think part of the issue early on was that I understood that backwards.
yeah, it should
i've had issues with that exact format but nested in dynamic tables so i just default to the invisble fields now lol
tested, it, it works just fine
in a d.table?
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
Sorry for accidentally making it extra frustrating.
np, I am still learning
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
froma d.table, I would imagine you'd have to use a lookupref to get the cell to update
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.
bruh
just make the numberfield...
invisible
and reference it in the label
😠
you can use a label, doesn't need a key just put in the label text ${round_counter}$
and yeah idk i tried just about everything in the book -- seems like if it was in the table self = self + 1 is recursive.
maybe
it's a little more than I care to try right now
🤣 i feel that
I thought that's what I was doing! 😩
ive been fighting with this meter for about 4 hours now and im about to throw something
Anyway, I'm super thankful for you guys for the help. I'm off to bed for real now. o7
ciao
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
hahaah, I do that with css
now, css i can do
I know, i might get you to help me pretty up my char sheets when I have the fundamentals working
have you been lurking or something? o3o i dont remember talking to you before
and im usually pretty good about that
been lurking for over 2 years
what's the variable you're passing?
i dont see any uh %{}%
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}$
it's at the bottom,
return;
});
}%
${setValues(sameRow('uuid'), 'Assigned_ID', 'diagdropdown')}$
${setValues(sameRow('uuid'), 'Dupe_Uuid', 'new_id')}$```
not sure i follow the question
but just try this for me:
${ref('NumberFieldStat') * 3}$
no ignornace, just misunderstanding, of which I have had plenty
if i understand correclty, surely just this?
That doesn't seem to work either, but I get the sense in it.
is it in a dynamic table or something, no reason that shouldnt work unless your component key is broken
(and by that i mean typos)
I would have thought something similar would work. I'm trying to multiply the initial number by 3, but simple math functions aren't doing the trick
It's in a tabbed panel. Would I need to reference that?
shouldn't, no.
dynamic tables and item containers are just different.
can i get a screen shot or two so i can visualize the problem
this works fine for me
Just a regular panel as well, not a tabbed panel.
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 ^^
Ah ok, so it should be working, I'm just not seeing it.
@sinful spade can't ask chatgpt for CSB problems, it just doesn't understand them
Excellent! I'll try that!
i've trained a chat with it to do so and it's actually fairly accurate
for JS yes, but not for CSB
no, i've trained a chat to work in CSB
it's not perfect but it does work
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
You guys are life savers, thanks!
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
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.
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
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.
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
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
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:```
It beat me, I just threw it all out and went my own way
sadly, it's easier to beat gpt over the head with a broom than it is for me to learn to code JS
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.
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
other problem here.
i've argued with csb and martin enough that i think i get csb, but have 0 knowledge ofJS.
i did, but at the time, it wasn't the right approach
no not yours with the clone, the one i sent ^^
it wont work, I can see that by looking
ok 🤷
i appreciate it though
in JS i have the freedom of using loops, but I cannot use loops when interaction with CSB
🤔 you cant?
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"
hey actually, @misty terrace you have any input here?
this message specifically
I figured it out, and of course something stupid and I would have never figured it out without your chatgpt help 😄
so whats wrong with your meter?
now dont go saying that or open AI will get a big head
i'm on... tack.... to solving it
i think
you can always bounce ideas off me, I find I learn more when I can throw ideas at someone
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.
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 🤣
have you tried,
${healthMax / (healthMax + tempHP)}$
syntaxtically the same
I know
still breaks
🤷 i know the refs are ... erronious but they help me keep track that "THIS THING IS A KEY" lol
surely though your dividing by 0?
how?
healthmax = 20 and temp health = 5
it would be 20 / (20+5)
20/25 = 0.8 but rounded down to 0
oh i see what you mean
so use roundup()
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
hehe
now just to figure out how to get an absolute possitioned mess to right align
well thats your area
<element align: right>
but the same trick aint working.
time to click down arrow till something works
i tried align-self: end;
and justify-self: end;
you don't just have align: right in a css?
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;
and float doesn't work?
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
so it's the overflow, and it's getting hidden?
I did try flex 😦
im currently confering with the oracle
the oracle is not responding... 🤣 i have been abandoned
I haven't abandoned you, but I take it there is more to this meter, because that formula is always < 1
huh? how so
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
so forgive me, but I don't understand where the formula goes
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
Foundry being pedantic
oh your doing something fancy with that health bar
🤣
now I get the formula
it took me 6 hours to figure out how to get the wound system working.
another 5 for the temp hp and shielding
jeezzzz
uh huh, I been at my system 2 years
dude. lol.
i started writing the rules for this system in 2019
total productive work time on it, maybe 3 days
i've been working in csb on and off as the ADHD allows for... nearly 2 years now 🤣
maybe 8 months of actual production
we must be glutton for punishment
looks pretty though
is it totally custom system or based on another?
something along the lines of stolen from so many other systems that it may as well be 100% custom
mines just stolen 🙂
but I want to make it custom, just now working on getting the basic mechanics working before customizing it
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
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
honestly, i'd be willing to throw my entire system out the window if crucible is half what i think it'll be
heard of car wars?
no? o3o
nyway, it's not car wars, but is similar
i assume you're talking about your system?
yes
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.
I kinda understand
i've done exactly this from items but not user input templates 🤔
lol
I've tried to reverse engineer some of the example sheets and userinputtemplates but it's just not doin what I want it to.
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
Both skills and purviews are currently in a table, but i can switch them over to an item displayer if that's more streamlined.
they are added as an item?
No, i have not fussed with items at all. they are labels and numbers displays
Thank you :)
so the values are in a dynamic table?
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
it should be fine, just trying to figure out your setup
ok
so we can directly call the variables
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
ok, so start by creating a userinputtemplate
ayeaye captain
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 🙂
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
"testinput" to be easy haha
the numerical values for skills and purviews are also just keyed as "brace" and "artistry", etc.
so easiest way, you need the keys in the dropdown to match the skills on the sheet
then you can close the input sheet
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
yes, ideally the "callings" will have at least 3 boxes checked at a time
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
so any component on the userinputtemplate will be returned to be used in the roll later
right?
but since it's just a true false check box wont she have to manually key each one in a conditional?
if i tell you how to with a single dropdown, you'll be able to figure it out with checkboxes?
ref('checkbox1') == true ? add Artistry : do nothing
I think so, yes
where we at?
dropdown is in the testinput, testinput is closed
forgot to ask what's the key of the dropdown?
just "purview"
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}$
that brings up the popout and allows me to select from the dropdown
honestly, i wish i did see
im too tired to uh
comprende
I assume so, when i press the confirm, nothing happens? no roll, no chat message (the button is clicked) nothain
savvie?
you have an error somewhere
hmmm ok
push le f12
only one reference, the purview
oh i just noticed i misplet it, so if you copy pasted it, it'll be that
ya
i fixed the typo already hehe
it works?
the console also doens't show any errors
should show as a chat message
hmm i might mess around with the items and see if i can get that to work that way.
Nope, no chat message
items are easy
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
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
and a screenshot of the chat messages
see it's working fine 🙂
but it does Not give me a Number
its giving you your dropdown key
nope, you'll now have to setup the logic to get the number
got it boss(es)
👍 either hand code the conversion logic, or change your keys (i think)
oh my gosh. i forgot to refresh the sheet between tests. THATS why it didn't give me a chat message initially
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
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
lmao
we all forget to refresh, it happens alot
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
@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
adding the proficency dropdown -- but i think it's too cluttered.
got any offhand suggestions?
how do you mean?
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
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
yeah
but this is the things that my players want to see.
right, my point is you can have more tabs for more options,
huh?
also if you remove the base dice header, it'll allow it to collapse more
oh, the dice are buttons
you can have more than 1 item displayer per item
THOUGH converting skills to an item would let me give them little icons
oh i do love little icons
I don't use d.tables, they never work right for my uses
90% of my table is d tables
i have everything as items
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
oh god
:>
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
🤨
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
well under the total column, you have 3d6+1, that could be a button
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
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
defo not widening the whole sheet
i hard locked it
i'd have to adjust (everything)
i didn't think so, bet that would screw up all the other formatting
i even disabled the resize handle 🤣
so we're down one option
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
see bounce ideas 😉
^^ 100%
now i just got to make... 10? little custom emblems
that sounds kinda fun tho
oh you love it
cool
heading out for the night, if you want to bounce more ideas, you can ping me or message me
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.
Thank you 🙂
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.
ref(selected_skill) is not the same as selected_skill.
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 :)
${[:ref(selected_skill):d6]}$
That was such a simple solution i might explode from embarrassment. Thank you so much.
This is why I use ref every time I call a key.
My tiny brain can't comprehend when to use which 😂
Plus it clarifies that the thing being called is a key and not a function
Any luck?
That's also too narrowminded, because something like ref(selected_skill) and ref('selected_skill') are also not the same
Oh yes, I've ran into that problem as well
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
The only thing that helps, is thinking only in inputs and outputs, the most rudimental logic you can think about.
I'm familiar with formal logic but I'm not sure how that relates to the use case of only sometimes do we need to call ref, and ' ' convert to a number -- but not exclusively so and seemingly not always
Then let's do an exercise. We'll assume we have the following values within our sheet:
{
"Strength": 7,
"SelectedSkill": "Strength"
}
- How do you get the value of
SelectedSkill? (Input:SelectedSkill, Output:'Strength') - How do you get the value of
Strength? (Input:Strength, Output:7) - How do you get the value of the property, that is referenced by
SelectedSkill? (Input:SelectedSkill, Output:7)
So
ref(selectedskill)
'strength'
And ref('selectedskill')?
- Unknown function
Ref(). Did you meanref()? - This would output
'strength' - This would output
'Strength'
I'm on mobile 😅 it autocapa
Same here, but I can do something against it
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
What is the difference between Strength and 'Strength'?
As an output? Nothing? As an input ? Conversion to a number no
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).
Wait so in js quotes marks variables as strings?? But in csb they try to convert to numbers?
${Strength}$would return7${'Strength'}$would return'Strength'
No, that's false
ref('selectedskill') returns str then
And ref(selectedskill) 7?
Basically yes
Strength also returns 7
But 'strength' str?
Well, if you have something like ${7}$, it would return 7
Right...? But can't that also be a character / string and not a number value?
And if I '7' it'll be a string
${7}$=>7(number)${'7'}$=>'7'(string)
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
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?
I don't think "or" is code speak?
Try ||
It is a valid keyword in CSB, || isn't
Maybe an issue with operator precedence, but I'll take a look in the docs of mathjs
thanks
i will probably have to use ternary operators
The order is not > and > xor > or
Math.js is an extensive math library for JavaScript and Node.js. It features big numbers, complex numbers, matrices, units, and a flexible expression parser.
i see
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 🩷
I don't know your case, so I can't evaluate it. But that's a valid solution
With the parens, the or will be evaluated before the not
the first half is a dropdown list the second a checkbox. I need to display an item the only if it is a "reacao" or the checkbox is checked. Anything else should return false.
I'm making this...
Then why not? That negates the expression
oh, sorry i forgot. I mean the opposite
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?"
I love this sheet
thanks. it's for my personal homebrew system
i will later show a big showcase
you can make big things with CSB if you make a module that changes it.
Love the hear that!
😂 yep... That's true.
@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.
Is there a way to reference the Actor object from sheet variables for passing into things like macro.execute?
Ah, thanks
The librarian.... ARCHIVIST!!! YOU HAVE COMPETITION
👀
Fight to the death now for our entertainment!
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?
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
you could use user input templates for popouts or
https://gitlab.com/custom-system-builder/custom-system-builder/-/wikis/Tips-&-Tricks/Tooltip-on-hover
%{return await game.macros.getName('MainRoll').execute({diceVal: ${sameRow("pow_val")}$, rollName: '${sameRow("pow_name")}$'});}%
Ok, so it is possible, I just need to find formula fitting that or look for template. That's great.
Thanks, I will check the link in a moment 😄
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>)
equalText() only allows exactly 2 arguments and only returns a boolean.
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
It is used for comparing stuff, not for concatenation. Use concat() if you want to combine strings together.
so, concat{item.ability_type_drop, 'key' , (formula), or concat(item_ability_drop, 'key', (formula) ......repeat for each entry?
That's what it does: https://www.w3schools.com/jsref/jsref_concat_string.asp
It just combines strings together. Nothing more, nothing less.
@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.
Wait a sec, do you want to output a conditional message with either Damage or Healing?
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.
@formal goblet yes, im looking to output a diffent roll repending on a drop down entry all on a single button
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?
you mean this message? 😄
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
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.
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
That's the one I'm thinking of, but not the same thing I was asking.
ah alr.
solved.
I need to start all the way back from "worlds/" unlike normal calls that i can start with ../
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
Is there any way to create a script that pops up a window for all my players?
You'd need to utilize sockets in JS.
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?
Hello.
I'm strugling with two topics:
- 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") :}$ - 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>
Yes you'll need to use the sameRow function along with whatever formula you want to use to determine the new value
Real quick you'll want it to be greater than or equal to six.
As far as your code, what's not working? Is paradox also a key?
So lets say I have a key somewhere else titled 'stength_mods' (this value is not in the dynamic table and is in itself a formula), and I want 'stength_mods' to replace the value that is currently in a dynamic table elsewhere on the player. Where exactly would the sameRow function be added as the only place it seems it can go is in the column header when using a dynamic table?
Ok, for rolls lower then 6, the Paradox should be raisen by 1 (yes, it is a key), for bigger it shouldn't be raisen.
The part which is not working is raising Paradox.
Oh I see your logic. Just waking up sorry
Try changing the name of your saved variable to something else. It may be conflicting
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
As far as hidden rolls # is what hides them -- also you can use js to count and filter?
Any error in console?
Do you want all rows to be str mod?
No, I want each of that column of mods to be a seperate reference to another key
If there's no errors in console. Try adding parenthesis around your +1 section. Is paradox a number field?
Based on...?
Name?
yes based on name would work
I'm not sure about the JS... yes, the Paradox is the number field
With this the same error:
<p>Paradox check ${Par:=[1d10]}$
${Par > 5 ? 'successful' : 'failed'}$</p>
${Par < 6 ? setPropertyInEntity('self',ref('Paradox'), ref('Paradox')+1 :}$
Give me like 20m to get to my PC I'm spacing hard on how to do that by hand but I have that formula laying around. Brains still booting
Your else condition has no value... Set it to ' ' to do nothing
There's also a missing parenthesis on the setproperty
Ok, the only results I got is with this, but it's still not working 😦
<p>Paradox check ${#ParadoxCheck:=[1d10]}$
${!ParadoxCheck > 5 ? 'successful!' : 'failed!'}$</p>
${ParadoxCheck < 6 ? setPropertyInEntity('self',ref('Paradox'), ref('Paradox')+1) : ''}$
Thank you!
Add another set of parenthesis around your math in your formula, the +1 but to make sure that's not it. Secondly is paradox in a dynamic table or anything?
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)
that's what i meant, grouping the ref and the +1. Try just Paradox instead of ref('paradox').
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.
Unfortunatelly, this is still not working 😦
${ParadoxCheck < 6 ? setPropertyInEntity('self','Paradox', ('Paradox'+1)) : ''}$
no ' 's around paradox
item.itemcomponentkey
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
))}$```
No longer error, but the value of Paradox is not changing with fail
setPropertyInEntity('self',Paradox, (Paradox+1)) : ''}$
why is there a ! infront of ParadoxCheck in the success logic?
To avoiding diplaying a formula for a players
isnt that a #?
oh wait i see ! avoids the explination, # avoids the roll value
is haiding the whole syntax, so it's not displaying in the chat
yo dont yell /s
sorry, not on the purpose 🙂
try this
<p>Paradox check: ${#ParadoxCheck:=[1d10]}$
${ParadoxCheck > 5 ? 'successful!' : 'failed!'}$
</p>
${#IncreaseParadox:=ParadoxCheck < 6 ? (Paradox + 1) : Paradox}$
${setPropertyInEntity('self', 'Paradox', IncreaseParadox)}$
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)}$
yeah i was debating if the ! was causing it or not so was gonna try it without it 🤣
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>
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.
Unfortunately just returns Error in the whole column, just to check is the 'statValueColumnName' the 'Mod stat value' column that I want to be changing?
yeah just update it to that column's name,
same with the nameColumnName for the column containing the value name
yes, unforutately not working, just returns error, also just to check the code is also going in the mod stat value's column label text?
try
${count(filter(arrayname))}$
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
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
Yes I have a total of 10 but I've separated them into three different dynamic tables as they work slightly differently
probably making it a complete mess to work with in the process
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
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 🙂
count(1(roll)) doesnt reem right?
count(filter(roll, 1))?
unfortunately still returning an error in the full column
anything useful in console? press f12 and look for red boxes
the only stat that will change is the mod stat, do you think its worth moving it over into a normal table?
like i said, dynamic tables if the # of rows you are using is updating
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
Nope 😦 ${count(filter(roll, 1))}$
no red boxes, ok I will move everything over to a normal table. I'm assuming I can then just use the code ${pc_might_mods}$ for each label? Many thanks for your help!
assuming your component key for might's value is pc_might_mods
is that the correct key?
Yes it exists and is pc_might_mods
is it a number field or a label?
it is a label
im so lost 
both the column and the key reference are labels? could that be an issue?
dont think so.
try replacing the " " around Might with ' '
probably doesnt matter but
how about just...
${count(roll, 1)}$
still an error unfortunately
we can just brute force it with ? : logic.
still not working 😦
do I perhaps need to reference the column name instead of the column key?
${sameRow('pc_attack_stats') == 'Might' ? pc_might_mods : ''}$
${sameRow('pc_attack_stats') == 'Agility' ? pc_agility_mods : ''}$
@dense verge ^ try something like thast.
error? 💀
it now gives me 4 errors in each row in the mod column 😂
I added Intellect and Insight fyi
how tf
even then ??? if its not == it should just be nothing
can you copy exactly what you put here?
yes
what is it?
ok i got fed up and asked the AI overlord.
${#onesCount:=length(split(join(roll, ","), "1")) - 1}$
${onesCount}$```
The error:
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
i wonder if CSB is trying to fight a Might component key and conver it to a number...
try chaning the text field of might's name to 1 and the logic to:
sameRow('pc_attack_stats') == 1
Ok, you are right. But I think, that this will be easier to change the rules instead of finding, how to make it work 😂
This: <p><b>Correspondence Roll</b>: ${roll:=[:Pool:d10cs>5xo10]}$</p>
${#onesCount:=length(split(join(roll, ","), "1")) - 1}$
${onesCount}$ is not working either... sooo, I'm giving up.
But thank you for your advices 🙂
same error!
this makes me wonder if csb dice pool results are an array or not.
I sent the image but it still said might one second
^^ i was gonna say lol you gotta refresh the character sheet
I thought I made a mistake by not refreshing/saving but it is actually staying as Might regardless of what I change it too...
I'll restart the software and try the ? logic again
we can try that, but i'd also need to see more of what you're doing to follow
<p>Roll Result: ${join(roll, ", ")}$</p>
can you see what that outputs?
if its 1 number it's not an array
nothing changed, so I made a new actor and straight away I noticed the Might Column when changed to 1 was working, so I changed it back to Might and made another new character and it didn't work. So the conflict with Might seems like an issue
${sameRow('pc_attack_stats') == Might ? pc_might_mods : ''}$
Error, when i changed them all to 1, 2, 3, 4 it worked though
the easy solution would be to make another colum that's set as an index of the row number and make it invisible, but that's messy.
lets see...
I'm aware of an equalText ? Could it be that its a string?
something like this maybe?
${sameRow('pc_attack_stats') == (equalText('Might')) ?
i mean i use names in formulas with string names all the time...
${floor(lookup('attributeTable','attributeDiceQuant','attributeName','Motor','==')/2)*5}$
for example is a working formula
and 'Motor', the skill name, is just a text field.
hmm
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
still an error but only 1 in each row
I'll try with 'Might' and Might
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
Sure, I've put this: <p><b>Correspondence Roll</b>: ${roll:=[:Pool:d10cs>5xo10]}$</p>
<p>Roll Result: ${join(roll, ", ")}$</p> which should be correct from a syntax point of view. But, as mentioned, I can live with this xD Thank you for all your help 😆
eh helping y'all really helps me understand more of what im doing lol
its no problem
oh dude... i found it
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
DropdownKey sounds like its going to be very useful! I'll test that out now, thank you so much, you've been incredible helpful
so that'd be...?
${equalText(sameRow('pc_attack_stats'), 'Might') ? dothis thing
Always a number
is there a way to get an array to count frequencies?
🤣 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}$