
Hi, recently I have an issue with a script I made some times ago. The script copy tokens from a token page on the current page at a beacon named PlayerStart (and start some music when the ribbon is moved on the page). Like before the tokens are created but now players cannot see anything. It's probably due to a modification of the updated dynamic lighthing gestion but can't figure hox to fix it Some precisions : on the token page tokens see correctly current page dynamic options are correct (and edit them don't change anything) I have a light source near my player to test All dynamic options on created tokens are correct and that's the most incomprehensible things for me because if I edit token and save without changing anything it works perfectly (the player is able to see like I expected) In conclusion it's like if I need to refresh the token to recalculate the token's vision correctly. Anyone have an idea of what I need to add/change in my script to do it automatically ? I try to deactivate the token's vision and reactivate it but it does'nt modify anything My script : on('chat:message', function(msg) { if ( msg.type == "api" && msg.content.indexOf("!prepareStart") !== -1 ) { /* get the arguements */ var parameters = msg.content.split(" "); var pageName = "Token" if ( parameters.length > 1 ) pageName = parameters[1]; var tokenName = "PlayerStart"; if ( parameters.length > 2 ) tokenName = parameters[2]; //sendChat("API PS Debug : ", "nb arg :" + parameters.length + ", pageName :" + pageName + ", tokenName :" + tokenName); /* find the pagename (the token page) */ var page = findObjs({ _type: "page", name: pageName }); if ( page.length !== 1 ){ sendChat("API PS Erreur : ", page.length + " pages named " + pageName + " existing."); return; }else page = page[0]; //sendChat("API PS Debug : ","pageId " + page.get("id")); /* check you are the GM */ if ( ! playerIsGM( msg.playerid ) ){ sendChat("API SD, " + msg.who + " you need to be GM to use it"); return; } /* and find the page you are looking (the destination) */ var gm=getObj("player", msg.playerid); var lastPage = gm.get("_lastpage"); /* find the id of tokenName (location's target)*/ var beacon = findObjs({ _pageid: lastPage, _type: "graphic", name: tokenName }); if ( beacon.length !== 1 ){ sendChat("API PS Erreur : ", beacon.length + " token named " + tokenName + " existing."); return; }else beacon = beacon[0]; //sendChat("API PS Debug : ","targetId " + beacon.get("id")); /* find tokens on the pageName */ var pageNameGraphics = findObjs({ _pageid: page.get("id"), _type: "graphic" }); /* since I play with 2 groups I use a little trick : rock group on the gm layer online group on the objects */ let layer = "objects"; let adjust = 0; if ( parameters.length === 4 && parameters[3] === "rock" ){ adjust = -4*70; layer = "gmlayer"; } _.each(pageNameGraphics, function(obj) { /* only visible */ if ( obj.get("layer") === layer ){ //sendChat("API PS Debug : ","token : " + obj.get("name")); /* search existing token with the same name on the pageName */ var alreadyExisting = findObjs({ _pageid: lastPage, _type: "graphic", name: obj.get("name") }); //sendChat("API PS Debug : ","alreadyExisting : " + alreadyExisting.length); if ( alreadyExisting.length === 0 ){ /* change the property in order to repect the formation on the new page */ let props = JSON.parse(JSON.stringify(obj)); props.left += beacon.get("left") - beacon.get("width") / 2; props.top += beacon.get("top") - beacon.get("height") / 2 + adjust; props._pageid = beacon.get("_pageid"); props.imgsrc = props.imgsrc.replace(/med|max/,'thumb'); props.layer = "objects"; /* create a copy */ const copy = createObj("graphic", props); if (copy) toFront(copy); } } }); /* -load */ if ( parameters.length === 4 && parameters[3] === "-load" ){ /* move the player to the page with Mapchange api */ sendChat("API Debug","!mc moveall --target " + lastpage); } } });