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

[Script] Hexploration

March 13 (7 years ago)

Edited October 30 (6 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter

Hexploration

This thread has been closed. The new support thread for the script is here: https://app.roll20.net/forum/post/6927322/script-hexploration-thread-2/?pageforid=6927322#post-6927322


March 14 (7 years ago)
The Aaron
Pro
API Scripter
neat!
March 14 (7 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's pretty darn clever.
March 14 (7 years ago)
Gold
Forum Champion
I'm pretty hexcited about this. Will test it out soon (within a few weeks, when practical for my games).
March 14 (7 years ago)

Edited March 14 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
I've tried running this a few times, but I keep getting "Error: PathMath is not defined"

It's hard to say what's going wrong. I'm just creating a polygon, then when it's complete, selecting it and clicking the macro.

My map has vertical hexes. Is there anything special i have to do to set it up, or something basic I'm missing when making the polygons?

More detailed error code from the log:
"ReferenceError: PathMath is not defined\n    
at getHexesInArea (apiscript.js:14150:20)\n    
at fillArea (apiscript.js:14114:17)\n    
at _.each.sel (apiscript.js:14254:13)\n    
at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9)\n    
at msg (apiscript.js:14252:13)\n    
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16)\n    
at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8)\n    
at /home/node/d20-api-server/api.js:1510:12\n    
at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560\n    
at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)"

March 14 (7 years ago)
The Aaron
Pro
API Scripter
I think that might be one of Stephen’s other scripts. Check the Roll20 repo?
March 14 (7 years ago)
The Aaron
Pro
API Scripter
Yeah:  https://github.com/Roll20/roll20-api-scripts/blob/master/PathMath/1.5/PathMath.js
March 14 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
Thanks, I found it also needs MatrixMath.

Now, that i have the dependencies, it crashes after drawing a single hex.

Errors in log:
"⬢⬢⬢ Initialized Hexploration v1.0 ⬢⬢⬢"
"Hexploration ERROR: Cannot read property 'get' of undefined"
"TypeError: Cannot read property 'get' of undefined\n    at Object.persistHex (apiscript.js:1681:21)\n    at _.chain.map.hex (apiscript.js:1742:29)\n    at Function._.map._.collect (/home/node/d20-api-server/node_modules/underscore/underscore.js:172:24)\n    at _.(anonymous function) [as map] (/home/node/d20-api-server/node_modules/underscore/underscore.js:1496:34)\n    at fillArea (apiscript.js:1726:6)\n    at _.each.sel (apiscript.js:1863:13)\n    at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9)\n    at msg (apiscript.js:1861:13)\n    at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16)\n    at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8)"
"Hexploration ERROR: Cannot read property 'get' of undefined"
"TypeError: Cannot read property 'get' of undefined\n    at Object.persistHex (apiscript.js:1681:21)\n    at _.chain.map.hex (apiscript.js:1742:29)\n    at Function._.map._.collect (/home/node/d20-api-server/node_modules/underscore/underscore.js:172:24)\n    at _.(anonymous function) [as map] (/home/node/d20-api-server/node_modules/underscore/underscore.js:1496:34)\n    at fillArea (apiscript.js:1726:6)\n    at _.each.sel (apiscript.js:1863:13)\n    at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9)\n    at msg (apiscript.js:1861:13)\n    at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16)\n    at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8)"
March 14 (7 years ago)
Arthur B
API Scripter

G G said:

Thanks, I found it also needs MatrixMath.

Now, that i have the dependencies, it crashes after drawing a single hex.

