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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Macros/Abilities that edit Attributes

November 21 (11 years ago)
I tried looking for an API that did this, but I couldn't find it. I also tried checking to see if Rugged Reroll is going to include it, but I didn't see it mentioned in the blog.

Did I over-look it? Regardless, I would love this function to be available. (I fully understand that I would need to donate to be able to use APIs)
November 22 (11 years ago)
+1
November 22 (11 years ago)
Attributes are accessible through the API. There are a lot of API scripts add or edit Attributes, what exactly are you looking to do?
November 22 (11 years ago)
I want to have a macro/ability that would reduce an attribute by x amount.

For example:
@HP=-3d6

This would automatically reduce the attribute "HP" by the result rolled. If I had this, excellent.

However, what I really want is:
{@Ammo=-{modifier|1}}d6

In this instance, the "Ammo" attribute is reduced by the amount entered and then that number of d6 are rolled. Though, I'm not sure if this one makes as much sense based on the pseudo macro I entered. If this existed, I would be amazed

Based on what I have seen, to get this last example to work a person would need to create a "Modifier" attribute:
@Modifier={modifier|0}
@Ammo=-@Modifier
{@Modifier}d6

Which is, more or less, a variation on my first example.
November 22 (11 years ago)
Macros don't work that way. You can't really store variables and reuse them in a macro, they are simply text replacements within a macro. Also, macros can't change the value of token's attributes. The turn tracker is a special case where macros can make a change like that.

What you're looking to do would need to be done in the API. API functions are called by making special commands in the chat (they start with !) and can be set up inside of macros for ease of use. For instance you could create the following macro.

!expend_ammo ?{ammo_modifier}d6

In the API you would capture the !expend_ammo message, retrieve the character's Ammo attribute, and reduce it. If you need an example of that, I can whip one up when I'm not on my lunch break.
November 24 (11 years ago)
I would like to see an example of an API function that could be used to reduce a character's HP (assuming HP is an Attribute).

Also, in order to gain access to this functionality, I would need to become a Mentor, correct? Is there more to the process than just getting access to the API?
November 24 (11 years ago)

Edited November 24 (11 years ago)
Gauss
Forum Champion
Here is the link where you can compare packages: https://app.roll20.net/account/supporter
November 26 (11 years ago)
Sam
Pro
Sheet Author
I also would love to see an example of an API function that would reduce a character's HP or expend ammo as shown above. I'm not a mentor yet but I have been considering to get access to the API but before I make the leap I have really been wanting to see if api scripts would so what I've really wanted to do.
November 26 (11 years ago)
Gauss
Forum Champion
Samuel, that would be a question you should post in the API forum. Perhaps someone will oblige you.
December 10 (11 years ago)

Edited December 10 (11 years ago)

[Request]Macro command that allows change to attribute number.


Right now i have a attributes that keep track of the ammo my gun holds. I think it would be great if when i used my macro to attack it changed my ammo attribute so I don't have to do it by hand.

December 11 (11 years ago)
Tom
Plus
Sheet Author
Rather than change an attribute, which can't be done with a macro, I wonder how one might do this with an Ability? Is it possible? Lets say, for instance, you set an Attribute called "magazine". This sets your ammo limit. Then you set things up with a status bar, so that every shot, burst, or auto fire attack depletes your ammo just like hit points.

i haven't done anything like this myself, but it might be workable with a macro.

But your suggestion is certainly something I'd like to see in the future. Witch Hunter has stances that the player can adjust each round. These can affect a variety of things, usually defenses and combat skills. I'm sure you could include these in the game with API's, but that's more work than I want to put into my game. It's too bad there isn't an easy solution for those of us with less programming backgrounds.

Another idea, it's too bad I can't buy API modules like I can tokens.
December 11 (11 years ago)

Edited December 11 (11 years ago)
Sam
Pro
Sheet Author
If its the difference between one or two stances I've been able to approximate this using reference abilities. To me a reference ability is one who's sole purpose is to build the meat of the ability and then serve it up to any macro or ability which calls it. You can see some of my work here.

If you want I'd be happy to come into your game and consult with you to see if it would be possible to create a bandaid. But yes, being able to directly affect abilities would be nice. Thankfully we're going to get a taste of that in the upcoming expansion in the form of Attributes being able to act like abilities and what not.
December 12 (11 years ago)
Tom
Plus
Sheet Author
Sam: No, its actually the difference between 4 different stances, each with different effects. Not terribly difficult to work around at this time, but it would be a nice feature for the future.

BTW, looking through your macro sets. I'm seeing some things I definitely adding to my yonk! list. :) Thanks for sharing!
December 17 (11 years ago)
Here is a bit of API that would reduce your ammo, just need to attach it to an event

var attribObj = findObjs({ type: 'attribute', characterid: character.id, name: "ammo" })[0];
if (attribObj)
{
var ammo = attribObj.get('current') -1;
attribObj.set('current', ammo);
}
December 17 (11 years ago)

Edited December 17 (11 years ago)
Sam
Pro
Sheet Author
Neat, thank you Peter. If I could give you an upvote, I would :)