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] Having major issues getting ItsATrap! to play nicely with Autofacing script!

1474324494

Edited 1474325737
Hi there, so I'm pretty new to this whole API thing and don't know the first thing about code. That said, I have gotten a decent bit of script to work for me and have even managed to make some (incredibly) minor tweaks to some of the script to fit my needs with a minor amount of success. But I digress, the reason I'm making this post is because I have been trying to get the newer versions of It'sATrap! to work for a long time because it looks extremely useful. Problem is, I haven't been able to so until recently after turning off the 'Autofacing' script I've been using (rotates tokens based on their last movement). So yeah, suddenly it worked, yay!...except the only problem is I REALLY like that autofacing script, I use it along with that script that changes a token's image based on the the rotation so that as the character tokens move, they also the graphically face the direction they are moving, like a sprite from a top down NES/SNES game like Zelda or something. My friends and I made/make all the tokens ourselves (complete turn around 0 45 90 degrees all the way up to 315 for each character, so it kinda means a lot to us that we keep that functionality in). So yeah, I just want to know if there is a way to get ItsATrap! (currently using the 5E-OGL theme) working alongside Autofacing without the 'detecting infinite loops' error. And actually how to make them work if it is possible, since I am basically stumbling around in the dark when it comes to this type of stuff and no matter how much information I try to glean through experimentation with the code (which is usually how I learn) I don't seem to get anywhere with it and the code just ends up breaking either in the same or in a different way. It just doesn't make sense to me. haha Anyway, it would be incredibly helpful to me if I could get some assistance with this. Thanks. :)
1474326196

Edited 1474326213
The Aaron
Pro
API Scripter
If you change this function in It's a Trap:   on("change:graphic:lastmove", function(token) {     _updateToken(token);   }); to this:   on("change:graphic:lastmove", function(token) {     _.defer(function(){ _updateToken(token); });   }); it will probably work. 
1474328719

Edited 1474328977
Hmm. Made the change, now it gives me: "Error: When using sendChat() you must specify a speakingas and input property." Just before it gives me the possible infinite loop error again. I'm pretty sure I did it right, as far as I could make out there was only one instance where those lines were used in the ItsATrap! script and I replaced them with you wrote. : / Is there something else I need to do? Sorry for sounding like a dingus, just want to make sure no further issues are being caused by my lack of know-how and not by anything else.
1474329976

Edited 1474330052
Ooh wait, I almost got it working! Nothing is breaking anymore, but it's still giving me the "Error: When using sendChat() you must specify a speakingas and input property." And it won't output anything into chat when the trap's effect goes off. Progress though! I have no idea why or what that error message means unfortunately. 
1474334231
The Aaron
Pro
API Scripter
hmm.. If you want to PM me a join link and GM me, I can take a look.
1474386143
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Does this error happen just anytime a token moves, or only when they move over the area of a trap?
1474386757
The Aaron
Pro
API Scripter
The issue turned out to be that the Announcer was not set in the state.  I don't know how that would end up as I'm not familiar with all the changes since you added the Themes.  I set the Announcer manually to the default "Admiral Ackbar" and it works now.
1474387579
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ah... right. In v2.6, which is not yet in One-Click but was merged into the repo yesterday, there is a new useroption for setting the announcer name. Yeah, that could cause some weirdness from just getting copied in without the default getting set. I'll get that fixed for next time to properly handle the default name if useroptions don't exist.
1474390283
The Aaron
Pro
API Scripter
Cool. =D