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] New to API

1426128199
Phillip G.
Plus
Sheet Author
Okay, I am trying to get into this API thing to make life easier on me and more fun for the players. I read through the API Wiki (intro, use guide, a few examples and some of the other stuff). I am not a programmer and know virtually nothing of javascript. I have gotten pretty good at using community information over the past few months, though. The first API I wanted to use was the Teleporter. It sounds like a great way to move the players around without have to cut and paste tokens or dragging them all over the map. As I understood it, all I had to do was copy the API script into the API Script editor from the campaign tools links. After that I thought I would be able to utilize the commands in my campaign. I loaded up the campaign and attempted to do so. No luck. I looked through all the notes in the script and re-read the forum posts a few dozen times and re-read the wiki as well (more than once). I noticed one poster mentioned starting a module. However, I cannot find anything about starting API modules or any way to tell the campaign that is should be running an API. Should I have to "start" anything or should the script just run? If there is nothing to start, then I can try to provide more details in hopes that this can be figured out. FYI: I have tried the same things on both the Live and Dev servers with no differences.
1426130358
Phillip G.
Plus
Sheet Author
Update: I decided to leave a window open to the API Script editor so I could see the console while I tried the script out. Turns out it is generating the following error: ReferenceError: obj is not defined at Object.Teleporter.Teleport (evalmachine. :31:19) at Sandbox. (evalmachine. :84:24) at eval ( Any help here would be great. I have copied the script for Teleporter without Movement Tracker from the link I found in this post: <a href="https://app.roll20.net/forum/post/193270/script-auto-teleporting-and-chat-based-teleporting#post-233925" rel="nofollow">https://app.roll20.net/forum/post/193270/script-auto-teleporting-and-chat-based-teleporting#post-233925</a>
Try sending a message to the author, Josh.
1426139894
The Aaron
Pro
API Scripter
I remember debugging this for someone in the past. The issue is the assumption on line 30-31 that there is a variable named obj defined. This was defined in another script as a global variable (naughty naughty!), and so this script picked it up as a side effect. Actually, looking at the script, if you just comment out 30 and 31, it should work fine. Those two variables are never even used, so it was probably just a copy paste error to begin with.
1426153611
Ziechael
Forum Champion
Sheet Author
API Scripter
I had no real problems with this script (using the same one 'sans movement tracker') but did find it a bit fiddly setting up some portals at first... but once it is locked down in your head its quite intuitive to use. If you want any help setting up just give me a shout and i'd be happy to jump into your campaign and advise. Also with a nameless scriptomancer's help (ok... it was Aaron and he did all the work!) I've been able to set it up so that some portals can be random for that extra 'where am I... hang on, where is everyone else!' based fun =D
1426169931
The Aaron
Pro
API Scripter
=D Z, I'm betting you haven't used the !teleport command, which is where this crash would take place. Your copy of the script would have this same problem unless something is leaving a roll20 object in the global obj variable for you.
1426173236
Ziechael
Forum Champion
Sheet Author
API Scripter
Well shucks, you outed me... i'm a stone cold !AUTOTELEPORTER using be-a**h. To be safe though i think i'll comment out those lines as suggested.... but that doesn't mean i'm scared!
1426173393
The Aaron
Pro
API Scripter
heheeheheh
1426270255
Phillip G.
Plus
Sheet Author
Ok, so I commented out lines 30-31 and then line 199 (since I missed that it needed to be commented out.) Still having issues, maybe I can get a hold of one you guys tonight and we can do some walk-throughs or something. Thanks for all the help so far.
1426270589
The Aaron
Pro
API Scripter
Quite possibly. =D Feel free to drop me a PM with a join link and GM me after I join and I'll jump in later and see if I can spot the issue.
1426271188
Ziechael
Forum Champion
Sheet Author
API Scripter
The Aaron said: Quite possibly. =D Feel free to drop me a PM with a join link and GM me after I join and I'll jump in later and see if I can spot the issue. Likewise... happy to take a look