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

[Help] Change Token Image

1506864527

Edited 1506864572
Hey, just grabbed this script, maybe I'm using it wrong. I made a rollable table (called cf_blue for my blue crystal floor button images) - I added two items, named 1 & 2, and gave them images from my library. I try to use any of the functions !change-token-img --incr  !change-token-image --flip  and nothing happens. I check my API window and have this error message. TypeError: Cannot read property 'substring' of undefined TypeError: Cannot read property 'substring' of undefined at Roll20Object.TrackedObj._validateAttrs (/home/node/d20-api-server/api.js:787:21) at Roll20Object.TrackedObj.set (/home/node/d20-api-server/api.js:858:18) at setImg (apiscript.js:13424:11) at apiscript.js:13551:39 at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9) at _.(anonymous function) [as each] (/home/node/d20-api-server/node_modules/underscore/underscore.js:1496:34) at handleInput (apiscript.js:13526:14) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1510:12
1506864873

Edited 1506864930
Ziechael
Forum Champion
Sheet Author
API Scripter
What other scripts do you have installed? Also, just to rule out the basics... are you running this with the token (created from the rollable table) selected?
Hey, So I was reading through some old forum posts and I AM using an image pulled from the marketplace but saved to my library, then I'm dragging it from the library sidebar into the img box. I'm using, Torch, Mapchange, Lightcrumbtrails, Vector Math, MatrixMath, Path Math, Token Collisions, HTML builder, It's a Trap + the Generic Theme. Flight, splitArgs, Carry Tokens, Character Sheet, 5th edition OGL, Group Initiative, Terrain Generator, Hourglass, ChangeTokenImage, Extended Syntax Roll20 Objects. (gonna uninstall a bunch that I'm not using, one of our players can't get dynamic light to work so i'll uninstall all of those DL scripts and report back)
1506865237
Ziechael
Forum Champion
Sheet Author
API Scripter
Ok, first things first you'll need to download the marketplace image to your computer and re-upload it to your  library. Then populate the table from that image.
Cripes! Okay, that's defeated the point of having marketplace assets not take up space in my uploads, and not having to upload 377 trap tokens. Thank you, though, I'll report back. Do you know if there'll be a fix for that in the future?
Oh, do you know why when attempting to drag n drop things from a folder on my computer into the upload box it's not bulk uploading? It just opens hundreds of tabs on my browser showing the local image path. :'c
1506865569
Ziechael
Forum Champion
Sheet Author
API Scripter
Lend your support to this  suggestion (I certainly have!). Its a matter of protecting copyright otherwise the API could potentially be abused to access ALL marketplace content without the need for purchase (i believe). I dream of a future where user libraries aren't a limitation on image access too though, as with all development however it won't change over night sadly :(
Alright, awesome it's working! I have a question that is more general / how to combine API usage I want to use IT'S A TRAP with this to make buttons that press when stepped on and then trigger a secondary trap or token change elsewhere. IT'S A TRAP has two functions that might work for this but I'm not good enough at scripting to figure this out. Trigger Properties: Trigger Other Trap: I'd be using this for the chain reaction, I feel confident about this. Special Properties: API command: I'm assuming I'd be using this to pop the change token command, however I don't know what I would write so it would select correct token for the change-token-image command (most likely itself for button presses/switch flips) I could be being incredibly dense and there's another script people are using alongside this to trigger token image changes in a simpler way. Thanks in advance for anyone who can help me out. <3