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, Call For Testers] Universal Chat Menus

February 27 (4 years ago)

Edited March 02 (4 years ago)

Bumping this for GiGs' convenience, and adding one link plus a newly noticed bug.

keithcurtis said:

Consolidated List of Bugs and Feature Requests

For whenever health, time and inclination allow. I just thought it would be handy to have these in one place.

Bug: parentheses in a feature name breaks the output of the script — keithcurtis

Feature: Include second value that, if specified, is printed on each button in parentheses — Persephone

Feature: Allow more than one attribute to be included in the report — keithcurtis

Feature: pass any unfiltered text through the UCM — keithcurtis

Code change: Don't Archive Chat Menu — keithcurtis

The linked posts explain the issue, and in some cases, provide suggested syntax.

Code change: Look into incorporate this fix for the parentheses issue — Steph

Feature: Option to build buttons with "/w gm " when the menu is printed by the GM for easy secret rolls. — Persephone

Bug: "|field=filter" also prints all items with empty "field", unless "|field!-" added (consequently bars any text with "-" in it) — Persephone

And a new, related bug

Sort of the opposite issue as above: "|field!filter" also prevents items with empty "field" from being printed, and only prints items with non-empty fields containing values that do not match the filter.

Example:

--repeating_actions|name|action|action_type=Other|other!One-Action

only prints repeating_actions with a non-empty "other" field that also does not contain "One-Action", even though the empty fields also do not contain that specified text.

Current workaround: Multiple calls for that section; one that calls all the items with an empty "other" field, then a few that search for a letter that will only come up in text that doesn't contain "One-Action" and is also likely to be used in that field (very limited options and extends time it takes for the script to filter and print the menu)

--repeating_actions|name|action|action_type=Other|other=- --repeating_actions|name|action|action_type=Other|other=minute|other!- --repeating_actions|name|action|action_type=Other|other=hour|other!- --repeating_actions|name|action|action_type=Other|other=day|other!-
March 01 (4 years ago)

Edited March 02 (4 years ago)

Feature Request

Most likely a unique case for me, so I'd probably just want to make the adjustment in my own copy of the script, but would there be any way to have the script add "`/w gm " inside the buttons only when the GM sends the menu to chat? That way my players could use it normally with their rolls public, but I could easily use it to make all rolls secretly, even when using it with their characters.

We tried using whisper queries in my game but all my players hate them lol.

March 01 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

You could probably alter it to whisper the menu itself to the GM, but any of the Abilities rolled would be beholden to the sheet settings.

March 02 (4 years ago)

Edited March 02 (4 years ago)

It does already whisper the menu to whoever prints it, but if it could check if the GM is using the command and then make the menu slightly different, so that the buttons are built with "`/w gm " inside each one, that should override whatever the sheet's whisper settings are. That way if I use a menu to roll for a player, it will be whispered regardless what that player has set their sheet to.

But I imagine this would require taking this block of the code:

        getButtonCode = (label, who, button, attribute = false) => {
let code = `[${label}](`;
if (attribute) {
code += `!
/w gm &${ch('{')}template:default${ch('}')}${ch('{')}${ch('{')}name=${ch('@')}${ch('{')}selected|character_name${ch('}')} ${label}${ch('}')}${ch('}')}${ch('{')}${ch('{')}=${ch('@')}${ch('{')}selected${ch('|')}${button}${ch('}')}${ch('}')}${ch('}')})`;
} else {
code += `~${who}|${button})`;
}
return code;
},

and changing it to check playerIsGM. If false it would make the buttons like shown above, but if true the only thing it would need to do differently is change the second half of the button as follows:

                code += ``/w gm %{${who}|${button}})`;

This would build the buttons like [label](`/w gm %{who|button}) instead of [label](~who|button)

It wouldn't be able to use the ~ since the /w gm comes before it, and it would have to use the HTML entities for the ` (to avoid closing the string in the code) and the % (to avoid calling the abilities before the menu is sent to chat).

