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

October 05 (5 years ago)


Seph said:

I've made some updates to my menus for the Pathfinder by Roll20 sheet, and also built some menus for the new Pathfinder Second Edition by Roll20 sheet! Also, I'm making use of keith's Stylus script for making the buttons smaller :)

Your menus look great. Thanks for sharing Seph.

Regards,

Meldogs

November 09 (5 years ago)

Edited January 18 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Spell Filter – for D&D 5e by Roll20 sheet

Edit: Added Range to list of filters

It occurred to me that the macro this script uses could take roll queries. And by great stroke of fortune, this is true. the following macro will allow you to select a spell caster token, answer some queries and generate a filtered spell list. The default on every query is to ignore the filter for that attribute, so you only need to answer the questions that matter.

Filters include:

  • Casting time: Any, 1 action, reaction, bonus action
  • Ritual: Any, Yes, No
  • Concentration: Any, Yes, No
  • Range: Any, ranged, self, touch
  • School, Any, {list of schools}

Here are some sample outputs using the Archmage stock NPC from the SRD. Each spell is clickable and castable. It works for both PCs and NPCs, though PCs will only display prepared spells. The filters display in the header, but from left to right they are:

  1. Unfiltered
  2. Spells requiring no Concentration
  3. Evocation Spells only
  4. Spells that can be cast as a reaction


In cases where the filtered item is a checkbox, "<2" is the value that catches 0-off and 1-on.

All of the filters are additive, as per the Script. So searching for Concentration and Divination, will only return spells that are both, not either.


Code:

!chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=**Filters**
Casting Time = ?{castingtime|any, |Action,1 action|Reaction,reaction|Bonus Action,bonus}
Ritual = ?{ritual|any,<2|no, |yes,1}
Concentration = ?{Concentration|any,<2|no, |yes,1}
Range = ?{range|any,<2|ranged,feet|self,self|touch,touch}
School = ?{School|any, |Abjuration,Abjuration|Conjuration,Conjuration|Divination,Divination|Enchantment,Enchantment|Evocation,Evocation|Illusion,Illusion|Necromancy,Necromancy|Transmutation,Transmutation}}}{{description=CHATMENU}} --separator: |   --title:Cantrips —  *Save DC @{selected|spell_save_dc}* --repeating_spell-cantrip|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl-1 *(@{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total})* --repeating_spell-1|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 2 *(@{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total})* --repeating_spell-2|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 3 *(@{selected|lvl3_slots_expended}/@{selected|lvl3_slots_total})* --repeating_spell-3|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 4 *(@{selected|lvl4_slots_expended}/@{selected|lvl4_slots_total})* --repeating_spell-4|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 5 *(@{selected|lvl5_slots_expended}/@{selected|lvl5_slots_total})* --repeating_spell-5|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 6 *(@{selected|lvl6_slots_expended}/@{selected|lvl6_slots_total})* --repeating_spell-6|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 7 *(@{selected|lvl7_slots_expended}/@{selected|lvl7_slots_total})* --repeating_spell-7|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 8 *(@{selected|lvl8_slots_expended}/@{selected|lvl8_slots_total})* --repeating_spell-8|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 9 *(@{selected|lvl9_slots_expended}/@{selected|lvl9_slots_total})* --repeating_spell-9|spellname|spell|spellcastingtime=?{castingtime},spellrange=?{range},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School}
November 09 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

GiGs, if you ever find the time to implement the suggestion to pass raw code that I made here, a filter chat button could be added to the main statblock macro to call up the filter macro above. As an example. :)

That's super clever, I'm gonna try this out!

November 10 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Thats great, Keith. Roll queries are completed before the API sees the macro, so roll queries always work with scripts btw.


keithcurtis said:

GiGs, if you ever find the time to implement the suggestion to pass raw code that I made here, a filter chat button could be added to the main statblock macro to call up the filter macro above. As an example. :)

