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

[BUG]: creating a graphic with API causes campaign to hang when moving token

Currently when using the createObj to create a graphic, the graphic does not accept anything for the controlledby field. The graphic is created with zero people in the controlled by field. However, any player may select this token and attempt to move it. If they do, the entire gamespace for that player goes white and they lose everything but chat capability. Refreshing returns the campaign for that player. The token never moves. The GM may edit and assign control of the token to someone, this resolves the problem for that token.
Riley et all, you guys had a chance to look at this yet?
1384998394
Gauss
Forum Champion
Moved to the API forum.
I thought issues from the dev server, especially rugged reroll, were supposed to stay in the Mentor forum?
I believe this is fixed. Let me know if you're still having this issue.
Does not appear to be working on my test campaign yet.
1385044648

Edited 1385045223
Riley D.
Roll20 Team
Hrm. Just to confirm, you have restarted the sandbox since I pushed this out? (I assume so, just checking). To test this, I am starting with a blank campaign, and adding a single token to it via upload. I am using this script, which creates a "copy" of a token whenever the token is moved left or right (you can move it up or down without copying it)...works best on a map with grid enabled: on("change:token:left", function(obj) { createObj("graphic", _.extend(obj.toJSON(), {left: obj.get("left") + 70})); }); I am logged in to a player account in the same campaign. Before this fix, it would create the copy but the player was unable to modify the token. After the fix, I can move a token (either the GM or player can do so), it creates a copy of the token, and I am able to move the token with the player. Note that the token you're copying has to have an eligible imgsrc parameter. I've also tried variations of setting "controlledby" on the "source" token to "all", the specific player, and none. Can you test this out in a blank campaign and let me know if you can still reproduce the error? If you can, are there any console error log messages showing up on the player's side (I assume there are...) If you can't reproduce with a blank campaign, let me know that, too. Thanks!
Still failing. I'm using this to create my tokens. Everything works except the controlledby: field. <a href="https://gist.github.com/Kamanar/7502150" rel="nofollow">https://gist.github.com/Kamanar/7502150</a>
Please follow the steps I outlined above with a blank campaign and let me know if it works, and if it doesn't what errors you're seeing in the console log. The goal is to eventually get your script working, but if we're not on the same page I can't figure out what the problem is. Thanks.
Your script works, including copying over the controlled by
When you're using your script, on the player's side are you seeing any errors in the console log when it fails and crashes their session?
The script works on the player's side. The token is created. However, the controlled by field is not filled in, but anyone can attempt to modify or move the token. When they do is when the campaign crashes their session. Zero errors in the console.
1385047060

Edited 1385047108
Riley D.
Roll20 Team
I figured out the problem (or, at least, one of the problems). You aren't setting the "layer" property of the new graphic. Change it to: imgsrc: "[Insert link to image here]", pageid: tok.get("pageid"), layer: "objects" ...and it should work. I will add a check in the API to make sure that layer is set properly.
Hey, that fixed it. Interesting.
1385047649

Edited 1385047757
Riley D.
Roll20 Team
For some reason when you open the settings dialog of the newly-created token it's showing "controlledby" as blank even though the backend database is storing the value correctly (and the correct permissions are enforced on the player). I'm working on figuring out that weird thing right now, but in theory it should work fine other than that. Edit: Actually nevermind, I had controlledby on the source token set to none during testing and forgot. Seems it's all working now. Let me know if you run into any further issues.
Will we eventually be allowed to use bought images from the marketplace when creating objects?
Most likely, yes. I have to implement a way for the API to talk to the Marketplace, and then it should work. May be a little while though.
At least it's on the 'To-do list' even if it's not high up on the priority list. Thanks Riley!