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

Bardic Inspiration Macro Help.

&nbsp;Everyone, I believe I posted this in the wrong forum before. &nbsp; &nbsp; I am working on a modified version of Nick Olivo's Making Bardic Inspiration Macros in Roll20 yt link &nbsp; <a href="https://youtu.be/a316TxMqpas?si=rMmSokNE45G1nrKf" rel="nofollow">https://youtu.be/a316TxMqpas?si=rMmSokNE45G1nrKf</a> for context I am the DM for D&amp;D 5e with the 2014 character sheets.&nbsp; I am using the API version of the macro. In the first part with the button for the bard to give the selected party member Bardic Inspiration everything is working the way I wanted. including my custom marker. However I did have an issue removing the marker during the Inspired players "Use Bardic Inspiration" macro. so i ended up having to but the&nbsp;!token-mod --set statusmarkers|-lute[] above the !script line. that worked for me. and is working great as is..&nbsp; here is what I am trying to accomplish, In order to give all my players the "Use Bardic Inspiration" macro I would need to paste it into all the non-bard characters. since the bard can not give himself the bardic inspiration and clicking the "Show as Token Action?" box would give him this button. again this is fine but i wanted to take it up a notch, and this is where i am having the issues. I was going to leave my general&nbsp; "Use Bardic Inspiration" macro in my main macros and give each player a separate macro that called upon the main one. The Idea is that i wanted the inspired player to have a button where it checks if they are inspired (has the "lute" marker) before running the&nbsp; "Use Bardic Inspiration" macro. I know this should be possible with the ScriptCard and TokenMod API's however I cant seem to get the --? command to function properly..&nbsp; !script --name="Bardic Inspiration Check"&nbsp; --? [!token-mod --statusmarkers|lute] | !UseBardicInspiration | &amp;{template:default} {{name=Inspiration Check}} {{You do not have Bardic Inspiration}} I know under normal circumstances to activate other macros you would use the # symbol, but whenever I did that it would just print the line in the chat before printing the "you do not have Bardic Inspiration" box. This didn't care if "lute" was activate or not on the selected token.&nbsp; when I use the ! symbol it only shows the "Inspiration Check" box, however again it doesn't care if "lute" is active or not. I am going to clean up the text and box later, but wanted this to be functional first. I have been checking high and low for examples to use and assistance in other threads but have not found anything that was actually helpful. I am fairly new what it comes to macros and coding in general, although I have dabbled in it here and there over the years. Any assistance in this would be helpful. for a list of active API's I am probably overlooking something that is super simple here but i don't know. Thank you&nbsp;
1739292802

