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

Dealing with Jumpgate and paths

1732701218

Edited 1732730988
Boli
Pro
OK, I am working on a new API and I am struggling with the way the new paths work with jumpGate. Given it is still in production I decided to add a toggle to the config of the API so the user can toggle if they are using JumpGate or not and thus I can render the paths differently depending on what the user is using. That said... I tried to 'reverse the co-ordinates' for jumpGate but I fear there is something I am missing as the nice rounded rectangles I was able to produce are simply a mess now. code is below... any thoughts on what I am doing wrong? I am more looking for an up to date version of this which has been my api bible for many, many&nbsp; months now:&nbsp; <a href="https://wiki.roll20.net/Mod:Objects/Path" rel="nofollow">https://wiki.roll20.net/Mod:Objects/Path</a> EDIT: i wrote the jumpgate and old wrong on the image below., clearly I am after the rounded rectangle look and not whatever is happening with jumpgate. &nbsp; drawRoundedRectangle: (pageId, x, y, width, height, radius, statusColor, layer = 'objects', questId, page) =&gt; { let pathData; if (QUEST_TRACKER_jumpGate) { pathData = [ ['M', -width / 2 + radius, height / 2], ['L', width / 2 - radius, height / 2], ['Q', width / 2, height / 2, width / 2, height / 2 - radius], ['L', width / 2, -height / 2 + radius], ['Q', width / 2, -height / 2, width / 2 - radius, -height / 2], ['L', -width / 2 + radius, -height / 2], ['Q', -width / 2, -height / 2, -width / 2, -height / 2 + radius], ['L', -width / 2, height / 2 - radius], ['Q', -width / 2, height / 2, -width / 2 + radius, height / 2], ['Z'] ]; } else { pathData = [ ['M', -width / 2 + radius, -height / 2], ['L', width / 2 - radius, -height / 2], ['Q', width / 2, -height / 2, width / 2, -height / 2 + radius], ['L', width / 2, height / 2 - radius], ['Q', width / 2, height / 2, width / 2 - radius, height / 2], ['L', -width / 2 + radius, height / 2], ['Q', -width / 2, height / 2, -width / 2, height / 2 - radius], ['L', -width / 2, -height / 2 + radius], ['Q', -width / 2, -height / 2, -width / 2 + radius, -height / 2], ['Z'] ]; } const rectObj = createObj('path', { _pageid: pageId, layer: layer, stroke: statusColor, fill: "#FAFAD2", left: x, top: y, width: width, height: height, path: JSON.stringify(pathData), stroke_width: 4, controlledby: '' }); if (rectObj) { H.storeQuestRef(questId, 'rectangle', rectObj.id); } }
1732737520
The Aaron
Roll20 Production Team
API Scripter
Nothing is different about the legacy path objects on jump gate. You can continue to create them the same way you have created them. Support for the new format of path that Jumpgate uses natively will be coming soon.
is there any way we can get an update on how 'Bézier or Quadratic Curves' work now? Yes, I am fully away the original method was perhaps a bit too complex when most uses of it I could see were for making more rounded corners or rounded paths. <a href="https://wiki.roll20.net/Mod:Objects/Path" rel="nofollow">https://wiki.roll20.net/Mod:Objects/Path</a>
1732919585
The Aaron
Roll20 Production Team
API Scripter
The new path objects are much simpler in many ways than the classic paths.&nbsp; They have an overarching type (Polyline, Rectangle, Ellipse, and Freehand), and a list of points which are interpreted based on the overarching type.&nbsp; Points are a JSON encoded array of array of 2 numbers, for example: "[[0,0],[70,70],[135,70],[70,0],[0,0]]" Rectangles and Ellipses are defined with two points that form the bounding box, for example a circle with radius 70, would be: "[[0,0],[140,140]]" Polylines are just lines between a list of points.&nbsp; Freehand is cubic Bézier curve using a sliding window of 4 points with the start and end point being doubled up: "[[0,0],[70,70],[70,35],[35,35],[0,0],[0,0]]" The way they are drawn by the UI, means the last point gets doubled up, but you could leave that off in your own constructed shapes if you wanted to. This would make the following curves: [0,0],[0,0],[70,70],[70,35] [0,0],[70,70],[70,35],[35,35] [70,70],[70,35],[35,35],[0,0] [70,35],[35,35],[0,0],[0,0] Hope that helps.
There are quite a few API Scripts that are using the old Path notation, like PathMath, which itself is a per-requisite for many popular scripts.&nbsp; I believe the author of that script is no longer maintaining it.&nbsp; One script I use a lot also by the same author, is "It's a Trap!" which uses PathMath.&nbsp; It works fine for games that are converted to JG because existing Paths use the old format, but any new Path drawn just breaks the script and errors show up in the chat whenever a token is moved.&nbsp; I hope that there's some way a new version can be produced so these legacy scripts will eventually work in JG.
1733797487
The Aaron
Roll20 Production Team
API Scripter
As it happens, we've added support for Jumpgate PathV2 objects:&nbsp; <a href="https://app.roll20.net/forum/post/12161242/jumpgate-support-for-path-objects-pathv2" rel="nofollow">https://app.roll20.net/forum/post/12161242/jumpgate-support-for-path-objects-pathv2</a> Also, I've updated PathMath, Token Collisions, and It's a Trap so that they support both path objects, and PathV2 objects on Jumpgate.&nbsp; Please let me know if you come across any scripts that aren't working because of path objects.
Oh this is great news, I've been working on another aspect of my script (soon to be released... ) and trying to forget about the pathing after it caused me so much headache before. I will have to jump back into it and make some adjustments.
The Aaron said: As it happens, we've added support for Jumpgate PathV2 objects:&nbsp; <a href="https://app.roll20.net/forum/post/12161242/jumpgate-support-for-path-objects-pathv2" rel="nofollow">https://app.roll20.net/forum/post/12161242/jumpgate-support-for-path-objects-pathv2</a> Also, I've updated PathMath, Token Collisions, and It's a Trap so that they support both path objects, and PathV2 objects on Jumpgate.&nbsp; Please let me know if you come across any scripts that aren't working because of path objects. You rock, man!&nbsp; Thanks so much!