I'Since the filter macro above works already, what do you mean by adding a filter chat button? A button you can output along with the chat menu, that calls a macro like the above?


November 10 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Exactly. Currently if you try to insert an un-parsed button anywhere in a UCM macro, the macro breaks. The link I gave above shows more detail and some use cases.

November 10 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Understood. Having a flag for leaving some areas unparsed is a good idea.

November 10 (5 years ago)

Edited November 28 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

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 — Seph

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.

November 10 (5 years ago)

Edited November 10 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I'll have to promote you to my secretary! (ahem, executive assistant.)

Thanks, that's very helpful.

November 10 (5 years ago)

Edited November 10 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Anything that makes it easier to get more and better goodies from you...


Much like Token-Mod or ChatSetAtt, this is a tool to make tools. And a fun toy to play with.

November 20 (5 years ago)

I noticed the if someone puts " in their Name the buttons do not work.
Like Grey "The Hammer" Valentine.
I know the easy fix is not to have them do it but just wanted to put that out there.

November 25 (5 years ago)

General question regarding the UCM cause I don't understand it.


If I create a macro for an action card for a NPC and click to create it in the chat, will everybody see it?

If I create a macro for an action card for a PC and he click to create it in the chat, will every other players see it?


Thanks.

November 25 (5 years ago)

Edited November 25 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

It will whisper from the selected character. The person who activated the chat menu is the one who will see it. You can test by running one of the sample macros in this thread. You will see the yellow background color in chat indicating that it is a whisper, and it will be "From: " the character who was selected.

If a GM selects Bob's character and runs it, both the GM and Bob will see it. If Bob runs it, only Bob will see it. If you want to test, create a dummy account and invite it as a player.

November 25 (5 years ago)

Edited November 25 (5 years ago)
Kraynic
Pro
Sheet Author

The menu that gets printed in chat is only visible to the person that clicked the macro button.

Edit: keithcurtis beat me to it.  I could be wrong, but I thought only the person that clicked the button sees the menu.  At least, I have had players claim they couldn't see it when I clicked on the token action to pull up a menu for their character.  I have to admit I haven't made a dummy account to test it though.

November 25 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I corrected my post above. You don't need any particular code, that's the normal (and preferable) behavior of the script.

November 25 (5 years ago)

Great, thanks for the info ''Ks'' ;)

November 28 (5 years ago)

Edited November 28 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

No Archive Code

Scott C. just told me about a bit of code that might be a nice addition. You can specify API-generated chat to not go to the archive. Chat menus generate a lot of fluff to the archive that doesn't need to be there:

sendChat('who','message',null,{noarchive:true})


November 28 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

That's a good idea to incorporate, thanks.

January 12 (5 years ago)

Thanks GiGs for this awesome script!


I made a few simple tweaks if you'd like to incorporate them to solve the Legendary Actions and parentheses issue mentioned by Keith

Added this as the first line of getButtonCode method (fixes issue with parentheses):

label  = label.replace('(', ch('(')).replace(')', ch(')'));

Modified line 53 of getRepeatingIds method (stricter match to avoid picking up legendary actions in the actions section):

return obj.get('name').startsWith(`repeating_${section}_-`) && obj.get('name').endsWith(attribute);


I've only tested those against the 5e OGL Sheet.


Cheers

January 12 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

They look good, I'll try to test them in a couple of days, and see if they are unintended consequences for other sheets.

This method

label.replace('(', ch('(')).replace(')', ch(')'));

reminds me that Aaron has a function for handling a wider range of replacements in one fell swoop. I'll have to look into incorporating that.

For the second method: what's the issue with legendary actions? How are they named and why do they get picked up?

January 12 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I believe it's the same issue, parentheses.

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

January 12 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

In that case, if I get aarons function incorporated, that should fix both these issues without needing two separate code fixes.

Oh cool! Maybe this could also be used to fix commas breaking the nonrepeating buttons that the script makes? I've noticed if I set a button to be made with a specific attribute, and the attribute name has a comma in it, menu breaks the same way as it would for Keith's Legendary actions.

