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

Create token from journal

Is it possible to use the API to duplicate dragging a character journal entry to the battlemap? I've searched and looked at a lot of scripts, and I'm beginning to think the answer is no. Everyone seems to use the createObj function and pull values from the journal entry. Why is this necessary? The code already exists. Why can't I just enter a journal entry name, specify some coordinates, and boom! The token is where I want it. Hopefully someone will point out that this is possible and I just missed it. Thanks.
1423166957
The Aaron
Pro
API Scripter
Not currently possibly. The UoH that's coming in Q1 has this new feature: Added read-only access to the "_defaulttoken" property on Characters. This is a JSON string that contains the data for the Character's default token if one is set. Note that this is a "blob" similar to "bio" and "notes", so you must pass a callback function to get(). Unfortunately, the volume of information is not really sufficient to create the token: OK, I was getting ready to tell you it wasn't possible with the new defaulttoken... but then I set about digging into it more. I **THOUGHT** that there were properties missing, such as playersedit_bar3, etc, which would prevent constructing the token correctly. However, what was confusing me was that only non-default values are stored in the defaulttoken. Below is a graphic object of a token, after it I've listed the _defaulttoken for that character twice. Once as I was looking at it, then again after I changed a bunch of stuff from default. You should be able to create objects with the correct properties using the _defaulttoken property. However... Huge Caveat!!! You cannot create an object whose imgsrc is not in a user library. That means if you have characters who's tokens are in the marketplace, you can't create them. It doesn't have to be your user library, but it must be in a user library. Token { . "_id": "-J_YCz7t2He2vMxBR1Ou", . "_pageid": "-JYLM7czXH6w_V--DmGU", . "left": 232.64, . "top": 875, . "width": 45.28, . "height": 70, . "rotation": 0, . "layer": "objects", . "isdrawing": false, . "flipv": false, . "fliph": false, . "imgsrc": "<a href="https://s3.amazonaws.com/files.d20.io/marketplace/5341/thumb.png?13395653815" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/5341/thumb.png?13395653815</a>", . "name": "Kobold 2", . "gmnotes": "", . "controlledby": "", . "bar1_value": "0", . "bar1_max": "", . "bar1_link": "sheetattr_ac", . "bar2_value": "", . "bar2_max": "", . "bar2_link": "", . "bar3_value": "28", . "bar3_max": "28", . "bar3_link": "", . "represents": "-JFiPCf9ic10MMx8GlKQ", . "aura1_radius": "", . "aura1_color": "#FFFF99", . "aura1_square": false, . "aura2_radius": "", . "aura2_color": "#59E594", . "aura2_square": false, . "tint_color": "transparent", . "statusmarkers": "", . "showname": true, . "showplayers_name": false, . "showplayers_bar1": false, . "showplayers_bar2": false, . "showplayers_bar3": false, . "showplayers_aura1": false, . "showplayers_aura2": false, . "playersedit_name": true, . "playersedit_bar1": true, . "playersedit_bar2": true, . "playersedit_bar3": true, . "playersedit_aura1": true, . "playersedit_aura2": true, . "light_radius": 40, . "light_dimradius": 5, . "light_otherplayers": true, . "light_hassight": true, . "light_angle": "", . "light_losangle": "", . "light_multiplier": 1, . "sides": "", . "currentSide": 0, . "lastmove": "162.64,665", . "_type": "graphic", . "_subtype": "token", . "_cardid": "" } _defaulttoken { . "left": 321, . "top": 258, . "width": 45.27904083915595, . "height": 70, . "imgsrc": "<a href="https://s3.amazonaws.com/files.d20.io/marketplace/5341/max.png?1339565381" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/5341/max.png?1339565381</a>", . "page_id": "-JFiD5RqIqWURFOAZQnu", . "layer": "objects", . "name": "Kobold %%NUMBERED%%", . "represents": "-JFiPCf9ic10MMx8GlKQ", . "bar1_link": "sheetattr_ac", . "showname": true, . "lastmove": "1341.0370578601423,110.83165564853667" } _defaulttoken (re-saved with non-default values) { . "left": 232.64, . "top": 875, . "width": 45.28, . "height": 70, . "imgsrc": "<a href="https://s3.amazonaws.com/files.d20.io/marketplace/5341/thumb.png?13395653815" rel="nofollow">https://s3.amazonaws.com/files.d20.io/marketplace/5341/thumb.png?13395653815</a>", . "page_id": "-JYLM7czXH6w_V--DmGU", . "layer": "objects", . "name": "Kobold %%NUMBERED%%", . "represents": "-JFiPCf9ic10MMx8GlKQ", . "bar1_value": "0", . "bar1_link": "sheetattr_ac", . "bar3_value": "28", . "bar3_max": "28", . "aura1_radius": "23", . "aura1_square": true, . "showname": true, . "showplayers_bar2": true, . "showplayers_bar3": true, . "showplayers_aura1": true, . "playersedit_bar3": false, . "light_radius": "40", . "light_dimradius": "5", . "light_otherplayers": true, . "light_hassight": true, . "lastmove": "162.64,665" }
Thank you, Aaron. As usual, you provide timely and useful information. I'll wait for the UoH since I'm too lazy to move my campaign to the Dev server. :)
1423170275
The Aaron
Pro
API Scripter
Now worries! =D
1423183039
Gen Kitty
Forum Champion
You cannot create an object whose imgsrc is not in a user library. That means if you have characters who's tokens are in the marketplace, you can't create them. It doesn't have to be your user library, but it must be in a user library. I note you didn't say 'The GM's library'. Does this open the door to a script that would allow a player to 'summon' monsters and whatnot, if the images arein the player's library? :&gt;
1423184544
The Aaron
Pro
API Scripter
Certainly, provided they knew the url for them, which isn't hard to get at.
1423184588
The Aaron
Pro
API Scripter
My TurnMarker script pulls the orange token for marking things out of my image library, as does the Mark script for it's marker. I'm not even in your games! =D
1423184679
vÍnce
Pro
Sheet Author
The Aaron said: My TurnMarker script pulls the orange token for marking things out of my image library, as does the Mark script for it's marker. I'm not even in your games! =D I've wondered if this could lead to "sharing" images between users...?
1423185015
The Aaron
Pro
API Scripter
As long as it's ethical, I'm sure there wouldn't be any cause for concern with doing such.
1423186312
vÍnce
Pro
Sheet Author
Absolutely.