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

July 10 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

That's almost certainly the Pathfinder by Roll20 character sheet, then. You'd have to specifically choose a different one. Cool!

July 10 (4 years ago)

Edited August 16 (4 years ago)
Kraynic
Pro
Sheet Author

Here is what I am currently using for the Pathfinder by Roll20 sheet. The NPC menu gives you just about everything you need except for skills.  The skills menu works for both PCs and NPCs, and filters out skills that aren't trained.

NPC

!chatmenu @{selected|character_id} {template:pc} {{charname=@{selected|character_name}}} {{type=ability}} {{smallname=NPC MENU}} {{showchar=[1]}} {{descflag=1}} {{desc=CHATMENU **Defense Statistics** AC @{selected|ac} |Touch @{selected|ac_touch} |Flat-Footed @{selected|ac_flatfooted} |CMD @{selected|cmd_mod} |SR @{selected|sr} }} {{shownotes=[1]}} {{notes=**- Fort:**@{selected|fortitude_notes} |**Ref:**@{selected|reflex_notes} |**Will:**@{selected|will_notes} |**AC:**@{selected|ac_notes} |**CMD:**@{selected|cmd_notes} |**SR:**@{selected|sr_notes}|**Defensive Abilities:**@{selected|defensive_abilities}|**DR:**@{selected|npc_dr}}} --title:Melee Attacks --separator:~ --repeating_npcatk-melee|atkname|attack --title:Ranged Attacks --repeating_npcatk-ranged|atkname|attack --title:Special Attacks --repeating_npcatk-special|atkname|attack --title:Spell Like and Items --separator:~ --repeating_spell-like|spelldisplay|spell --title:Cantrips and Orisons --separator:~ --repeating_spell-0|spelldisplay|spell --title:Level 1 --repeating_spell-1|spelldisplay|spell --title:Level 2 --repeating_spell-2|spelldisplay|spell --title:Level 3 --repeating_spell-3|spelldisplay|spell --title:Level 4 --repeating_spell-4|spelldisplay|spell --title:Level 5 --repeating_spell-5|spelldisplay|spell --title:Level 6 --repeating_spell-6|spelldisplay|spell --title:Level 7 --repeating_spell-7|spelldisplay|spell --title:Level 8 --repeating_spell-8|spelldisplay|spell --title:Level 9 --repeating_spell-9|spelldisplay|spell --title:Saves --Fort(@{selected|fortitude}),fortitude --Ref(@{selected|reflex}),reflex --Will(@{selected|will}),will

Skills

!chatmenu @{selected|character_id} {template:pc}{{charname=@{selected|character_name}}} {{type=ability}} {{smallname=SKILLS}} {{showchar=[1]}} {{descflag=1}} {{desc=CHATMENU}} --title:Athletic Skills --Acrobatics,acrobatics|Climb,climb|Fly,fly|Swim,swim --title:Sneaky Skills --Disable Device,disabledevice,disable_device_ranks|Escape Artist,escapeartist|Disguise,disguise|Sleight of Hand,sleightofhand,sleight_of_hand_ranks|Stealth,stealth --title:Social Skills --Bluff,bluff|Diplomacy,diplomacy|Intimidate,intimidate|Sense Motive,sensemotive --title:Utility Skills --Appraise,appraise|Handle Animal,handleanimal,handle_animal_ranks|Heal,heal|Linguistics,linguistics,linguistics_ranks|Perception,perception|Ride,ride|Spellcraft,spellcraft,spellcraft_ranks|Survival,survival|Use Magic Device,usemagicdevice,use_magic_device_ranks --title:Knowledge Skills --Knowledge (Arcana),knowledgearcana,knowledge_arcana_ranks|Knowledge (Dungeoneering),knowledgedungeoneering,knowledge_dungeoneering_ranks|Knowledge (Local),knowledgelocal,knowledge_local_ranks|Knowledge (Nature),knowledgenature,knowledge_nature_ranks|Knowledge (Planes),knowledgeplanes,knowledge_planes_ranks|Knowledge (Religion),knowledgereligion,knowledge_religion_ranks|Knowledge (Engineering),knowledgeengineering,knowledge_engineering_ranks|Knowledge (Geography),knowledgegeography,knowledge_geography_ranks|Knowledge (History),knowledgehistory,knowledge_history_ranks|Knowledge (Nobility),knowledgenobility,knowledge_nobility_ranks --title:Craft Skills --@{selected|craft_name},craft,craft_ranks --repeating_skillcraft|name|skill --title:Perform Skills --@{selected|perform_name},perform,perform_ranks --repeating_skillperform|name|skill --title:Profession Skills --@{selected|profession_name},profession,profession_ranks --repeating_skillprofession|name|skill --separator:~

