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] CharUtils to rename macro

Hi Everybody! I'm trying to use CharUtils' function !rename-attr to rename a lot of shared name macro, but it doesn't work. I'm talking about different macro in different sheet that simply share the same name. Is there an API that can help me? 
1633534988

Edited 1633535135
timmaugh
Forum Champion
API Scripter
If you're talking about abilities on the character sheet, then I doubt something that something named for renaming attributes is going to help you. Is there a separate command option for "rename-abil" or something similar? If you can't see that with CharUtils, InsertArg has a trick to do what you need to do... here is the relevant post . EDIT: we typically only include [Script] in the post's topic if we're releasing a new script. In the future, you can just ask your question and someone will jump in. =D
I'm sorry, in the future I'll do othetwise 😅 Anyway, yes i mean the abilities. My problem is that I already have abilities with the same name, and i'd like to substitute them with a command. Copy a single ability in every sheet will result in multiple abilities with the same name, and since I have to use them for the most part as buttons, this will be a problem
1633698564
timmaugh
Forum Champion
API Scripter
I don't think that will be a problem, if I understand what you're saying... the trick mentioned, above, will create the ability on the target character sheet only if it doesn't exist. If it does exist, it should overwrite the contents. You should end up with only one ability of that name on the sheet.
Thank you so much tim! It works GREAT!
1633714257
timmaugh
Forum Champion
API Scripter
Great! Glad to help! By the way, I was using this trick this morning to copy a series of abilities from one character to a bunch of different characters. I created a macro to have all of the InsertArg copy lines in it, then chatted as the recipient character to get the abilities copied over. If you have a bunch of abilities to move, you might use this same approach. If you *do* use that approach, you might have the same trouble I did where I ran into the bug where Roll20 sometimes drops lines from a multi-line macro. So where I was trying to copy 14 abilities from the source character, I might only end up with 11. Or 13. To get around that, I rolled everything up in Plugger (another metascript) statements. Here was my original macro: !ia --load#Tiberius McA|show_power_Super-Power-80 --store#show_power_Super-Power-80 !ia --load#Tiberius McA|whisper_power_Super-Power-80 --store#whisper_power_Super-Power-80 !ia --load#Tiberius McA|show_power_Lesser-Power-70 --store#show_power_Lesser-Power-70 !ia --load#Tiberius McA|whisper_power_Lesser-Power-70 --store#whisper_power_Lesser-Power-70 !ia --load#Tiberius McA|show_power_Minor-Power-60 --store#show_power_Minor-Power-60 !ia --load#Tiberius McA|whisper_power_Minor-Power-60 --store#whisper_power_Minor-Power-60 !ia --load#Tiberius McA|DieRoller --store#DieRoller !ia --load#Tiberius McA|skilla --store#skilla !ia --load#Tiberius McA|skillb --store#skillb !ia --load#Tiberius McA|skillc --store#skillc !ia --load#Tiberius McA|skilld --store#skilld !ia --load#Tiberius McA|skille --store#skille !ia --load#Tiberius McA|SetPower --store#SetPower !ia --load#Tiberius McA|Character-Menu --store#Character-Menu But by wrapping every line (except one, the last one) in Plugger's eval statements: {&eval} ... {&/eval} ...and then removing linebreaks, I got the final version of: !ia --load#Tiberius McA|Character-Menu --store#Character-Menu {&eval}!ia --load#Tiberius McA|show_power_Super-Power-80 --store#show_power_Super-Power-80{&/eval}{&eval}!ia --load#Tiberius McA|whisper_power_Super-Power-80 --store#whisper_power_Super-Power-80{&/eval}{&eval}!ia --load#Tiberius McA|show_power_Lesser-Power-70 --store#show_power_Lesser-Power-70{&/eval}{&eval}!ia --load#Tiberius McA|whisper_power_Lesser-Power-70 --store#whisper_power_Lesser-Power-70{&/eval}{&eval}!ia --load#Tiberius McA|show_power_Minor-Power-60 --store#show_power_Minor-Power-60{&/eval}{&eval}!ia --load#Tiberius McA|whisper_power_Minor-Power-60 --store#whisper_power_Minor-Power-60{&/eval}{&eval}!ia --load#Tiberius McA|DieRoller --store#DieRoller{&/eval}{&eval}!ia --load#Tiberius McA|skilla --store#skilla{&/eval}{&eval}!ia --load#Tiberius McA|skillb --store#skillb{&/eval}{&eval}!ia --load#Tiberius McA|skillc --store#skillc{&/eval}{&eval}!ia --load#Tiberius McA|skilld --store#skilld{&/eval}{&eval}!ia --load#Tiberius McA|skille --store#skille{&/eval}{&eval}!ia --load#Tiberius McA|SetPower --store#SetPower{&/eval} That is essentially the LAST line of my first macro with a bunch of meta structures embedded in it. Roll20 sees one command, so you side-step the bug of dropped lines, and then Plugger parses out the embedded parts and issues those commands, itself.
That will make my work so much faster, thank you again!