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

[Script] Power Cards

October 08 (10 years ago)

Edited October 08 (10 years ago)
I've noticed another issue with our campaign. Our party is using scripts for the first time, but we did copy and paste in the above script into the API section and it seemed to take. The macros I have created that use power cards work fine for a bit, but it seems like if I reconnect to roll20 or anything, my power card macros no longer work. There is no error, nothing. If I do a test macro of !power --name|Test it won't display anything. I didn't find much as far as setup for this goes, so I may be missing an important part.
October 08 (10 years ago)
You'd have to check the api section to see why it is stopping.
October 10 (10 years ago)

Tobel said:

I've noticed another issue with our campaign. Our party is using scripts for the first time, but we did copy and paste in the above script into the API section and it seemed to take. The macros I have created that use power cards work fine for a bit, but it seems like if I reconnect to roll20 or anything, my power card macros no longer work. There is no error, nothing. If I do a test macro of !power --name|Test it won't display anything. I didn't find much as far as setup for this goes, so I may be missing an important part.

As a routine, whenever i start a new session, I always open the API window (and keep it open during the session) to verify the sandbox (API) is running. If not i start it. If at anytime during the session it appears the api is not working i simply open the tab that contains the API debug screen and restart it if it needs.

Keep in mind that your api sandbox can actually crash on the server side (due to things outside your control) without you doing anything. So checking that the sandbox is running is standard startup for all my sessions. Perhaps others don't seem to have these issues, but they happen to me, although it happens far less now than it used to.
October 11 (10 years ago)
Gen Kitty
Forum Champion
Chris N, I also do this!
October 11 (10 years ago)
Same here. I'm not that great at idiot error proofing my scripts. I crash them all the time and I should know what does and does not crash them, lol.
October 11 (10 years ago)
Gen Kitty
Forum Champion
Is there progress on adapting this script to allow for 'only reroll once'? I honestly can't remember if someone said they were working on that.
October 11 (10 years ago)
I could, but since Riley posted the re-roll once dice mechanic suggestion... I have a feeling it is going to be added officially and won't require an api hack.
October 11 (10 years ago)
Sigh, can't even get [HR(20-8)] to work :/
October 12 (10 years ago)
It isn't meant to work that way. The crit tags do absolutely no math. Just put HR12 if that's what their crit rating is. Or do [HR@{CritFormula}] and put your crit stuff on the character sheet.
October 13 (10 years ago)
It looks like there should be a way to use this without using tokens but either I am doing something wrong (likely) or I am misunderstanding it. Whenever I try to use the @character_id it does not seem to be working for me.

Here is what I am sending that appears to work just fine:
!power --emote|Test --name|Testing --attack|[[d20]]

This does not work:
!power --emote|Test --charid|@{character_id} --name|Testing --attack|[[d20]]

I get this error - No character was found for 'character_id' which makes me think I am supposed to supply the actual character ID in the macro, but I am not sure how the players are supposed to get that and enter it into all of their macros.
October 13 (10 years ago)
If the macro is a token macro it will resolve character id. If it isn't you can use @{selected|character_id} and it will resolve the currently selected token

October 13 (10 years ago)

Zepth said:

If the macro is a token macro it will resolve character id. If it isn't you can use @{selected|character_id} and it will resolve the currently selected token


What if you do not use tokens at all?
October 13 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
I think you can do @{Bob|character_id} to get the Id for a character named Bob. Does that help?
October 13 (10 years ago)

The Aaron said:

I think you can do @{Bob|character_id} to get the Id for a character named Bob. Does that help?

You sir are a genius!
October 13 (10 years ago)
Yay for problems being solved before I see them. ^_^
October 13 (10 years ago)
@{character_id} will work whether or not you have a token selected, as long as it is a character sheet macro. It will only not work if it is a generic campaign macro on the campaign settings tab. That is when you would have to supply a name for the macro to find.
October 14 (10 years ago)
I've been manually adding --charid|@{selected|character_id} after the emotes on all of the character's powers so their token shows up in the chat window, and now that I'm done, it occurs to me that I should have asked here if there is a way to make that a default action when importing a character. That was a lot of typing, especially with seven characters in my campaign at level 7. Is there currently a way to have that be automatically added to the powers when importing a character? Maybe when they level up it will be less work! Is that already built in and I missed it?