Btw GiGs, have you had the chance to see if specifying secondary values in a button is possible?

January 12 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

There are sheets that have commas in the attribute names? Insanity!

January 13 (5 years ago)

Edited January 14 (5 years ago)

Sorry, I worded that weird. I meant the value in the attribute has a comma :)

Specifically PF2e's NPC Perception button shows the NPC's senses, and if they have multiple senses then those senses are separated by a comma. My current workaround is changing the comma to a semicolon, but I have to do this every time I populate an NPC with multiple senses from the compendium.

P.S.

Updated my PF2e menus :)

January 18 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I added Range as a filter criteria to my 5e Spell Filter macro above. It occurred to me that someone running a spell caster might want to know at a glance what they can cast through their familiar, or what can reach the goblin on that ledge.

January 20 (5 years ago)

I'm trying to set up Unviversal Chat Menus for my text only async Traveller: The New Era game. UCM would be great for this as my players often check in from mobile devices where the chat is workable, but using character sheets is more or less impossible.

I've had to tweak a bit to get some things working, using character id and name as well as rewriting the sheet (that adapted from the Twillight:2000 sheet) to name roll buttons etc.

However I'm struggling with some of the repeating sections. The repeating weapons section works as expected, but none of the skills appear.

Here is a part of the macro:

!chatmenu -LB_3tzu9U64sKeiR48P --title:Intelligence skills --Intelligence @{Ando Oet|Intelligence},Int --repeating_intSkills|intskillName|IntSkill --title:Weapons --repeating_weapons|weaponName|btnWeapon


Wich produces this menu:



This is the code for the repeating section that does not appear, since I'm guessing that is where the error is (and I'm sorry it is a bit of a monster, I don't know how to code anything and just poke old code till ut does something new):

	<div class="Intelligence Skills" style="width: 100%"> <!-- Intelligence skills section headers -->
<span class="span-header center" style="padding: 0px; width: 184px"><b>Intelligence</b></span>
<span class="span-header center" style="padding: 0px; width: 30px" name="attr_Intelligence"></span>
<span class="span-header center" style="padding: 0px; width: 30px text-align: right">XP</span>
<span class="span-header center" style="padding: 0px; width: 30px">
<button type="roll" value="&{template:skillRoll} {{name=@{Name}}} {{skillvalue=@{Intelligence}}} {{os=[[@{Intelligence}*?{Difficulty?|Average,[[2]]|Easy,[[4]]|Difficult,[[1]]|Formidable,[[0.5]]|Impossible,[[0.25]]}-10]]}} {{cf=[[@{Intelligence}*?{Difficulty?| Average,[[2]]|Easy, [[4]] |Difficult,[[1]]|Formidable,[[0.5]]|Impossible,[[0.25]] }+10]]}} {{success=[[@{Intelligence}*?{Difficulty?| Average,[[2]]|Easy, [[4]] |Difficult,[[1]]|Formidable,[[0.5]]|Impossible,[[0.25]] }]]}} {{roll=[[1d20]]}} {{skillname=Intelligence}}" name="roll_Int"></button>
</span>
</div> <!-- End of intelligence skills section headers -->
<br>
<fieldset class="repeating_intSkills"> <!-- Repating intelligence skills -->
<select style="display:inline-block;margin-bottom:0px" name="attr_intskillName">
<option value="Farming">Farming</option>
<option value="Fleet Tactics">Fleet Tactics</option>
<option value="Forward Observer">Forward Observer</option>
<option value="Gambling">Gambling</option>
<option value="Ground Tactics">Ground Tactics</option>
<option value="Interview">Interview</option>
<option value="Investigation">Investigation</option>
<option value="Navigation">Navigation</option>
<option value="Observation">Observation</option>
<option value="Painting">Psychology</option>
<option value="Research">Research</option>
<option value="Sculpture">Sculpture</option>
<option value="Sensors">Sensors</option>
<option value="Ship Tactics">Ship Tactics</option>
<option value="Streetwise">Streetwise</option>
<option value="Survey">Survey</option>
<option value="Survival">Survival</option>
<option value="Tracking">Tracking</option>
<option value="Willpower">Willpower</option>
</select>
<input type="number" value="0" name="attr_intskillValue"/>
<button type="roll" value="&{template:skillRoll} {{name=@{Name}}} {{skillvalue=@{intskillValue}}} {{os=[[((@{intskillValue}+@{Intelligence})*?{Difficulty?|Average,[[2]]|Easy,[[4]]|Difficult,[[1]]|Formidable,[[0.5]]|Impossible,[[0.25]]})-10]]}} {{cf=[[((@{intskillValue}+@{Intelligence})*?{Difficulty?| Average,[[2]]|Easy, [[4]] |Difficult,[[1]]|Formidable,[[0.5]]|Impossible,[[0.25]] })+10]]}} {{success=[[(@{intskillValue}+@{Intelligence})*?{Difficulty?| Average,[[2]]|Easy, [[4]] |Difficult,[[1]]|Formidable,[[0.5]]|Impossible,[[0.25]] }]]}} {{roll=[[1d20]]}} {{skillname=@{intskillName}}}" name:"roll_IntSkill"></button>
</fieldset>
January 20 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I dont have time to look over this right now, I'm literally on my way to bed, but I did notice this:

