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

Is there a way to share Token attributes across pages?

Every time I change maps/pages I have to repopulate all the Tokens (assign them to characters, assign the bars, vision, and other properties). Is that the expected behavior? Is there any way to permanently connect a character with a Token, so I don't have to redo all those settings every time I switch story locations?

Thanks,

M.
January 30 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Yup! That's a bit counter intuitive. Here's a wiki page all about it: https://wiki.roll20.net/Linking_Tokens_to_Journals
January 30 (10 years ago)
The 'quick' way: Select them on the old page, press Ctrl-C for copy, then switch to the new page, and press Ctrl-V for Paste, and you'll have your tokens. They will behave separately from then on again, but it's a quick-and-dirty way to do it.

The better way: What Aaron said.
January 30 (10 years ago)
The Aaron
Pro
API Scripter
That quick method is especially great when you're mid game. :)
January 30 (10 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter

The Aaron said:

Yup! That's a bit counter intuitive. Here's a wiki page all about it: https://wiki.roll20.net/Linking_Tokens_to_Journals

*snigger* i love unintentional puns... counter, a synonym for token... beautiful!

The wiki page will certainly help but i would emphasise that you shouldn't link a token to a journal entry until it is 100% set up as subsequent changes won't be recorded (you can always remove the default token and re-add the updated one however).

Just something to be aware of as i have, many times, added tokens then come to use them and had to set them up all over again! Yes, i'm an idiot.
January 30 (10 years ago)
Gen Kitty
Forum Champion
You can link a token to a character sheet at any time, that's the first step after all in setting up the token. You shouldn't set a token as the default token for a character sheet until you've finished all the work.
Thanks, all. What a relief!


M.
Well, drat. I can't seem to edit the properties at all on my tokens — even as GM. Could this have something to do with the way info is being pulled from my character sheet. Perhaps I shouldn't be using variables from there? I know I've edited them before, but can't now. The only variable I can think being that now I'm using a character sheet and I wasn't then.
When you say you can't edit them, do you mean they don't change when you do? Or that you're simply unable to access the edit window in the first place?

If you're able to edit, but the changes aren't being retained, that's (probably) because you need to re-assign the default token AFTER you make the changes.

If you simply can't open the edit window at all, that's odd. Are you, maybe, signed in as a player instead of GM?

-Phnord, who owes The Aaron another nickel.
January 30 (10 years ago)
The Aaron
Roll20 Production Team
API Scripter
Another couple possibilities:
  • is the token set to is_graphic? That would make it selectable with no bars or bubbles. Right click it and paw through the menu till you find the graphic setting.
  • Is it on the map layer? Any tokens on the map layer are treated as graphics.
(The Aaron needs all the nickels he can get to buy back his lost marbles!)
I can get the pop-up bubbles. I can click in it and edit it, but as soon an I hit Enter, the value reverts to the original value. The edit doesn't "take". I've already tried deleting the token and re-establishing the link from the journal.

M.
January 30 (10 years ago)
The Aaron
Pro
API Scripter
hmmm.. If you want to PM me an invite link and GM me, I'd be happy to jump in and and see if I can figure out the issue.
My Guess This Time: The token value you were trying to change is a 'calculated' value from the character sheet... probably HP_Max.

Didja get it figured out?

-Phnord
January 31 (10 years ago)
The Aaron
Pro
API Scripter
Waiting to he gm'd. :)

good theory!
I GM'd you 5-6 hours ago. Are you not seeing it?
Phnord, yeah, that was my theory, too. Can you not edit the value if it's calculated? It would be nice to have it calculated as a default, but be able to overwrite it as you take damage.
Hey Malcolm... is that the case?

If so, I had the same problem in my game. The workaround is simple:
When the value changes, go into the Attributes section of the sheet and input it there manually.

Reason is that a calculated value isn't stored in the same place; in a sense, it isn't stored at all.
Doing this gives the token a nice solid value to look up.

Downside is that you have to remember to change it manually every time the character levels up.
The upside is that you get a nice wonky bar to remind you to do it!

-Phnord
January 31 (10 years ago)
The Aaron
Pro
API Scripter
@Phnord, you were exactly correct. The current HP on that character sheet is calculated based on a bunch of checkboxes. It might be nice if it were updated to have a manual HP field that could be used instead.

We decided to create an attribute on each character named manual_HP, and fill it with the current HP, then link the tokens to that. I wrote a script to handle this for him:
on('ready',function(){
    'use strict';

    var fixNewObj= function(obj) {
        var p = obj.changed._fbpath,
        new_p = p.replace(/([^\/]*\/){4}/, "/");
        obj.fbpath = new_p;
        return obj;
    },

    SetupHitPoints = function(token) {
        var attr = findObjs({type: 'attribute', characterid: token.get('represents'), name: 'manual_HP'})[0],
            srcHP = getAttrByName(token.get('represents'),'hp-current', 'max');
           
        if(!attr) {
            attr=fixNewObj(createObj('attribute', {
                name: 'manual_HP',
                characterid: token.get('represents'),
                current: srcHP,
                max: srcHP
                }));
        } else {
            attr.set({
                current: srcHP,
                max: srcHP
            });
        }
        token.set({
            bar3_link: attr.id
        });
    };

    on('chat:message',function(msg){
        var args;

    	if (msg.type !== "api") {
			return;
		}
        
    	args = msg.content.split(/\s+/);
		switch(args.shift()) {
			case '!setup-hp':
                _.chain(msg.selected)
                    .map(function(o){
                        return getObj('graphic',o._id);
                    })
                    .reject(_.isUndefined)
                    .reject(function(t){
                        return undefined === t.get('represents');
                    })
                    .each(SetupHitPoints)
                    ;
                break;
		}
    });
    log('Setup-HP: ready!')
});

To use it, you'd just setup the token as normal with it representing a character, then select them and run:
!setup-hp
This will cause the script to go through each of the selected tokens, and if they represent a character, find or create an attribute on that character named manual_HP, set it's current and max to the value of "hp-current", then change bar3 of the token to link to it.

At that point, it can be added to the character sheet as a default token. Calling the command again is a handy way to update the manual_HP field when the character's calculated HP changes.

I'm going to drop a generalized version of this in the github repo, next time I'm working on such. =D
Awesome. Thanks so much, Aaron. This is great!

T.