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

Reference Global Modifier name in API output

So I am trying out some custom martial abilities and I am trying to develop a script that will ask the player how many hands are used with a weapon and then roll attack and then damage.   Here is my attack roll: Myattack+=`{{Attack [[1d20cs>20+@{${tokenName}|Strength_mod}+@{${tokenName}|PB|}[Prof Bonus]+@{${tokenName}|Global_Attack_mod}[Global_Attack_mod_name]]]}}` I have inserted "Bless" as a global attack mod as I want the script to add any global modifiers.  Everything here is working as I would like except I would like the inline roll description(when you offer over the roll result in the chat window) to have "[Bless]" after the 1d4 roll.  Currently this shows as - Rolling 1d20cs>20+3+2[Prof Bonus]+4[ Global_Attack_mod_name]  =(8)+3+2+4. I can see the global attack mod under the attributes column as global_attack_mod with a result of [[1d4[Bless]]]. ideas?
1598201045
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Just remove the inline roll brackets around your bless roll.
Scott C. said: Just remove the inline roll brackets around your bless roll. I am not looking to change the in line roll [[1d4[Bless]]] to reflect Bless.  I am looking to replace [Global_Attack_mod_name] in the in line roll presented in the chat results to # [Bless]
1598216173
GiGs
Pro
Sheet Author
API Scripter
I'm not following. Why cant you just change it manually? Myattack+=`{{Attack [[1d20cs>20+@{${tokenName}|Strength_mod}+@{${tokenName}|PB|}[Prof Bonus]+@{${tokenName}|Global_Attack_mod}[Bless]]]}}`;
1598238730
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
rcbricker said: Scott C. said: Just remove the inline roll brackets around your bless roll. I am not looking to change the in line roll [[1d4[Bless]]] to reflect Bless.  I am looking to replace [Global_Attack_mod_name] in the in line roll presented in the chat results to # [Bless] If you change that inline roll of bless, then when it is displayed in the hover text, it will read 3[Bless]. Just remove the [Global_attack_mod_name] from your script.
What I found solved this problem was to manually edit the attribute in the character sheet's attribute page.
GiGs said: I'm not following. Why cant you just change it manually? Myattack+=`{{Attack [[1d20cs>20+@{${tokenName}|Strength_mod}+@{${tokenName}|PB|}[Prof Bonus]+@{${tokenName}|Global_Attack_mod}[Bless]]]}}`; the global modifier being added may not always be bless.  I am looking for a dynamic approach.  Having the global's name will help should there be confusion about a roll.
Ron H. said: What I found solved this problem was to manually edit the attribute in the character sheet's attribute page. not sure I follow.
Scott C. said: rcbricker said: Scott C. said: Just remove the inline roll brackets around your bless roll. I am not looking to change the in line roll [[1d4[Bless]]] to reflect Bless.  I am looking to replace [Global_Attack_mod_name] in the in line roll presented in the chat results to # [Bless] If you change that inline roll of bless, then when it is displayed in the hover text, it will read 3[Bless]. Just remove the [Global_attack_mod_name] from your script. I think i see what you mean.  This might also be what Ron H. was alluding to.  Change the attribute value to read [1d4 Bless] so it rolls and shows the name.  The problem is that the global will not always be bless.  I would have to manually change it each time a new global attack modifier is applied.
1598302855
timmaugh
Pro
API Scripter
So, it looks like you're building this command line in a script, so I expect that you can drop in whatever text you need to before sending the finished line to the chat output. I don't want to make too many assumptions about what you're doing, so let me ask some questions: how would a global mod be defined? How would you capture it? Would it be coming from a character sheet, or could the GM have "switches" applied to a given situation where the mods were active? How many global mods could be active? Because it seems that, at least from the script's perspective, the workflow would be: 1) identify the global mods 2) capture the values of the mods 3) construct the command line output 4) send it to chat (or write it to the character sheet) So, are you having trouble at the transition between 2 and 3, above...? How to put the value of the mod into the roll language you're building?
1598304920
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
rcbricker said: Scott C. said: rcbricker said: Scott C. said: Just remove the inline roll brackets around your bless roll. I am not looking to change the in line roll [[1d4[Bless]]] to reflect Bless.  I am looking to replace [Global_Attack_mod_name] in the in line roll presented in the chat results to # [Bless] If you change that inline roll of bless, then when it is displayed in the hover text, it will read 3[Bless]. Just remove the [Global_attack_mod_name] from your script. I think i see what you mean.  This might also be what Ron H. was alluding to.  Change the attribute value to read [1d4 Bless] so it rolls and shows the name.  The problem is that the global will not always be bless.  I would have to manually change it each time a new global attack modifier is applied. Right, the global attack modifier won't always be bless, but if you enter your global attack modifiers like: 1d4[Bless] + 1d8[Some random thing] + 1[some other random thing] When the attribute is expanded from the call, it'll roll each of those and have the indicated tag after it. Essentially, your script doesn't need to dynamically set those as the user can set them in the character sheet.
Scott C. said: rcbricker said: Scott C. said: rcbricker said: Scott C. said: Just remove the inline roll brackets around your bless roll. I am not looking to change the in line roll [[1d4[Bless]]] to reflect Bless.  I am looking to replace [Global_Attack_mod_name] in the in line roll presented in the chat results to # [Bless] If you change that inline roll of bless, then when it is displayed in the hover text, it will read 3[Bless]. Just remove the [Global_attack_mod_name] from your script. I think i see what you mean.  This might also be what Ron H. was alluding to.  Change the attribute value to read [1d4 Bless] so it rolls and shows the name.  The problem is that the global will not always be bless.  I would have to manually change it each time a new global attack modifier is applied. Right, the global attack modifier won't always be bless, but if you enter your global attack modifiers like: 1d4[Bless] + 1d8[Some random thing] + 1[some other random thing] When the attribute is expanded from the call, it'll roll each of those and have the indicated tag after it. Essentially, your script doesn't need to dynamically set those as the user can set them in the character sheet. But it does't do that.  once the roll has been sent to chat, it simply shows the 1d4 for the global modifier, but it doesn't name it.  That is why I began looking have the name appear after the inline roll.  If there are questions from the players about 8+2+4+1, I would prefer for them to see (8)+2[Prof]+4[str]+3[bless].  that way they can see how the result was formulated.
timmaugh said: So, it looks like you're building this command line in a script, so I expect that you can drop in whatever text you need to before sending the finished line to the chat output. I don't want to make too many assumptions about what you're doing, so let me ask some questions: how would a global mod be defined? How would you capture it? Would it be coming from a character sheet, or could the GM have "switches" applied to a given situation where the mods were active? How many global mods could be active? Because it seems that, at least from the script's perspective, the workflow would be: 1) identify the global mods 2) capture the values of the mods 3) construct the command line output 4) send it to chat (or write it to the character sheet) So, are you having trouble at the transition between 2 and 3, above...? How to put the value of the mod into the roll language you're building? Well you are thinking a few steps out. I normally do this when coding in VBA as it is my wheelhouse, but this is all new so I am baby stepping it.  What I am trying to create for martial attacks is a custom drop down that is populated with the players martial options, the number of hands used drop down option, player ability modifiers (sneak attack, rage) drop down options.  These are all sent to the script which will then roll the appropriate amount and size of dice add all applicable modifiers (including globals) and return the message to the GM and player only. Like I stated it should be accomplished with drop downs.  Actually that or Chat menu buttons.  I like token as they don't hyper scroll chat, but the fewer the better so the token action bar isnt too full.  So which ever results in the cleanest process. This is an extension of the custom spell book and prayer ideas.  Custom marial i guess. Thanks,