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

Appreciate help with V20 macros

hey fellas I use 2 macros that iahd while back generic die roller   !r ?{Amount of Dice|0} ?{Difficulty|6} ?{Specialty|0} ?{Willpower|0} 0  (I have the appropriate API) and an initiative one. I want to make a macro, that draws on the stat of the selected token (firearms, braw, melee)  i tried chat gpt, to no avail, am not a programmer   if i can get at least 1 right, i can build up on for the other skills. cheers
1746188882
timmaugh
Forum Champion
API Scripter
Derivative AI is not only morally problematic, it is ill-equipped for the niche environment of Roll20. Much better to ask a community, as you have, for help. In this case, it is a pretty straightforward change. If the command you supplied is "well-formatted" (that is, it works as you have written it): !r ?{Amount of Dice|0} ?{Difficulty|6} ?{Specialty|0} ?{Willpower|0} 0 Then you can replace any of those queries (the things formatted like: ?{Prompt|0} ) for a reference to a selected token's attribute... for instance, the firearms attribute: @{selected|firearms} ...which, if substituted for the "Amount of Dice" query, would make the command line: !r @{selected|firearms} ?{Difficulty|6} ?{Specialty|0} ?{Willpower|0} 0 TIP: The attributes are case-sensitive, but you can enter the attribute formation into chat on its own to see if you get the appropriate value back. Once you know you have the correct name, use it in your command line. If all of your tokens have the same attributes (that is, they all have firearms, they all have brawl, they all have melee), then you can provide a query to choose between them: ?{Choose skill|Firearms,@{selected|firearms}|Brawl,@{selected|brawl}|Melee,@{selected|melee}} Then you could substitute that into your original command line, dropping the appropriate component it should replace.
thank you, the firearm works but only rolls firearms but does not include dexterity,  so i tried ot play with it am stumped, i have zero knowleddge about this :( !r @{selected|firearms} + @{selected|Dexterity} ?{Difficulty|6} ?{Specialty|0} ?{Willpower|0} 0 thank you for your help, and yes i want macros to use the most common skills like firearms, brawl, melee, perception  subterfuge,  i figure once i figure how at least 1 works can easily make as many as i want.
1746241114
timmaugh
Forum Champion
API Scripter
So, a command line like that is going to be picked up by a script. That script is going to parse the line -- that is, it's going to try to break down the line into component parts that it then uses and applies as it was written. We call those parts "arguments". Without further indications of where one argument begins and another ends, it seems that the script likely splits the line on empty space... which means you can't just put a " + " between values. Not only will that not do the math, but it will look (to the script) like too many arguments, displacing arguments from where they need to be. Hopefully the script is built to break down inline rolls , because those will both register as a single argument to this script AND will allow you to do math. For instance, you can do: [[@{selected|firearms} + @{selected|Dexterity}]] That will add those 2 items together as a roll, which your script should be able to retrieve. It will register as a single argument to the script, because by the time the script sees the message that portion of the command line will look like: $[[0]] Importantly: no spaces. So, give this a try: !r  [[@{selected|firearms} + @{selected|Dexterity}]]  ?{Difficulty|6} ?{Specialty|0} ?{Willpower|0} 0 If that doesn't work for some reason, it's likely the script, so post back with more specifics (the name of the script, where you got it -- a link, etc.)
hi Timmaugh tried  it and no dice,  no biggie dont wana waste your time with this i found a work around @{selected|token_name} makes a firearms attack! /roll [[@{selected|firearms} + @{selected|dexterity} + ?{Willpower?|0} + ?{Specialty Bonus?|0}]]d10>?{Difficulty|6}f1! not pretty though  but seem to work thanks for all the help