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

Help with creating a single macro for /fx combinations

1715589278

Edited 1715589557
I have been trying to solve this for a few weeks and I cannot figure it out no matter how many forum posts I read. I currently have a bunch of macros to display fx on creature death based on what killed it (physical damage, magic, radiant, poison, etc.).  The existing macros are incredibly simple but needing one for each desired fx combination doesn't seem right.  I should be able to nest a pair of dropdowns for effect and type and pass that into the /fx call. Existing macro for when a creature is killed by physical damage: !token-mod --set bar3_value|0 /fx nova-blood @{selected|token_id} !token-mod --ids @{selected|token_id} --set statusmarkers|dead Not remotely complicated, but I have others for /fx burn-death, /fx burn-fire, /fx burn-holy, /fx burn-magic, /fx nova-smoke, etc.  I'd really like to have one macro that prompts me for [burn | nova] and prompts again for [acid | blood | charm | death | fire | frost | holy | magic | slime | smoke | water] . Am I missing the trick or can it not be done the way I'm trying to do it?  And if I'm going about it the wrong way, what is the right way?
1715615150

Edited 1715615189
Gauss
Forum Champion
My experience is that if you stack FX commands they all happen at the same time. It sounds like you want them to happen in sequence?  If that is the case you will probably need to use a Mod (API Script) to delay them. If that is even possible (I don't know if it is).
1715624589

Edited 1715626079
No, what I'm after is a single macro that prompts me for the effect and type I want to use in that specific instance and then fires off the effect and the !token-mod stuff.  /fx takes two arguments (effect and type) so a single prompt won't work... unless I pre-define the combinations I want to use, but even that is proving illusive.  
1715631072
Gauss
Forum Champion
In testing this works, but there appears to be a delay I cannot explain due to putting it into a query:  /fx ?{fx type|acid burn,burn-acid|acid nova,nova-acid|blood burn,burn-blood|blood nova,nova-blood} @{selected|token_id} You can also split up the two halves into two queries such as: ?{type|burn,burn|nova,nova}-?{effect|acid,acid|blood,blood} But again...it still has a delay.  My suggestion instead would be the following, use an API Script to push what you want into an attribute, activate the attribute. That should remove the delay.  Example:  !setattr --sel --fx| ?{type|burn,burn|nova,nova}-?{effect|acid,acid|blood,blood} Note: because all lines are activated at once, you'd need to put the "/fx @{selected|fx} @{selected|token_id}" behind a chat menu button or set an API Script to fire after the chatsetattr mod inputs the correct value into the attribute.  However, this is getting complicated enough where this is probably all done better with a metascript (not my area of expertise). Perhaps the metascript gurus will come along and point the way.
1715634440

Edited 1715635444
This /fx ?{fx type|acid burn,burn-acid|acid nova,nova-acid|blood burn,burn-blood|blood nova,nova-blood} @{selected|token_id} looks similar to something I tried earlier but it didn't work at all.  I gotta assume I had a syntax error in there somewhere.  This at least gets me limping forward.  Thanks much. This is good enough until someone posts a more elegant solution. !token-mod --set bar3_value|0 /fx ?{fx type|physical,nova-blood|magic,burn-magic|holy,burn-holy|fire,burn_fire|ice,burn-frost|poison,burn-slime|acid,burn-death|undead,nova-smoke} @{selected|token_id} !token-mod --ids @{selected|token_id} --set statusmarkers|dead
1715634649

Edited 1715634744
Gauss
Forum Champion
The problem with that is that there is a very large delay (measured in 10s of seconds). I expect a metascript will avoid that issue.  Additionally, you are running multiple API commands in one macro. That can cause issues (sometimes one doesn't run). A metascript will probably avoid that as well. Beowulf said: This /fx ?{fx type|acid burn,burn-acid|acid nova,nova-acid|blood burn,burn-blood|blood nova,nova-blood} @{selected|token_id} looks similar to something I tried earlier but it didn't work at all.  I gotta assume I had a syntax error in there somewhere.  This at least gets me limping forward.  Thanks much.
1715635369
timmaugh
Forum Champion
API Scripter
Yeah, your query option will work for a single fx. The problem with doing a delay is that "/fx" handle gets eaten and executed by Roll20 before something like a metascript can get in the way. That means if you want, as Gauss was suggesting, first one effect and then another... you won't be able to delay them automatically with metascripts. However, you should be able to generate 2 buttons for yourself (where each query returns a button of a particular fx type... then you can click them in sequence to make them fire in succession... You can modify your queries to only have the correct set (if you want a limited subset for the first fx, then a different subset for the second fx... but here is a working model: /w gm [FX1](!
/fx ?{fx type|acid burn,burn-acid|acid nova,nova-acid|blood burn,burn-blood|blood nova,nova-blood} @{selected|token_id}) /w gm [FX2](!
/fx ?{fx type 2|acid burn,burn-acid|acid nova,nova-acid|blood burn,burn-blood|blood nova,nova-blood} @{selected|token_id})
1715635640

Edited 1715636221
I'm not trying to kick off multiple fx.  I want a single macro to present pre-defined combinations and the above code seems to accomplish that.  I didn't encounter a delay during testing. Curious thing when I inadvertently selected multiple tokens; !token-mod did what it was supposed to on both tokens but /fx put the effect in the upper left corner of the map.  Don't care because I'm not going for multi-token action, but it's kind of odd.
1715636289
Gauss
Forum Champion
Beowulf said: I'm not trying to kick off multiple fx.  I want a single macro to present pre-defined combinations and the above code seems to accomplish that.  I didn't encounter a delay during testing. Curious thing when I inadvertently selected multiple tokens; !token-mod did what it was supposed to on both tokens but /fx put the effect in the upper left corner of the map.  Don't care because I'm not going for multi-token action, but it's kind of odd. Well if you didn't encounter a delay during testing that is great. :)
Beowulf said: This /fx ?{fx type|acid burn,burn-acid|acid nova,nova-acid|blood burn,burn-blood|blood nova,nova-blood} @{selected|token_id} looks similar to something I tried earlier but it didn't work at all.  I gotta assume I had a syntax error in there somewhere.  This at least gets me limping forward.  Thanks much. When you say "it didn't work at all", what do you mean? That exact macro code appears to be working for me. This is good enough until someone posts a more elegant solution. !token-mod --set bar3_value|0 /fx ?{fx type|physical,nova-blood|magic,burn-magic|holy,burn-holy|fire,burn_fire|ice,burn-frost|poison,burn-slime|acid,burn-death|undead,nova-smoke} @{selected|token_id} !token-mod --ids @{selected|token_id} --set statusmarkers|dead I'm curious why you have two separate TokenMod commands?  Are they intended to affect different tokens, or the same token? If I'm reading what you're looking for correctly, then I think this is what you need for a dropdown that lists all possible combinations of Burn and Nova: !token-mod --set bar3_value|0 statusmarkers|dead /fx ?{FX Type?|Acid Burn,burn-acid|Acid Nova,nova-acid|Blood Burn,burn-blood|Blood Nova,nova-blood|Charm Burn,burn-charm|Charm Nova,nova-charm|Death Burn,burn-death|Death Nova,nova-death|Fire Burn,burn-fire|Fire Nova,nova-fire|Frost Burn,burn-frost|Frost Nova,nova-frost|Holy Burn,burn-holy|Holy Nova,nova-holy|Magic Burn,burn-magic|Magic Nova,nova-magic|Slime Burn,burn-slime|Slima Nova,nova-slime|Smoke Burn,burn-smoke|Smoke Nova,nova-smoke|Water Burn,burn-water|Water Nova,nova-water} @{selected|token_id} Or if you want a separate query for the Effect and Color: !token-mod --set bar3_value|0 statusmarkers|dead /fx ?{Effect?|Burn|Nova}-?{Color?|Acid|Blood|Charm|Death|Fire|Frost|Holy|Magic|Slime|Smoke|Water} @{selected|token_id}
@Jarrin - I mean the code didn't work the first time I wrote it (before I came here looking for help).  It worked when I copied it from here, which leads me to believe I didn't do it right on my own. - Why do I have two separate !token-mod commands?  Because I'm stupid and didn't combine them after adding the --set bar3_value part.  Simple as that.  I was so focused on figuring out the /fx that I ignored everything else.  I'd have probably left it like that had you not pointed it out. - This is more elegant and flexible/extendible: /fx ?{Effect?|Burn|Nova}-?{Color?|Acid|Blood|Charm|Death|Fire|Frost|Holy|Magic|Slime|Smoke|Water} @{selected|token_id}
Beowulf said: - This is more elegant and flexible/extendible: /fx ?{Effect?|Burn|Nova}-?{Color?|Acid|Blood|Charm|Death|Fire|Frost|Holy|Magic|Slime|Smoke|Water} @{selected|token_id} Great! I'm glad it's working for you!