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

Referencing a Sheet from another Sheet

So I'm still pretty new to Roll20 API stuff, but I wanted to be able to reference a sheet from another sheet.  I skimmed the Building Character Sheet's document, but didn't see anything there that looked like it fit the bill.  Is it possible to put in like a dropdown like a token has for sheet reference, or am I stuck with just having a text input with a name and pray they remain linked?  (or I suppose one could "cheat" and grab the id and cut&paste, but that feels even more cludgey in a way, albeit more robust).  Thoughts, suggestions, etc.? By way of concrete example, take, for instance, a sheet which could represent a person or a vehicle and I want to specify the pilot of the vehicle so scripts that pull info from the vehicle can also grab info about the pilot as necessary.
1542683880
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Are you talking about general macro use, or are you looking to build this functionality into a sheet?
Into a sheet.  ideally there'd be a field where you could select a character from a dropdown to be "the pilot" (for example).
1542691362
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The only way I know to implement this is how I did it for the Starfinder sheet, which is pretty much what you've described.
Hrmm... ok, so could I make a button to grab the characterId?  Maybe someone can save me a bunch of time reading docs and experimenting in this regard... I think I'd need two or three capabilities... First, is it possible to conditionally show/hide a field?  Like have a checkbox [ ] isVehicle? and if its true, show some html elements? We have buttons.  The ones I've seen invoke template macros to emit stuff to the chat, but can I do something like `@{target|character_id} and store the result into a field on the character sheet? Third, I guess, is not so important, but currently, my friend is storing stuff like `isVehicle`, `isHorde`, etc. as attributes on the "character sheet" (in the third tab `Attributes & Abilities`.  Can the sheet itself access this information, or is it out of its scope? If those three things are possible (and again the third isn't too important, as I could move those into the sheet proper, just would require him to remake a bunch of tokens... which I might be able to do programmatically for him, even...)... I was saying if those are doable, then I could have a various linkage fields that would optionally show up if appropriate with a button to link them with a targetting icon, which would be reasonably slick, even if not as nice as a discrete drop down.
1542855276

Edited 1542855433
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Shin said: First, is it possible to conditionally show/hide a field?  Like have a checkbox [ ] isVehicle? and if its true, show some html elements? Yep, that's simple html/css driven conditional display: HTML <input class='control-display' type='checkbox' name='attr_display_control' value='1'> <div class='conditional-display'></div> CSS .sheet-control-display:not(:checked) + .sheet-conditional-display{      display:none; } We have buttons.  The ones I've seen invoke template macros to emit stuff to the chat, but can I do something like `@{target|character_id} and store the result into a field on the character sheet? The sheet can't react to anything in chat, it can only react to changes on the sheet itself. You can use the new action buttons to cause a sheetworker to fire without needing an attribute, but that doesn't really help you. There is a hacky method to sort of grab another character's information by storing it in a global variable in the sheetworkers. The global variables are shared between all characters, however they are only updated for each user when that user makes a change on the sheet you are trying to grab info from. This is how I link the pilot's piloting ranks to a ship's ac for the Starfinder sheet. Third, I guess, is not so important, but currently, my friend is storing stuff like `isVehicle`, `isHorde`, etc. as attributes on the "character sheet" (in the third tab `Attributes & Abilities`.  Can the sheet itself access this information, or is it out of its scope? The character sheet can react to any attribute stored on the sheet, even if it isn't contained in the html. However, you could easily embed those attributes in the html to change what aspects of the sheet are displayed (see the answer to #1).
1542875647

Edited 1542875690
But I *could* do something like... `!bc_pilot --vehicle|@{selected|character_id} --pilot|@{target|character_id}` in a token action on the vehicle and fill in the value myself... He said, having just thought of it this moment. P.S. Do sheets allow for css data attribute selectors?