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

[D&D5E] Delaying multiple outputs of a single api command

Hello. My goal is to find a way to delay the output of api commands ran using one button, to avoid mishaps and issues. The API that I am using is !ammo, and I am using it in a variety of ways for my character sheet (Mainly for my blatent metroid stuff, ie beams). I'll give an example of what one of my beams looks like: Attribute            Value                                                         |    Max_Value                                                # Comment de                   @{my_char_name|de                                           |    @{my_char_name|                                          # "@{My_Char_Name" refers to the actual name of the character, not "@{character_name}" --Power Beam-- ACPwB                1                                                             |                                                             # The value 0 or 1 determines if the beam is "installed" onto my arm-cannon ACPwBM               1                                                             |                                                            # This determines the mode the beam is on, 0 being disabled, 1 being single beam, and 2 being stacked beam ACPwBI0              !wammo @{character_name} ACPwB [[1-@{ACPwB}]] Install         |                                                              ACPwBI1                                                                            |    !wammo @{character_name} ACPwB -@{ACPwB} Uninstall ACPwBI               @{de|max}ACPwBI@{ACPwB}}                                     |    @{de|max}ACPwBI@{ACPwB}|max}                             # The three here and above act as the installer/uninstaller commands ACPwBIC0             %NEWLINE%[**Power Beam**](@{ACPwBI})                          | ACPwBIC1                                                                           |    %NEWLINE%[**Power Beam**](@{ACPwBI|max}) ACPwBIC              @{de|max}ACPwBIC@{ACPwB}}                                     |    @{de|max}ACPwBIC@{ACPwB}|max}                            # These three provide the buttons used in my macros to install or uninstall the beam ACPwBDA0                                                                           | ACPwBDA1             !wammo @{character_name} ACPwBM -@{ACPwBM} Powerbeam Mode     | ACPwBDA             @{de|max}ACPwBDA@{ACPwB}}                                     |                                                             # This sets the beams mode to 0 (disabled) as long as the beam itself is installed (otherwise does nothing) ACPwBS0                                                                            | ACPwBS1              !wammo @{character_name} ACPwBM [[1-@{ACPwBM}]] Single        |    !wammo @{character_name} ACPwBM [[2-@{ACPwBM}]] Stacked ACPwBS               @{de|max}ACPwBS@{ACPwB}}                                      |    @{de|max}ACPwBS@{ACPwB}|max}                             # This Sets the beam mode to either 1 or 2 as per desire, if the beam is installed ACPwBC0                                                                            | ACPwBC1              %NEWLINE%[**Power Beam**](@{ACPwBS})                         |    %NEWLINE%[**Power Beam**](@{ACPwBDA}) ACPwBC               @{de|max}ACPwBC@{ACPwB}}                                      |    @{de|max}ACPwBC@{ACPwB}|max}                             # This gives the buttons to either set the beam to Single Mode/Disable the beam mode in my macros. ACPwBD10                                                                           | ACPwBD11             [[1d6@{ACCBD}@{ACSBD}]][Power]                                |    Force ACPwBD12             [[2d6@{ACCBD}@{ACSBD}]][Power]                                |    Force ACPwBD0                                                                            | ACPwBD1             @{de|max}ACPwBD1@{ACPwBM}}                                    |    @{de|max}ACPwBD1@{ACPwBM}|max} ACPwBD               @{de|max}ACPwBD@{ACPwB}}                                      |    @{de|max}ACPwBD@{ACPwB}|max}                             # Determines the damage output of each beam mode (value) and dmgtype (value_max), as long as the beam is both installed and not disabled --Extra-- ACBD                 @{ACPwBD}@{AC[other beams]D} ACBT                 @{ACPwBD|max}@{AC[other beams]D|max}        # These go into the macros in the dmg1= roll (ACBD} and dmgtype (ACBT) so that it can dynamically change the results depending on what beam is installed/enabled Repeat this 11 more times and you got a mostly-accurate display) I have a macro that I use to change the mode of my beams (one to enable a beam, and others to disable the rest), the issue there is that, I want to be able to select a beam, and have its mode change to 1 or 2, and have the rest be disabled, but if I do that, it overloads the API, causing most of the commands to not work. I have a workaround that literally groups the beams 3 at a time to disable, and even that sometimes doesn't quite work. I have to press 5 buttons to change 1 beam, when I want to only press 1 to change 1 beam. Is there a way in that I can maybe have them all disable slowly, so as not to overload the API when doing this?
1714768603
timmaugh
Forum Champion
API Scripter
Yes... you can use the Metascript Toolbox batching, which will send each command out sequentially. If that is not enough of a delay, you can provide  individual {&delay} values to each line to further space them out. What is the full set of commands it takes to enable your first beam while disabling the rest (I'm guessing it's one command per beam -- whether turning on or off -- but having the syntax will let me give you an accurate answer)? Even if you would have to run them manually, what would the full set look like?
I believe this is the requested items: Change-Beams &{template:atk} {{r1=Beams}} {{normal=1}} {{r2=AC}} {{range=Select Beam}} {{desc=[**Stacked(1)**](~ACSBW1) [**Stacked(2)**](~ACSBW2) [**Disable Beams**](~Disable-Beams) **Main**@{ACPwBC}@{ACWBC}@{ACIBC}@{ACPBC}@{ACNBC} **Specialized**@{ACDBC}@{ACLBC}@{ACABC} **Special Beams**@{ACPhBC}@{ACHBC}@{ACDrBC} }} Disable Beams &{template:atk} {{r1=Disable Beams}} {{normal=1}} {{r2=AC}} {{range=Select Beam}} {{desc=**Main** [Change Beam](~Beam-Change)@{ACPwBC|max}@{ACIBC|max}@{ACWBC|max}@{ACPBC|max}@{ACNBC|max} **Specialized**@{ACDBC|max}@{ACLBC|max}@{ACABC|max} **Special**@{ACPhBC|max}@{ACHBC|max}@{ACDrBC|max} **Group-disable** [Group1](~Dag1) [Group2](~Dag2) [Group3](~Dag3) [Group4](~Dag4) [Dis-Check](~DaC) }} Install &{template:atk} {{r1=Install Upgrade}} {{normal=1}} {{r2=AC}} {{range=Select Item}} {{desc=**Beams**@{ACCBIC}@{ACPwBIC}@{ACIBIC}@{ACWBIC}@{ACSBIC}@{ACPBIC}@{ACNBIC}@{ACDBIC}@{ACLBIC}@{ACABIC}@{ACPhBIC}@{ACHBIC}@{ACDrBIC} }} Uninstall &{template:atk} {{r1=Uninstall Upgrade}} {{normal=1}} {{r2=AC}} {{range=Select Item}} {{desc=**Beams**@{ACCBIC|max}@{ACPwBIC|max}@{ACIBIC|max}@{ACWBIC|max}@{ACSBIC|max}@{ACPBIC|max}@{ACNBIC|max} **Specialized**@{ACDBIC|max}@{ACLBIC|max}@{ACABIC|max} **Special**@{ACPhBIC|max}@{ACHBIC|max}@{ACDrBIC|max} }} DaG1-4 + Dis-Check (as seen in Disable Beams) &{template:atk} {{r1=DG1}} {{normal=1}} {{r2=AC}} {{range=Changing}} {{desc=}} @{ACPwBDA} @{ACIBDA} @{ACWBDA} &{template:atk} {{r1=DG2}} {{normal=1}} {{r2=AC}} {{range=Changing}} {{desc=}} @{ACPBDA} @{ACNBDA} &{template:atk} {{r1=DG3}} {{normal=1}} {{r2=AC}} {{range=Changing}} {{desc=}} @{ACDBS|max} @{ACLBS|max} @{ACABS|max} &{template:atk} {{r1=DG4}} {{normal=1}} {{r2=AC}} {{range=Changing}} {{desc=}} @{ACPhBS|max} @{ACHBS|max} @{ACDrBS|max} &{template:atk} {{r1=Beam-Disability Check}} {{normal=1}} {{r2=AC}} {{range=Enabled:}} {{mod=[[@{ACPwBM}[Power] + @{ACIBM}[Ice] + @{ACWBM}[Wave] + @{ACPBM}[Plasma] + @{ACNBM}[Nova] + @{ACDBM}[Dark] + @{ACLBM}[Light] + @{ACABM}[Annihilator] + @{ACPhBM}[Phazon] + @{ACHBM}[Hyper] + @{ACDrBM}[DreadHyper]]]}} DaG1-4 are the macros I use to rapidly disable the beams, stably it disables 2 at a time, but normally it can do 3. 4 and above is when it starts having trouble. The attribute values shown refer to the commands that either install, uninstall, enable or disable the displayed beams. For charification, these are the beams: (Stackable): ACCB - Charge Beam, ACPwB - Power Beam, ACIB - Ice Beam, ACWB - Wave Beam, ACSB - Spazer Beam, ACPB - Plasma Beam, ACNB - Nova Beam (Specialized): ACDB - Dark Beam, ACLB - Light Beam, ACAB - Annihilator Beam (Special): ACPhB - Phazon Beam, ACHB - Hyper Beam, ACDrB - Dread Hyperbeam
1714791284
timmaugh
Forum Champion
API Scripter
OK, that's a lot to work through, so let me give you the general idea and see if I can meet you halfway. Assuming that when you would enable one beam, you would need to disable the other 11, you would be running one command like this: !wammo @{character_name} ACPwB [[1-@{ACPwB}]] Install ...and 11 commands like this: !wammo @{character_name} ACPwB -@{ACPwB} Uninstall Based on how you use the @{ACPwB} attribute, it looks like a full attribute on its own (not a sub-attribute of a list item entry)... so that makes me wonder what the other 11 beam weapon attributes are named... @{BCPwB} ... ? @{CCPwb} ... ? If we go with that naming convention, a command set for "Enabling 'Power Beam'" (the 'A' set) would look like: !wammo @{character_name} ACPwB [[1-@{ACPwB}]] Install !wammo @{character_name} BCPwB -@{BCPwB} Uninstall !wammo @{character_name} CCPwB -@{CCPwB} Uninstall !wammo @{character_name} DCPwB -@{DCPwB} Uninstall !wammo @{character_name} ECPwB -@{ECPwB} Uninstall !wammo @{character_name} FCPwB -@{FCPwB} Uninstall !wammo @{character_name} GCPwB -@{GCPwB} Uninstall !wammo @{character_name} HCPwB -@{HCPwB} Uninstall !wammo @{character_name} ICPwB -@{ICPwB} Uninstall !wammo @{character_name} JCPwB -@{JCPwB} Uninstall !wammo @{character_name} KCPwB -@{KCPwB} Uninstall !wammo @{character_name} MCPwB -@{MCPwB} Uninstall Are those fair assumptions? And, if so, then when we start controlling things with the metascripts, we're going to need to get the character name (to reference attributes) either by: 1) hard-coding it in the command line, OR 2) adding a bit of complexity using metascript constructions Which way would you like to go (assuming I'm right about how one "enabled" a particular beam)?
Ah, my apologies for the confusion - AC refers to "Arm Cannon", the bits after that indicate the specific beam - ACPwB means " A rm- C annon P o w er B eam" I should also clarify too, when changing from one beam to another, the idea is not to uninstall the other beams, but to simply disable them. Modifying the initial example, it would moreso be, for power beam, "!wammo @{character_name} ACPwBM [[1-@{ACPwBM}]] Power Beam Enabled; Single Mode", followed by several other "!wammo @{character_name} AC<beamname>BM -@{AC<beamname>BM} X Beam Disabled" - the M at the end of the attribute intends to mean "Mode". The way I have it set up, if a beam is installed (@ACPwB = 1), you can set its mode (ACPwBM) to 0, 1 or 2. If the mode is 0, ACPwBD (value and value_max) will output nothing, since the idea is that the beam is disabled (although still installed) However, if the beam itself is not installed, the options in the macro does not even show up. Your second example is pretty spot on save for the naming convention and the exact attribute (AC<beamname>BM). It would moreso look like this: !wammo @{character_name} ACPwBM [[1-@{ACPwBM}]] Powerbeam Enabled; Single Mode !wammo @{character_name} ACIBM -@{ACIBM} Ice Beam Disabled !wammo @{character_name} ACWBM -@{ACWBM} Wave Beam Disabled !wammo @{character_name} ACSBM -@{ACSBM} Spazer Beam Disabled !wammo @{character_name} ACPBM -@{ACPBM} Plasma Beam Disabled !wammo @{character_name} ACNBM -@{ACNBM} Nova Beam Disabled !wammo @{character_name} ACDBM -@{ACDBM} Dark Beam Disabled !wammo @{character_name} ACLBM -@{ACLBM} Light Beam Disabled !wammo @{character_name} ACABM -@{ACABM} Annihilator Beam Disabled !wammo @{character_name} ACPhBM -@{ACPhBM} Phazon beam Disabled !wammo @{character_name} ACHBM -@{ACHBM} Hyper Disabled !wammo @{character_name} ACDrBM -@{ACDrBM} Dread-Hyper Disabled
1714825068
timmaugh
Forum Champion
API Scripter
Ah... ok. That is beginning to make more sense. So, after a night of sleep, I'm not sure we're going to have to either hard-code some of the character references or preserve them using metascript constructions. The charcacter references (like @{character_name} ) will resolve as long as the command line is on the character sheet (in an ability). The only reason we would need to work around them is if we don't want them to expand too early. That is, we're about to send 12 command lines; those will each be their own message. We could imagine certain pieces of data that we don't want to expand in the first, parent message... but instead we would want to wait for one of the 12 later ones. We're not there, yet, so this is just to point out that as we get deeper into this, it might get a bit more complicated. For now, let's try the above set of commands with delaying each line by a subsequent .1 seconds. Adjust the timing as necessary, depending on the speed of your sandbox: !{{(^)   !wammo @{character_name} ACPwBM [[1-@{ACPwBM}]] Powerbeam Enabled; Single Mode   !wammo @{character_name} ACIBM -@{ACIBM} Ice Beam Disabled {^delay .1}   !wammo @{character_name} ACWBM -@{ACWBM} Wave Beam Disabled   {^delay .2}   !wammo @{character_name} ACSBM -@{ACSBM} Spazer Beam Disabled   {^delay .3}   !wammo @{character_name} ACPBM -@{ACPBM} Plasma Beam Disabled   {^delay .4}   !wammo @{character_name} ACNBM -@{ACNBM} Nova Beam Disabled   {^delay .5}   !wammo @{character_name} ACDBM -@{ACDBM} Dark Beam Disabled   {^delay .6}   !wammo @{character_name} ACLBM -@{ACLBM} Light Beam Disabled   {^delay .7}   !wammo @{character_name} ACABM -@{ACABM} Annihilator Beam Disabled   {^delay .8}   !wammo @{character_name} ACPhBM -@{ACPhBM} Phazon beam Disabled   {^delay .9}   !wammo @{character_name} ACHBM -@{ACHBM} Hyper Disabled   {^delay 1}   !wammo @{character_name} ACDrBM -@{ACDrBM} Dread-Hyper Disabled   {^delay 1.1} }} (This obviously requires the Metascript Toolbox.)
1714909462
David M.
Pro
API Scripter
I've never used the ammo script, but it seems like it is just modifying attributes. Another option would be to use a Scriptcard macro. Scriptcard direct  Object Modification  has the advantage of being synchronous. Multiple attributes can be changed without fear of dropping commands, and once changed, you can even immediately reference the new attribute value in the next line of your SC macro.  That being said, the downside is you would have to basically start from scratch, and there is a learning curve for programmatic SC syntax. I only bring this option up in case (1) you find that you have to add lengthy delays in order to ensure nothing ever gets dropped and your macro takes forever to run, or (2) in case you might want to explore SC for future needs. Here's a simple example of changing multiple attributes with a single line (bolded below): !script {{ --#whisper|gm --#emoteState|0 --#sourceToken|@{selected|token_id} --#title|Enable Power Beam --!a:[*S:id]|ACCB:0|ACPwB:1|ACIB:0|ACWB:0|ACSB:0|ACPB:0|ACNB:0 --+Current Power Beam Status|[*S:ACPwB] }} --!a tells SC that you want to modify one or more attributes. We are referencing the sheet that represents the selected token. The ACPwB attribute's current value is changed to 1, and the rest are changed to 0. Immediately after changing the attributes, we whisper the latest value of the ACPwB attribute to the GM.  If you don't want any chat output or confirm the latest value(s), then it can be reduced to this two-line macro:   !script {{   --#hideCard|1   --!a:@{selected|token_id}|ACCB:0|ACPwB:1|ACIB:0|ACWB:0|ACSB:0|ACPB:0|ACNB:0 }} Obviously, these macros are hardcoded, but it could be generalized to include a query, variables, etc. and logic for setting the attribute values so a single macro could be used to modify all of your attributes based on a selection. 
timmaugh said: (This obviously requires the Metascript Toolbox.) Haven't been able to test this just yet, Will update when able David M. said: Here's a simple example of changing multiple attributes with a single line (bolded below): Interesting alternative. Question for both: Would it be possible to put these commands in as an attribute of its own rather than a macro? It's mostly just because it would be much more visually appealing imo having one extra attribute per beam instead of having 12 new macros in a bunch. I know I can use %NEWLINE% to act as an enter key, but at least for the Ammo API, it didn't quite seem to like that. I'm not sure if the same would happen for these two options
1715029726
timmaugh
Forum Champion
API Scripter
There are further tricks we can do with the toolbox to agnosticize this... but just to be clear about what you're looking for... when you say "macro" I'm thinking "Collection Tab Macro". Is that what you mean, or a character ability? Are you saying that you would prefer an attribute rather than a character ability?
Ah, I should clarify that I do intend to use the character sheet for all of this, attributes/macros as a whole. Ideally attributes for the disabling/enabling of beams, instead of raw macros Still haven't had a chance to do anything yet, but I'll edit this when I have unless you reply first, in which I will propose a secondary post in order to ensure notifications are sent as per the update of the message) Okay, metascript toolbox should be installed (apparently requires a lot of other API's to function?), but I'm not certain if I am doing it right. In a test player macro, I ran the one you did here: !{{(^)   !wammo @{character_id} ACPwBM [[1-@{ACPwBM}]] Powerbeam Enabled; Single Mode   !wammo @{character_id} ACIBM -@{ACIBM} Ice Beam Disabled {^delay 1}   !wammo @{character_id} ACWBM -@{ACWBM} Wave Beam Disabled {^delay 2}   !wammo @{character_id} ACSBM -@{ACSBM} Spazer Beam Disabled {^delay 3}   !wammo @{character_id} ACPBM -@{ACPBM} Plasma Beam Disabled {^delay 4}   !wammo @{character_id} ACNBM -@{ACNBM} Nova Beam Disabled {^delay 5}   !wammo @{character_id} ACDBM -@{ACDBM} Dark Beam Disabled {^delay 6}   !wammo @{character_id} ACLBM -@{ACLBM} Light Beam Disabled {^delay 7}   !wammo @{character_id} ACABM -@{ACABM} Annihilator Beam Disabled {^delay 8}   !wammo @{character_id} ACPhBM -@{ACPhBM} Phazon beam Disabled {^delay 9}   !wammo @{character_id} ACHBM -@{ACHBM} Hyper Disabled {^delay 10}   !wammo @{character_id} ACDrBM -@{ACDrBM} Dread-Hyper Disabled {^delay 11} }} But no output Also tried it in a Collectiontab macro, no luck. Also realized an oopsie I did in the OP Post, it's @{character_id} for !ammo commands, not @{character_name}
1715088733
timmaugh
Forum Champion
API Scripter
OK, the idea of "output" is a bit squishy, here. The metascripts aren't providing any new output; they are just providing a way to delay and space out the commands. The only thing that will happen is what the ammo script specifies to do, including any output. So, what is the ammo script doing for you? I assumed it was setting some attribute (for instance, in the first line, setting ACPwBM to the result of [[1-@{ACPwBM}]] ). The check to see if this worked would be to see if that action by the ammo script worked for all of the beams (i.e., check it on the sheet). If so, then we can tweak things to get you the output you're looking for. Another thing to look at is if the ammo script *should* normally provide a report of its action (the "Powerbeam Enabled; Single Mode" of the first line), then it might not be doing that now because of how we're delivering the command line. We're using ZeroFrame to send the message... you send the original message which gets picked up by ZeroFrame, and then it dispatches each of the individual commands (one for each beam). That means, instead of a human sending the command, a script is sending the command, so the ammo script might be reporting what it did... but it's whispering it to a different "player" than you (the Script Moderator is like another player at the VTT). SelectManager is designed to get around this problem, but it doesn't come preconfigured to automatically do it. You have to configure it yourself. To do that, run this command one time in your game: !smconfig +playerid +who That should help with these situations... returning the ammo script's ability to report to you, if that's what it should have been doing all along.
I seem unable to test this without the API's breaking on me. Due to It not being my game, I do not want to risk corruption by having the DM constantly re-enable API Scripts, as that is apparently a concern with these. Idk how they keep breaking, but I might not be able to use this one. (even !ammo breaks itself a lot) I might have to find a non-API way to disable/enable beams. I'd be happy to if possible, but the biggest thing is I don't want to have +10 rows of core-resources just to toggle beams again.
1715180755
timmaugh
Forum Champion
API Scripter
OK, so from other threads, I'm gathering you use ammo just to change attributes... If that's all it's doing for you, I'd suggest CSA as a much more stable and flexible method. In that case, you can enable a beam like this: !setattr --@{character_id} --silent --ACPwBM|[[1-@{ACPwBM}]]  --ACIBM|-@{ACIBM} -- ACWBM|-@{ACWBM}   -- ACSBM|-@{ACSBM}   -- ACPBM|-@{ACPBM}   -- ACNBM|-@{ACNBM}   -- ACDBM|-@{ACDBM}   -- ACLBM|-@{ACLBM}   -- ACABM|-@{ACABM}   -- ACPhBM|-@{ACPhBM}   -- ACHBM|-@{ACHBM}   -- ACDrBM|-@{ACDrBM} /w @{character_name} Powerbeam Enabled; Single Mode This way you don't need to run (and delay) a bunch of commands. It's all handled in one go. And CSA is VERY stable and won't crash nearly as much as the ammo script. If that works, you could build out the 12 commands (1 per beam option) into a Chat Menu of buttons to enable the correct beam weapon or we could (via metascript chicanery) let you have a single command that would selectively do its work based on a query option you pick. Let me know if you want to go that route.
I got to try both ChatSetAttr and Scriptcards out, both are honestly really cool. Both seem to do what I want in regards to beams, which is great. The one thing i wonder though is, I can make a button with ChatSetAttr, but as far as I can see, not Scriptcards. I'll give an example So, say I want to enable my stacked beam weapons using a macro button with ChatSetAttr, it would look like this: Attributes Attribute      Value ACStB0 ACStB1    !setattr --charid @{my_char_name|character_id} --silent --ACPwBM|2 --ACIBM|2 --ACWBM|2 --ACSBM|1 --ACPBM|2 --ACNBM|2 --ACDBM|0 --ACLBM|0 --ACABM|0 --ACPhBM|0 --ACHBM|0 --ACDrBM|0%NEWLINE%/w my_name Stacked beams enabled ACStB %NEWLINE%[**Stacked Beams**](@{ACStB1}) Macro &{template:atk} {{r1=Beams}} {{normal=1}} {{r2=AC}} {{range=Select Beam}} {{desc=@{ACStB}}} If I run that, it would result in an output in an atk template with a button ready to press, and upon doing so, executing ACStB1 and enabling the Stacked Beams and disable the others. Now, if I did the same thing, but instead with ScriptCards ie: Attribute      Value ACStB1    !script {{ --#whisper|my_name --#emoteState|0 --#sourceToken|@{my_character_name|character_id} --#title|Changing Beam --!a:[*S:id]|ACPwBM:2|ACIBM:2|ACWBM:2|ACSBM:1|ACPBM:2|ACNBM:2|ACDBM:0|ACLBM:0|ACABM:|ACPhBM:0|ACHBM:0|ACDrBM:0 --+Beam Selected:|Stacked Beam }} and run the macro, it would break and not output a pressable button (it shows "[Stacked Beams](!script {{...") I love that both of these are able to do this in their own way. ChatSet for working as a button, and Scriptcards for being visually appealing. I'll honestly likely use both, but can I get it so I can have the Scriptcards one work as a button in the method shown above?
1715511839
timmaugh
Forum Champion
API Scripter
It is likely the colon characters in the Script cards text. Those don't get parsed out until after the button is pushed and ScriptCards runs, so they're there when you make the button.  The colon character tricks the Roll20 parser into thinking that you're sending a URL link, which it wants to step on . If there isn't a different character you can use within ScriptCards (some scripts offer either a pipe or a hash character), then you can try HTML substitution for every instance of the colon. Swap it out for: : ...and see if that works. I'm not 100% sure this will work, but give it a try.
Tried that, same result and it undid the change every time I ran the macro
1715516011
timmaugh
Forum Champion
API Scripter
Okay, two things. First the macro isn't undoing your HTML substitutions when you run it. If you use a collections tab macro, one of the limitations is that any HTML substitutions you do in a macro will be undone when you open it to edit it again. As long as you never open it, those HTML substitutions remain. However, when you open it, that's when the HTML characters revert. This is a known and long-standing issue with collection tab macros, and why most people opt for a macro mule character where instead of using collection tab macros you can use character sheet abilities. Character sheet abilities do not revert HTML substitutions just because you edit them again.  Second, I will have to take a closer look at your command line when I'm back in front of my PC... Maybe there's something else I'm missing in what you're trying to do.
1715519286
David M.
Pro
API Scripter
I guarantee I am not fully understanding your workflow, but it seems like there is an additional level of complexity being used here by embedding macros into abilities. SC can create chat menus (using rbuttons , "reentrant" buttons), and can directly modify attributes without using other mods (like CSA). Here's how I would probably do this using SC. Create a Beam Manager chat menu using rbuttons. Clicking the respective mode button for a given beam would pass a comma-delimited parameter back to the reentrant portion of the scriptcard macro that contains the beam description (element 0) and the mode (element 1). Using conditional logic, assign the attributes for the selected beam. Here's a redacted version that only provides three beam choices with two modes per beam. I would not put this into an attribute, but either a token action or collections macro. Example output. Note that once the chat menu is printed, you can switch beams/modes multiple times by clicking the buttons. Here's the macro I used for the above output. I added some comments in there to help describe how it works, as there are some relatively advanced SC concepts involved (reentrant scripts, functions, arrays, etc.). !script {{ --#debug|0 --:FORMATTING DEFAULTS| --#title|Beam Manager --#leftsub|Select Beam --#emotestate|1 --#sourcetoken|@{MyChar|character_id} --#titlecardbackgroundimage|url(<a href="https://s3.amazonaws.com/files.d20.io/images/324665765/SbvvIwCAOouKyd823YZzrg/max.jpg);background-size" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/324665765/SbvvIwCAOouKyd823YZzrg/max.jpg);background-size</a>: cover;background-repeat: no-repeat; --&amp;evenRowBGColor|#222222 --&amp;oddRowBGColor|#222222 --#evenRowBackground|[&amp;evenRowBGColor] --#oddRowBackground|[&amp;oddRowBGColor] --#evenRowFontColor|#E5D27C --#oddRowFontColor|#E5D27C --#buttonFontSize|16px --#buttonBackground|#222222 --#buttonTextColor|#E5D27C --#buttonPadding|1px --&amp;delimit|&amp;&amp; --&amp;QB|? --&amp;QB|+{ --&amp;QE|} --&amp;TB|&amp; --&amp;TB|+# --&amp;TB|+64 --&amp;TB|+; --&amp;TB|+{ --:THIS LINE JUST PROVIDES SCRIPTCARDS A UNIQUE IDENTIFIER FOR THE REENTRANT THREAD| in case multiple reentrant threads are being actively processed by players --#reentrant|BeamSelection [*S:id] --:|THIS LINE CALLS A FUNCTION THAT PRINTS REENTRANT BUTTONS, CREATING A "SCRIPTCARD CHAT MENU" --&gt;PrintBeamMenu| --X| End Macro. Whenever SC encounters this line, it stops processing --:REENTRANT BLOCK| this is where you jump back into the code after an rbutton is clicked. The next line is the reentrant identifier. It is called up by an rbutton in the PrintBeamMenu function. --:ReentryBeamSelection| --#title|Beam Selected --#leftsub| --:CREATE ARRAY CALLED "beamArray" CONTAINING BEAM AND MODE| passed in via the "reentryval" string variable denoted by the rbutton. We will assign new string variables to each of the array elements --~|array;fromstring;beamArray;,;[&amp;reentryval] --&amp;activeBeam|[@beamArray(0)] --&amp;mode|[@beamArray(1)] --:CONDITIONAL STATEMENTS| change attributes based on the activeBeam and mode --?"[&amp;activeBeam]" -eq "Dread Hyperbeam"|[ --!a:[*S:character_id]|ACPwBM:0|ACIBM:0|ACWBM:0|ACSBM:0|ACPBM:[&amp;mode]|ACNBM:0|ACDBM:0|ACLBM:0|ACABM:|ACPhBM:0|ACHBM:0|ACDrBM:[&amp;mode] --]| --?"[&amp;activeBeam]" -eq "Power Beam"|[ --!a:[*S:character_id]|ACPwBM:[&amp;mode]|ACIBM:0|ACWBM:0|ACSBM:0|ACPBM:0|ACNBM:0|ACDBM:0|ACLBM:0|ACABM:|ACPhBM:0|ACHBM:0|ACDrBM:0 --]| --?"[&amp;activeBeam]" -eq "Plasma Beam"|[ --!a:[*S:character_id]|ACPwBM:0|ACIBM:0|ACWBM:0|ACSBM:0|ACPBM:[&amp;mode]|ACNBM:0|ACDBM:0|ACLBM:0|ACABM:|ACPhBM:0|ACHBM:0|ACDrBM:0 --]| --:DISPLAY CURRENT BEAM SELECTION AND MODE| --+[&amp;activeBeam]:|Mode [&amp;mode] --X| End Macro --:FUNCTIONS| --:PrintBeamMenu| --+|Dread Hyperbeam [rbutton]mode 1::ReentryBeamSelection;Dread Hyperbeam,1[/rbutton] [rbutton]mode2::ReentryBeamSelection;Dread Hyperbeam,2[/rbutton] --+|Power Beam [rbutton]mode 1::ReentryBeamSelection;Power Beam,1[/rbutton] [rbutton]mode2::ReentryBeamSelection;Power Beam,2[/rbutton] --+|Plasma Beam [rbutton]mode 1::ReentryBeamSelection;Plasma Beam,1[/rbutton] [rbutton]mode2::ReentryBeamSelection;Plasma Beam,2[/rbutton] --&lt;| }}