Thanks!
October 14 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
I don't think there is, but it could be added. My UsePower script does that for its calls in abilities.
October 14 (10 years ago)
You could add a line to the character importer script to add that to the macros when imported pretty easy. I didn't even think to include it because the use of the new emotes is a little buggy with the way it sometimes throws in a blank line with a colon : at the beginning. I really, really, really, really wish we could turn that shit off.
October 14 (10 years ago)
Hi guys

Sorry to bother you.
...but I'm trying to run some basic power card but with no results. Could you please help me answering the next questions
Is there any specific place I have to use/put the code ?
Do I have to consider a power card as a macro or what ?
Do I have to import the initial huge script shown at the beginning of the post in order to be executed ?
Do I have to be a DM to create one ?


October 14 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Hi Ivano,

These scripts use the Roll20 API, which is a Mentor level feature. If you aren't a mentor (and you don't have the flag next to your name, so I'm guessing you aren't), you'll need to subscribe as a Mentor in order to use them.

Once you are a mentor, you go to Show Details on your campaign, and click API Scripts. Place the source of the script in a new tab and click save. If you aren't the DM of your campaign, then your DM needs to be a Mentor and needs to install the script in the campaign. Once it is available, players can freely execute scripts.

Hope that Helps!
October 14 (10 years ago)
Hahahahahahahahahahahahahahahaha. Sorry... i tought roll20.net was good but then after i wanted some kind of formating macros i read this and i was all like: BWAAAHAHAHAHA. Going back to maptools.
October 15 (10 years ago)

Edited October 15 (10 years ago)
Maptool is a great program, and if you like configuring your router, messing with settings, are familiar with computer stuff, and dont mind having just a few people to game with, it is the thing for you.

It doesn't have 100,000+ people on it a day though, so it must not be perfect.

Here I have been able to simulate or improve nearly everything I did in maptool, except the additional invisible layer (minor thing)

PowerCard script give me something I can't recall being available in Maptool. I love this script!
October 15 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Yeah, I try not to respond to trolls. =D I was going to say "What, the helpful and friendly attitude of the community? Guess we won't miss you then!" =D
October 15 (10 years ago)
Actually I wrote a similar D&D 4e framework for MapTool a long time ago. Used a separate popup window just for power cards/attacks. I may still have some screenshots in my pc at home for comparison. Will look in the morning.
October 17 (10 years ago)
HoneyBadger, yeah, I see the colon on every other activation of a macro using the power card script. Since it has so much other awesomeness however, I just ignore it. Is it a quick add to put the --charid string in the importer script? I have not the skills to know where or how to implement it.

Aaron, I just found your script. I'll look at it to see if I can understand how you implemented it. Thanks to both of you!
October 17 (10 years ago)
vÍnce
Pro
Sheet Author
Quick question. Is it possible to make something like this work inside a powercard output?
/r 1d100>[[@{selected|spell-fail}]]

but when I try something like;
!power --name|@{selected|character_name} --Result|1d100>[[@{selected|spell-fail}]]

It doesn't roll the 1d100, or do the comparison.
Thanks
October 17 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter

Scott B. said:

Aaron, I just found your script. I'll look at it to see if I can understand how you implemented it.

The part of interest is on line 73, in the function validateAndRepairAbility(), which is called both on add:ability and change:ability:action. It looks through each line of the ability, and if it matches the API command, it replaced the id passed to the script. In your case, you'd want to match the API command and look for --charid. Hope that helps!

October 17 (10 years ago)

Scott B. said:

HoneyBadger, yeah, I see the colon on every other activation of a macro using the power card script. Since it has so much other awesomeness however, I just ignore it. Is it a quick add to put the --charid string in the importer script? I have not the skills to know where or how to implement it.

Yeah... it's easy enough. If you use regular emotes and not the one that uses the charid, it avoids the extra colon showing up.
October 17 (10 years ago)

Vince said:

Quick question. Is it possible to make something like this work inside a powercard output?
/r 1d100>[[@{selected|spell-fail}]]

but when I try something like;
!power --name|@{selected|character_name} --Result|1d100>[[@{selected|spell-fail}]]

It doesn't roll the 1d100, or do the comparison.
Thanks