repeating_intSkills

repeating section names would always be entirely lower case. They dont interact well with sheet workers or scripts at all if you have upper case letters, as I found way back in this thread. I'd been meaning to investigate it further, but forgot about it. I dont know if its the source of your issue, but I'd recommend changing to lower case anyway.

January 21 (5 years ago)

That was it! Thanks


GiGs said:

I dont have time to look over this right now, I'm literally on my way to bed, but I did notice this:

repeating_intSkills

repeating section names would always be entirely lower case. They dont interact well with sheet workers or scripts at all if you have upper case letters, as I found way back in this thread. I'd been meaning to investigate it further, but forgot about it. I dont know if its the source of your issue, but I'd recommend changing to lower case anyway.




January 21 (5 years ago)

After some more tweaking the script is working great, this will really help my players.

I've included the ability scores in the menu by using this code " --Strength @{Ando Oet|Strength},Strength". Is there a way to do the same thing for the values for the repeating skills?



January 21 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Be sure to post your macro code when you have it all figured out, so others can benefit from your work. 

January 23 (5 years ago)

Edited January 23 (5 years ago)

This is the macro I'm going with for now. Looking through this thread I realiazed that a "statblock" like menu would be great for an async chat based game since players who are on the mobile website only have a functional access to the chat.

The only novel thing in this application is that since the players sometimes wont' have access to the tokens I'm using a combination of character_id to get the character and name to get attribute values. I would love to get the values for the repeating sections as well, but haven't been able to get that working. A potential next step would be to make a statblock macro menu of some kind and link to the UCM menu(s) form there (among other things because the menu is very long). In any case the macro has to be made for each character, but it's a relatively quick find/replace job for character_id and names.

A final note is that this is for my home-made and unreleased Traveller: The New Era sheet. After some trial and error I discovered that I had not named my roll-buttons, and neither had the Twillight:2000 sheet that I was basing my sheet on. So for anyone trying to get Universal Chat Menus to work with sheets that have not been very heavily developed that might be a thing to examine early.

Example code for a character named Ando Oet. The two "power suit" buttons trigger a Chatsetattr ability on the character sheet that adjusts the strength attribute:

