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 .
×

[Help] createObj not creating the graphic token

Hello! I'm attempting to pull a map token image from my library and put it on a page. When I'm calling createObj I'm getting a return object like I'd expect, and I'm not seeing any errors in the API console, but the token never appears anywhere on the page, or anywhere else for that matter.. I cant figure out what I'm doing wrong. I'm starting to wonder if there is some kind of bug? I'm new to javascript and roll20 scripting, but am an experience programmer. logged createObj return (manually formatted): { "_id":"-MByrQtX2LMJasxl6MLk", "_pageid":"-M5tY0YUHizkqMRzdfgY", "left":3920, "top":2450, "width":700, "height":700, "rotation":270, "layer":"map", "isdrawing":false, "flipv":false, "fliph":false, "imgsrc":"<a href="https://s3.amazonaws.com/files.d20.io/images/133341899/vTI4UfvWuyRG0Hpwbi1lzg/thumb.jpg?15891497295" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/133341899/vTI4UfvWuyRG0Hpwbi1lzg/thumb.jpg?15891497295</a>", "name":"", "gmnotes":"", "controlledby":"", "bar1_value":"", "bar1_max":"", "bar1_link":"", "bar2_value":"", "bar2_max":"", "bar2_link":"", "bar3_value":"", "bar3_max":"", "bar3_link":"", "represents":"", "aura1_radius":"", "aura1_color":"#FFFF99", "aura1_square":false, "aura2_radius":"", "aura2_color":"#59E594", "aura2_square":false, "tint_color":"transparent", "statusmarkers":"", "showname":false, "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":"", "light_dimradius":"", "light_otherplayers":false, "light_hassight":false, "light_angle":"", "light_losangle":"", "light_multiplier":1, "adv_fow_view_distance":"", "sides":"", "currentSide":0, "lastmove":"", "_type":"graphic", "_subtype":"token", "_cardid":"", "has_bright_light_vision":false, "has_night_vision":false, "night_vision_distance":0, "emits_bright_light":false, "bright_light_distance":0, "emits_low_light":false, "low_light_distance":0 } createObj call: let room_token = createObj( 'graphic' , { _type : "graphic" , _subtype : "token" , _pageid : Campaign(). get ( "playerpageid" ) , imgsrc : room_imgsrc , top : host_token. get ( "top" ) , left : host_token. get ( "left" ) , width : 700 , height : 700 , rotation : 90 * room_to_rotation[ 1 ] , isdrawing : false, layer : "map" }) ;
NM, figured it out. I didn't have the player banner on the page I was on as the GM.. so, the Campaign.get("playerpageid") returned the wrong page.. weirdly I would think the tokens would have appeared on the page with the banner but, IDK. Maybe they were off map or something.
1594508364
The Aaron
Roll20 Production Team
API Scripter
You can get the GM's page from their player object "lastpage" property. This is only updated fir GMs ave is updated when the move to a page. The only caveat is that if you have multiple windows open, it will be for the lady one of them that loaded a page.&nbsp;