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

Movement Limiting Based On Character Speed - Outdated API Script?

Hi scripting wizards! Nearly a decade ago, someone came out with what looks like a great script to limit character movement based on their speed. From what I can surmise, it worked by displaying a brief aura that showed their maximum movement based on speed, and prevented movement outside of said aura. Each time the token was dropped within the aura, the remaining movement was calculated and the respective aura reduced in size until there was no movement left. The script is like 8 years old and no longer seems to be working. Upon import, nothing occurs, no initial API errors, no commands work, nothing appears to "load". However, after fiddling with tokens in roll20 and eventually returning to the API manager, i can see the following: ReferenceError: results is not defined ReferenceError: results is not defined at GetCharSpeed (apiscript.js:7609:5) at apiscript.js:7162:17 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:168:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1078:14) at updateLocalCache (/home/node/d20-api-server/api.js:1421:18) at /home/node/d20-api-server/api.js:1713:7 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) Is there any interest in refurbishing this script so it works under the current version of roll20? I would love to use this script as I have issues with players fudging movement.
1657731804
timmaugh
Pro
API Scripter
Short of re-jiggering the script, did you go through the required configuration/setup steps? Does your character have a Speed attribute, and did you create the pin tokens?
You might be interested in this scriptlet  to add a small marker under the current token who is at the top of the Turn Tracker, which can help with monitoring how much movement has been used on a turn. It won’t help if they are moving at other times, but can provide some limited oversight. 
1657737027

Edited 1657737058
M K.
Pro
timmaugh said: Short of re-jiggering the script, did you go through the required configuration/setup steps? Does your character have a Speed attribute, and did you create the pin tokens? I think so. I am playing 5e with the roll20 5e character sheets and they all appear to have a speed variable by default. I use this variable on the token markers itself and there is no issues with it there, so I believe I have this set correctly: In terms of the tokens, the requirement state I must have "tokens" with those specific names, but roll20 appears to just use standard graphics files to represent tokens. I cannot find a way to define a graphic as a "token" unless its within a specific character sheet via "use selected image as token." So I have uploaded and renamed 15 images and they sit in my Art Library where I assume they are meant to be placed? Jarren said: You might be interested in this scriptlet  to add a small marker under the current token who is at the top of the Turn Tracker, which can help with monitoring how much movement has been used on a turn. It won’t help if they are moving at other times, but can provide some limited oversight.  Thanks, I'll check this out in the meantime!
1657738325
The Aaron
Roll20 Production Team
API Scripter
I've always wanted to write a more comprehensive script for this sort of thing.  Has to take into account lots of factors, but that's what makes it fun. =D  Maybe I can put some time behind this in the semi-near future...
1657739025

Edited 1657739363
M K.
Pro
The Aaron said: I've always wanted to write a more comprehensive script for this sort of thing.  Has to take into account lots of factors, but that's what makes it fun. =D  Maybe I can put some time behind this in the semi-near future... Ha ha, I scoured the forums for options for this feature and nearly every time it the topic comes up I see your profile respond with something like this. I think many of us are relying on 1 man for many of these features ;). If we have it generate an aura that's diameter is 2x the characters max movement when initiative is passed to the token, then I suppose you could then have it store the size of that aura. Then, on token drop, have it calculate the quantity of grid space separation between the initial location and  dropped location in game units (ft, meters, whatever). Then redraw the aura to be the character's max movement less the distance between the last location and current location (previously determined) and repeat this process until the aura's diameter is less than the remaining movement? Easier said than done, thats for sure....
1657741527
David M.
Pro
API Scripter
Looks like that Movement Tracker script assumes that all of the pins are already on the map with token names = XPin1, XPin2, etc. (it just moves them off the visible portion of the map between each turn). So, if you want to use that script (vs. whatever wizardry Aaron may come up with) seems like you'd want to make character sheets for each one with default tokens set up appropriately. Then, for each new map, you'd have to place the tokens. I suppose you could make it a little easier on yourself once you've set up the default tokens by using the SpawnDefaultToken script to plop them all on the map at once. You could then select an existing token on the map an try a single macro like the following (hopefully none of the "!" api commands would get dropped): !Spawn --name|XPin1 --offset|1,0 !Spawn --name|XPin2 --offset|2,0 !Spawn --name|XPin3 --offset|3,0 !Spawn --name|XPin4 --offset|4,0 !Spawn --name|XPin5 --offset|5,0 !Spawn --name|XPin6 --offset|1,1 !Spawn --name|XPin7 --offset|2,1 !Spawn --name|XPin8 --offset|3,1 !Spawn --name|XPin9 --offset|4,1 !Spawn --name|XPin10 --offset|5,1 !Spawn --name|XPin11 --offset|1,2 !Spawn --name|XPin12 --offset|2,2 !Spawn --name|XPin13 --offset|3,2 !Spawn --name|XPin14 --offset|4,2 !Spawn --name|XPin15 --offset|5,2 This should Spawn a 5x3 array of the required tokens adjacent to the selected token (assuming no dropped api commands as mentioned before). l all seems a bit fiddly to me, though.
1657751938