!chatmenu -LB_3tzu9U64sKeiR48P --title:Strength skills --Strength @{Ando Oet|Strength},Strength --repeating_strskills|strskillName|strskill --title:Agility skills --Agility @{Ando Oet|Agility},Agility --repeating_aglskills|aglskillName|aglskill --title:Constitution skills --Constitution @{Ando Oet|Constitution},Constitution --repeating_conskills|conskillName|ConSkill --title:Education Skills --Education @{Ando Oet|Education},Education --repeating_eduskills|eduskillName|eduskill --title:Intelligence skills --Intelligence @{Ando Oet|Intelligence},Intelligence --repeating_intskills|intskillName|intskill --title:Charisma skills --Charisma @{Ando Oet|Charisma},Charisma --repeating_chaskills|chaskillName|ChaSkill --title:Power Suit --Off,suit-off --On,suit-on --title:Weapons --repeating_weapons|weaponName|btnWeapon


Screenshot (after I've made the sheet support spaceships I'll make a roll-template, I had to stretch the chatfield to fit it in one screenshot):





January 23 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I think you should be able to get the values from a repeating section. What are your repeating sections calleed, what are the attribute names you want within it, and what are their typical values?

January 23 (5 years ago)

The repeating sections are called (for example) repeating_strskills and names are in attr_strskillName and values in attr_strskillValue, the "str" is changed according to the controlling attribute for each section.

Values would be between 0 very seldom go as high as 10, but the 0's are important. When doing a skill check the controlling attribute and the skill value is added, so having a 0 let's you use the attribute value unmodified.

January 23 (5 years ago)

Edited January 23 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Have you tried the ! modifier as described under the Non-Roll Buttons*  heading in the first post?

That would look like 

--repeating_strskills|strskillName|strskillValue!

Let me know if it doesn't work :)


Edit: changed the Non-Roll Buttons heading to Attribute Values instead of Buttons. Hopefully that's clearer.


January 24 (5 years ago)


GiGs said:

Have you tried the ! modifier as described under the Non-Roll Buttons*  heading in the first post?

That would look like 

--repeating_strskills|strskillName|strskillValue!

Let me know if it doesn't work :)


Edit: changed the Non-Roll Buttons heading to Attribute Values instead of Buttons. Hopefully that's clearer.

This does not produce the results I'm looking for. First the syntax above requires a selected token, which I'm trying to avoid. Second this produces a button that, when I have a token selected, posts the skill value to chat. I was trying to have a button, like the Strength button in the screenshot, where the skill value is visible to the player and clicking the button produces a skill check roll. The non-roll buttons also break when there are paranthesis in the skill or weapon name, but the roll buttons work.

However if I could get a button that whispers the various attributes in the repeating_weapons section based on character_id that would be great. Using the syntax above for the reapeating_weapons section I can get the button to push one of several attributes in the section, but only with a selected token and if I add further attributes it breaks. I've also tried to rewrite the roll_btnWeapon to push the values to chat, but not been able to do it with a whisper to the player without using selected.

Example code/screenshots:

--title:Weapons --repeating_weapons|weaponName|Dam!

--repeating_strskills|strskillName|strskillValue!

Screenshot for reference:




January 24 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I see, that makes sense. Some possible ideas to add to my "features for when i eventually can update this script" list.

January 24 (5 years ago)

Edited January 24 (5 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Steph posted some suggested code changes upthread on this page to address the parentheses issue, which is the first item in this consolidated list of requested enhancements and fixes. I haven't tested them. The reporting of multiple attributes is number 3.

January 25 (5 years ago)

I'm very happy with the way the script works currently GiGs, it will really be very helpful in its current incarnation. So a big thanks!

I should have seen, or rather remembered that post, keithcurtis. All my issues are mentioned already, except that when supplying character_id directly at the start, the script still asks for selected tokens when referring  to repeating sections. I guess that is a bug. 



January 25 (5 years ago)

Edited January 25 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Marius said:

I'm very happy with the way the script works currently GiGs, it will really be very helpful in its current incarnation. So a big thanks!

I should have seen, or rather remembered that post, keithcurtis. All my issues are mentioned already, except that when supplying character_id directly at the start, the script still asks for selected tokens when referring  to repeating sections. I guess that is a bug. 

That;s good to hear. :)

