Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Scriptcards - dead simple comparison - defeating

I know I shouldn't have started this late at night :) What I'm trying to do is roll 1d10 and check if it's greater than or equal to the character toughness attribute and print the character name plus Pass/Failedd, tried looking at examples in the scriptcard docs, but, i can't see it :(   what I have is this !scriptcard {{ --#title|@{selected|token_name} checks toughness vs @{selected|Toughness} --=TTest|1d10 --?[$TTest} -ge @{selected|Toughness} | [   --+| Passed [$TTest} --]  |  [   --+|Failed [$TTest} --] }}
Hi Norman, What system and sheet are you using?
Hey Norman, Not sure how much was lost due to posting it here in the forums without a code block but I cleaned up your ScriptCard a bit: !scriptcard {{ --/|VARIABLES TO SET --&AttributeName|Toughness --#sourceToken|@{selected|token_id} --#title|[*S:t-name] checks [&AttributeName(tolowercase)] vs [*S:[&AttributeName]] --=TTest|1d10 --?[$TTest] -ge [*S:[&AttributeName]]|[ --+|Passed [$TTest] --]|[ --+|Failed [$TTest] --]| }} You had some end curly braces where you'd want closing brackets in your roll variable references of [$TTest]. I also tend to like to minimize the number @{} references in a ScriptCard since Roll20 processes those before ScriptCards acts so I went with --#sourceToken and using [*S:t-TOKENPROPERTY] and [*S:CharacterATTRIBUTE] references.  ScriptCards wiki link about object referencing Your end code block was missing a closing pipe so I added one --]| and I turned the Attribute you want to check into a String Variable  so that it can be set once at the top of the ScriptCard so if you want to change it to another attribute you only have to change it in that one location and not hunt throughout the ScriptCard. That's what it looks like with the above code. Let me know if you have any questions.
Thanks both, it's working now, was really my first foray into scriptcards and I got lost in a welter of options and curly and square braces :) It's a custom character sheet for a free western gunfight set of rules for my regular game group <a href="https://www.littlewarstv.com/uploads/2/3/7/7/2377799/ruthless_-_fastest_rules_in_the_west.pdf" rel="nofollow">https://www.littlewarstv.com/uploads/2/3/7/7/2377799/ruthless_-_fastest_rules_in_the_west.pdf</a> Thanks again for your help