− | //Standard API command detection...on("ready", function() { on("chat:message", function(msg) { if(msg.type == "api"){processMessage(msg)}; });}); //Your command processes preferanceprocessMessage = function(msg) { if(msg.type !== "api"){return}; //For development any API command launched the generator geomorph();}; //Things you must edit (you could use the current player page to save looking for this.)var pageID = "7F73B956-71C3-4C5B-8C72-576EE4F15EA4"; /*The geomorphic tiles you plan to use for the dungeon frameI choose:Geo_Type_A_0025 for the cornersGeo_Type_A_0027 for the entrance(s)Geo_Type_A_0026 for just part of the side*/var frameCornerSrc = "2909450/HYFOTgFf7moHhliEgdYsLg/thumb.jpg?1390956561";var frameEntranceSrc = "2909454/hhmhCCRsiAmiKyaCGVR4BQ/thumb.jpg?1390956565";var frameSideSrc = "2909452/fSkmduITZLlluRkQivHdAQ/thumb.jpg?1390956564"; /*Add as many geomorphs as you likeI choose: Geo_Type_A_0001 to Geo_Type_A_0003, Geo_Type_A_0008 to Geo_Type_A_0024 and Geo_Type_A_0045*/var roomArray = [ {room: "2909424/94athDw17E98DvIP70twJQ/thumb.jpg?1390956530"}, {room: "2909425/neY089vrU4sQ2oVWWYmQDw/thumb.jpg?1390956531"}, {room: "2909426/hfOfbRq9JH6Jom2sh6dtoQ/thumb.jpg?1390956532"}, {room: "2909432/KNge9nok4gswRXNbb-PfCw/thumb.jpg?1390956538"}, {room: "2909431/hakv67o79QUX2pHiUGNVkA/thumb.jpg?1390956538"}, {room: "2909433/9fsGQm7CNCGa6iLv1cl9oQ/thumb.jpg?1390956540"}, {room: "2909434/c_2VflN6axUPLLtOWXFctg/thumb.jpg?1390956541"}, {room: "2909435/589f_kmTWIElc97v7Ag07g/thumb.jpg?1390956543"}, {room: "2909436/4-7lLkqvFrjgkTJqlBGtbQ/thumb.jpg?1390956543"}, {room: "2909440/ZE3cEdnJnHXmI_RjiPS90w/thumb.jpg?1390956548"}, {room: "2909439/ZOf0HSRSj-TNTXU5lbyT8A/thumb.jpg?1390956547"}, {room: "2909441/oLH5A08xTn81lhNweIpwzA/thumb.jpg?1390956550"}, {room: "2909442/xKeEyHm0WpAnyB2jt3GaRw/thumb.jpg?1390956553"}, {room: "2909443/W9Ajn7H03-X-UrNVUeQebg/thumb.jpg?1390956553"}, {room: "2909444/aSRD2F_osoXf4EtVEgYV0g/thumb.jpg?1390956554"}, {room: "2909445/uU6JnLZoQ7kf8oeTLwWKOA/thumb.jpg?1390956556"}, {room: "2909446/qoNHY3u9akdgmd3MSFMBiw/thumb.jpg?1390956557"}, {room: "2909447/Y2B8aD4U7gSZ1q5fPayIwA/thumb.jpg?1390956557"}, {room: "2909448/s3aMFhYy97wKl_v_oALHwg/thumb.jpg?1390956559"}, {room: "2909449/06bso6wo0QlfG1PBa5VzHg/thumb.jpg?1390956560"}, {room: "2909457/xhwHm48cQ7prLFv4ldPTcA/thumb.jpg?1390956569"}, {room: "2933326/JGnMquqDHbBf79zP92yYYQ/thumb.jpg?1391133999"}]; /*You can design one or several dungeon framesI kept it simple*/var frameArray = [{srcImg: frameCornerSrc, rotation: 0, hFlip: true, vFlip: true, column: 0, row: 0 },{srcImg: frameEntranceSrc, rotation: 270, hFlip: false, vFlip: false, column: 1, row: 0 },{srcImg: frameSideSrc, rotation: 270, hFlip: false, vFlip: false, column: 2, row: 0 },{srcImg: frameSideSrc, rotation: 270, hFlip: false, vFlip: false, column: 3, row: 0 },{srcImg: frameSideSrc, rotation: 270, hFlip: false, vFlip: false, column: 4, row: 0 },{srcImg: frameCornerSrc, rotation: 270, hFlip: false, vFlip: false, column: 5, row: 0 },{srcImg: frameSideSrc, rotation: 0, hFlip: true, vFlip: false, column: 0, row: 1 },{srcImg: frameSideSrc, rotation: 0, hFlip: true, vFlip: false, column: 0, row: 2 },{srcImg: frameSideSrc, rotation: 0, hFlip: true, vFlip: false, column: 0, row: 3 },{srcImg: frameSideSrc, rotation: 0, hFlip: true, vFlip: false, column: 0, row: 4 },{srcImg: frameSideSrc, rotation: 0, hFlip: false, vFlip: false, column: 5, row: 1 },{srcImg: frameSideSrc, rotation: 0, hFlip: false, vFlip: false, column: 5, row: 2 },{srcImg: frameSideSrc, rotation: 0, hFlip: false, vFlip: false, column: 5, row: 3 },{srcImg: frameSideSrc, rotation: 0, hFlip: false, vFlip: false, column: 5, row: 4 },{srcImg: frameCornerSrc, rotation: 0, hFlip: true, vFlip: false, column: 0, row: 5 },{srcImg: frameSideSrc, rotation: 90, hFlip: false, vFlip: false, column: 1, row: 5 },{srcImg: frameSideSrc, rotation: 90, hFlip: false, vFlip: false, column: 2, row: 5 },{srcImg: frameSideSrc, rotation: 90, hFlip: false, vFlip: false, column: 3, row: 5 },{srcImg: frameEntranceSrc, rotation: 90, hFlip: false, vFlip: false, column: 4, row: 5 },{srcImg: frameCornerSrc, rotation: 0, hFlip: false, vFlip: false, column: 5, row: 5 },]; /*That is it... ...the rest is below:*/geomorph = function() { _.each(frameArray, function(indexRooms) { createObj("graphic", {_type: "graphic",_subtype: "token", _pageid: pageID, layer: "map", width: 840, height: 840, left: (indexRooms.column * 840) + 420, top: (indexRooms.row * 840) + 420, imgsrc: "https://s3.amazonaws.com/files.d20.io/images/" + indexRooms.srcImg, flipv: indexRooms.vFlip, fliph: indexRooms.hFlip, rotation: indexRooms.rotation, }); }); for (var i=1;i<5;i++){ var randomRoom = roomArray[Math.floor(Math.random() * roomArray.length)].room; for (var j=1;j<5;j++){ var randomRoom = roomArray[Math.floor(Math.random() * roomArray.length)].room; createObj("graphic", {_type: "graphic",_subtype: "token", _pageid: pageID, layer: "map", width: 840, height: 840, left: (i * 840) + 420, top: (j * 840) + 420, imgsrc: "https://s3.amazonaws.com/files.d20.io/images/" + randomRoom, flipv: [true,false][Math.round(Math.random())], fliph: [true,false][Math.round(Math.random())], rotation: [0,90][Math.round(Math.random())], }); }; };};</code>
| + | [[Random Dungeon Generator]] |