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

I couldn't get the 'flight' API to work,

I was going and copy and pasting the simpler APIs that looked like they could be useful. I have Ibrolled, the bloodied and dead marker one, the turn order highlighting one that lets players end their turn and move counter. But I couldn't get the Flight API to work and I couldn't find the thread for it. I copy pasted it from the directory. I type in !fly 5 with a token selected and the flight marker didn't show up. And I do use a lot of flight and multiple altitude combat. So any help?
1421891158
The Aaron
Pro
API Scripter
There is an error in that script. Change line 50 to be this: command, arg0, isHelp; instead of this: command, arg s 0, isHelp; Also, be sure you have SplitArgs installed.
1421891661
The Aaron
Pro
API Scripter
I submitted a correction for this but to the repo. Here is the pull request: <a href="https://github.com/Roll20/roll20-api-scripts/pull/15" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/15</a>
1421908313

Edited 1421909104
Lithl
Pro
Sheet Author
API Scripter
Blarg, sorry about that. I went and checked my other scripts and found the same transcription error in five others (pull request submitted). Thanks for finding it, Aaron! Devlin: The original thread for the Flight script can be found here , although it is locked because there have been no responses in over 2 months. That thread previously linked to version 1 and version 2 of the script, however with the creation of the scripts repository I've removed the gists and put the script up to a centralized location. Version 2 of the script was originally in the repo (you can find it if you look in the history), while the current version is v3. If you want to see version 1, you can look at the history of Script:Flight on the wiki. Finally, I watch the wiki pages for all of my scripts. If you post to the script's discussion page, I'll see it in my watchlist. =)
Alright, thanks!
1421947883

Edited 1421948119
Didn't work. :( I put split Arg in and did the change you said so. /** * Set selected tokens flying with !fly height. Clear the flight status markers with !fly. */ var bshields = bshields || {}; bshields.flight = (function() { 'use strict'; var version = 3.0, commands = { fly: function(args, msg) { var selected = msg.selected, height = parseInt(args[0], 10) || 0; if (!selected) { return; } _.each(selected, function(obj) { var token = getObj('graphic', obj._id), wings = '', digit, markers; if (obj._type !== 'graphic' || !token || token.get('subtype') !== 'token') { return; } token.set('status_fluffy-wing', false); while (height &gt; 0) { // Iterate over digits, from ones on up digit = height / 10; digit -= Math.floor(digit); digit = Math.round(digit * 10); // Shift height height = Math.floor(height / 10); wings += 'fluffy-wing@' + digit + ','; } if (wings.length &gt; 0) { wings = wings.substring(0, wings.length - 1); } markers = token.get('statusmarkers'); if (markers !== '') markers += ','; markers += wings; token.set('statusmarkers', markers); }); } }; function handleInput(msg) { var isApi = msg.type === 'api', args = msg.content.trim().splitArgs(), command, arg0, isHelp; if (isApi) { command = args.shift().substring(1).toLowerCase(); arg0 = args.shift(); isHelp = arg0.toLowerCase() === 'help' || arg0.toLowerCase() === 'h'; if (!isHelp) { if (arg0 && arg0.length &gt; 0) { args.unshift(arg0); } if (_.isFunction(commands[command])) { commands[command](args, msg); } } else if (_.isFunction(commands.help)) { commands.help(command, args, msg); } } else if (_.isFunction(commands['msg_' + msg.type])) { commands['msg_' + msg.type](args, msg); } } function registerEventHandlers() { on('chat:message', handleInput); } return { registerEventHandlers: registerEventHandlers }; }()); on('ready', function() { 'use strict'; bshields.flight.registerEventHandlers(); }); But it gave me a heart beat timed out, infinite loop likely culprit error.
1421948198

Edited 1421948224
The Aaron
Roll20 Production Team
API Scripter
(You can format a block as code by highlighting it and clicking on the ¶ symbol at the upper left and choosing code. Fixed it for you.) Looks like the right change. If you want to PM me an invite to your campaign and GM me, I can take a look.
1421948652
The Aaron
Pro
API Scripter
Incidentally, I tried your copy and it works fine in my (gloriously large) api test bed. Might be something else that is going on.
"Also, be sure you have SplitArgs installed." Hey Aaron, I was trying to get this to work as well. What is SplitArgs and how do I install this? Thank again, I have learned a lot about how to make Roll20 work better in the last few days...
Nevermind - I found it. Thanks
1421964324
The Aaron
Pro
API Scripter
Good deal! If you have any other issues, feel free to reach out! =D
1422074536
Lithl
Pro
Sheet Author
API Scripter
Aaron's fix for Flight (and my fix for the same error in my other scripts) just got merged into the official repo.
1426159462

Edited 1426159512
Toby
Pro
Barry said: "Also, be sure you have SplitArgs installed." Hey Aaron, I was trying to get this to work as well. What is SplitArgs and how do I install this? Thank again, I have learned a lot about how to m I have have found this script would be enormously useful but what is this and where can it be found. I'm getting the same error as original poster.
1426170280
The Aaron
Pro
API Scripter
It is in the official Roll20 Git Repo, here's a link straight to the file: <a href="https://github.com/Roll20/roll20-api-scripts/blob/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/</a>...
I wasn't talking about the Flight.js, I was talking about the SplitArg. I tried running Flight.js and I got the same error as the original poster.
1426182002
The Aaron
Pro
API Scripter
Ah, apologies. SplitArgs is in the same repo: <a href="https://github.com/Roll20/roll20-api-scripts/blob/master/splitArgs/splitArgs.js" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/master/splitArgs/splitArgs.js</a>