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

@Stephen S. The log() did not show any information. However, your space tip was the key as I had " Geo_Type_A_0002" instead of the correct tile name: "Geo_Type_A_0002". You can't even notice it on the screenshot above. After fixing the space, the log() message does work. Thank you very much for all the help!!!
Bryan, are you available now? :)
1409570159

Edited 1409570239
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Did you read through this: <a href="https://wiki.roll20.net/Random_Dungeon_Generator" rel="nofollow">https://wiki.roll20.net/Random_Dungeon_Generator</a> The most challenging part is setting up the rollable table. It must be named "GeomorphicTiles" and if should only include "Geo_Type_A_0001" through "Geo_Type_A_0045" with the unmodified API code. Most often its a slight mistake in setting up that table that gives everyone fits. You need to create a table that looks like: <a href="https://wiki.roll20.net/File:Use_of_Rollable_Table.png" rel="nofollow">https://wiki.roll20.net/File:Use_of_Rollable_Table.png</a>
1410442472
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
placeTile = function(name,l,t,spin) { obj = _.find(geomorphicTilesArray, function(obj) {return obj.tileName == name;}); var left = (l * 840) + 420; var top = (t * 840) + 420; var url = obj.tileURL var r = spin; marker = createObj("graphic", {_type: "graphic", _subtype: "token", _pageid: geomorphicMapId, layer: "map", width: 840, height: 840, left: left, top: top, imgsrc: url, rotation: r, sides: sideString, currentSide: obj.side}); marker=fixNewObject(marker); }; //--Utility Function var fixNewObject = fixNewObject || function(obj){ var p = obj.changed._fbpath; var new_p = p.replace(/([^\/]*\/){4}/, "/"); obj.fbpath = new_p; return obj; } ; This fixes the token rotation.... many thanks to those that put that work around together.
Has this been updated to the GIST which was down? This is additional code and not replacement code, correct? So it can be added anywhere?
1410444404
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Additional and replacement... The "placeTile" function.... last few lines of it in BOLD Italic is replaced and the //--Utility Function below it is added.
1410444575
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Updated GIST on the lead post.
thank you Stephen, tested it out, all good. I plan on designing an entire campaign around this tool, so it is greatly appreciated.
1410554626
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I want to redesign it soup to nuts.... no reason GM layer information couldn't be added (room number for example) or random door placement.
GM layer numbers wouldn't be bad, neither would doors.
1410654863
Nibrodooh
Pro
Sheet Author
i am getting the following error when i try and run the Create-Map-Layer macro TypeError: Cannot read property 'changed' of undefined at fixNewObject (evalmachine.&lt;anonymous&gt;:683:16) at placeTile (evalmachine.&lt;anonymous&gt;:678:12) at stepThroughMap (evalmachine.&lt;anonymous&gt;:665:13) at geomorph (evalmachine.&lt;anonymous&gt;:529:58) at processMessage (evalmachine.&lt;anonymous&gt;:469:31) at evalmachine.&lt;anonymous&gt;:463:61 at eval ( any assistance would be appreciated, thanks.
1410654969
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Have you created the rollable table? <a href="https://wiki.roll20.net/File:Use_of_Rollable_Table.png" rel="nofollow">https://wiki.roll20.net/File:Use_of_Rollable_Table.png</a>
1410669805
Nibrodooh
Pro
Sheet Author
yes, and double checked the names.
1410687828
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
"Cannot read property 'changed' of undefined at fixNewObject" One of your tiles can't be created for some reason.... Tile 45 doesn't come over in the group down load. 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.
1410710741
Nibrodooh
Pro
Sheet Author
my table appears to be set up correctly, i have all 45 tiles in the table. if you would be willing i can give you gm access to check the table. i'll pm you a link to the campaign.
1410710806
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Send me the PM and I will look at it.
1410732656

Edited 1410732729
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I likely need to write a better utility to ensure the table is setup properly. Really should just create the table... and then you add in the right avatar.
1415446814
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I made a space/industry pack that will work in this script with a little modification. <a href="https://marketplace.roll20.net/browse/set/399/spac" rel="nofollow">https://marketplace.roll20.net/browse/set/399/spac</a>... I don't play these sort of games, however if I was going to build a Death Star this is the way I would approach it (especially when consider how much time and energy it takes to construct one and how short of time they are actually in service.)
I have spent the better half of three hours trying to get the script to work. I have the roll table completed, and the script ready to go, but each time it never shows up and I get this message. What am I doing wrong? TypeError: Cannot read property 'tileName' of undefined at evalmachine. :579:16 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 (
1415874231
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Check the names of the tiles in the rollable table. A "space" at the end or the start of the text might be the issue.
That fixed it. Thanks. I had to remake the rolltable from scratch to get it working, but it was all worth it.
1415983124

Edited 1415983461
Hi. I have created the table with all 45 tiles, added the script, run !setup, but when I run !geo, I get no results at all. And this is the message in the API ouput console: ReferenceError: geomorphicTilesTableItems is not defined at buildTileArray (evalmachine.:577:12) at geomorph (evalmachine.:526:35) at processMessage (evalmachine.:469:31) at evalmachine.:463:61 at eval ( EDIT: Disregard, I disabled and re-enabled and now it works!
So, what if it says "GeomorphicMap has images on it." but there are actually no images on the map?
1416345778
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Place an image on the map... select it... and then press [Ctrl]+A to "Select All"... then press "delete." There has to be an image on there somewhere. Or... delete (or rename) the map and make a new one with a the proper name.
It was a brand new blank page... weird.
1416359492

Edited 1416359533
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
You can send me PM with the link to campaign and I can look at it.