I couldn't figure out a way to get that working inside of a Powercard either, not sure what it is failing on, or if simply handling success is not within the scope of the script.
October 17 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
I think it has to be something like:

--Result|[[{1d100}>@{selected|spell-fail}]]

Certainly, all dice you want rolled must be in [[ ]] and I think > must operate on a group in { }.
October 17 (10 years ago)
I tried this as well, I think that the problem is that the "spell-fail" field is an auto-calculated field, so when you attempt to use the above I get:

SyntaxError: Expected [0-9] but "(" found.
October 17 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Ah... that makes sense. Probably there isn't a direct way around that with the inline dice syntax. You could write a script that monitors attributes and maintains an evaluated copy of spell-fail that could be used in formulae like the above, but would be kept up to date whenever it changes. Or I could write that for you. =D
October 17 (10 years ago)
vÍnce
Pro
Sheet Author
LOL, Kevin. I thought you may have dealt with this one before... Just going through the "PF-powercard-friendly" sheet you sent me. I came to the conclusion pretty fast that there was a reason that roll hadn't been given !power.

It's not that big of a deal Aaron. It's easy enough to just post the roll inside a powercard without the comparison and let us mere humans determine the outcome visually.
October 17 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Well, let me know if you decide otherwise, it's probably only about 10 lines of code if I don't make it Aaron-Pretty. =D
October 17 (10 years ago)
If you make it Aaron-Pretty, please add the green power cards for the ".monster files"

Jim
October 18 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
I'm just talking about the code! =D
October 18 (10 years ago)
Gen Kitty
Forum Champion
Wishlist: Pass URLs as clickable URLs. Example:

--DC Table|http://www.d20pfsrd.com/skills/use-magic-device

Something tells me this isn't an easy fix, but a girl can wish!

October 18 (10 years ago)
It actually is pretty easy... just trying to find an easy way to make links instead of just urls.
October 18 (10 years ago)

Updates

  • October 18th, 2014 ~ 3:40 pm eastern: Added ability to parse URLS/Links
    • Format: @@url||link text@@
    • Example: @@http://www.google.com||Google@@
    • You must enable this explicitly in the script itself using ALLOW_URLS and ALLOW_HIDDEN_URLS. This option is a use at your own risk kind of option since I'm not great at making sure input is sanitized or idiot proof.
October 18 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Does it work on whispers?
October 18 (10 years ago)
Gen Kitty
Forum Champion
HB, thank you very very much! You're a sweetheart to get this added so quickly. ^_^
October 19 (10 years ago)

The Aaron said:

Does it work on whispers?

I would guess it does.
October 19 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
I've had issues with HTML links getting scrubbed on whispers. If you've found a way to make it work, I'm totally stealing it... =D
October 19 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Appears it doesn't work with whispers. =(


October 19 (10 years ago)
Ah. Did not know that. Probably no way to get around it for security reasons or something.
Cool! now I can put the link to the spell in the powercard for it. Any questions, click the link.
Does it give you the standard "you are about to open a link outside of Roll20, open in a new window?" message?

((I got tired of looking up players stat/save scores so I used this script to whisper me them for all characters at once, like a little character sheet))
October 19 (10 years ago)

Edited October 19 (10 years ago)
HoneyBadger, or any other big brain code monkeys that sees the Matrix.

A while back you had posted about having the "monsters status cards" show up in the chat, have you or anyone else came up with away to do this?

All I see in the matrix is green lines of code, but it looks like HB's power card script could be modified to display the monster status in chat.

I have a DDI account and could export the ".monster files" and have for many of the monsters I use, but it"s very mouse click based and slow.

I all so have all the DDI power cards and creature cards in html format and love to have an importer for that format if it possible?


Here is my current solution for being up a green monster card, you need to be logged into your dndinsider account to use it. I open this file into a new window and reference it as needed.

Below is dndinsider table of content for every official monster with their links to the green cards. I would love if could use this in roll20 some how.

Monsters Html File



Jim
October 19 (10 years ago)

OldSchoolChris said:

Cool! now I can put the link to the spell in the powercard for it. Any questions, click the link.
Does it give you the standard "you are about to open a link outside of Roll20, open in a new window?" message?

((I got tired of looking up players stat/save scores so I used this script to whisper me them for all characters at once, like a little character sheet))

Yes, it does.