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

[Macro] Need macro help (Using References and previous rolls)

July 02 (7 years ago)

Edited July 03 (7 years ago)
Okay so... I've been working for the past 2 days trying to figure out how to do this. I've made great progress, but I'm a bit stuck now. 

So theres 2 questions:

1) When you use one of the attack macros from the character sheet, it slaps a little card with your rolls into chat. I would LOVE to create something like this that is more flexible using the macros in collections. This might be the singularly best way for me to implement what I'm attempting to do. Otherwise, it's back to trying to fenagle the pathfinder sheet to even remotely work with a Magus...

2) Is it possible to reference the result of a previous roll within a macro? Say for instance, I have 2 damage rolls under a single roll that are different types, lets say Slashing and Fire. If my attack roll crits, both of the rolls get their dice multiplied. How would I do this, and what would it look like? 

What I'm trying to do is create the attack macros for my Magus in a way that all I need to do is change the sword, and have those changes translate into my macro with out having to edit it, or more importantly, further macros that use these same variables. 

Any and all help appreciated! Thanks!
July 03 (7 years ago)

Edited July 03 (7 years ago)
vÍnce
Pro
Sheet Author
All rolls are made at the same time when you execute your macro.  I believe the powercards script (pro level perk) is one of the only options for using a stored roll's result in another.  

Can you use a query for the extra damage on your attacks?  ie " ?{Electrical dmg?|No,0|Yes,[[ [[ {@{selected|level},5}kl1 ]]d6 ]] } " There are macro fields on the sheet for global attack and damage as well as per attack macro fields for Extra Damage(non-crit and crit) as well as attack and damage macros that get included in the attack and damage rolls.  You can enable these fields using Settings|Sheet Configuration|Advanced| check them all.  Now you will see the additional fields (Extra Damage or Attack modifiers section and the sub-sections under each attack for Extra Damage and Add-to roll macros).
July 03 (7 years ago)

Edited July 03 (7 years ago)

Vince said:

Can you use a query for the extra damage on your attacks?  ie " ?{Electrical dmg?|No,0|Yes,[[ [[ {@{selected|level},5}kl1 ]]d6 ]] } "
I should probably go ahead and state that everything I know about how this works, I learned pretty much just today, so I really am a novice... There is a lot in that line that confuses me...

The answer is, I dont know. I can write the pseudo code for what I'm trying to do, but I dont know how to use the macros well enough to really try. Which would be:

SpellStrike(Shocking Grasp)
Roll for a Melee Attack VS AC. Display Result.
Record if Critical Threshhold met (Yes/No)
Roll Melee Damage > If critical yes, double dice. Display Results.
Roll Additional non critical damage. Display Results.
Roll Spell Damage > If Critical yes, double dice. Display Results.


As far as the extra fields, Thanks for pointing this out! I've taken a look at the "Add-to-roll Macros' fields, but I dont think I can use that for my goals. As a test, I gave a simple but obvious value of 50, and as it said it would, it added 50 to my rolls, though surprisingly only the ones native to the initial role.

For the Extra damage, I have so far been using that to be able to calculate the damage, as I do not seem to be able to use a pointer to reference my level for number of Die, or add to my damage mod. 

I think what I need right now is additional Extra Damage fields as they do exactly what I need them to. This would instantly solve what I am attempting to do (I would just write ALL the damage into the macro able fields, each field a different damage i wished to be displayed.). This would still leave a field of "Damage   [0]" that gets output, but it's the best I've been able to come up with so far... But at least I can specifically reference things. 

If I could also just use a reference for the initial damage field, this would also solve my qualms, but as I've found you cant use a macro in the [x]d[x] fields. I would just point all these fields to my weapon, so if I made changes to that, it would change the value of the fields.

I really wish I could show you guys what I have right now, and explain a bit more of what I'm trying to do. 


EDIT:

I noticed the dropdown for the Extra Damage or Attack Modifiers that's not in attacks. This is incredibly helpful, and eliminates one variable that I had to consider, namely the additional damage for the sword. At least so much as long as I stick with a single type of damage, as soon as another is added (such as if I go for Frost Fire sword), then I'm back to wishing that I had more of these fields.

The reason I'm so concerned with displaying each of these damages, is because resistances and weaknesses are a big thing in our campaign. These additional damages need to be noted, so I cant just pool them into a single roll.


EDIT 2:

BTW... Here is what the code for my iterative looks like, if it'll help:

{{BlackBlade=[[@{Lilliana Vesh|repeating_weapon_-knvljafqyh8oeswh784_damage-dice-num}d@{Lilliana Vesh|repeating_weapon_-knvljafqyh8oeswh784_damage-die} + @{Lilliana Vesh|repeating_weapon_-knvljafqyh8oeswh784_precision_dmg_macro}]]}}


July 03 (7 years ago)

Edited July 03 (7 years ago)
vÍnce
Pro
Sheet Author
Just so you know, you can add additional rows of macros within the Extra Damage field. Just hit return at the end of your first extra damage macro to make a new line.  So you could have an infinite number of damage types rolled.  ;-)  You could add a row for electrical, a row for fire, a row for ...?  You could also have one long query(I think you'll have to substitute html for special characters , | and } wiki:https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries)  The query I used as an example above uses the characters level to determine the number of d6 to roll with a max of 5.  Your query could just be a straight damage roll ie [[1d6]] or whatever...

July 03 (7 years ago)

Edited July 03 (7 years ago)

Vince said:

Just so you know, you can add additional rows of macros within the Extra Damage field. Just hit return at the end of your first extra damage macro to make a new line.  So you could have an infinite number of damage types rolled.  ;-)  

... The more you know! This solves so many problems. The descriptions cant be expanded, but I discovered I can just have a bit of text before the roll, and  that suffices beautifully.

Also, thank you for that Query macro! I had no idea this was possible. The substitutions are confusing to look at, but I think I understand the gist of it. I've identified and isolated the important parts and can manipulate it for my needs.

Curious question, can you have it pop up multiple "queries" at the same time instead of 1 by 1? If I could, I could literally have my Black Blade strike, then have every single touch spell I know in a query, and just choose yes for the spell I'm using. That would make it so instead of having half a dozen different potential attacks, I'd merely have two, one for my full attack, another that queries for literally every variation of spellstrike. 

So have it display like:
Window
Brand [no/yes]
Shocking Grasp [no/yes]
Frostbite [no/yes]

Rather than

Window
Brand [no/yes]
New Window
Shocking Grasp [no/yes]
New Window
Frostbite [no/yes]


I'm currently now experimenting with this new knowledge. If I discover another question, I'll edit this post. 

Thank you so much Vince for helping me thus far. I believe I can work with the additional knowledge you've shown me to finally make this class work. 

Not related, but for beauties sake... Is there a way to have the pathfinder sheet not roll for critical confirmation? We dont use it. 
July 03 (7 years ago)
vÍnce
Pro
Sheet Author

AFIK, you have to step thru queries because each one produces a single result.  Someone may know a cool trick (Silvyre comes to mind) to get more mileage from a query.  I know queries can be nested as well, it gets more complicated and you need to make substitutions for the special characters... which sucks btw.  I assume you could create a query of your best "combos".  ;-)

For crit confirm; it doesn't really effect what the template shows, so you can just ignore it.  If you want it gone all together; you can edit your attacks macro-text and change this portion "{{crit_confirm=[[ 1d20 + @{attack_macro} + [[ @{crit_conf_mod} ]] ]]}}" to just "{{crit_confirm=}}".  
July 04 (7 years ago)

Edited July 04 (7 years ago)
Thanks so much for all your help. I'm not sure if nesting would work, but if it's that difficult I can happily suffice with having just multiple attacks. The only thing I have to remember to do is when I use an attack and I've keened my sword, to simply change the critical threat range. Not so bad. And I'm not terribly concerned about the critical confirm, but I am curious where I would go to find the attack's macro-text? I have looked for it but cant find. 

In the meantime, this is how I've gotten my cards to look now. 



Pretty much perfect. The fire and Ice would be the enchants from my arcane pool skill, and behave appropriately.. Everything else does just fine. Learning that I could have multiple lines for those extra attacks was a huge boon and made this possible, especially to apply a broad effect such as the weapon enchantments. 

Unless you can think of any other ways to improve or streamline, I think this handily does the job. Otherwise, thanks so much for helping me with this, I've certainly learned a lot. 
July 04 (7 years ago)

Edited July 04 (7 years ago)
vÍnce
Pro
Sheet Author
Looking good.  Enable/reveal macrotext and more from Settings|Sheet Configuration|Advanced  You'll be able to edit full macrotext of the sheet rolls. On attacks it will be a new sub-section


