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]Objects layer changer

Hi, Decided &nbsp;to get cracking at the API and programming in general. I'm making a simple layer changer script, but english being my third language hasn't helped in understanding what the API wiki is saying. Here's what I have so far: <a href="https://gist.github.com/Art-Wizard/5590403" rel="nofollow">https://gist.github.com/Art-Wizard/5590403</a> The idea is to change the layer back and forth with each !show TokenName, but I haven't managed to get it to work yet.
Very close! Here's what should work: <a href="https://gist.github.com/rileydutton/5591511/revisions" rel="nofollow">https://gist.github.com/rileydutton/5591511/revisions</a>
Well, it seems that I need to have a way to name my tokens first.&nbsp; <a href="https://gist.github.com/Art-Wizard/5590403" rel="nofollow">https://gist.github.com/Art-Wizard/5590403</a> Current version should work, but I keep getting "no such token" log. So, a simple question but: How do I name my tokens so that this script would work?&nbsp;
Here's how I find tokens... var n = msg.content.split(" "); var command = n[0].toLowerCase(); var TargetName = n[1]; var TargetToken = findObjs({_type: "graphic", name: TargetName, _pageid: Campaign().get("playerpageid")}, {caseInsensitive: true})[0]; if (msg.type == "api" &amp;&amp; command == "!command") { Do stuff here for that command. } For example, I have a command that allows players to mark a target. !mark Orc1 blue The script splits the command into an array with Orc1 (n[0]) and blue (n[1]) &nbsp;and then does stuff based on those commands and parameters. You don't need to remove api !commands from the array. The api already ignores it.
<a href="https://gist.github.com/Art-Wizard/5590403" rel="nofollow">https://gist.github.com/Art-Wizard/5590403</a> Well, it seems that something fixed it. It was most likely an error on my side with naming my tokens properly.Now, what I'm going to use it for is to make it easier to run visual novel style games like so: Without the need to constantly use my mouse every time a character exits or enters a scene.&nbsp;
Cool! You should record a video of one of those games, I'd be interested to see it...