Attacks

!chatmenu @{selected|character_id} {template:pc} {{charname=@{selected|character_name}}} {{type=ability}} {{smallname=ATTACKS}} {{showchar=[1]}} {{descflag=1}} {{desc=CHATMENU}} --title:Attack Options --separator:~ --repeating_attacks|atkname|fullattack

Spells (includes Spell-like)

!chatmenu @{selected|character_id} {template:pc} {{charname=@{selected|character_name}}} {{type=ability}} {{smallname=MAGIC}} {{showchar=[1]}} {{descflag=1}} {{desc=CHATMENU}} --title:Cantrips and Orisons --separator:~ --repeating_spell-0|spelldisplay|spell --title:Level 1 --repeating_spell-1|spelldisplay|spell --title:Level 2 --repeating_spell-2|spelldisplay|spell --title:Level 3 --repeating_spell-3|spelldisplay|spell --title:Level 4 --repeating_spell-4|spelldisplay|spell --title:Level 5 --repeating_spell-5|spelldisplay|spell --title:Level 6 --repeating_spell-6|spelldisplay|spell --title:Level 7 --repeating_spell-7|spelldisplay|spell --title:Level 8 --repeating_spell-8|spelldisplay|spell --title:Level 9 --repeating_spell-9|spelldisplay|spell --title:Spell Like and Items --repeating_spell-like|spelldisplay|spell

Feats/Traits

!chatmenu @{selected|character_id} {template:pc} {{charname=@{selected|character_name}}} {{type=ability}} {{smallname=FEATS & TRAITS}} {{showchar=[1]}} {{descflag=1}} {{desc=CHATMENU}} --title:Feats --separator:~ --repeating_feats|name|feat --title:Features and Traits --repeating_abilities|name|trait

Saves and Stats

!chatmenu @{selected|character_id} {template:pc}{{charname=@{selected|character_name}}} {{type=}} {{smallname=Defenses}} {{showchar=[1]}} {{descflag=1}} {{desc=CHATMENU **Defense Statistics** AC @{selected|ac} |Touch @{selected|ac_touch} |Flat-Footed @{selected|ac_flatfooted} |CMD @{selected|cmd_mod} |SR @{selected|sr} }} {{shownotes=[1]}} {{notes=**- Fort:**@{selected|fortitude_notes} |**Ref:**@{selected|reflex_notes} |**Will:**@{selected|will_notes} |**AC:**@{selected|ac_notes} |**CMD:**@{selected|cmd_notes} |**SR:**@{selected|sr_notes}}} --separator:~ --title:Stats --STR(@{selected|strength}),strength|DEX(@{selected|dexterity}),dexterity|CON(@{selected|constitution}),constitution|INT(@{selected|intelligence}),intelligence|WIS(@{selected|wisdom}),wisdom|CHA(@{selected|charisma}),charisma --title:Saves --Fort(@{selected|fortitude}),fortitude --Ref(@{selected|reflex}),reflex --Will(@{selected|will}),will 

I haven't looked these over since setting them up quite a while ago, so some of them might be able to be condensed in some way, but hopefully that will get you going, or give you some ideas.  I think someone else posted something they used back on page 3 or 4 of the thread.

Edit: Updated the npc menu to include info on damage reduction (DR).

July 11 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

The thread was busy yesterday!


Jarren K. said:

One more request: the ability to add a carriage return as the separator. It seems that it's not possible to use &#10; or &#13; or <br> or /r.  Looks like that would have to be something in the script itself. 