I'm still learning JS so I'm not sure yet how best to set up the function (I'm guessing if () else function) for this otherwise I'd do it myself.

March 02 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Have you tried that code manually? I don't think it will work that way, since the ability you are invoking uses its own generated whisper string, but I could be wrong. 

Yeah, I tested buttons in chat with the [label](`/w gm %{who|button}) format, using sheets with rolls set to public, whisper, and query. It whispered the output to me each time, which is what I'm wanting.

March 02 (4 years ago)

Edited March 02 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

I think this is a great suggestion, and I'll definitely get around to adding it on that fateful day I start rewriting this code. 

That said, I wouldnt implement this change in the way suggested, because it looks like it has unforeseen consequences (described below). But if you want to try it, here's what you need to make it work:

You'd need to pass the character id (cid) to that function. Although since it was created in the parent function, it should still work. 

To implement the extra if, you just need to add an "else if" like below. 

getButtonCode = (label, who, button, attribute = false) => {
let code = `[${label}](`;
if (attribute) {
code += `!
/w gm &${ch('{')}template:default${ch('}')}${ch('{')}${ch('{')}name=${ch('@')}${ch('{')}selected|character_name${ch('}')} ${label}${ch('}')}${ch('}')}${ch('{')}${ch('{')}=${ch('@')}${ch('{')}selected${ch('|')}${button}${ch('}')}${ch('}')}${ch('}')})`;
} else if (playerIsGM(cid)){

                code += ``/w gm %{${who}|${button}})`;

            } else {
code += `~${who}|${button})`;
}
return code;
}
If that doesnt work (test it first), you just need to make three small edits to the script as well as the above, to make sure the function recieves the character id:

change the first line of the function above to 
getButtonCode = (label, who, button, cid, attribute = false) => {

Then change line 169 to

getButtonCode(getAttrByName(cid, repname(section, id, display)), who, repname(section, id, button), cid, buttonAttr));

and change line 195 to

getButtonCode(label, who, button, cid, buttonAttr));


Two reasons I wouldn't do it like this:

First, the aesthetic reason, the cid and who variables are essentially referring to the same thing (who = player name, cid = player id), so I'd rewrite that function to replace who with the character id, then get player name within the code from the id. No sense in passing the same identity twice. 

Second, the practical reason: it looks to me that this will send every button the GM clicks as a whisper, which isnt desirable. Sometimes you'll want the players to see your menu rolls.

It would be better to create a setting that can be passed by the chat menu that tells the function whether to whisper the button or not. And it would be ebtter to make it more universal: some players (not just the GM) might want to create buttons that whisper to them, too.

To create this functionality needs a more substantial change in the code, which will have to wait.


March 02 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


GiGs said:

To create this functionality needs a more substantial change in the code, which will have to wait.

I eagerly anticipate your eventual return to this script. :)



GiGs said:

It would be better to create a setting that can be passed by the chat menu that tells the function whether to whisper the button or not. And it would be ebtter to make it more universal: some players (not just the GM) might want to create buttons that whisper to them, too.


That's a brilliant idea! In the meantime, I'll test out the changes you suggested. Most rolls I want public are usually custom macros anyway, so I don't mind all rolls from my menus being whispered for now.

March 03 (4 years ago)

Edited March 03 (4 years ago)

Okay so I tested your initial suggestion, and the API crashed when I tried running the command. Then I made the other 3 changes, and the menus work fine but nothing seems to have changed. The buttons are built the same whether I print the menu or a player does. Shouldn't it be checking playerIsGM(msg.playerid) instead of playerIsGM(cid)?

March 03 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Oh yes, it should be checking player not character.

Assuming these functions are called from a context that recognises msg, you can fix it by changing line 169 to

getButtonCode(getAttrByName(cid, repname(section, id, display)), who, repname(section, id, button), pid, buttonAttr));

and change line 195 to

getButtonCode(label, who, button, pid, buttonAttr));


But you'll also have to change a couple of other lines

Line 113

buildButtons = (cid, who, args, pid) => {

and line 260

let buttons = buildButtons(cid, who, args, msg.playerid);


You can see why i hadnt done this earlier-  any small change requires a bunch of other changes, and the knock-on effect that might make the script break if you aren't careful.

If this doesnt work, you're on your own, until i can find the time to do this properly!


That worked :) Thanks again, GiGs!

