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

Autonpctoken, not.

When trying to use this feature I get an error mesaage of: "ERROR: You must specify a valid layer to create this object type." I have quite  a few macros running so it might be a conflict, but maybe someone has a quick answer...
Just a guess, but are you dragging to a layer that is not the Object/Token layer?
BY default I am using the token layer. Tried it on the GM layer, but not expecting it to work, and it didn't.
1487593516
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Is this a script that you are using, or is it one of the new default settings? If it's a script, can you provide a link to its forum thread, wiki entry, and/or code page?
Its a feature of the Roll20 OGL 5e Companion script. Because it is an official script I am assuming it works, and there must be a problem with my collection in some way.  I was hoping that it was something obvious, a conflict with a script would be hard to find as I use quite a few, sigh.
Went through and removed all non-Library (one click) scripts and it still throws the error.   I am using creatures imported from the D&D Manual, is there a chance the artwork from these is not being moved over properly?
1487732179
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, I'd post to the OGL sheet thread and see if Steve has any insight.
1487737515
The Aaron
Pro
API Scripter
Kevin Flynn said: When trying to use this feature I get an error mesaage of: "ERROR: You must specify a valid layer to create this object type." I have quite  a few macros running so it might be a conflict, but maybe someone has a quick answer... Was there anymore info with this, like a call stack?
No call stack, api is still running ok, just that one line each time.
I manually configured a NPC creature and the Auto tool works ok. So the problem only exists with creatures dragged from the Monster Manual. So far I have opened the Compendium, found a monster, dragged it to the Objects layer. This creates a new creature in the Journal. If I drag that Journal entry to the map it is ok. If I open the Journal entry and click the HPs bar (button?) it is supposed to create a new creature, but it throws the error.
1488202314
The Aaron
Pro
API Scripter
Oh? Interesting!  Found the issue.  There is an assumption in the script that the token is on a given layer.  Changing Line 231 to this should fix it:                 layer: (_.contains(["gmlayer", "objects", "map"], t.layer) ? t.layer : 'gmlayer'), If you wanna test that real quick, I can submit a patch.
1488202700
The Aaron
Pro
API Scripter
Actually, I just tested it and it's not going to work anyway.  The API can't create tokens with URLs that aren't in a User's Image Library.
1488202773
The Aaron
Pro
API Scripter
Ok, I take it back.  Looks like there is a special exception for Images in the Monster Manual?
1488203960
The Aaron
Pro
API Scripter
You'll also need to change the getCleanImgsrc function on line 241: var getCleanImgsrc = function (imgsrc) { &nbsp; &nbsp;var parts = imgsrc.match(/(.*\/(?:images|marketplace)\/.*)(thumb|med|original|max)([^\?]*)(\?[^?]+)?$/); &nbsp; &nbsp;if(parts) { &nbsp; &nbsp; &nbsp; return parts[1]+'thumb'+parts[3]+(parts[4]?parts[4]:`?${Math.round(Math.random()*9999999)}`); &nbsp; &nbsp;} &nbsp; &nbsp;return; }; Apparently, Compendium monster's default tokens come in without the ?#### on the end, which is required. &nbsp;You end up getting this error if you don't do the above: "ERROR: You must include the query string in your URL. For example, use '<a href="https://s3.amazonaws.com/files.staging.d20.io/images/123456/med.png?12345678" rel="nofollow">https://s3.amazonaws.com/files.staging.d20.io/images/123456/med.png?12345678</a>', not '<a href="https://s3.amazonaws.com/files.staging.d20.io/images/123456/med.png" rel="nofollow">https://s3.amazonaws.com/files.staging.d20.io/images/123456/med.png</a>'"
This is a one click script, do your comments get passed to the author? I will do so later on anyway. Thanks. Surprised this hasn't happened to anyone else?
1488247404
The Aaron
Pro
API Scripter
I dropped them to the author directly (Roll20's Steve). &nbsp;They'll likely get rolled in in the next week or two. &nbsp;The Monster Manual having only just come out, I'm not surprised it hasn't come up yet. =D
Seems to be fixed now, but it put MM icons on the GM layer, and generated icons on the token layer ?
1488801437
The Aaron
Pro
API Scripter
So, the tokens you've set up will be created on the layer you had them on when you stored it. (I can't say if that's right or wrong, it's the behavior Steve had there). &nbsp;What I added was setting the layer to the GM Layer if the token had no layer set (Which was the case for monsters from the Monster Manual). &nbsp;The API can't tell what layer you are on, so it has no way to intelligently decide which layer to put them on. &nbsp;I erred on the side of caution and created them where players wouldn't see them.