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

I need help with the simple stuff because I suck with macros

1622906755

Edited 1622998452
Ok, I'm trying to get some code to work when I click a token and it shows me all of their stats, and I figured out how to mostly do it. The code I wrote just looks at the selected dude's character sheet and pulls a lot of values from it  Here's the code: /w gm &{template:default} {{name=**@{selected|token_name} Stat Block**}} {{Hit Points (HP)= @{selected|hp} / @{selected|hp|max} HP}} {{Armor Class= @{selected|npc_AC} | @{selected|npc_actype}}} {{Speed= @{selected|npc_speed}}}  {{Strength= @{selected|strength_base} | @{selected|strength_mod}}} {{Dexterity= @{selected|dexterity_base} |  @{selected|dexterity_mod}}} {{Constitution= @{selected|constitution_base} | @{selected|constitution_mod}}} {{Intelligence= @{selected|intelligence_base} | @{selected|intelligence_mod}}} {{Wisdom= @{selected|wisdom_base} | @{selected|wisdom_mod}}} {{Charisma= @{selected|charisma_base} |  @{selected|charisma_mod}}} {{Damage Resistance= @{selected|npc_resistances}}} {{Damage Vulnerability= @{selected|npc_vulnerabilities}}} {{Damage Immunity= @{selected|npc_immunities}}} {{Condition Immunity= @{selected|npc_condition_immunities}}} {{Senses =  @{Selected|npc_senses}}} And it does this if you select someone like a goblin (in case you don't want to read the mountain of 'code') (sorry, this is michael from the future: totally forgot to put an mage in here, so here it is):  I'm sure it's in no way optimized, but I wrote it and boom it works as intended... but now I want to add something to it, and that's to make the strength, dexterity, constitution, wisdom and charisma have buttons I can click and it would first prompt me to ask if I want to roll it with advantage, disadvantage, or normally (can do), then roll the saving throws (can 1/3s do). But I don't quite know how to do that because A. I don't know how to make buttons, and B. I don't know how to make macros roll advantage or disadvantage. I'm also curious if I could attack with a macro, although I don't have my hopes too high for that and I'm pretty sure you need API with that because (I think) the general rule with macros is that it can only see data and bring it back to you, as well as roll dice and do other things like that. But if I can't do that, it would be cool to know if it's possible to have a macro give me information about what kind of weapon someone has and then give an effect depending on what it was (So if it had a weapon that did piercing damage, the macro would give a blood splatter effect or something like that).  Finally, I want to know a couple things not concerning the macro I have above. So pretty much I 'made' (as in shamelessly copied and pasted from an underrated youtuber named Grasen Jobsent because It's WAY over my skill level) an initiative tracker and with the help of the keyboard fu chrome extension, I binded it so every time I selected an enemy and did `+i at the same time, it would roll their initiative and put them in the turn order tracker. Here's the code that I put into keyboard fu: javascript:(function(){$('#textchat-input textarea').val('/w GM &{template:default} {{name=@{selected|token_name} - Initiative Roll}} {{Initiative = [[1d20 + @{selected|initiative_bonus} &{tracker}]]}}}');$('#textchat-input button').click();})(); Here's the code I had to manually yeet into every monstor's abilities: '/w GM &{template:default} {{name=@{selected|token_name} - Initiative Roll}} {{Initiative = [[1d20 + @{selected|initiative_bonus} &{tracker}]]}}} And boom it somehow works as intended, but I want to scale it up a bit, if it's possible-- and that's being able to select multiple enemies and putting the into in initiative tracker. I'm not sure if that's even possible without the use of API scripts, but I want to know if you can do that or not. And I think that's about it. Thanks for suffering through this awfully long question and yeah.
Bonus question that may or may not be related: Is it possible to edit all character sheets at once to add certain abilities to it without needing a pro subscription? Also, how do you make Monster/NPC character sheets?
Also also I'm kinda scared about something: So I'm DMing and my players hits one goblin and I click on it and change the health (I have goblin hp binded to green) to -3 or something. But then, EVERY goblin in the cluster loses 3 health. Is there a way to fix this?
1622920286

Edited 1623028195
I can answer the last question: Change the setting on Bar 1 for the goblin tokens from "hp" to "None", and then enter the goblin hp values for Bar 1 manually. (The current behavior is happening because each goblin token is pointing to the same character sheet, so assigning Bar 1 to hp means that changing the value in the bar of one token changes the value of the hp attribute on the common character sheet, which in turn changes the number displayed in Bar 1 for every goblin token.)  I hope this helps! Edit: You're welcome, Michael H.! And no need to facepalm--the only reason I knew about setting Bar 1 to "None" was by looking at how monster tokens were set up in the module I purchased.
Ahhh, I see. Thanks :)
1622952197
timmaugh
Forum Champion
API Scripter
Here are a few links, Michael: API Command Buttons (they're not just for the API) Chat Menus If it came to a Pro sub, there are scripts that can produce a chat menu for you. I wrote InsertArg , which could get your attributes dynamically, format them and return buttons. Scroll down to the "Menus (More Function Examples)" heading.
1622964783

Edited 1622964792
GiGs
Pro
Sheet Author
API Scripter
Michael H. said: Bonus question that may or may not be related: Is it possible to edit all character sheets at once to add certain abilities to it without needing a pro subscription? Also, how do you make Monster/NPC character sheets? The quick answer here is no. You cant do multiple character sheets at once without the API, a Pro subscription perk. Macros cant even edit a single character sheet - you need to go in and make your adjustments manually, one at a time, without the API.
1622965219
GiGs
Pro
Sheet Author
API Scripter
Your first post as a LOT of questions. For the last part, you cant roll initiation for multiple characters at once, without the API. You have to roll them one at a time. However, you don't need to add the initiative macro to every character's abilities. Your initiative macro can be added to macros collection in the sidebar, and there you can activate the MacroBar which will create toolbar along the bottom of your screen. Finally you can add the initiative button to that toolbar, and now you have it instantly avail;able. Just click a token, click the button, and initiative is rolled. You CAN attack with macros - most character sheets already have attacks built into them for that system. But the name of the attack might vary from character to character, and you need to know the name to be able to make the attack - so its hard to come up with a single universal macro (but you can with the API, as usual). Tim has linked to chat buttons. If you have more questions, ask away.
1622989853
Kraynic
Pro
Sheet Author
Michael H. said: Bonus question that may or may not be related: Is it possible to edit all character sheets at once to add certain abilities to it without needing a pro subscription? Also, how do you make Monster/NPC character sheets? If you have a modification that you want done to all the character sheets, you would need to do that manually to each currently existing sheet.  However, for future sheets, you could create a "character" named something like Sheet Template, make your changes there, and then simply duplicate that sheet (an option after you hit the edit button) any time you need a new character sheet.  The duplicates will carry whatever modifications/additions you made to the original. As far as the Monster/NPC sheet, that depends on what game system/character sheet you are using.  I don't see where you have specified that, and the macros look like they could apply to quite a few D&D (and closely related) systems.
1623000476

Edited 1623000742
@GiGs Sorry for all the questions-- I didn't think I had this many either! At first I only had one question, but it just snowballed from there... Also thank you gigs for clarifying what can and cant be done with macros. Also to clarify about the reason I manually yeeted that code into the monster's ability tab was so the code inside of keyboard-fu could read/find the code inside of the macro and execute it, which I'm pretty sure that's what the code did (I think you find the code you want to put into keyboard fu and paste this into there, then paste you code in the designated place: javascript:(function(){$('#textchat-input textarea').val(INSERT YOUR CODE HERE);$('#textchat-input button').click();})(); Then you yeet the code that you want into any token that you want and boom your done. Also, I know I could put it in the macro bar, but I have a small, small screen (I'm using a 100 dollar Chromebook to do this) so I'm trying to not put too many things into the macro bar because I don't like it when there's too many things in the way obstructing the screen (although I could be wrong). Also also, Thank you @Kraynic for the solution for this problem, too. I'll be sure to utilize that the next time I need to make new characters. Also, is it possible to make the duplicate charactersheet the default charactersheet in a game without a pro subscription? I don't think it is, but I want to double check first before I knock it entirely.  Also also also, thank you @timmaugh for the material I can read to learn up on buttons. I'll be honest with you, the reason I got into macros was so I could make a chat button. Then this escalated and now I know a lot more than I previously knew... except I still didn't know how to make buttons, so thank you for that. If I ever get a Pro subscription, I'll be sure to check out insertArg. When I looked at it, it didn't even occure to me that that was roll 20! Finally, thank you @Sarah Rebecca Colhen for answering my last question. I'll be honest with you, I facepalmed myself when I read that because it was super simple solution (ouu nice alliteration) and I didn't even think twice about it.
Also @GiGis, its cool to know that macros can automatically attack. I thought that macros couldn't edit character sheets, but this is great! My idea for the macro was for it to pull up all of the weapons a npc has in chat and then I could click on a button of which one I want to use... but I don't even know where to begin with that lol 
1623021961
GiGs
Pro
Sheet Author
API Scripter
Michael, macros cant automatically attack, and they can't edit sheets. I misunderstood what you were asking there. Regarding your javascript code: do you actually need to put that code into a character ability? It looks to me like javascript bookmark alone will do what you need - try it with a character where you haven't added that ability.