March 03 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Great :)

March 25 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

For anyone using my UCM macros for D&D 5th Edition by Roll20, I have updated the code to match recent changes in the sheet attribute names.

For quick reference:

NPC Code

PC Code

Thank you keithcurtis!!! I was pulling my hair out with my last group, because my macros stopped working!!

March 25 (4 years ago)

For the PC Code I keep getting this error

Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info...

For reference, the error message generated was: Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}] undefined

March 25 (4 years ago)

NPC traitis give this error

Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info...

For reference, the error message generated was: TypeError: Cannot read property 'split' of undefined TypeError: Cannot read property 'split' of undefined at apiscript.js:11626:58 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1648: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) at Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400

March 25 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

While I don't doubt you are getting the errors, the macro code is not the cause. The PC code has been unchanged for months, and only one attribute on the NPC code was changed. Also, I'm not even sure it's possible to cause an API crash with macro code in UCM. This looks indicative of a script error. Did you just recently install UCM or another script?

March 25 (4 years ago)

This is for a new game. I had just installed a few of my normal ones.  The API only crash, so far when trying to run the PC code and when trying the traits from the NPC. I know they changed the traits to be clickable now so I didn't know if something else changed that might cause the issue. I will play around with it more when I am not at work and see if I find anything else.

March 25 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Have you tried running any other macros using UCM?

March 25 (4 years ago)
I re-added the code to the game, and the NPC macro one works fine. I still the same error for the PC.
But when I use the following macro (modified off your)  that I use in another game it works.
!chatmenu @{selected|character_id} {template:atk} {{charname=Race: @{selected|race_display}
**HP: **@{selected|hp} / @{selected|hp|max} | ** AC: ** @{selected|ac} | **Spd: ** @{selected|speed} | **Passive: ** @{selected|passive_wisdom}
}}{{r1=@{selected|character_name}}} {{normal=1}} {{attack=1}} {{range=**@{selected|class_display}** | @{selected|background}}}{{desc=CHATMENU}} --separator: | :   --title:``-----Ability Rolls-----`` --**Str @{selected|strength}** *(@{selected|strength_mod})* ,strength|**Dex @{selected|dexterity}** *(@{selected|dexterity_mod})*,dexterity|**Con @{selected|constitution}** *(@{selected|constitution_mod})* ,constitution|**Int @{selected|intelligence}** *(@{selected|intelligence_mod})* ,intelligence|**Wis @{selected|wisdom}** *(@{selected|wisdom_mod})*,wisdom|**Cha @{selected|charisma}** *(@{selected|charisma_mod})*,charisma --title:``-----Saving Throws-----`` --Str,strength_save|Dex,dexterity_save|Con,constitution_save|Int,intelligence_save|Wis,wisdom_save|Cha,charisma_save|**☠☠Death Save☠☠**,death_save  --title:``----Skills----`` --Acrobatics,Acrobatics|Animal Handling,Animal_Handling|Arcana,Arcana|Athletics,Athletics|Deception,Deception|History,History|Insight,Insight|Intimidation,Intimidation|Investigation,Investigation|Medicine,Medicine|Nature,Nature|Perception,Perception|Performance,Performance|Persuasion,Persuasion|Religion,Religion|Sleight of Hand,Sleight_of_Hand|Stealth,Stealth|Survival,survival --title:``----Traits----`` --repeating_traits|name|output|name!Invocation:  --title:``----Attacks----`` --repeating_attack|atkname|attack  --title:``--Eldritch Invocations--`` --repeating_traits|name|output|name=Invocation: --title:``---Cantrips —  *Save DC @{selected|spell_save_dc}*---`` --repeating_spell-cantrip|spellname|spell --title:``----Lvl-1 *(@{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total})*----`` --repeating_spell-1|spellname|spell|spellprepared --title:``-----Lvl 2 *(@{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total})*----`` --repeating_spell-2|spellname|spell|spellprepared --title:``----Lvl 3 *(@{selected|lvl3_slots_expended}/@{selected|lvl3_slots_total})*----`` --repeating_spell-3|spellname|spell|spellprepared --title:``----Lvl 4 *(@{selected|lvl4_slots_expended}/@{selected|lvl4_slots_total})*----`` --repeating_spell-4|spellname|spell|spellprepared --title:``----Lvl 5 *(@{selected|lvl5_slots_expended}/@{selected|lvl5_slots_total})*----`` --repeating_spell-5|spellname|spell|spellprepared --title:``----Lvl 6 *(@{selected|lvl6_slots_expended}/@{selected|lvl6_slots_total})*----`` --repeating_spell-6|spellname|spell|spellprepared --title:``----Lvl 7 *(@{selected|lvl7_slots_expended}/@{selected|lvl7_slots_total})*----`` --repeating_spell-7|spellname|spell|spellprepared --title:``----Lvl 8 *(@{selected|lvl8_slots_expended}/@{selected|lvl8_slots_total})*----`` --repeating_spell-8|spellname|spell|spellprepared --title:``-----Lvl 9 *(@{selected|lvl9_slots_expended}/@{selected|lvl9_slots_total})*----`` --repeating_spell-9|spellname|spell|spellprepared --title:``--Resources (read-only)--`` --@{selected|class_resource_name} *@{selected|class_resource}/@{selected|class_resource|max}|@{selected|other_resource_name} *@{selected|other_resource}/@{selected|other_resource|max}*&{noerror}
March 25 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Also, I just made one other slight change to the NPC code. It was forming the menu just fine, but not reporting the feature correctly. It should work now.