Errors in log:
"⬢⬢⬢ Initialized Hexploration v1.0 ⬢⬢⬢"
"Hexploration ERROR: Cannot read property 'get' of undefined"
"TypeError: Cannot read property 'get' of undefined\n    at Object.persistHex (apiscript.js:1681:21)\n    at _.chain.map.hex (apiscript.js:1742:29)\n    at Function._.map._.collect (/home/node/d20-api-server/node_modules/underscore/underscore.js:172:24)\n    at _.(anonymous function) [as map] (/home/node/d20-api-server/node_modules/underscore/underscore.js:1496:34)\n    at fillArea (apiscript.js:1726:6)\n    at _.each.sel (apiscript.js:1863:13)\n    at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9)\n    at msg (apiscript.js:1861:13)\n    at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16)\n    at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8)"
"Hexploration ERROR: Cannot read property 'get' of undefined"
"TypeError: Cannot read property 'get' of undefined\n    at Object.persistHex (apiscript.js:1681:21)\n    at _.chain.map.hex (apiscript.js:1742:29)\n    at Function._.map._.collect (/home/node/d20-api-server/node_modules/underscore/underscore.js:172:24)\n    at _.(anonymous function) [as map] (/home/node/d20-api-server/node_modules/underscore/underscore.js:1496:34)\n    at fillArea (apiscript.js:1726:6)\n    at _.each.sel (apiscript.js:1863:13)\n    at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9)\n    at msg (apiscript.js:1861:13)\n    at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16)\n    at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8)"

Same here. 
March 14 (7 years ago)

