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

Character Sheet always opens to the last tab used - can that be controlled

1533201972
Mike W.
Pro
Sheet Author
Actually I have 2 questions here. 1. When using a Character Sheet with multiplier tabs, how does it remember which tab I opened last? I ask this because after I close the sheet and then reopen it, it opens at the tab I last used. This happens even if I leave the game, clear all my cache, and even restart my PC. When I go back into the game and open a character sheet, it opens again to the last tab I had opened. This has happened using the GURPS (sheet #1) and the Pathfinder-Neceros character sheets.  2. Is there any way I can modify the character sheet to always open to a specific tab? For example I have a tab named Updates, and what I would like is that when anyone opens their character sheet it always opens to that tab. This way users get to see all the latest updates that have been applied to the sheet. I am a novice when it comes to HTML5 and CSS cude so I need some help. Any help here would be greatly appreciated.
1533211452
Finderski
Pro
Sheet Author
Compendium Curator
I would assume it's because an attribute was set. If you want to change that behavior, you'd need a sheet worker with an on:open  rule and then within that, you'd need to set the attribute to the value you want.
1533211516
Kryx
Pro
Sheet Author
API Scripter
1. The tabs are actually a field stored to roll20. So when you open the sheet it loads the sheets data, including that field and the tab is opened. 2. You can use sheet:opened on('sheet:opened', () => {   // set tab field });
1533214145
Andreas J.
Forum Champion
Sheet Author
Translator
You can get away with only some html/css and one or two attribute that track that, don't need sheetworker(it's another matter if the below example or sheetworkers is more simple) Shadowrun 5th have things done in that way, but it's maybe a bit large to analyze. I managed to copy the essential parts of it to my current WIP of Star Wars D6 sheet with tabs . relevant css begins on row 329. SW D6 sheet uses attribute "tabnumber" to tell which tab to show. My test Campaign for the sheet if you wanna see tab tracking in action. Don't have time atm to go give clearer details/example, I'll check back in a few days if nobody else have provided better example.
1533220715

Edited 1533220876
DXWarlock
Sheet Author
API Scripter
If you are using the css tricks/posted tab options..what sets the 'tab' attribute is the following code: <div class ="sheet-tab-relative_main"> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab1" value="1" checked="checked" /><span title="A"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab2" value="2" /><span title="B"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab3" value="3" /><span title="C"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab4" value="4" /><span title="D"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab5" value="5" /><span title="E"></span> You could just set  value=  to whatever tab you want it to open to on all of them. Then no matter what tab they closed on, it assumes they closed it on the tab you wish. So say Updates is tab 3. Set them all to have  value="3"
1533221185
Kryx
Pro
Sheet Author
API Scripter
DXWarlock said: If you are using the css tricks/posted tab options..what sets the 'tab' attribute is the following code: <div class ="sheet-tab-relative_main"> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab1" value="1" checked="checked" /><span title="A"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab2" value="2" /><span title="B"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab3" value="3" /><span title="C"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab4" value="4" /><span title="D"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab5" value="5" /><span title="E"></span> You could just set  value=  to whatever tab you want it to open to on all of them. Then no matter what tab they closed on, it assumes they closed it on the tab you wish. So say Updates is tab 3. Set them all to have  value="3" If you do that you can skip the value and just use "selected" on the one you want selected. That'd reset every time.
1533229406

Edited 1533229878
Mike W.
Pro
Sheet Author
Kryx said: DXWarlock said: If you are using the css tricks/posted tab options..what sets the 'tab' attribute is the following code: <div class ="sheet-tab-relative_main"> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab1" value="1" checked="checked" /><span title="A"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab2" value="2" /><span title="B"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab3" value="3" /><span title="C"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab4" value="4" /><span title="D"></span> <input type="radio" name="attr_tab" class="sheet-tab sheet-tab5" value="5" /><span title="E"></span> You could just set  value=  to whatever tab you want it to open to on all of them. Then no matter what tab they closed on, it assumes they closed it on the tab you wish. So say Updates is tab 3. Set them all to have  value="3" If you do that you can skip the value and just use "selected" on the one you want selected. That'd reset every time. Kryx: Yes the sheet is coded exactly like this. I tried setting the value= to all the same number, that did not give me the desired effect as it just opened to a page with no tabs selected. How would I use "selected" in the above example? Again I am a novice and I did not design this sheet. HTML <!-- ===== ===== ===== ===== TABS ===== ===== ===== ===== --> <input type="radio" name="attr_tab" value="1" class="sheet-tab sheet-tab1" checked="checked" /><span>General</span> <input type="radio" name="attr_tab" value="2" class="sheet-tab sheet-tab2" /><span>Traits</span> <input type="radio" name="attr_tab" value="3" class="sheet-tab sheet-tab3" /><span>Skills</span> <input type="radio" name="attr_tab" value="4" class="sheet-tab sheet-tab4" /><span>Combat</span> <input type="radio" name="attr_tab" value="5" class="sheet-tab sheet-tab5" /><span>Inventory</span> <input type="radio" name="attr_tab" value="6" class="sheet-tab sheet-tab6" /><span>Grimoire</span> <input type="radio" name="attr_tab" value="7" class="sheet-tab sheet-tab7" /><span>Updates</span> <input type="radio" name="attr_tab" value="0" class="sheet-tab sheet-tab0" /><span title="Sheet Options">y</span> <div class="sheet-tab-br"></div> CSS /* ===== CUSTOM TABS ===== */ input.sheet-tab1:not(:checked) ~ .sheet-tab1, input.sheet-tab2:not(:checked) ~ .sheet-tab2, input.sheet-tab3:not(:checked) ~ .sheet-tab3, input.sheet-tab4:not(:checked) ~ .sheet-tab4, input.sheet-tab5:not(:checked) ~ .sheet-tab5, input.sheet-tab6:not(:checked) ~ .sheet-tab6, input.sheet-tab7:not(:checked) ~ .sheet-tab7, input.sheet-tab0:not(:checked) ~ .sheet-tab0 {     display: none; }
1533251026

Edited 1533251097
GiGs
Pro
Sheet Author
API Scripter
In this code, <input type="radio" name="attr_tab" value="1" class="sheet-tab sheet-tab1" checked="checked" /><span>General</span> attr_tab is referring to an attribute named tab. when the user jumps to a different tab, the attribute tab is being changed to the number listed in that tab definition there (1, 2, 3, etc.) So you can always manually set a tab by directly changing the @{tab} attribute. The easier way, if you want to do it automatically, is to use Kryx's suggestion, and have be a sheet worker that activates on sheet:opened , something like (untested): on('sheet:opened', () => {   setAttrs({tab:1}); }); change tab:1  to whichever tab you want to be the default. That said, there's good reasons to not do this. When players close a character sheet and re-open it, they will often be jumping to the page they were on last. 
1533255721

Edited 1533257061
Mike W.
Pro
Sheet Author
G G said: That said, there's good reasons to not do this. When players close a character sheet and re-open it, they will often be jumping to the page they were on last.  You know that is a good point however in my games, and my friend's games, we never close the character sheet once it is opened - we might minimize it but never close it. I will have to gather the opinion of a few more people on this before I go forward here.  Thank you all for the information, wow how I love this community. By the way  G G , your code works although there is a slight delay. You open the sheet to the last tab you were on and within a second or two it changes to the tab designated in your script.