March 25 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Kilter said:

I re-added the code to the game, and the NPC macro one works fine. I still the same error for the PC.

I just replaced my PC macro directly from the gist, and I'm not getting an error. I'm not sure what's up. Does the error occur when you run the macro, or when you press one of the chat buttons? Also (and I know this is likely a stupid question, but I'm trying to be thorough), you are testing these macros on a game running the D&D 5th Edition by Roll20 sheet?

March 25 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

NPC macro still giving inconsistent reports depending on if NPC was created before or after the change. Why in the name of all that's Gygax would they change an attribute name???

March 25 (4 years ago)

Edited March 25 (4 years ago)

Yes, roll20 sheet for 5e. (not a dumb question) The error happens when I click the macro for the PC. (token action)

March 25 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

OK, I tracked down one element that was causing inconsistency, at least on NPCs. Actually view the character sheet. If for some insane reason it's asking do you want to use charactermancer on this or edit directly, dismiss it with edit directly. Why it would even consider asking this on an NPC Compendium drop is boggling.

I'm getting consistent behavior and no errors in macro or API now.

As annoying as it is, try creating a new new game, with just UCM installed. Drag and drop a compendium NPC and create a new PC to test on.

March 25 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Keith is answering these questions well, so i dont have anything to contribute yet. But I;m still here if the problem turns out to somehow be UCM.

Keith, I am having the same issue with the API not working on the PC side. Any NPC works great, but not the PC and I am getting the same error message as Kilter.


April 01 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

An API crash? Is the PC sheet out of Charactermancer mode?

April 03 (4 years ago)

Edited April 03 (4 years ago)

Posted this on another post as well, but adding here for potential visibility. I get an API crash when attempting the PC macro from the current iteration of the Gist and API from this page here. The error message in the API sandbox varies from character to character.

Error messages always terminate as follows:

Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}]
undefined

Sometimes the error has more detail and terminates after some more information. This is after restarting the API and attempting the PC on a character token with the macro.

"Starting webworker script..."
"Loading 705 translation strings to worker..."
"-=> GroupInitiative v0.9.32 <=-  [Tue Mar 17 2020 02:20:23 GMT+0000 (UTC)]"
"-=> Universal Chat Menu v0.3.5 <=-   [Wed May 29 2019 06:00:03 GMT+0000 (UTC)]"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3RTl63QwsZObKgb5VX_"
"rules: [{\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}]"
"rule: {\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}"
"value: WEAPON"
"match: Language"
"pass: false"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3RTl63QwsZObKgb5VY_"
Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}]
undefined

This is on a different character token with the same macro after restarting the API sandbox:

Spinning up new sandbox...
"Starting webworker script..."
"Loading 705 translation strings to worker..."
"-=> GroupInitiative v0.9.32 <=-  [Tue Mar 17 2020 02:20:23 GMT+0000 (UTC)]"
"-=> Universal Chat Menu v0.3.5 <=-   [Wed May 29 2019 06:00:03 GMT+0000 (UTC)]"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3X9p3d6SI4MYPIWrCH_"
"rules: [{\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}]"
"rule: {\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}"
"value: WEAPON"
"match: Language"
"pass: false"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3X9p3d6SI4MYPIWrCI_"
"rules: [{\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}]"
"rule: {\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}"
"value: WEAPON"
Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}]
undefined


Edit/Update: I initialized a new game with only this macro and API script running with a completed character from the charactermancer and see the same type of error message.

April 04 (4 years ago)

Edited August 25 (4 years ago)

Modular Menus for Pathfinder Second Edition by Roll20 sheet

08/24/20—Updated to include hyperlinks in certain menus and to support secondary and subsequent attack rolls (plus a makeshift way to support Alchemist's formulae).

04/04/20—Updated to be compatible with changed repeating section names and offer more filtering options.

For my menus for the Pathfinder by Roll20 sheet, see this post.

These are menus for the new Pathfinder Second Edition by Roll20 sheet. I'm also using keith's inline links Stylus script (just the top half) and Mik's PF2e alt template Stylus script.

Most of these filter out items with the padlock emoji in the name, as I like to add things to my sheet for higher levels and 'lock' them.

The name of each file includes the emoji I use as the macro name in parentheses.

For any interested in using them:

Combat

Contains HTML entities so I recommend saving these first as Abilities on a macro character, then making a global macro that calls that Ability.

Prints melee strikes, ranged strikes, and actions with Attack trait. For this purpose, I add the Attack trait to all actions that involve the Strike action. Now uses multiple menus, accessible using the Second and Subsequent buttons in the footer of the initial menu. The Second menu also has a button for Subsequent attacks. These extra menus make buttons using the new #2 and #3 buttons from the sheet which apply multiple attack penalty (MAP) to the roll. I've also included buttons for Acrobatics and Athletics skill checks, since they're used for most of the Attack actions; however, in the Second and Subsequent menus, these buttons instead look for Abilities on the selected character that are custom macros for applying MAP to each of those skills. I've included in the pastebin a macro for using the script SetAbility to apply these to selected characters. I plan to request #2 and #3 buttons be added to those skills on the official sheet, which will get rid of the need for these extra Abilities.


Spells (Spontaneous Caster) | (Prepared Caster) | (Innate/Focus Only)

Contains HTML entities so I recommend saving these first as Abilities on a macro character, then making a global macro that calls that Ability.

Gives a drop-down to choose from All, Innate, Focus, Cantrips, and levels 1-10.

As I've reached higher levels and gotten a large number of spells, sometimes filtering through all those repeating items leads to the script crashing due to a possible infinite loop, so I only use the All option for lower level casters.

Now includes a button for a macro called REFOCUS that uses the Ammo script to return one Focus Point (I put buttons in the spell descriptions themselves for spending points/slots), as well as a footer showing Spell DC and a button for a macro called SpellCounteractRoll that rolls makes a counteract roll with the appropriate modifiers for spells. Both of these extra macros are included in the pastebin.

The Prepared Caster version only shows spells with a non-0 number in the left Daily Uses box

I've also added a menu for characters with only Innate and/or Focus Spells, such as Monks, Champions, or Rangers.


Alchemist's Formulae

Since the sheet doesn't have a tab for Alchemist's formulae, I use the spells tab to track all known formulae and daily infused reagents.

This menu filters the Normal Spells section for the following traits: Bombs, Elixirs, Mutagens, Poisons, Tools. I use it for infusions since they're used immediately and not carried, while tracking non-infused alchemical items in Inventory.

Here's an example of how I set up a spell as a formula:

Adding }} {{subheader=Level @{current_level} in the Cast field overrides the subheader that shows the school and spell tags.

So it comes out like this:

Compact NPC Sheet

Prints the entire NPC sheet (minus the initiative button; see below) into chat in a compact form. Includes spells at the bottom. Items have been moved down to keep Strikes closer to the top of the menu, and some NPC item lists end up being quite long. Avoid commas in Senses, as this will break part of the menu (I replace them with semicolons in the sheet).


NPC Initiative

Not a menu, but still relevant I think. Since PF2E allows you to use different skills for the initiative roll, a simple Initiative token action doesn't quite suffice. This prompts you with a drop-down query to select the skill being used. Unfortunately the query must be answered twice; each has a different output and I don't know of a way to consolidate them.

The roll also adds the character's bonus to the relevant skill as a decimal in the case of a tie, as well as a static +0.3 to maintain the CRB method of "Enemies always win ties"


Hazards

I use NPC sheets to store Hazard stats, and this is an altered version of the NPC menu. I use the following sections of the NPC sheet for the usual Hazard stats:

sheet section = hazard stat

Stealth notes = Stealth DC

AC notes = Description

Speed notes = Disable requirements

HP notes = Hardness and Broken Threshold

Saving Throws and Ability Checks

Saves show the bonus in parentheses, and the proficiency is marked as a bold letter next to it. Abilities show the ability score, with the modifier in parentheses.

Now includes a button for a macro called FLATCHECK that's just a templated version of a d20 roll. You change the link to [Flat Check](`/R 1D20) if you don't want to bother with the extra macro.

Skills

Prints Perception, senses, and all skills.

Shows proficiency same as for Saves; groups all Lore skills separately (can't print their proficiency since they're repeating items, so instead I manually add (#) **P** to the name, like (7) **T** in the example above).

Defenses

Shows armor class, armor (filters worn item descriptions for the words 'armor', 'mail', and 'plate' while avoiding the work 'affix'; may find a better way to do this in the future), resistances , hit points, shield stats, and Save and Skill DCs. The emojis represent the following: [hourglass] temp HP, [skull] Dying value, [bandage] Wounded value, [shield] AC w/ shield raised, [hammer] shield's Hardness, [spanner] shield's Broken Threshold, [heart] shield's HP.

Buttons for macros that use ChatSetAttr to adjust the Dying value, Wounded value, and shield Hit Points have been moved to the footer.

Inventory

Shows Bulk capacity and Encumbrance limit, coins, and items in the Worn, Readied, and Other (Stowed) repeating sections of the sheet.

Now includes a button in the footer for a macro called CoinSpendage that uses an Ammo command to lets the player reduce their coin quantities.

Actions

Contains HTML entities, so I recommend saving it first as an ability on a macro character.

I've nested these so only one Actions button needs to be set as a Token Action. It gives you the following menu:

This shows actions with traits matching the class in @{class} for the selected character, as well as actions with the Concentrate, Manipulate, and Move traits that are not Exploration or Downtime, plus free actions and reactions. Basically everything your character can do during combat besides Attacks. Then in the footer are buttons for filtering all actions by Type, Name, Trait, or Skill.


by Trait

Type a trait into the query, and the menu prints all actions with that trait in the Traits field.


by Skill

Select a skill from the drop-down query, and the menu prints all actions with that skill in the Source field.

by Name

Type an action name or partial name into the query, and the menu prints all actions with that string in the name.


by Type

Gives a drop-down to filter actions by Action Type, based on the type assigned to that action or by looking for the words 'minute', 'hour',  'day', and 'week'. in the action's Other field for activities that take longer than 3 actions. The option Other prints any actions that don't match any categories:

  • 1 ▶️
  • 2 ⏩
  • 3 ⏭️
  • 1-3 ▶️-⏭️
  • Free Action ⏺️
  • Reaction ↩️
  • 1+ min
  • 1+ hr
  • 1+ day
  • 1+ wk
  • Other

Initiative

This one is just a normal chat menu, as it uses Abilities in a character named 'macro' for the buttons. Each Ability is named after one of the listed skills (lower case). The first macro here is the Initiative Menu, followed my the individual skill macros to use as Abilities in the 'macro' character. These are all separated by two lines of double backslash in the link.

The roll also adds the character's bonus to the relevant skill as a decimal in the case of a tie with another PC. (I give enemies a +0.3 to their rolls to follow the CRB method of "Enemies always win ties")

Character Details

Shows ancestry and heritage, class, level, alignment, size, age, height, weight, speed, deity, xp, background, class specialization (looks for items in class abilities with matching words in the Type field, like bloodline, muse, racket, school, etc.), archetype(s), languages, and feats of each category.


April 04 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

wowzers, great work Persephene.

Bob said:

Posted this on another post as well, but adding here for potential visibility. I get an API crash when attempting the PC macro from the current iteration of the Gist and API from this page here. The error message in the API sandbox varies from character to character.

Error messages always terminate as follows:

Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}]
undefined



Edit/Update: I initialized a new game with only this macro and API script running with a completed character from the charactermancer and see the same type of error message.


When an error like this occurs, it usually means there's some incompatible data. Characters that would normally break javascript will tend to break this script (until I add some more robust error checking), which means things like brackets or hyphens in attribute names might case problems.

What is generating the error codes you are receiving?

April 04 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

That's awesome Persephone!

And the best use of table formatting I've seen on the Roll20 forums. That can't have been easy.

Lol! Thanks, I was pleasantly surprised to discover line breaks work in table cells :)

Some of the old menus no longer worked because a few repeating sections got renamed, plus I've gotten a lot better at formatting the templates. I'm no scripter, but I make a mean macro!

April 04 (4 years ago)

Anyone interested in taking a crack at showing the rest of us how to use UCM for the GURPS #1 sheet?  Any examples of how that might look?

April 05 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Someone familiar with the sheet and system would need to describe what you want to see in the chat menu output. 


Bob said:

Posted this on another post as well, but adding here for potential visibility. I get an API crash when attempting the PC macro from the current iteration of the Gist and API from this page here. The error message in the API sandbox varies from character to character.

Error messages always terminate as follows:

Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}]
undefined