Edited 1657752106
M K.
Pro
David M. said: Looks like that Movement Tracker script assumes that all of the pins are already on the map with token names = XPin1, XPin2, etc. (it just moves them off the visible portion of the map between each turn). So, if you want to use that script (vs. whatever wizardry Aaron may come up with) seems like you'd want to make character sheets for each one with default tokens set up appropriately. Then, for each new map, you'd have to place the tokens. I suppose you could make it a little easier on yourself once you've set up the default tokens by using the SpawnDefaultToken script to plop them all on the map at once. You could then select an existing token on the map an try a single macro like the following (hopefully none of the "!" api commands would get dropped): !Spawn --name|XPin1 --offset|1,0 !Spawn --name|XPin2 --offset|2,0 !Spawn --name|XPin3 --offset|3,0 !Spawn --name|XPin4 --offset|4,0 !Spawn --name|XPin5 --offset|5,0 !Spawn --name|XPin6 --offset|1,1 !Spawn --name|XPin7 --offset|2,1 !Spawn --name|XPin8 --offset|3,1 !Spawn --name|XPin9 --offset|4,1 !Spawn --name|XPin10 --offset|5,1 !Spawn --name|XPin11 --offset|1,2 !Spawn --name|XPin12 --offset|2,2 !Spawn --name|XPin13 --offset|3,2 !Spawn --name|XPin14 --offset|4,2 !Spawn --name|XPin15 --offset|5,2 This should Spawn a 5x3 array of the required tokens adjacent to the selected token (assuming no dropped api commands as mentioned before). l all seems a bit fiddly to me, though. I must just be really thick. I have things configured this way. If i drag the token characters to the map while the script is running, they disappear, which i believe is intended. I then roll for initiative to engage the script, and i get all the errors in the API logs that I listed in my original post.  If I roll for initiative and get the errors, I can start the script again, and it now places the first token under my character and then places a 5 foot aura beneath the character. If i move the character, nothing happens. If i try to move with waypoints, nothing happens. I return to the API, errors. At this point in time I do not believe there is an issue with my setup. I believe the issue is with the 9 year old script.  I originally made this post hoping someone would be able to help me correct whatever line needs updating to work under the modern API, but considering all the work required just to restrict players to their actual speeds this likely is just not worth it. I scratch my head and wonder why Roll20 doesn't have this as a baked in feature at this point in time. How many games utilize a movement limit and are ok with players exceeding the limit?
This is a cool idea, though it would need to allow for teleports like Fey Step, Misty Step, Thunder Step and even other movement types like Flying, Climbing that may not have the same speed as walking. If it could do all those things it could be awesome. As a DM, though, I could be lenient on occasion and let the player move another 5ft for flavour/coolness. Actually, I wonder if it handles difficult terrain and/or ignorance of. And I know some may use different rules on movement around the diagonals on the grid - ie. moving diagonal is more than 5ft per square.
1657752144

Edited 1657752279
M K.
Pro
Styx said: This is a cool idea, though it would need to allow for teleports like Fey Step, Misty Step, Thunder Step and even other movement types like Flying, Climbing that may not have the same speed as walking. If it could do all those things it could be awesome. As a DM, though, I could be lenient on occasion and let the player move another 5ft for flavour/coolness. Actually, I wonder if it handles difficult terrain and/or ignorance of. And I know some may use different rules on movement around the diagonals on the grid - ie. moving diagonal is more than 5ft per square. As of now it handles nothing as the API breaks whenever a PC rolls for initiative, however 9 years ago there was a simple command to disable the script to allow things like misty step. Back then it was as simple as pressing one macro button to enable teleportation based abilities.
Another problem with this is that Roll20 does not calculate aura diameters correctly on anything but a square grid (and they are calculated differently for V and H hex grids).