Edited March 14 (7 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Oh, right. I also updated PathMath to support this script. Here's the new PathMath: https://github.com/Cazra/roll20-api-scripts/blob/h...

March 14 (7 years ago)
Arthur B
API Scripter
Looks great! It's working now for me. I just noticed one thing: The token that reveals hexes needs to represent a character. Most people will probably have a "party token" that doesn't represent a single character in the journal
March 14 (7 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Right, this is mentioned in the script's README/One-Click documentation.
March 14 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
Okay now I have VectorMath installed too, it's working. It's pretty great.

This will be a huge benefit to hexmapping exploration games. 

It's a shame it doesnt work for squares, it would be a pretty useful alternative to fog of war i think for people who cant use dynamic lighting because its too demanding, or whatever. Just have a token that represents vision and move it around to clear a room.  Manual fog of war is so clunky.
March 14 (7 years ago)
Arthur B
API Scripter

Stephen L. said:

Right, this is mentioned in the script's README/One-Click documentation.

Yes, I saw that afterwards. Just mentioning it because my party token on the map didn't represent a character, and I think that's the case for most people. But once I adjusted it, the script works like a charm. 

Luckily, I have some travelling/hexcrawling planned for my next session, so this comes in just in time! Thanks!
March 14 (7 years ago)

Edited March 14 (7 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter

G G said:

Okay now I have VectorMath installed too, it's working. It's pretty great.

This will be a huge benefit to hexmapping exploration games. 

It's a shame it doesnt work for squares, it would be a pretty useful alternative to fog of war i think for people who cant use dynamic lighting because its too demanding, or whatever. Just have a token that represents vision and move it around to clear a room.  Manual fog of war is so clunky.

I'm not sure how useful that would be for dungeon crawling since the purpose here is to reveal one tile at a time. That could get a bit tedious clearing out each tile with the light source token one at a time. Probably a better solution for that use-case would be large, polygonal fog-of-war areas that get removed as PCs step into their area.
March 15 (7 years ago)
Ravenknight
KS Backer
Excellent! I will give it a spin this weekend for sure.
This is great! Can it be used to reveal hexes that are one or more spaces away from the players rather than just the one they land on? 
March 18 (7 years ago)

Edited March 18 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
At present it removes hexes when you move your token on top of them.
That suggests an idea though: clear all hexes the token is adjacent to. I suppose you could set a range, from 0 (land on top) to whatever, but 1 would be very useful.
March 18 (7 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Cool idea! I'll add it to the roadmap.
March 18 (7 years ago)
Arthur B
API Scripter
Could you add an option, where you draw a path, and the script fills the complete map EXCEPT the hexes that were covered by the path area? Like an inverted fill?
March 19 (7 years ago)

Edited March 19 (7 years ago)
I used this last weekend for some hex crawling my group was doing.  Things went really well.  Nicely done!
I edited the script to make the hexes black with dark grey outlines because I found that easier on the eyes than the built-in yellow.  Maybe the ability to customize the color would be nice.

I also moved a copy of the world map from the Map layer to the GM layer, lining them up exactly.  That way, when I had it drop all the hexes on the mostly-unexplored world, I could still tell where things were since I now have a GM-only copy of the map right on top.  It made it hard for me to see the "You Are Here" token, but I already know where that is, so it was doable.
I don't know if that's something you could automate with the script as well, but I would sure like it for the next world map I set up this way.


March 19 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
That's a great idea. I find the yellow a bit too bright too.
Great!
March 20 (7 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
neat trick!
consider me a possible hexvert for this i just might be :D 
March 20 (7 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter

Adam E. said:

I used this last weekend for some hex crawling my group was doing.  Things went really well.  Nicely done!
I edited the script to make the hexes black with dark grey outlines because I found that easier on the eyes than the built-in yellow.  Maybe the ability to customize the color would be nice.

I also moved a copy of the world map from the Map layer to the GM layer, lining them up exactly.  That way, when I had it drop all the hexes on the mostly-unexplored world, I could still tell where things were since I now have a GM-only copy of the map right on top.  It made it hard for me to see the "You Are Here" token, but I already know where that is, so it was doable.
I don't know if that's something you could automate with the script as well, but I would sure like it for the next world map I set up this way.



Nice trick! I already had plans to allow GMs to choose colors for their hexes in the next version, but I'll see about implementing the trick of putting the map on the GM layer too.

Arthur B said:
Could you add an option, where you draw a path, and the script fills the complete map EXCEPT the hexes that were covered by the path area? Like an inverted fill?

Sure, I'll add that to the roadmap.
March 25 (7 years ago)
The links seem to not work for me anymore.
March 25 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
Looks like github might have changed its folder structure:

Hexploration
PathMath
I think you might also need VectorMath

March 25 (7 years ago)

Edited March 25 (7 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Sorry, I deleted my branch after it got merged into the upstream master branch. The script is now available through Roll20's One-Click library.
March 26 (7 years ago)

Edited March 26 (7 years ago)
Is there an option to reveal the hexes around the token, so the party can see a bit in front of them? Or maybe perhaps a Mouse click reveal hex option? =)

Scrolled up and saw it had just been asked, im a lazy idiot, nevermind me! =P
March 27 (7 years ago)
Havoc
Sheet Author
API Scripter
"fill: '#FFFF88'," I think you should be able to add another hex number like 60 to add transparency, to create a fog of war feel.
March 27 (7 years ago)
Havoc
Sheet Author
API Scripter
Question: Are you able to port this thing into Fog of War? To create a fog of war based on the same selection and make it disappear one by one using a token?
March 27 (7 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter

Havoc said:

Question: Are you able to port this thing into Fog of War? To create a fog of war based on the same selection and make it disappear one by one using a token?
No, there is currently no interface in the API to manipulate the Fog of War.
April 05 (6 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter

Update: v1.1

Version 1.1 is now available in beta from the merge request here: https://github.com/Roll20/roll20-api-scripts/pull/...

This update has the following changes:
* The script now has a chat menu interface.
* Implemented script configurations for hex colors.
* Implemented reveal distance configuration. When a token moves, it will also reveal hexes out to this distance.
* Hexes can now be named. When the named hex is revealed, it will announce that it has been discovered in the chat.
* Implemented inverted fill. This works like the ordinary polygon fill, except that every hex NOT in the selected polygons is filled instead.
* Requires HTML Builder script.

Preview: 

April 05 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That is terribly cool.
April 06 (6 years ago)
GiGs
Pro
Sheet Author
API Scripter
Those are great improvements!
April 06 (6 years ago)
Arthur B
API Scripter
Awesome! That will be one of my must-have scripts!

Stephen L. said:

Update: v1.1

Version 1.1 is now available in beta from the merge request here: https://github.com/Roll20/roll20-api-scripts/pull/...

This update has the following changes:
* The script now has a chat menu interface.
* Implemented script configurations for hex colors.
* Implemented reveal distance configuration. When a token moves, it will also reveal hexes out to this distance.

Splendid! Awesome work man! <3
April 15 (6 years ago)
Ravenknight
KS Backer
Very nice Stephen! I remade the campaign map just to be able to use this script! :D
April 17 (6 years ago)
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Glad ya'll are liking it! 
Version 1.1 is now available through the Roll20 One-Click library.