Sometimes the error has more detail and terminates after some more information. This is after restarting the API and attempting the PC on a character token with the macro.

"Starting webworker script..."
"Loading 705 translation strings to worker..."
"-=> GroupInitiative v0.9.32 <=-  [Tue Mar 17 2020 02:20:23 GMT+0000 (UTC)]"
"-=> Universal Chat Menu v0.3.5 <=-   [Wed May 29 2019 06:00:03 GMT+0000 (UTC)]"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3RTl63QwsZObKgb5VX_"
"rules: [{\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}]"
"rule: {\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}"
"value: WEAPON"
"match: Language"
"pass: false"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3RTl63QwsZObKgb5VY_"
Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}]
undefined

This is on a different character token with the same macro after restarting the API sandbox:

Spinning up new sandbox...
"Starting webworker script..."
"Loading 705 translation strings to worker..."
"-=> GroupInitiative v0.9.32 <=-  [Tue Mar 17 2020 02:20:23 GMT+0000 (UTC)]"
"-=> Universal Chat Menu v0.3.5 <=-   [Wed May 29 2019 06:00:03 GMT+0000 (UTC)]"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3X9p3d6SI4MYPIWrCH_"
"rules: [{\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}]"
"rule: {\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}"
"value: WEAPON"
"match: Language"
"pass: false"
"=== FILTER ===="
"check: prof_type=Language prefix: repeating_proficiencies_-M3X9p3d6SI4MYPIWrCI_"
"rules: [{\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}]"
"rule: {\"stat\":\"prof_type\",\"match\":\"Language\",\"type\":\"=\"}"
"value: WEAPON"
Could not determine result type of: [{"type":"M","expr":0},{"type":"C","text":"]"}]
undefined