Edited 1739292827
timmaugh
Forum Champion
API Scripter
So... I think there are a handful of things that you'll need to understand. They're all going wrong in their own way, which is making the overall effect more confusing to attribute to a given problem, but the good news is that what you're wanting to do is easily achievable. Let's just clear up some of what you have going wrong. Problem the FIrst First, for a single command to span multiple lines, you have to use the "template braces" trick. You see how a template part is enclosed in double braces (the "name" part in the following example): &amp;{template:default} {{name=Example}} Template parts *can* span lines, so we use them with a script command if 1) the script is built to recognize it, and 2) we want to organize our input across multiple lines. You're basically tricking the Roll20 parser into letting you use multiple lines for your input because it thinks you're using a template part. That means that this is a single command: !script {{ &nbsp; --+|Some parameter }} But this is two separate commands: !script &nbsp; --+|Some parameter Problem the After the First You can't use TokenMod like this. TokenMod is going to *do* something, not return a value to your command line (to Scriptcards). TokenMod will let you *set* the statusmarkers property to include the lute, but it will not, in any kind of timing, return a information to the command line (or message object) that ScriptCards could read -- if it even knew to look for it! Since TokenMod is an "active" script (that is, it takes action on tokens in the game), when people utilize it in a ScriptCards macro, they are typically instructing ScriptCards to issue a NEW MESSAGE where the command line is whatever TokenMod syntax they've written. If you want to understand more of the timing around how script commands are handled, I'd suggest at least the first 15-ish minutes of this video . If you read on in this message and intend to use the metascript solutions I suggest, below, then I'd suggest you go ahead and watch the rest of the video, too. Problem the Related to the After the First Since TokenMod isn't going to do what you want it to do, this isn't going to get you closer to your goal (conditionally reading a statusmarker and taking different actions based on the result). However, the way you were trying to use TokenMod showed another mistake so, just to clarify the point before we move on to the actual solution... Let's say that you really/actually needed to use TokenMod (or another script) to create an outbound message somewhere during the&nbsp;processing of a ScriptCards command. For instance, you come to a point in the processing where you want to issue a TokenMod command to SET the lute statusmarker on a token. In that case, you include a line like this: --@token-mod| _set statusmarkers|lute Note that the line opens: --@ ...followed by the script handle: token-mod ...followed by a pipe: | ...followed by all of the arguments for that new outbound command, but you change all double hyphens to an underline. This is because the double-hyphen is used to indicate arguments to ScriptCards, and since ScriptCards is the "destination" script that is handling the processing, you have to handle double-hyphens intended for other, outbound scripts with some other syntax. ScriptCards establishes the underline as that other syntax. Problem the Understanding ScriptCards th ScriptCards is a script that offers a pretty powerful line parser to give you functional capabilities, much like a coding language. However, in addition to that, it has a "reporting" side (a visual output) that you can use to construct the chat result for you or your players. If you are going to use ScriptCards, you typically DO NOT have to use a roll template as your output. You would, instead, construct a "card" using ScriptCards syntax, and then output it at the end. I don't do a lot of ScriptCard-ing, but I believe that would look more like these two lines: &nbsp;--#title|You Uninspired LUMP of MEAT-SACKERY! --+|You do not have Bardic Inspiration. Now, go away, or I shall taunt you a second time! I mean, actual verbiage may vary. But the two lines comprise a "title" line (for the top of the card) as well as a line that will appear as the "contents" of the card. The idea would be placing these in a ScriptCards macro in a place where they would only output if specified conditions were met (i.e., the selected token NOT having the lute statusmarker). So you could use ScriptCards processing to control whether these lines were included in the processing.&nbsp; Like I said, I'm not a ScriptCard maven, but the relevant conditional syntax is discussed here .&nbsp; I believe the logical conditional you need is setup with this construction: --?"Thing to test" --eq "Equals, but there are other options like 'gt' and 'lt' and 'inc'"|[ &lt;&lt;true case verbiage&gt;&gt; --]|[ &lt;&lt;false case verbiage&gt;&gt; --]| The two lines controlling your output would go in one of these cases, depending on what you were testing. Your command to run the "UseBardicInspiration" macro would go in the other. Before we get to that, there's one more problem to point out... Problem the How to Run an External Macro Your initial attempt at the command line seems to expect that if the selected token has a lute marker, you will run the "UseBardicInspiration" command like this: !UseBardicInspiration That looks like you would expect to run a script command where "UseBardicInspiration" was the script's handle (the way "script" is for ScriptCards or "token-mod" is for TokenMod). If that's the case, you would want to structure this the way I discussed sending the TokenMod command line, above: --@UseBardicInspiration| However, I don't think that's what you're trying to do. I think you want to trigger either a Collections Tab macro or a sheet ability from a mule character. I'm not the best one to answer whether this is possible (let alone how to do it), but I would wonder if you have to use this approach at all...? If the contents of the UseBardicInspiration macro were already a series of ScriptCards commands, you could just include them, in this macro in the appropriate side of the if/else conditional (or, alternatively, put a conditional into the UseBardicInspiration. Maybe if you share a bit more of what commands are in the UseBardicInspiration macro and whether it's a macro or an ability we might be able to better help you get where you're wanting to go. Enough With the Problems - Solution the First So if you want to use a ScriptCards conditional, you can use ScriptCards to return the statusmarkers and drive your conditional based on whether it includes "Lute": !script{{ &nbsp; --?[*@{selected|token_id}:t-statusmarkers] -inc Lute|[ &nbsp; &nbsp; --#title|The Wind Beneath My BattleAxe &nbsp; &nbsp; --+You are inspired. Replace this text with the UseBardicInspiration commands &nbsp; --]|[ &nbsp; &nbsp; --#title|You Uninspired LUMP of MEAT-SACKERY! &nbsp; &nbsp; --+|You do not have Bardic Inspiration. Now, go away, or I shall taunt you a second time! --] }} Enough With the Problems - Solution the Second If, instead of a ScriptCards output you'd *rather* use the roll template output (the default template, from your example), you can accomplish this by installing the Metascript Toolbox in your game. It comes with it's own conditional structures, as well as ways to test the presence of a status marker on a token. Here is what that would look like if you were wanting to run a MACRO called UseBardicInspiration if the token was marked with the "Lute" status marker, but instead output your default template message if the token was NOT: !{&amp;if @(selected.is.Lute) = yes}#\(UseBardicInspiration){&amp;else}{&amp;template:default} {{name=You Uninspired LUMP of MEAT-SACKERY!}} {{You do not have Bardic Inspiration. Now, go away, or I shall taunt you a second time!}}{&amp;simple} {&amp;end} I can break down what's going on in there if you decide to go this route. My guess is that you'll go for the ScriptCards solution (Solution the First)... and, since this message is already long, I shall simply apologize for calling your wife a bloated warthog, and bid you good day.
1739293593
timmaugh
Forum Champion
API Scripter
Thank you so much timmaugh, and thank you for the Monty Python humor. love it! I use the Run Away picture for my party token when showing group placement on larger maps. I really appreciate the lengthy and thorough response. The Meta-toolbox commands are far more similar to the coding I am used to. Mostly just arduino coding. Bardic Inspiration !script {{ --#title|Granting Inspiration --?@{selected|class_resource} -eq 0 |[ --+|[c][#ff0000]You are unable to inspire others until you finish a rest[/#][/c] --]|[ --=bardicInspirations|@{selected|class_resource} - 1 --+|[c]You inspire @{target|Give to Whom?|token_name}[/c] --+|[c]You have [$bardicInspirations] bardic inspirations remaining[/c] --@setattr|_charid @{selected|character_id} _class_resource|[$bardicInspirations] _silent --@token-mod|_set statusmarkers|lute _ids @{target|Give to Whom?|token_id} --]| }} For this one, I kept it exactly as written in the youtube video. I will probably mess around with customization options in the future as I would like to prompt a pop up window with a drop down option to select the Player Characters who can receive the bardic Inspiration. but I may have not chosen wither I want to stick with the ScriptCard or switch to the Meta-Toolbox. or combo both as i did below. this is placed only in the Bards Abilities macros. "UseBardicInspiration" script !token-mod --set statusmarkers|-lute[] !script {{ --#title|Bardic Inspiration --+|[c]Donquixote has inspired you![/c] --?@(Donquixote|base_level) -ge 15 |=inspirationDie;1d12 --?@(Donquixote|base_level) -lt 15 |=inspirationDie;1d10 --?@(Donquixote|base_level) -lt 10 |=inspirationDie;1d8 --?@(Donquixote|base_level) -lt 5 |=inspirationDie;1d6 --+|[c]Add [$inspirationDie] to your roll![/c] }} The only modification I made for this script from the original template was moving the !token-mod line outside of the !Script. and this is because it seemed to have no effect while in the script. This is why I chose to use a separate macro to pull this macro because I was unsure of nesting a !script within a !script. No Inspiration !script {{ --#title|You Uninspired LUMP of MEAT-SACKERY! --+|[c]You do not have Inspiration.[/c] --+|[c]Now, go away, [/c] --+|[c]or I shall taunt you a second time![/c] }} I chose to keep the format I was using within the !scrip API because i liked the template better. I'm sure after I play around more I can figure out other templates but this will do for now. The Abilities Macro !{&amp;if @(selected.statusmarkers.lute)}#\(UseBardicInspiration) {&amp;else}#\(NoInspiration) {&amp;end} I used the Meta-toolbox here because I like the format better and I will most likely do most of my macros this way as the format is more comfortable for me. so I want to thank you very much for this API. it took me a while to figure out how to call the lute in the macro. but I ended up using a reference that you used in you Available Propertied By Object Type &nbsp;on the Meta Script - Fetch Forum. amazing help and I am bookmarking that page. So thank you again for that. Conclusion I simplified the Abilities Macro and as you can see above &nbsp; I have decided to use a combo of both scripts throughout. I also decided to keep the bulky "UseBardicInspiration" as well as the "NoInspiration" in the Collection tab for easier editing in the future. This way i can edit them and it will affect all instances used by the players instead of making the changer under each characters abilities. I can't thank you enough for the help and Info. and hopefully someone else will find this useful in their campaigns.&nbsp;