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

Two scripts needed - Attribute change from macro and referencing an earlier dice roll

Hello! I figure these exist, but I just am not having good luck finding current working ones. Basically I need: Something where I can change the value of an attribute like Ship Fuel due to a macro input (not the three bubbles for tokens) Also to reference a dice roll from an earlier macro. So say I want a Power Card to say that a specific thing is worth d20*4 gold, and then afterwards i want it to say if brought in alive it would be worth d20*4 but the d20 is the same result as the first one. Right now I have it as two separate power cards with the second one using a query that I just input the first result. It works, but would be nice to have everything in one! Do these exist?
1415762740
The Aaron
Roll20 Production Team
API Scripter
Certainly, if you find the first one, you can use it for the second. There is an alter script floating around somewhere. I have an Ammo script that can be used for modifying the attributes in the case that they are numeric. I believe someone posted a modified version in the comments that makes it's purpose more generic. I'm working on a version of it that is more configurable as to the names of adjusted fields and such. Ah.. found an old forum post that talks about this: <a href="https://app.roll20.net/forum/post/1034445/help-api" rel="nofollow">https://app.roll20.net/forum/post/1034445/help-api</a>... So back to the second. If you have an attribute somewhere that you can store that die roll in, you can set the value in the attribute, then use the attribute in both places on the powercard (or in both powercards).
1415763163

Edited 1415763326
Oh! I forgot about using the ammo script for that. Does it work well with power cards yet? I remember last time I used it it was a bit funky and had to change a specific thing Also, if there ISNT a token, do I just put a token down on one page, link it, generate the token_id, and use that? Its going to be used for ship fuel, and i wont have a ship token on each page?
1415765187
The Aaron
Roll20 Production Team
API Scripter
For the ammo script, it goes off a character_id, but will do a conversion based on the represents of a token. You can call !get-represents on a token and it will show you the character_id. Not sure about problems with the PowerCards. Let me know if you run into any issues and I'll try to track them down. =D
Okay! So I got the ammo script up and running and tweaked the heck out of it (not really, just replaced all instances of 'ammo' with 'fuel') The powercards work perfectly with it too! Now for the chat reference rolls... Where do I begin? My goal is to like have a random bounty generator (well this is one example to which I would use this method) so it rolls a d10 to give me the 'danger' level of the bounty. I want it to roll 1d10 but have the same result three times in a single power card. So like it says danger level=y=d10 and then have a bounty for alive = y*300 and bounty for dead=y*100 (or something to that effect) Does that make sense?
1415799519
The Aaron
Roll20 Production Team
API Scripter
I don't think I have a script that is setup for easy manipulation of character attributes. I need to write a CharMod to go with my TokenMod script. If you follow that link to the past forum post, you can grab Sam's script and use !alterattr to set the value of an attribute . Actually, that script takes a token_id. You can do this in two steps with the ammo script. Lets assume you have a character setup for this named Bob with an attribute called BountyRoll. Here are the steps: !ammo @{Bob|character_id} BountyRoll -[[@{Bob|BountyRoll}]] !ammo @{Bob|character_id} BountyRoll [[1d10]] !powercard --name|Bounty: [[@{Bob|BountyRoll}*300]] Alive, [[@{Bob|BountyRoll}*100]] Dead That first line just clears out the BountyRoll by subtracting it's current value. The second line sets it to the result of 1d10. The third line calls the powercard script and gives the Bounty alive and dead. I'll add in an = option to Ammo at some point to make this easier and set it up so you can name things dynamically (working on that now!)
Thank you The Aaron! Though I think I done goofed. I removed the whisper function of the Ammo script (deleted the /w gm on one line) and so now if I did what you suggest, it would show those first two macros to everyone and not look that great. Is there anything you would recommend to make it prettier or can I activate the whisper for some things (like the bounty roll) and not for others (like the reduction of fuel for the ship)?
1415813323
The Aaron
Roll20 Production Team
API Scripter
hmm... well, you could have second copy of the script that whispers. =D I'll try to add something in the next version that allows selection of who will see messages.
Oh yeah! I changed it to !fuel so I can just have !ammo do that with the whispering! Thank you
1415815265

Edited 1415815298
I am getting this error and not quite sure how to fix it :( (From Ammo): Amount [-$0] is not correct. Please specify a positive or negative integer value like -1 or 4. (From Ammo): Amount [$1] is not correct. Please specify a positive or negative integer value like -1 or 4.
1415815844
The Aaron
Roll20 Production Team
API Scripter
Looks like inline rolls are broken. Try with the base ammo script and see if it works?
I am using the ammo.js that you posted in the first link. Is that the 'base ammo script'? Ill try it in a different campaign and see if may modified script is conflicting.
Okay, tried it with another campaign and still running into the issue. If I do [d10] as opposed to [[d10]] this happens (From Ammo):Amount 5 is not correct. Please specify a positive or negative integer value like -1 or 4.
the 5 is an inline roll
1415816535
The Aaron
Roll20 Production Team
API Scripter
Weird. PM me an invite and I'll jump in and try and track it down. :)