Edit/Update: I initialized a new game with only this macro and API script running with a completed character from the charactermancer and see the same type of error message.


Hey just wanted to report that I'm getting the same error with the PC script.

April 14 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Yoou'll need to mention what sheet you are using, and give the macro you are using which causes the crash.

April 14 (4 years ago)

Edited April 14 (4 years ago)

Sorry for not being specific.

I'm using the same macro as Bob, which is Keith's PC Macro. The NPC one works fine but the PC Macro crashes my API with the exact same error.

Like Bob I'm also using Roll20's 5E Character Sheet

Addendum: I've added and tested Keith's macros for inventory, spell filter, NPC and PC macros... All of them work except for PC for some reason. The PC one just crashes the API

April 14 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

It's likely there's an attribute in your character sheet somewhere that contains a value that is breaking the script.

It would be a good idea to remove sections from the pc script, try it, them remove other sections, try it again. When you successfully run it without causing the crash you'll identify where the troublesome attributes is.

I'd offer to jump into your campaign and look for the issue myself, but i cant today.

when removing things, like to --title and remove everything from there to the next --title, then run the macro and see if it crashes the sandbox.

Keep doing it till you dont get a crash, and then report back with the last title section you removed before it started working properly.

Weird, I deleted just about everything relating to your universal chat menu script and it still crashed. This was what I ran in my last test which crashed with the same error


