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

scriptcard works from attributes but not from macros section

1701522761

Edited 1701522842
Hi guys, I have written the following scriptcard for skill checks and it works fine if I use it from the attributes section of the charactersheet (Pathfinder 1st by Roll20). !script{{ --/|CARDSETTINGS --#emotestate|no --#sourceToken|@{selected|token_id} --?"[*S:t-name]" -inc Simar|&NAME;Simar --?"[*S:t-name]" -inc Eldon|&NAME;Eldon --?"[*S:t-name]" -inc Dagan|&NAME;Dagan --?"[*S:t-name]" -inc Samuel|&NAME;Samuel --?"[*S:t-name]" -inc Thorgk|&NAME;Thorgk --Lsettings|[&NAME] --/|DEFINE SAVE --&Rettungswurf|?{Welcher Rettungswurf?|Reflex|Willen|Zähigkeit} --?"[&Rettungswurf]" -inc Reflex|&RW;@{reflex} --?"[&Rettungswurf"] -inc Willen|&RW;@{will} --?"[&Rettungswurf]" -inc Zähigkeit|&RW;@{fortitude} --/|DEVINE TITLE --#title|Rettungswurf --#leftsub|[&Rettungswurf] --/|ROLL AND CHECK INSPIRATION --=ROLL|1d20 + [&RW] --?"[*S:t-name]" -inc Simar|CHECKINSP --+|[c][*S:t-name] würfelt eine [$ROLL][/c] --x| --:CHECKINSP| --?[*S:Inspirationsvorrat] -ge 2|GENUG --+|Simars Inspirationsvorrat für diesen Tag ist erschöpft! --^NOINSPROLL| --x| --:INSPROLLDONE| --#emoteState|no --#rightsub|Inspiration (Kosten 2) --=SAVEINSP|[$ROLL] + [$INSPROLL] --+|[*S:t-name] würfelt zusätzlich eine [$INSPROLL] und kommt insgesamt auf [$SAVEINSP]. --@modattr|_silent _name Simar Altran _Inspirationsvorrat|-2 --X| --:NOINSPROLL| --#rightsub|ohne Inspiration --+|[*S:t-name] nutzt seine Inspiration nicht und bleibt bei einer gewürfelten [$ROLL]. --X| --:GENUG| --#reentrant| --=INSPROLL|1d6 --+|Simar würfelt eine [$ROLL] und hat genügend Inspirationsvorrat, um das Ergebnis verbessern zu können! --+|[c][rbutton:#ffffff:#ff0000]Inspiration::INSPROLLDONE[/rbutton][/c] --+|[c][rbutton:#ffffff:#ff0000]Keine Inspiration::NOINSPROLL[/rbutton][/c] --x| }} But if I use it from the macros section on the right side of the screen the following error occurs. TypeError: Mt is undefined Any advice for a coding noob?
1701524643
timmaugh
Pro
API Scripter
Not sure if you mean that you are running it from the right side of a character sheet, so you're running it as an ability macro, or if you are running it from the right side of the screen, so you are saving it as a collections tab macro. They do have some small differences in that if you are working from a character sheet, you can use shorthand notation like @{reflex} and it will resolve for you. From a collections tab macro, you need to fully qualify that reference to include the character name.
I meant the collection tab macros. Your answer should solve my problem. thanks.
To add to what timmaugh said about those @{} references, I see you are setting the #sourceToken so you would be able to replace those with [*S:] calls like so: [*S:reflex] [*S:will] [*S:fortitude] Roll20 will always process @{} references and ?{} first before ScriptCards can process them. But with the above you can get all token parameters with the [*S:t- and you can get all the character attributes with [*S: and no t-. You probably know this already and I'm sure you have reasons for keeping as is but just in case, if you updated the stored settings to be the full name and not the short name, you could just pass in --Lsettings|[*S:character_name] or --Lsettings|[*S:t-name]. That would make the ScriptCard less hardcoded and more universal based so you could use it in any games you run without needing to update the ScriptCard itself for that specific player list. Especially considering that's the only place you use &NAME variable.
Thanks Joshua. That will simplify the code.