Have fun.
July 04 (7 years ago)

Edited July 04 (7 years ago)
So, because I was able to edit the attack macro, I actually was able to just have any values I wanted point at my main weapon. I no longer have to change the critical threat range for every weapon! Ultra thanks for showing me this was possible! I also went ahead and deleted the critical confirmation roll line as it was entirely unneeded. Looks much cleaner!

Also, I've went back in and started making another attack, this one using a query and having every variation of spellstrike as an option to choose from (single question, multiple answers). This actually I think will work for just about all of my strikes! And best yet, it condenses everything my character /could/ do with the attack, into a single, augmentable attack. Ultra cool.

Then I noticed that Queries for the same query, will automatically choose the option that was initially selected. However, this dupes the entirety of the original results code. 



As you see, I'm trying to run a query that, for extra damage will run the selected option, which works! Then I'm trying to get it to dynamically change the "Type" displayed based on the answer I chose, but it merely runs the first bit of code twice. 

Is this a limitation? If so, that's fine. It's not critical to the attack, as I can simply call the damage "Spellstrike" or even just " ", but if it's possible to have it display two separate things based on the same answer, that would be amazing. 
July 04 (7 years ago)
vÍnce
Pro
Sheet Author
Are you trying to use two queries of the same name, but with different choices?
ie ?{foo|X} ?{foo|Y}
I'm not sure what happens in this situation...?  Normally if you run multiple queries of the same name and choices ie ?{foo|X} ?{foo|X} , you only need to answer one, you will not get prompted for the same query again, and the value selected for the first query will be used wherever the query has been duplicated.

I believe the Type field for extra Damage is just a text input field.  It's purpose is really designed just to enter a text label for the extra damage.  Entering macro and/or roll template commands will have unexpected results since it's being handled within the attacks roll template (pf_attack). 
Sort of. I was trying to have the same query with the same choices, but result in different things. 

And I did test it out, you can run macros within that type field. All I was trying to do is make it so that it would dynamically change the text displayed in the field based on the choice. So if I chose, say, Shocking grasp, it would display "Electric" for the type. 
July 04 (7 years ago)

Edited July 04 (7 years ago)
vÍnce
Pro
Sheet Author
AFAIK, only an API script can make changes to a sheet's attributes using a macro.  pseudo case;  attributes can also be manipulated via a linked token's bar values...
... Hmm... 

Can data values, like numbers, say perhaps from a dice roll, be sent to a token to SET a value? (not just modify one)

As in, Roll a 1d20+X, send the result of that to a token by perhaps having it set that as it's HP or some other value... Then perhaps be able to have another macro (or the same one down the line) look at that value? 

If you could, this could be a really ghetto way of storing and retrieving variables... 

I should go ahead and mention this is well beyond what I need, or even want to do with my character sheet. In fact, I'm done with it. Though there may be more that can be done to further refine and streamline the sheet, the fact that I've reduced the need for potentially dozens of individual attacks that would need to be individually modified every time I enhanced my sword in a different way, or changed it mid battle, or when it expired a minute later, to being able to use a single attack where I can output different types of additional damage, and now only need to edit 1-2 fields (again, opposed to potentially dozens), has more than fulfilled the goals I had set out to do. 

The entire goal was to have many attacks that could all be modified by changing a single 'master' attacks attributes. Between learning to manipulate the available extra damage fields, as well as the attack's macro, I have done this wonderfully and with surprising finesse (mentioning I doubt it was ever intended to be used as such)

So, thank you a ton for helping me learn and discover what I needed to to do this. Unless I come up with a radical new idea that I think is potentially possible, anything further is just messing with the system to see what is possible. 
July 04 (7 years ago)
vÍnce
Pro
Sheet Author

Deidashi said:

... Hmm... 

Can data values, like numbers, say perhaps from a dice roll, be sent to a token to SET a value? (not just modify one)

As in, Roll a 1d20+X, send the result of that to a token by perhaps having it set that as it's HP or some other value... Then perhaps be able to have another macro (or the same one down the line) look at that value? 

A script like tokenmod can change the bar values of a token.  A script like chatsetAttr can directly modify a sheet's attribute data (and even create new repeating rows)  Both are awesome scripts.  Pro is worth it just to have access to all the cool scripts people have written.

Glad you got things working.  Have fun.