A carriage return should be possible to add, but I think it'll a change to the way buttons are created. I'm planning to refactor the code, which will be a big job. I have a bunch of RL stuff going on (including house repairs and a move). I dont expect to have time to work on it till the end of the month. But Keith will be pleased to know that it will be my first programming priority for next month. 

Johnny Meatshield said:

If you have time, I have a request.  Would it be possible to toggle buffs?  I know there is a Chatsetattr api already but it looks like you need to know the name or ID of the buff in order to do that.  I can use UCM to make a list of buffs but the ability to toggle is escaping me.

Buffs are out of scope for this script. But adding the ability to call other scripts - like chatSetAttr which can do them - is in my plans. But it wont be for a while (see above reply). 


July 11 (4 years ago)

Edited July 11 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Here's my current list of bugs to be fixed, and feature suggestions, for the next version of the script. (They might not all get done!)

Let me know if there's anything I've overlooked.


    ==== BUGS ==== 
    parenthesis in a feature name (and parsing in general): 
    see also: 
    https://app.roll20.net/forum/permalink/8045475/
    This is part of a larger issue with text parsing, but its not too hard to fix (as part of a complete rewrite!).


    When filtering (|field!filter), items with empty fields get printed: 
    https://app.roll20.net/forum/permalink/8162086/
    The filtering module needs a complete rewrite. Its a bit kludgey, and needs more robust code.

    Repeating Section Sorting
    I noticed recently that UCM doesnt respect player ordering of repeating sections. Since no-one has mentioned it, this doesnt seem like that big of a problem, and so isnt a high priority to fix. But I'll look into it.

    
    === SUGGESTIONS ====
    Include another label that is printed on the button (like spells remaining)
    https://app.roll20.net/forum/permalink/7764403/
    This seems very feasible. 

    Allow buttons to have whisper options: 
    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 better to make it more universal: 
some players (not just the GM) might want to create buttons that whisper to them, too. I expect this is doable.

    Pass unfiltered text through UCM:
    Basically pass strings that dont get parsed by ucm, and will be printed out naturally.
    This is certainly possible. Its mostly a matter of figuring out syntax for it that isnt too klunky.
    
    Allow more than one attribute to be included in report (for buttons which print out text): 
    This might be a bit beyond spec. There are design questions, and the incredible range of options (as shown in the two questions above) might make it hard to implement in a standardised way satisfactorily. 
But I'll explore possibilities (and see second New Feature idea below).

    carriage return as separator


    === POSSIBLE NEW FEATURES ===
    NATIVE STYLE
    The script uses the default rolltemplate if you dont state a rolltemplate. 
I plan to create an inbuilt style for UCM that might be closer to Keith's stylus tweak 
that uses space better than the default rolltemplate, and give some basic colour options.

    ACCESS USER-CREATED ABILITIES
    UCM accesses character sheet buttons and attributes. I am considering the option to add user-created Abilities too, and if they follow name patterns, it'll be able to treat them like repeating sections 
(automatically build a menu section from abilities named in a certain way). 
    This will allow people to create abilities that contain whatever output they want, and integrate them into UCM output.




July 11 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Glad to see you might be returning to this excellent script.

    NATIVE STYLE

I do think the native style would be a useful addition (not everyone knows about or wants to use Stylus), however, I hope this wouldn't come at the expense of sheet templates, since those provide many options useful to the game being played, and retain uniform styling for the play experience. If you do go with a universal template, feel free to see if there is anything in Supernotes you can use, since it allows users to choose a default roll template for the script.

    Pass unfiltered text through UCM:
If this can pass roll buttons, awesome! So many uses!

    Allow more than one attribute to be included in report (for buttons which print out text): 
I understand if this is beyond spec. It would be extremely useful for things like showing a spell without casting it, but I can see how it might be a tangle to use.
July 11 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter


keithcurtis said:

Glad to see you might be returning to this excellent script.

    NATIVE STYLE

