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

[SCRIPT REQUEST] Script to delay an action macro call until after current macro complete

November 17 (4 years ago)

Is there a script that delays a macro call? 


I am trying to have a macro fire another macro action after the first one is complete instead of simultaneously.


To explain, I have an Action Macro that uses ChatSetAttr to deduct a class resource, then displays the remaining value of said resource.  I have done this by having it call

[[ @{class_resource} - 1 ]]


Trouble is I have a new ability that can use wither one resource or another, in this case either a Class resource or an Other resource.  I have built in a query to determine which resource is reduced using ChatSetAttr, but I would like to display both remaining resources after calling the ability macro. I have it set to call a second and third ability macro that displays remaining resources for each, but it all fires simultaneously, so it does not account for the new value.


Any ideas on if and how this would be possible?

November 17 (4 years ago)
The Aaron
Roll20 Production Team
API Scripter

It would likely be far easier to give you a script that would display the output you want and let you call that after the ChatSetAttr and thus provide the proper counts.

November 18 (4 years ago)

I could also just use a macro to announce it if it were a separate call.  Even easier than a script. 


I am looking for something out there that could call another macro on a delay to minimize button pushes for myself and my players.  I tried the Delay script by Kastion, but it does not work on ability calls. I was hoping there was something out there that did.

November 18 (4 years ago)

Edited November 18 (4 years ago)
Oosh
Sheet Author
API Scripter

If you're already using a Query, you can just put it in there (garbage stats example):

&{template:default} {{name=Stats}} {{Strength
Dexterity
Constitution=?{Decrement which stat?|
Strength,[[@{bob|strength} -1]]
[[@{bob|dexterity}]]
[[@{bob|constitution}]]}}
!modattr --name bob--strength|-1|
Dexterity,[[@{bob|strength}]]
[[@{bob|dexterity} -1]]
[[@{bob|constitution}]]}}
!modattr --name bob --dexterity|-1|
Constitution,[[@{bob|strength}]]
[[@{bob|dexterity}]]
[[@{bob|constitution} -1]]}}
!modattr --name bob --constitution|-1}
November 18 (4 years ago)

Oh, yeah! I forgot about replacement strings! I'lThat will let me plug my query result into ModAttr. l'll try that tonight!


Is there a place that lists all replacement strings for trouble characters? I keep finding smattering here and there, but no single list...

November 18 (4 years ago)

Oh, yeah again!  I tried this originally, but unfortunately the Order of Operations calls the ability before it runs the query result, so I always get this error when I try that:


No attribute was found for @{charactername|?{Resource}}


Which is why I am looking for a way to delay firing the resource display until after the first macro fires.

November 18 (4 years ago)
Oosh
Sheet Author
API Scripter

You're right, you can't do that - that's why my example macro has a !modattr line in each Query option, and doesn't try to split any Attribute calls :)

November 19 (4 years ago)

I am a moron.  All I have to do is take the Silent command out of the !modattr string. The name is different, but the player gets the info needed. Thank you all for coming with me on this glorious journey of making things way too difficult!


November 19 (4 years ago)
Oosh
Sheet Author
API Scripter
Haha, that's a good solution too! :)
November 19 (4 years ago)

Never one to be satisfied, I figured it out even more and better.

So I made a primary macro for choosing which resource to use, giving a button to push that called a secondary macro based on the appropriate resource, then had the !modattr command and the resource display worded how I wanted in the secondary macro.

This worked great, but I still was not satisfied with the default template not matching the damage template, so I made a power card for the damage that matched the default template output.


My players will never understand how much time I have put into making it as simple as possible for them to play.

November 19 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


CatSwann said:

My players will never understand how much time I have put into making it as simple as possible for them to play.

"This is The Way."


November 19 (4 years ago)
timmaugh
Pro
API Scripter
*chef's kiss*
November 20 (4 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter

Not all heroes wear capes but all DM's should be issued one as standard!