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

Stupid simple question

Ok, I know this is probably stupid simple to do, but I go cross-eyed if I look at JavaScript for more than about a minute. How do I find out what the specific id is of a character? I set up a sheet and token so I could write a macro to track my game's calendar using the !ammo Script. I got everything working exactly how I want it to but I would prefer not to have to actually drop the dummy token I made to use the macro which uses the @{selected|token_id} method to get the id to run everything on. I really want to just be able to enter the specific character id into the macro and put it on my quick-bar and not mess with the token at all. I know it's a pretty basic thing. I tried to search the forum, but putting "Character Id" or "Get Character Id" in the search pretty much gave me every thread ever made....
1485594347

Edited 1485596500
plexsoup
Marketplace Creator
Sheet Author
API Scripter
EDIT:  make your macro like this: /w gm @{target|character_id} Then save that character id in your ammo script. eg: !ammo -KbRGP_-sUw_DxcewG4U attributeName -1 Here's an overly complicated script with two other methods to get a character ID on('chat:message', function(msg) { // make a macro like this: !getCharacterID @{target|token_id}  if (msg.type == "api" && msg.content.indexOf("!getCharacterID") !== -1 ) { var argsFromUser = msg.content.split(/ +/); var command = argsFromUser[0]; var tokenID = argsFromUser[1]; var characterID = getObj("graphic", tokenID).get("represents"); var message = "character ID = " + characterID; sendChat("ID Getter", '/w gm ' + message); } }); on('change:graphic', function(tokenMoved) { log("token id: " + tokenMoved.get("_id")); log("token name: " + tokenMoved.get("name")); log("represents (character id): " + tokenMoved.get("represents")); }); To use it, either move a token and watch the log, or make a macro as follows: !getCharacterID @{target|token_id} (It's chatty, so you'll want to disable the script when you're not using it.)
1485595781
plexsoup
Marketplace Creator
Sheet Author
API Scripter
message updated ^^^^^^^^^^
Thanks a bunch!
1485618298
The Aaron
Pro
API Scripter
Ammo used to have a second command that was basically /w <me> @{selected|character_id} before I realized that was redundant. :)
1485667881

Edited 1485667898
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Could also just use @{Char Name|character_id} in your ammo call.
1485685350
Silvyre
Forum Champion
The Aaron said: Ammo used to have a second command that was basically /w <me> @{selected|character_id} before I realized that was redundant. :) Looking forward to the day we can use character id's as a keyword so I can use @{character_id|character_id}