Regarding the selected bug: looking at my code, that looks like an unquestioned assumption I made when writing the script, that it would always be run with a token selected. That's a useful discovery. I'll have to fix that when I clean up the code.




The Pathfinder2e sheet updated today and changed a repeating section from repeating_actions-activities to repeating_actions, but the values for repeating_actions-activities are still on the sheet. This is causing some issues when I set up a chat menu that uses

--repeating_actions|name|action

The API console gets filled with the following error for each item that was in repeating_actions-activities, prints the menu, then crashes from possible infinite loop if the menu is called more than once.

"Error: No attribute or sheet field found for character_id -LpLwLumqxTRtau_xGEL named repeating_actions_repeating_actions-activities_-Lvxa4zrHgYFvYBf0hZ0_name"

I imagine this is because both repeating sections start with repeating_actions. Is there any way to avoid it trying to stack both repeating sections, until the sheet authors give us a way to remove the old repeating section?

February 26 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

That is frustrating! I'll have a look at this later.

Sheet workers cant delete attributes, so the character sheet designer cant fix this. API scripts can, so a quick-and-dirty solution might be to create a script to delete all the old repeating section attributes (being careful not to delete the new ones!). 

That the error is occurring is confusing, but if it's happening here, it could theoretically happen in any sheet where two repeating sections have names that start the same way so i will need a proper fix for it too.



Thanks for the suggestion, I'll look into that!

It looks like the sheet consolidated two separate repeating sections into this new one, and pulled any existing items in the old repsecs into repeating_actions. My menus that call the old repsecs still work for those existing items, so for now I'll just let my players know they won't include any items created after the update.

February 26 (5 years ago)

Edited February 27 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Here's a quick & dirty script to delete the old attributes. Before running this test it first, by copying your campaign, installing it there and running it. It will show you all the attributes it deletes so might take a while to run. Then try running the Chat menu script, and see if it works.

Run it with !cleanup-attributes

<script deleted, see below>

If it works fine, make another backup of your campaign (just to be safe), and run this script on the non-backup. (Or just keep using the copy you just made - that works too.) You can delete the first sendChat line and it'll run much faster.

Oh thank you! I'll test it out tonight =D

February 26 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter


Persephone said:

Thanks for the suggestion, I'll look into that!

It looks like the sheet consolidated two separate repeating sections into this new one, and pulled any existing items in the old repsecs into repeating_actions. My menus that call the old repsecs still work for those existing items, so for now I'll just let my players know they won't include any items created after the update.

The old sections that were combined - what were their names?

The script I posted will just delete the attributes from one section. I'm wondering if the other one was repeating_actions, in which case all should be well - but if it was something else, its attributes might need deleting too.


The other is old one is repeating_free-actions-reactions, which isn't popping up in the works messages, but it's attributes are still present. If that script there works for the first section, I assume I could just edit line 6 to run against the other section.

February 26 (5 years ago)

Edited February 26 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Yes, editing that line would do the trick. If you're feeling ambitious, you could get them both in one pass:

if(obj.get("type") === 'attribute' && (obj.get('name').indexOf('repeating_actions-activities_') > 1 || obj.get('name').indexOf('repeating_free-actions-reactions_') > -1)) return true; 

I'm guessing its not necessary because it doesnt start with the same name as the other two sections (repeating_actions), but cleaning up a bunch of unused attributes wont do any harm and might help with lag in the long run.


It's a shame you cant do this kind of cleanup in sheet workers. I'm sure sheet designers would love to do this after they've changed attribute names and written robust versioning workers.

February 27 (5 years ago)

Edited February 27 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

We got this sorted out. Turns out the deletion script was running into time-out issues. trying to delete too many attributes in one go (6,500!) was triggering roll20's "infinite loop warning" error, and i had to write a script with a delay function to get around that.

It was really slow though, so I am going to try to optimise it a bit before I post it for others to use, if they need it.