I do think the native style would be a useful addition (not everyone knows about or wants to use Stylus), however, I hope this wouldn't come at the expense of sheet templates, since those provide many options useful to the game being played, and retain uniform styling for the play experience. If you do go with a universal template, feel free to see if there is anything in Supernotes you can use, since it allows users to choose a default roll template for the script.

Not to worry there. I'm very happy with the script's handling of rolltemplates. This is for users who dont use rolltemplates, and just use very basic commands to generate the button menus.





July 11 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I've thought about adding the same functionality to Supernotes.

July 12 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

It's definitely a nice feature to have.


GiGs said:

    Repeating Section Sorting
    I noticed recently that UCM doesnt respect player ordering of repeating sections. Since no-one has mentioned it, this doesnt seem like that big of a problem, and so isnt a high priority to fix. But I'll look into it.


I don't know why, but this—of all things—I assumed to be an innate limitation and never thought to bring it up :p

Not an urgent issue of course, but if you get around to the fix that would sure be awesome!

July 12 (4 years ago)

Edited July 12 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter


keithcurtis said:

Pass unfiltered text through UCM:

If this can pass roll buttons, awesome! So many uses!
There's a problem here in that roll20 parses anything parsable before the script ever sees the input. So some things wont be able to be passed to UCM without using html entities, and then might require internal processing to stop them triggering automatically again when the script sends the menu to chat. So there are definitely somethings that would be tricky. API buttons that use the ~selected|name syntax are probably okay, but the two formats that use html entities might be too much to commit to.

Persephone said:


GiGs said:

    Repeating Section Sorting
    I noticed recently that UCM doesnt respect player ordering of repeating sections. Since no-one has mentioned it, this doesnt seem like that big of a problem, and so isnt a high priority to fix. But I'll look into it.


I don't know why, but this—of all things—I assumed to be an innate limitation and never thought to bring it up :p

Not an urgent issue of course, but if you get around to the fix that would sure be awesome!

It is doable but definitely adds complexity.

First, I've been using this for a few months as a spellbook macro on the 2e simple sheet, and it's great.


Finally sat down today to do the same for the weapons and I am hitting some sheet limitations. I've messaged the current sheet author, but what would solve my problem (I think) is if I can call up a system or character sheet macro.

This works, but the hit1 button on the sheet is not sufficient for our needs:

!chatmenu @{selected|character_id} @{selected|character_name}'s Attack Options  --title:Weapon Attacks --repeating_weapons|weaponname|hit1


This is what I would like it to pull:

!chatmenu @{selected|character_id} @{selected|character_name}'s Attack Options  --title:Weapon Attacks --repeating_weapons|weaponname|systemmacro

Where systemmacro is ATTACK1 is the macro in question. I can put this on an ATTACK sheet, or even on each character sheet if necessary. (gonna try these now, as typing this made me think of this!)


Can this script do this? If not, I'll live with the solution I have in place with a selection macro, this is just so much slicker!

July 13 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

I'm not really sure what youre asking here. This code

--repeating_weapons|bla|bla

Can only call attributes or roll buttons that exist within that repeating section on the character sheet. It cant call external macros, or abilities from anywhere thats not inside that repeating section.


Hi everyone,

Working with the 5e OGL sheet. Trying to use the Menu macro template that KeithCurtis laid out. Here's the macro code:

!chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{description=CHATMENU}} --separator: |&nbsp; --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,npc_str_save|Dex,npc_dex_save|Con,npc_con_save|Int,npc_int_save|Wis,npc_wis_save|Cha,npc_cha_save  --title:Skills --Acrobatics,npc_Acrobatics|Arcana,npc_Arcana|Athletics,npc_Athletics|Deception,npc_Deception|History,npc_History|Intimidation,npc_Intimidation|Investigation,npc_Investigation|Medicine,npc_Medicine|Nature,npc_Nature|Perception,npc_Perception|Persuasion,npc_Persuasion|Sleight of Hand,npc_Sleight_of_Hand|Survival,npc_survival --title:Traits --repeating_npctrait|name|description --title:Actions --repeating_npcaction|name|npc_action --title:Traits --repeating_traits|name|output --title:Attacks --repeating_attack|atkname|attack --title:Cantrips --repeating_spell-cantrip|spellname|spell --title:Lvl-1 *(@{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total})* --repeating_spell-1|spellname|spell --title:Lvl 2 *(@{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total})* --repeating_spell-2|spellname|spell --title:Lvl 3 *(@{selected|lvl3_slots_expended}/@{selected|lvl3_slots_total})* --repeating_spell-3|spellname|spell --title:Lvl 4 *(@{selected|lvl4_slots_expended}/@{selected|lvl4_slots_total})* --repeating_spell-4|spellname|spell --title:Lvl 5 *(@{selected|lvl5_slots_expended}/@{selected|lvl5_slots_total})* --repeating_spell-5|spellname|spell --title:Lvl 6 *(@{selected|lvl6_slots_expended}/@{selected|lvl6_slots_total})* --repeating_spell-6|spellname|spell --title:Lvl 7 *(@{selected|lvl7_slots_expended}/@{selected|lvl7_slots_total})* --repeating_spell-7|spellname|spell --title:Lvl 8 *(@{selected|lvl8_slots_expended}/@{selected|lvl8_slots_total})* --repeating_spell-8|spellname|spell --title:Lvl 9 *(@{selected|lvl9_slots_expended}/@{selected|lvl9_slots_total})* --repeating_spell-9|spellname|spell
Getting this result when trying to click the NPC trait buttons:

If you change the `%` to the `@` symbol it works. Not sure if I'm doing something wrong or that's a missed feature for the OGL NPC traits. 
Any help is greatly appreciated!
July 14 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Just checking, when you say "working with the OGL sheet", do you mean the one you select with the dropdown: "D&D 5th Edition by Roll20 Sheet", or the legacy ogl sheet or one of the many clones?

The sheet recently underwent some breaking changes, and the actual code should be something like:

%{Abigail Potts|repeating_npctrait_-LsB---wrwM0AIq4zGL-_-npc_roll_output}

The sheet is very non-standard on this. The code for the statblock was updated to match earlier this year, and has been tweaked occasionally over the last year to keep up with other changes and to correct errors. Make sure you have the latest version if using the official sheet.

I was referring to the "D&D 5th Edition by Roll20 Sheet". That fixed it! Thanks again keithcurtis!

Hey Everyone,

I think I am just being a moron but I installed this API and none of it's commands seem to be responding. I disabled all the other APIs to see if that changed anything and it didn't. I don't get any error messages except when I haven't got a token selected.


I'm pretty sure I have missed a step somewhere but if anyone could point me in the right direction that would be great.


I'm using the d&d 5e roll20 sheet.



    

July 21 (4 years ago)

Edited July 21 (4 years ago)
Kraynic
Pro
Sheet Author

You might want to post what commands (well, one at least) you are using, so that people can spot if there are any errors there.

July 21 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

As Kraynic says, you'll need to post your code. For reference there are very complex working examples of 5e macros in this thread (on page 3, I think).

Well, I used the same one as Keith posted above as I figured that was 5e and should work. However I got no errors or functions.

I'm sorry if this formats wrong


!chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=@{selected|class_display}
@{selected|race_display}, @{selected|background}
**Jump** - Long [[(@{selected|strength}/2)]] / [[@{selected|strength}]]ft. | High [[((@{selected|strength_mod}+2)/2)]] / [[@{selected|strength_mod}+2]] ft.
**HP: **@{selected|hp} / @{selected|hp|max} | ** AC: ** @{selected|ac} | **Spd: ** @{selected|speed} | **Passive: ** @{selected|passive_wisdom}}}{{description=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,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:Languages --repeating_proficiencies|name|output|prof_type=Language --title:Tools --repeating_tool|toolname|tool  --title:Traits --repeating_traits|name|output|name!Invocation:  --title:Melee --repeating_attack|atkname|attack|atkrange<1 --title:Ranged --repeating_attack|atkname|attack|atkrange --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:Use Hit Dice --@{selected|hit_dice} Available,hit_dice|Long Rest,hit_dice --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}*
July 21 (4 years ago)
Kraynic
Pro
Sheet Author

Just out of curiosity, have you tried restarting the api sandbox in one tab while logged into the game on another?  I just copy/pasted your code into a test game (I don't actually play 5E), and it spit out a long menu.  I only tried a couple rolls, but they seem to work.


July 21 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

You are using it while selecting a single token that represents a PC (not an NPC)?

So I opened a new game and it worked in that one. So the code is fine, it must have been something I have done in the installation process.

Thanks for your help!


keithcurtis said:

You are using it while selecting a single token that represents a PC (not an NPC)?


Yes

August 11 (4 years ago)
Kraynic
Pro
Sheet Author

Is it possible to allow an attribute call to fill in a title entry?  I was looking over my examples for my Heroes Unlimited sheet an thought that instead of using Vehicle 1 Weapons for vehicle turret attack rolls, it would be nice to have the actual vehicle names displayed instead.  The portion of the currently used api/macro call that works is this:

--title:Vehicle 1 Weapons --repeating_turretone|turretname|turret --title:Vehicle 2 Weapons --repeating_turrettwo|turretname|turret

But it breaks if I do this:

--title:@{vehicle1_name} --repeating_turretone|turretname|turret --title:@{vehicle2_name} --repeating_turrettwo|turretname|turret

When I insert the attribute call, it just gives the "c is undefined" error.

Is there a way for me to call in those names as the script is currently written, or would that require script changes?  Obviously, it isn't an absolutely necessary thing, but just something I thought of trying.

August 11 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Thats odd, because attribute references are fully resolved before the macro reaches the API. Is this macro being run in a place where you need to supply the character or token name (e.g. from a button printed to chat)? Like below (replacing CHARACTER with selected or the actual character name).

--title:@{CHARACTER|vehicle1_name} --repeating_turretone|turretname|turret --title:@{CHARACTER|vehicle2_name} --repeating_turrettwo|turretname|turret
August 11 (4 years ago)
Kraynic
Pro
Sheet Author

You would think I would know better by now...  Yeah, inserting selected| in there made it work just fine.

August 11 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

great! :)

August 18 (4 years ago)

Edited August 18 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Here's a 5e UCM macro I wrote for warlocks. Warlocks have some very complicated spell casting, what with spells, eldritch invocations and mystic arcana.

This one requires some setup. Each spell on the  D&D 5th Edition by Roll20 Sheet has a Class field and a Type field at the very end.


The Class field has the value Warlock for every spell you get from the warlock class.


The Type field can be one of 4 values:

  • Slot this is a normal spell you cast with a Warlock spell slot
  • Eldritch Invocation for Eldritch Invocations
  • Mystic Arcanum for Mystic Arcana.
  • Book for the Book of Shadows for Tome Pact warlocks


Be sure to fill the Innate field in with 1/day on 1/long rest Eldritch Invocations. Mystic Arcana can be tracked with spell slots, as below.

You can further customize the macro by placing short notes for invocations that grant you abilities (ex. Devil's Sight) in the name field of the macro.

Lastly, for maximum utility, make sure your first Resource on your character sheet is "Eldritch Invocations", and edit the additional spell slots on your settings tab to grant you a spell slot for 6-9th level as you achieve Mystic Arcana at those levels. Here is an example of the output from a 16th level Tome Pact warlock:


Here is the code. I welcome any improvements.

Keith that looks great! If you want the separator to have a space on both sides, remember to put a colon at the end of the separator tag, like this:

--separator: | :
August 19 (4 years ago)

Edited August 19 (4 years ago)

Also, I just discovered a way to put hyperlinks in these chat menus—with a few limitations. You can include them in section titles, but it converts the text to all caps. So here, I made hyperlinks for macros that contain other chat menus, but I had to make sure the macro names were in all caps (I capitalized them within the macro as well just to help me remember). Clicking SECOND in the first menu brings up the second menu, and clicking SUBSEQUENT in either the first or second menu brings up the third menu.

I titled the Attack Actions section in the initial macro like this

--title: Attack Actions | [SECOND](`#COMBATMENU2) | [SUBSEQUENT](`#COMBATMENU3)

And in the second macro it's changed to this

--title: Attack Actions | [SUBSEQUENT](`#COMBATMENU3)

I know I found a way a while back to show a title with an empty list below it, which would be good for dedicating a line of the menu to a button or a few, but I can't remember how I did it...


Of course, links will still work in the footer parameter like

--footer:[SECOND](`#COMBATMENU2) | [SUBSEQUENT](`#COMBATMENU3)

but that places the text outside of the template, and I wanted the option to include links within the main body of text.

August 19 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Nice trick! I could include a ChatSetAttr command to decrement the warlock spell slots in the line that reports those.

To make things better, after posting this I realized there IS a way to include the footer as part of the template! So you could have links in the title lines, then extra links in the footer. I have CHATMENU in the description, and added the footer as notes, but it requires putting opening double brackets before the first title line and closing double brackets in the beginning of the footer (to wrap the line break and '/w <player>' that the script creates; this brings the footer up into the rest of the template).

!chatmenu @{selected|character_id} {template:rolls} {{charactername=@{selected|character_name}}} {{header=Spells}} {{desc=CHATMENU}}
{{notes_show=[1]}} {{ --title:1st-level (@{selected|level_1_per_day}/@{selected|level_1_per_day|max})
--repeating_normalspells|name|spellroll|current_level=1|name!|uses <....> --separator: | : --footer:}} {{notes=**SPELL DC @{selected|spell_dc}
| [COUNTERACT](`#SpellCounteractRoll)**}}

Underlined and emboldened the parts that make this work (I cut the bulk of the text and added line breaks for readability.)

If your sheet requires a toggle to show the notes of a roll, like above, and normally uses [[1]], remember to change it to single brackets.

This example ends up looking like this:

Both methods of adding links are gonna be super useful! Titles can be used for macros that expend spell uses, like you suggested, keith, while the footer could include more general macros.

August 19 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

I'm so happy that you and Keith latched on to this script. You do such great work with it.

August 19 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Those are awesome finds, Persephone! Hades should let you out more often.



GiGs said:

I'm so happy that you and Keith latched on to this script. You do such great work with it.


You're the one who saw me struggling with my janky nested drop-downs and wanted to make a script to help! I'm just excited 'cause now I don't need to use two separate templates when I want both UCM and hyperlinks in a macro =D

keithcurtis said:

Those are awesome finds, Persephone! Hades should let you out more often.


With how the weather's been lately I'm not sure winter will be claiming me any time soon :p

This is gonna let me really improve my menus, tho, I can nest a lot of them this way like I did with the combat menu.


August 23 (4 years ago)

Edited August 23 (4 years ago)

Hey @GiG.-

I'm running on some trouble running this script from an API. After some extensive research, turns out sendChat commands from API's avoid this script's chat command to come through, since it doesn't have a "caller" variable set, which is defined in line 257 as "const caller = (getObj('player', msg.playerid)".

Could it be possible that, on a 'null' caller, instead of making it 'get: () => 'API', it could get the controlledby property corresponding to the character defined by the cid?

Nevermind, I just did that by replacing line 257 with

get: () => msg.who

So it uses the API's sendCall's display name instead of a player ID on a null (which is easier to work around in API's).

I also added a SendChat to myself for troubleshooting purposes.

August 23 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

There's probably a reason I didnt use msg.who, but maybe I just didnt think of the script being called by other scripts. I'll add that to the list of things to explore.

My PF2e modular menus now include hyperlinks and account for multiple attack penalty rolls, as well as some extra new stuff. See the updated post here:

https://app.roll20.net/forum/permalink/8390047/

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

Nice work!

September 25 (4 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

Is the latest version of this the code snippet on the first page?

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

It should be yes. It's pending a very big rewrite.

September 29 (4 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Does this mean you are currently re-writing it, or that you feel it needs a big rewrite?

September 30 (4 years ago)
David M.
Pro
API Scripter

Persephone said:

My PF2e modular menus now include hyperlinks and account for multiple attack penalty rolls, as well as some extra new stuff. See the updated post here:

https://app.roll20.net/forum/permalink/8390047/

Awesome stuff!