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

Nesting macros from character sheet

Can someone give some direction on Nesting macros from a character sheet. I understands how to do it overall game macros but cant seem to get right how to call it from a selected token/character sheet. Thanks
1541395341
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
If you mean within roll queries, in general it's not possible unless the sheet exposes the macro code, and then you'll break the sheet roll for use outside of the query. If your looking for a different kind of nesting, can you give some more details?
1541399762

Edited 1541399926
I am using my own system and a character sheet I designed. My HTML and CSS skills are limited but its working well. I have made some very good GM macros for nesting all sorts of things such as saving throws for all 8 stats, to hit, damage etc. I am now trying to get the players to be able to use multi macro nesting in the chat for the same things such as saves, various weapons on attacks etc. I have learned how to use rollable tables and nesting the over all macros. I am lost on the buttons for characters as I cant seem to follow some of the information out there. Ideally, I would like to do something like this guy(SEE at 2:05 secs the saves) :&nbsp; <a href="https://www.youtube.com/watch?v=dlJgpiFXPdo" rel="nofollow">https://www.youtube.com/watch?v=dlJgpiFXPdo</a> &nbsp;did but Im not really sure given I am not playing 5e how do it it and if his method isnt over kill.&nbsp;
1541419035

Edited 1541419084
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, gotcha. Those are just ability command button chat menus. In that videos case created via script, however you can generate them with sheet workers as well. If you aren't referencing repeating sections you can even hard code them in. The 5e shaped, Pathfinder community, and Starfinder official sheet all do this; there may be others but those are the ones I'm aware of. I'm on mobile ATM, so demonstrating code is a little hard. But you could look at the Starfinder code on GitHub, particularly the div with a class of "menus" and the buildMenus function for some ideas.
Thank you so much I will do that!
1541472566
GiGs
Pro
Sheet Author
API Scripter
Scott, I had a look at your Starfinder HUD sheet code to check out the buildMenus function. Why did you fold all the sheet worker code into a "var name = function" construction? It's the first sheet I've noticed doing that instead of laying out each function separately within the script section. Are there advantages to doing it that way, and what are they?
1541474714

Edited 1541474801
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Well, not the best reason, but the truth is is that it's how I learned javascript from The Aaron when I started as an API scripter. It's called the revealing module pattern. A benefit (especially for API scripts) is that you don't pollute the name space. Of course that's not really a concern with character sheets and there are of course other patterns that prevent polluting the namespace, but it's the pattern I'm used to, so it's what I went with. As far as efficiency or ease of readability, I don't think there's any difference between the two. EDIT: Also, look at the starfinder official code. The HUD code is deprecated and hasn't been updated in a long time (good lord, it's almost a year since I started working on the official sheet).
1541476314

Edited 1541476381
GiGs
Pro
Sheet Author
API Scripter
I tried to look at the starfinder official code, but couldnt find the html sheet. I looked in this folder , but don't see it? Edit: looking at the history, a user deleted the starfinder.html file 16 hours ago. weird.
1541476832
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
huh, my upload wasn't included in the PR apparently, just the deletion of the old code. Just submitted a new PR with the starfinder.html.