April 14 (4 years ago)

Edited April 14 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Just try this and see if it works

!chatmenu @{selected|character_id} {template:npcaction} {{rname=@{selected|character_name}}} {{description=CHATMENU }} --separator: | --title:Skills --Acrobatics,Acrobatics|Animal Handling,Animal_Handling

Also, what is your character's name? Does it include any characters that aren't alphabet letters?

April 14 (4 years ago)
Kraynic
Pro
Sheet Author

What do the character names look like?  Some character names can break the script, depending on how they are written.

I don't think in-line rolls work within the chat menu template, that usually causes crashes for me, too. I usually include any info that needs a in-line roll in a separate template within the same macro.

No special characters. PC names are: Eddie, Judge Suedy, Mace Dindu etc... no numbers nor special characters. Just alphabets and spaces

So I removed the !chatmenu and it churns out this:


GiGs said:

Just try this and see if it works

!chatmenu @{selected|character_id} {template:npcaction} {{rname=@{selected|character_name}}} {{description=CHATMENU }} --separator: | --title:Skills --Acrobatics,Acrobatics|Animal Handling,Animal_Handling

Also, what is your character's name? Does it include any characters that aren't alphabet letters?

This works fine btw

The weird thing is that Keith's NPC Macros work fine on my PCs.


So I'm guessing Persephone is right, it's in-line rolls? But what the heck is an inline roll?

April 14 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter


Persephone said:

I don't think in-line rolls work within the chat menu template, that usually causes crashes for me, too. I usually include any info that needs a in-line roll in a separate template within the same macro.


That's curious. It probably depends where you put them. If you try to use inline rolls in the part of the macro that is processed by chatmenu, i can see them braking things, but in the initial part where keith uses them here, they shouldn't. Keith, do the inline rolls in this macro work okay for you?

April 14 (4 years ago)

Edited April 14 (4 years ago)

Oh my god it finally works. It's the Jump calculator that caused it to crash!

**Jump** - Long [[(@{selected|strength}/2)]] / [@{selected|strength}]ft. | High [[((@{selected|strength_mod}+2)/2)]] / [[@{selected|strength_mod}+2]] ft.


Once I removed that bit it totally works

April 14 (4 years ago)

Edited April 14 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter


Benjamin Quekers said:

GiGs said:

Just try this and see if it works

!chatmenu @{selected|character_id} {template:npcaction} {{rname=@{selected|character_name}}} {{description=CHATMENU }} --separator: | --title:Skills --Acrobatics,Acrobatics|Animal Handling,Animal_Handling

Also, what is your character's name? Does it include any characters that aren't alphabet letters?

This works fine btw

The weird thing is that Keith's NPC Macros work fine on my PCs.


So I'm guessing Persephone is right, it's in-line rolls? But what the heck is an inline roll?


So something in the template is causing the crash. Let's test if its an online roll.

Try this

!chatmenu @{selected|character_id} {template:npcaction} {{rname=[[@{selected|character_name} length: [[@{selected|strength}]]}} {{description=CHATMENU }} --separator: | --title:Skills --Acrobatics,Acrobatics|Animal Handling,Animal_Handling


That's been the case for me, in-line rolls in any part of the template would crash the API, but it's been so long since I started avoiding that. I assumed it was part of the same reason in-line rolls in a repeating item name would cause a crash.