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] Random Dungeon Generator with Dynamic Lighting

Ah! That makes sense lol. If other people make tiles, will the code need to be updated to include them (and the lighting paths for them?)
1392815386
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Only if they change the wall locations..... you could change the way the floors looks... you could change the way the floors looks... etc and use the same point information and just change the tile name so it associated to its own set of points. But... Going to make a script to captures and correct the paths for new tiles with new wall patterns.... For this "Geo_Type_A" tile set template paths should be on a multiple of 35px. So the idea is: 1) You make your tile and put it in on the map. 2) You draw your lines as close as you can.... 3) And hit "correct" and the API will move a line you placed at [105, 36] to [105, 35] 4) Adjust anything that got adjusted the wrong way... and repeat step 3 5) hit "get paths" and you get all the code you need for the still in a handout or something. Because I got to tell you.... it sucked getting those the way I did the first time through :P (Note... should likely use color for lines we want corrected and another color for lines we don't want corrected... cave tiles will have some lines that are funky and some lines are normal for geomorphic reasons.)
That's actually a great idea. I was wondering how long it would take to get the placement down for new paths.. I was wondering if there would be a way to work with Alex and incorporate automatic door placement from a Doors table and drawing paths where the doors are placed (both on token layer) so that all you need to do is set up your switch and link them with his Door/Trap script.. With those two integrated together you can have a fully automated dungeon complete with doors. (Maybe figure out how to place torches with light values built in automatically every X number of squares also?) I don't want to be demanding at all. I also don't know what's possible to do either. What you've explained here is the most extensive experience I've had with coding. Sorry if I've been bothersome at all :)
I'm having trouble with this API. The first problem is, I purchased your tile bundle so that I can set up the tile roll able table. It only has tiles 0001 to 0044 but your program requires a 0045 tile. Second when I copy and paste your code i get the following error message: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: TypeError: Cannot read property 'blocked' of undefined at evalmachine.<anonymous>:618:15 at Array.forEach (native) at Function._.each._.forEach (/home/symbly/www/d20-api-server/sandcastle/node_modules/underscore/underscore.js:78:11) at buildTileArray (evalmachine.<anonymous>:616:7) at geomorph (evalmachine.<anonymous>:565:35) at processMessage (evalmachine.<anonymous>:508:31) at evalmachine.<anonymous>:502:61 at eval ( What am I doing wrong?
You actually have to click on the tile set and go in and look through for 0045. I had the same issue where it wasn't in the grouped download. As far as the error message, try disabling the script and reenabling it.. That's worked for me before.
Jarrod . said: You actually have to click on the tile set and go in and look through for 0045. I had the same issue where it wasn't in the grouped download. As far as the error message, try disabling the script and reenabling it.. That's worked for me before. Ok i found the file and added. as for the error message i did what u said, set up a map with the prerameters listed above but when i hit the create map macro nothing happens
hm, does it give you any type of message in the chat log?
nope
1392888572

Edited 1392888952
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I just setup a new campaign. The only item I copied over was my roll able table. I went to the Gist link and clicked "copy raw" Which goes to here Copied all and pasted into a new script. No other changes where made or actions taken. So it may be in the roll able table.... or something else.... any other clues as to what is happening?
Stephen S. said: I just setup a new campaign. The only item I copied over was my roll able table. I went to the Gist link and clicked "copy raw" Which goes to here Copied all and pasted into a new script. No other changes where made or actions taken. So it may be in the roll able table.... or something else.... any other clues as to what is happening? so i tried it again and i get this in the API Output Console TypeError: Cannot read property 'blocked' of undefined at evalmachine.<anonymous>:579:15 at Array.forEach (native) at Function._.each._.forEach (/home/symbly/www/d20-api-server/sandcastle/node_modules/underscore/underscore.js:78:11) at buildTileArray (evalmachine.<anonymous>:577:7) at geomorph (evalmachine.<anonymous>:526:35) at processMessage (evalmachine.<anonymous>:469:31) at evalmachine.<anonymous>:463:61 at eval ( i setup everything and typed !setup which works but after i click to use the Create Map Layer macro nothing happens and this message appears when i check the API
1392944901

Edited 1392944951
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
So its breaking in the buildTileArray function This takes the items in the roll able table, and for each one, compares it to each item in the var geomorphicTilesInformation array where the names are equal.... I updated the script in the lead post... lets see if we get you a bit further with the changes... be sure to use the link because the code displayed in the forum might not be the most current.
1393073567
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Updated the Script.... Re-Saving and then trying to rotate tiles seems to help with the firebase issue... still trying to sort through that.
1393103159
Gold
Forum Champion
keep up the awesome work, thank you for sharing
I keep getting the same error "ERROR: You must pass in a valid 'pageid' property when creating a path." What am I doing wrong?
This is the error I am getting now. ReferenceError: geomorphicTilesTableItems is not defined at buildTileArray (evalmachine.<anonymous>:869:12) at geomorph (evalmachine.<anonymous>:804:35) at processMessage (evalmachine.<anonymous>:747:31) at evalmachine.<anonymous>:741:61 at eval (
Stephen S. said: So its breaking in the buildTileArray function This takes the items in the roll able table, and for each one, compares it to each item in the var geomorphicTilesInformation array where the names are equal.... I updated the script in the lead post... lets see if we get you a bit further with the changes... be sure to use the link because the code displayed in the forum might not be the most current. Looks like you're having the same issue Stephen was posting about
Maybe I'm crazy, but I am having difficulty finding the script. Where is the script to be ran?
When I run the Create-Map-Layer macro, it doesn't place all of of the tiles. Can anyone help me out with that one?
Keith M. said: Maybe I'm crazy, but I am having difficulty finding the script. Where is the script to be ran? <a href="https://gist.github.com/BaldarSilveraxe/9075585" rel="nofollow">https://gist.github.com/BaldarSilveraxe/9075585</a> Mark C. said: When I run the Create-Map-Layer macro, it doesn't place all of of the tiles. Can anyone help me out with that one? Would you be able to elaborate on what you mean by "it doesn't place all of the tiles," possibly post some screenshots?
1402355864
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Plan to look at this one this weekend.... Would like to make sure is behaving.
are there any more plans for geometric map tiles in the future Stephen?
1402747057
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Yes, I think so. Been planning to
Stephen S. said: Yes, I think so. Been planning to I'm excited! Do you have any themes in mind?
Am I missing something, I am interested in this and willing to pay the $5 for the tileset, but where is the API that comes with it??? The link seems to be a bit confusing : <a href="https://wiki.roll20.net/Random_Dungeon_Generator#M" rel="nofollow">https://wiki.roll20.net/Random_Dungeon_Generator#M</a>...
1407351311
The Aaron
Roll20 Production Team
API Scripter
At the very bottom under "Code".
I haven't bought anything of of the marketplace before. Does it auto-upload to your library? Then the API script I'm guessing pulls from your library?
1407352742
The Aaron
Roll20 Production Team
API Scripter
Actually, for that script you build a Rollable Table with a known name and the individual entries named after the tiles and set the pictures on each of the entries.
Hm... I just finished setting up the rollable table (only found tiles up to #44, not #45) and now I realize that the gist link seems to be broken. The link points to <a href="https://gist.github.com/BaldarSilveraxe/9075585" rel="nofollow">https://gist.github.com/BaldarSilveraxe/9075585</a> but I get the following error: "Whoops. We seem to have missed the gist of that gist you were looking for." Hopefully it's just a problem on GitHub's gist end.
Actually <a href="https://github.com/BaldarSilveraxe" rel="nofollow">https://github.com/BaldarSilveraxe</a> and <a href="https://gist.github.com/BaldarSilveraxe" rel="nofollow">https://gist.github.com/BaldarSilveraxe</a> don't work either. So I am guessing that BaldarSilveraxe deleted/renamed his/her GitHub account.
Leo said: Hm... I just finished setting up the rollable table (only found tiles up to #44, not #45) and now I realize that the gist link seems to be broken. The link points to <a href="https://gist.github.com/BaldarSilveraxe/9075585" rel="nofollow">https://gist.github.com/BaldarSilveraxe/9075585</a> but I get the following error: "Whoops. We seem to have missed the gist of that gist you were looking for." Hopefully it's just a problem on GitHub's gist end. #45 has to be manually downloaded from the marketplace. For some reason it doesn't download with the rest of the tiles. As far as the links being down.. you may wan to send a PM to Stephen about it.. if that doesn't work I can send you the code I currently have.
1408754205
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Working to get my gist back up... turns out I am not human per their bot.
@Jarrod Thank you! I completely missed that the issue with tile 45 was already explained in this thread. I didn't see it at <a href="https://wiki.roll20.net/Random_Dungeon_Generator" rel="nofollow">https://wiki.roll20.net/Random_Dungeon_Generator</a> and failed to search this thread fully for this problem. @Stephen S. Ohh! I hadn't heard about something like this happening before... I guess GitHub has too many users now. Well, good luck getting it back up ^^
1408992076

Edited 1408992200
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://docs.google.com/document/d/1gXABc5ssycwy7z" rel="nofollow">https://docs.google.com/document/d/1gXABc5ssycwy7z</a>... I don't know what it up with my gist account... trying to get them to unlock it. Hopefully you can get the code from here.
Thank you, got it working, pretty sweet, I didn't get the rotate to work, but I didn't read if it had special rules.
1409007514
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
When I wrote that the token rotate was broken in the API. It may be fixed now.
1409168563

Edited 1409168637
Hm... I can't get it to work as I'm getting an error similar to what was previously reported. Problem: When I click on the "Create-Map-Layer" macro I get the following error: TypeError: Cannot read property 'blocked' of undefined at evalmachine.:579:15 at Array.forEach (native) at Function._.each._.forEach (/home/symbly/www/d20-api-server/sandcastle/node_modules/underscore/underscore.js:78:11) at buildTileArray (evalmachine.:577:7) at geomorph (evalmachine.:526:35) at processMessage (evalmachine.:469:31) at evalmachine.:463:61 at eval ( No info is shown on the chat log. Setup: * Copy-pasted the script from <a href="https://docs.google.com/document/d/1gXABc5ssycwy7z" rel="nofollow">https://docs.google.com/document/d/1gXABc5ssycwy7z</a>... into a script I called "geoMap.js" This is the only active script. * Created a campaign with only 1 map: GeomorphicMap 36 x 36, didn't change other options * Set up the rollable table called "GeomorphicTiles" with tiles Geo_Type_A_0001 until Geo_Type_A_0045 with 31, 32 and 43 having item weight equal to 0. Table is set so players can roll on the table. * Used the "!setup" command to create the 5 macros. I only have the "Create-Map-Layer" and "Add-Dynamic-Lightning-Paths" macros enabled in the bar. Troubleshooting steps taken: * Verified the tiles names. * Verified the tile weights (all 1 except 31, 32 and 43 which are 0). Also tried with weights equal to 1 for 31 and 32, and then for all. * Moved to a new campaign with only 1 map. * Tried enabling/disabling the rollable table & macros for all players (tried in one with 2 online players, and another one with 0 players). * Deleted and re-did the copy-pasting of the script. * Enabled/disabled script. * Re-loading editor window after re-saving the script in the API. Like stated before, it seems to be breaking on the buildTileArray() function, which just for doc purposes I pasted in this gist <a href="https://gist.github.com/lcolladotor/cb98766e058c2b" rel="nofollow">https://gist.github.com/lcolladotor/cb98766e058c2b</a>... Any ideas?
I love the idea of this. Boy, is it confusing, though. Haha.
1409189321
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Jarrod . said: You actually have to click on the tile set and go in and look through for 0045. I had the same issue where it wasn't in the grouped download. As far as the error message, try disabling the script and reenabling it.. That's worked for me before. Did you try this?
Yes and it didn't work. If you prefer I can invite you to the single map campaign and give you GM powers. You might notice something I didn't.
1409219307
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
The rollable table is not matchy matchy with the hard coded array for one of the tiles is the issue. Stuck in a hotel with table only until this weekend, so it will be until then before I can look at more closely. But that is the issue.
1409234540

Edited 1409234672
When you say give tiles weight, what does that mean? Do we need to have the actual tiles sprawled on the map itself, or does it pull from the library? Trying to figure this out because I love the thought of random dungeon generator WITH dynamic lighting. :D edit: Found out (sadly qq) that by hitting !setup a few times (to see if anything worked) will generate a multitude of the same macros. Any way to get rid of those?
Kurrin, 1. In the rollable table you created, for those numbers listed, there is after the name field, a weight field. It should be set to 0 if you want it to work properly. 2. Yes, in the top right, there is the gear tab(top right inside of browser). Scroll down, you will see multiple entries listed. Click on them, to get into them. Then scroll down and click DELETE. Also you probably want to change them so all players don't see them, as that's what they are by default, my players were asking what they were, which is in the same place (go into the last remaining one, scroll to the bottom, and delete the line where it says "All" for players have access/see.
If this doesn't work, you can invite me to your campaign and make a temporary co-GM, and I can walk you through it. It seems complicated at first, but is simple once you figure it out.
I'll definitely need you to come in, I think. I can't even get to the rollable table part! Lol. I'm obviously missing the first step -- make a map with GeoMapTiles (or whatever it needs to be) and then I have no idea what to really do after that. -.- I'm at school right now -- but, are you available later tonight (5pm PST)?
1409235709

Edited 1409235764
Now wouldn't work for me either, 8PM Eastern should work for me. Do you have skype or mumble client installed? I have a mumble server, or you can PM me with your skype name. You purchased the required Old School Geomorphic tileset from the marketplace correct? Once you do that, everything else I can help you with.
Zomg! Sorry. I got towed after I got out of class, so that ruined my day since I had to rush home and get ready to GM game. Are you available this weekend or Monday?
Sunday if anything.
1409476639
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
buildTileArray = function() { geomorphicTilesArray = new Array(); var count = 0 _.each(geomorphicTilesTableItems, function(geomorphicTilesTableItemsEach) { obj = _.find(geomorphicTilesInformation, function(obj) {return obj.tileName == geomorphicTilesTableItemsEach.get("name");}); log(obj.tileName) if(obj.blocked == false){ geomorphicTilesArray.push({ tileName: geomorphicTilesTableItemsEach.get("name"), tileURL: geomorphicTilesTableItemsEach.get("avatar").replace("med.jpg?","thumb.jpg?"), edge: obj.edge, corner: obj.corner, entrance: obj.entrance, type: obj.type, rotation: obj.rotation, rarity: obj.rarity, blocked: obj.blocked, side: count }); count++ }; }); }; Add the log statement in the buildTileArray function... see the example above " log(obj.tileName) " You should be able to see which tile you break at. Could be as simple as an extra space in the rollable table for one of the tile names.