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 .
×
Advertisement Create a free account

Query in attack name.

1627324641

Edited 1627324679
Is it possible to change the name of an attack, based on queries it's given? The queries are already present in the attack and damage parts of the macro, and work very well. But i was hoping to do something both fun and informative with the name. Here's how the attack name currently looks in my attacks list: And here's how the resulting attack looks in the chat window: I've tried adding the following macro, in the hopes that I can change this to be a bit more situational, removing the generic "+1 masterwork greatsword" portion of the name, and replacing it with "Smiting" and "Powerful" as those options are chosen. ?{Smiting?|No, Regular|Yes, Smiting} ?{Power Attack?|No, Normal|Yes, Powerful} Slash Unfortunately, this doesn't seem to just "not work", but it also stops the attack rolls from even appearing in the chat window.
1627325514
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Unfortunately, you can't have a roll query return different results at different invocations. It always returns the same result as the first time it was used.
And I don't suppose it's possible to pick text based on the numerical result of the original query, in this case 0, or 1?
1627328714

Edited 1627328771
GiGs
Pro
Sheet Author
API Scripter
You could kind of do that, by creating two rollable tables, one called 0 and one called 1, each with the single entry being the text you want to display. Then you call the table with the result of the query as the table name. The normal method would be to make the query contain more on each row, but that's only practical when you are in control of the complete macro - not when you are using one built in to the sheet attacks.
1627331016
Almighty_gir  said: Is it possible to change the name of an attack, based on queries it's given? The queries are already present in the attack and damage parts of the macro, and work very well. But i was hoping to do something both fun and informative with the name. Here's how the attack name currently looks in my attacks list: And here's how the resulting attack looks in the chat window: I've tried adding the following macro, in the hopes that I can change this to be a bit more situational, removing the generic "+1 masterwork greatsword" portion of the name, and replacing it with "Smiting" and "Powerful" as those options are chosen. ?{Smiting?|No, Regular|Yes, Smiting} ?{Power Attack?|No, Normal|Yes, Powerful} Slash Unfortunately, this doesn't seem to just "not work", but it also stops the attack rolls from even appearing in the chat window. I'm not sure which game system and character sheet you are using, but I can get this to work on the D&D 5E by Roll20 sheet. I can put this in the item name and get a query when I make the roll: Battleaxe (?{1 or 2?|1,One|2,Two}-Handed) And when I click on the attack, I get a query to choose one or two handed -- unfortunately it's a simple query that only changes the name; it doesn't actually change the value of the roll. However, on the 5E sheet you can also input the specific Damage type, so a query could be added to that field: ?{Smiting?|No,|Yes,Smiting} ?{Power Attack?|No,|Yes,Powerful} Slashing Again, this doesn't change the value of the roll in any way; it only adds the 'Smiting Powerful' text to the damage description. So in your case, if the character sheet supports queries inside item names, you might be able to do something similar.
1627337068
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Right Jarren, but the OP is trying to combine changing the name of the roll with affecting the attack and damage roll with the same query.
1627350010
timmaugh
Pro
API Scripter
Could meta-scripts help, here? Or, to put it another way: I don't completely understand what the OP wants to do, but I see interpretations of what is being said where I could imagine ways that meta-scripts could help... I'm just not sure the interpretation matches the original ask.
1627363245

Edited 1627363598
vÍnce
Pro
Sheet Author
I can get a query(s) in the attack name (PF Community sheet) to work just fine as long as they are different queries than the ones you are using in the additional attack/damage sections.  I bet you were trying to use ?{foo|a|b|c} in one section/field and ?{foo|x|y|z} in the other.  Although the query is the same, the options are different, so it fails.  You just need to create a similar but unique query in both sections/fields. Say you have your normal power attack query set up as a global attack/damage in the 'Add to roll' section of the sheet, something like  attack:  -[[ ?{Power Attack?|Yes,1|No,0}*(1+floor(@{bab}/4)) ]] damage: [[ ?{Power Attack?|Yes,1|No,0}*(1+floor(@{bab}/4))*2 ]] If you want to also include a query in the attack name, change it up a little to something like Longsword ?{Add Power Attack to name?|Yes, Powerful!!!| No} You will get two different prompts related to Power Attack, but this should work. If you only want to use a single Boolean query that works for math as well as toggles an appropriate text, you might try the rollable table tip that GiGs mentions.  Or perhaps Tim's meta-scripts would work for Pro users...? BTW: Power Attack has been added as a common buff on the sheet now if you would rather toggle a buff vs using a query. ;-)
Sorry for the lack of clarity in my initial post. Hopefully, this will answer some questions: 1. I'm using Pathfinder. 2. I'm trying to change the way the attack roll appears visually in the chat window, as well as modify attack properties, based on a single query. 3. I believe because I'm a player and not the GM, I don't have access to a roll table to use.
1627388180

Edited 1627388269
timmaugh
Pro
API Scripter
Yeah... if scripts are available to you (determined by the subscription level of the game-originator), then you can use 1 query to return 2 results. (I'll use Vince's ?{foo|a|b|c} and ?{foo|x|y|z} example... which you can solve with just a, b, and c.) The basic idea would be to use Muler and load 2 different mules. One would be the attack name (we'll call it Mule1): a=Sprectralescent Jabber b=Long Sword of Much Smight c=Incessant Jazz The other mule would be the actual effect (ie, what is currently in the query): a=x b=y c=z We'll call that one Mule2. Then you just use the query in the place of a variable name to pull from your Mule. Where you want the attack name, you pull from Mule1: get.Mule1.?{foo|a|b|c}/get Where you want the effect, you pull from Mule2: get.Mule2.?{foo}/get