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

A script initializing token size and virtical/horazontal filp with in campaine adjustments with in game setting controlls.

I created this script because I got tired of loading tokens in to my campaine only to have them facing the wrong direction and having to resize it because what should be a 3x3 mob loaded in as a 1x1. What this script dose whenever a new token is added to a map is look for a character named INITILIZER. It then checks that character for for the atributes hight, width, and initilizer. If initilizer is set to 1 then the token that was just add to your game will have its hight&width set to the corasponding values, be fliped virticaly&horazontaly, rotated 180 and have isdrawing set to false Things you will need to add to your game: 1 character sheet named INITILIZER to that character add hight, width and initilizer atributes (Optional) Add a token named INITILIZER and asigne it to the character setting the three bars to the three atributes An example of the character and token: hear is the code: <a href="http://pastebin.com/vivjUBWe" rel="nofollow">http://pastebin.com/vivjUBWe</a>
on("ready", function() { //var H = 2; //var W = 2; on("add:token", function(obj) { var init = findObjs({ _type: "character", name: "INITILIZER", }); //log(init); _.each(init, function(atr){ init = atr.get("_id"); }); //log(init); var H = findObjs({ name: "hight", _characterid: init, }); //log(H); _.each(H, function(atr){ H = atr.get("current"); }); //log(H); var W = findObjs({ name: "width", _characterid: init, }); //log(W); _.each(W, function(atr){ W = atr.get("current"); }); //log(W); var check = findObjs({ name: "initilizer", _characterid: init, }); //log(W); _.each(check, function(atr){ check = atr.get("current"); }); //log(W); if(check == 1) { obj.set("height", H * 70); obj.set("width", W * 70); obj.set("flipv", 1); obj.set("fliph", 1); obj.set("rotation", 180); obj.set("isdrawing", false); } //log("Heard change for object ID: " + obj.id);//Will only be called for new objects that get added, since existing objects have already been loaded before the ready event fires. }); //You could also set a variable and ignore add events until it is 1. started = 1; })