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] PF Character Sheet - "Skillbook" macro generator

1457900979

Edited 1458509703
James W.
Sheet Author
API Scripter
Here's an API script that will generate a token action that will put a template with buttons for each of a character's skills into the chat log (similarly to the Spellbook macro generator I posted), so players can quickly roll skill checks without having to open their character sheets.  These buttons use the macros listed on the character sheet, so any changes to the macros or the skill modifiers on the sheet will work with these buttons. Note that Craft, Lore, Perform, and Profession skills, as well as the "misc" skills at the bottom of the sheet, will only be added to "skillbook" if the names are filled in; changes to the names won't require rerunning the script, but filling in new names will. Usage is simple: select the token (or tokens) that represent the characters you want to generate skillbooks for, then type "!skillbook" into the chat window.  If you ever need to re-generate the skillbook (such as when a character fills in a skill name that was blank the first time around), just do that again, and it'll overwrite the existing token action. Speaking of which: this script is hard-coded to put this token action into a character ability named "Skills"; if a character already has an ability with that name, it will overwrite that ability .  If you wish to keep that character ability, be sure to rename it first.
1457909662

Edited 1457909805
vÍnce
Pro
Sheet Author
Cool James.  I just added Artistry and Lore (3 each) including the NPC tab to v40 beta, all are fill-in-the-name fields.  Just in case you need/want to update your script. Cheers
1457909789
James W.
Sheet Author
API Scripter
Heh, of course  you do that literally seconds  after I submitted a pull request for v1.0 of the script... :P As soon as I take a look at the changes to the sheet, I'll work on an update.
1457909848
vÍnce
Pro
Sheet Author
I did it last night in the wee hours of the night.  Many other changes as well.
1457911016
James W.
Sheet Author
API Scripter
Alright, updated the lists of skills, and it now works with the extra Artistry and Lore skills.  Gist has been updated, and I cancelled the original pull request, and resubmitted with both the v1.0 and v1.1 versions; use v1.0 with the current version of the character sheet (v.37), and v1.1 with future versions.
1457919021
vÍnce
Pro
Sheet Author
That's handy James.  Any way to not generate the Skill buttons for skills that aren't filled in?  That would just be a bonus. ;-)
1457920495
James W.
Sheet Author
API Scripter
Well, it already excludes any skills that the user hasn't filled the name in for (i.e., Craft, Perform, etc).  I'll probably add an option to exclude "trained only" skills that the character doesn't have any ranks in.
1457924636
vÍnce
Pro
Sheet Author
I think buttons for artistry, craft, perform, etc. were generated even though they wern't filled in...  I'll have to play around with it.  Thanks James.
1457925124
James W.
Sheet Author
API Scripter
Hmm, the script checks to make sure that the name filled in on the Skills tab doesn't come back as an empty string, so should skip any skills with blank names; the characters I tested it with don't seem to have any skills like that.  Please, let me know what you find.
1457930482
vÍnce
Pro
Sheet Author
Looks they generate all buttons for me.  I get similar results on 3 different characters.   This is v.40 beta on the Dev with v1.1 of Skillbook.
1457939529

Edited 1457939586
James W.
Sheet Author
API Scripter
That... is really odd.  I tested it exclusively on the dev server, and with the beta version of the sheet, and not one of my characters produced API buttons for skills with no names.  In fact, I just made sure I was running the same code that was on the Gist, and re-ran the script, still no empty skills. I went ahead and updated the script to v1.11; all I did was set it to trim the whitespace off of the names before checking if they were empty; give that a shot.  The only other thing I can think of is to make sure you don't somehow have multiple attributes on the character for the skill names.
1457942354
vÍnce
Pro
Sheet Author
Getting an error in the API console with v1.11 when I try to fire !skillbook ;-( TypeError: Cannot read property 'trim' of undefined     at apiscript.js:1388:54     at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9)     at HandleInput (apiscript.js:1371:6)     at eval (eval at <anonymous> (/home/node/d20-api-server/api-dev.js:105:34), <anonymous>:65:16)     at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api-dev.js:105:34), <anonymous>:70:8)     at /home/node/d20-api-server/api-dev.js:1163:12     at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560     at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)     at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)     at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489)
1457942771
James W.
Sheet Author
API Scripter
That actually seems to explain it; to my understanding, when an attribute doesn't exist, getAttrByName is supposed to return an empty string, but it seems that it was returning an undefined value for you, instead.  I set the script to check for that; give the latest version a shot.
1457943455
vÍnce
Pro
Sheet Author
That works!  Much better. Thanks.  What about the Misc skills?  Is the output at the bottom expected?
1457943680
James W.
Sheet Author
API Scripter
No, I just forgot that I handled those separately; should be fixed, now.
1457943818

Edited 1457945576
vÍnce
Pro
Sheet Author
New one works, but I lost Dog Training as well as the Misc...
1457973318
James W.
Sheet Author
API Scripter
It could be a capitalization issue; try the updated version.
1457982535
vÍnce
Pro
Sheet Author
Works like a champ James.  Cheers
I keep getting an "Unexpected token function" error when I try to save this API.  Am I missing something?
1457991195
James W.
Sheet Author
API Scripter
I'm not sure; I just pasted v1.11 into a campaign on the live servers, and I didn't have any errors.  All I can recommend without more info is to make sure you click the "raw" button on the Gist, and copy from there, and make sure you paste it into its own, separate script file, rather than putting it in the same file as other scripts.
I disabled all of my API scripts except for !Skillbook and now it works.  It seems that is didn't like Cgen for some reason.
1457992017

Edited 1457992047
James W.
Sheet Author
API Scripter
When I get home, I'll see if I can figure out what the conflict is. EDIT: Luckily this isn't the kind of script you need to run too often...
1458001207
James W.
Sheet Author
API Scripter
Well, I tried running CreatureGen and Skillbook at the same time, both on the Dev and live servers, with Skillbook loaded both before and after the three CGen scripts, and I haven't been able to reproduce the Invalid Token error.
I have not been able to recreate the error either.  After disabling all my API scripts, I reenabled them all and they are working fine.
Wow!  this is a really great macro!  It keeps the players off their charactor sheets and on the battle map.  Much less delay in getting rolls done.  Really speeds up combat.  Bravo!
Is there a way for me as a GM to "ignore" the chat log entries created by the usage of these macros?  Every time I ask player to roll a skill check, my chat panel is flooded with the results and it makes it hard to find each characters roll results.  Perhaps a nested roll query instead of a GM whisper would work better?  It would certainly reduce clutter in the chat pane.
1458508074
James W.
Sheet Author
API Scripter
Well... no, not as the script is currently written.  The script just puts together a macro, and the macro whispers the skillbook to the character, so it should show up for anyone who can control the character.  Currently, there is no way to whisper to yourself without using your own player name (which obviously wouldn't be something Skillbook could know ahead of time). I'm going to do a bit of a re-write on Skillbook so that it will whisper the skillbook to the player who calls it, instead of generating a macro, by default.
1458509818
James W.
Sheet Author
API Scripter
Alright, committed Skillbook v1.5 to my repo (check link in OP); Skillbook will now whisper the resulting skillbook to the player who gave the !skillbook command, instead of creating a token action.  If you want to create the token action instead, use "!skillbook --createability".