|
50 | 50 | // Version 1.01 Nov 2019 Chris D. After all characters have been created, do loops to read attributes and abilities once and create for each new character.
|
51 | 51 | // Version 1.02 Jan 2020 Chris D. Fixed bug where script would crash API if clean was run with no tokens selected.
|
52 | 52 | // Version 1.03 Mar 2020 Chris D. Tokens dragged from the journal would not be correctly linked. Moved setDefaultTokenForCharacter to occur after attributes are copied.
|
| 53 | +// Update 1.031 May 2020 Chris D. Minor bugfix with copying bio and gmnotes. |
53 | 54 | //
|
54 | 55 | //
|
55 | 56 | // Commands:
|
@@ -173,7 +174,7 @@ on('ready',()=>{
|
173 | 174 | sChat( "Token is not correctly linked to a good character." );
|
174 | 175 | else { // Everything is good. We are duplicating.
|
175 | 176 | let oldCid = charObj.id;
|
176 |
| - let tmpC = JSON.stringify( charObj ), |
| 177 | + let tmpC = JSON.stringify( charObj ).replace ( /\,"bio"\:.*?\,/gi, ',"bio":"",').replace ( /\,"gmnotes"\:.*?\,/gi, ',"gmnotes":"",'), |
177 | 178 | tmpT = JSON.stringify( tokenObj );
|
178 | 179 |
|
179 | 180 | for( let i = startnum; i < (startnum + num); ++i) { // We are going to want to duplicate both the character and token this many times.
|
@@ -232,12 +233,12 @@ on('ready',()=>{
|
232 | 233 | }
|
233 | 234 | charObj.get("bio", function(bio) {
|
234 | 235 | _.each( charArray, c => {
|
235 |
| - if( !_.isNull( bio ) && !_.isUndefined( bio) && bio != "null" && bio != "undefined" && !(typeof bio === 'string' && bio.trim() !== "") ) |
| 236 | + if( !_.isNull( bio ) && !_.isUndefined( bio) && bio != "null" && bio != "undefined" && (typeof bio === 'string' && bio.trim() !== "") ) |
236 | 237 | c.set( 'bio', bio );
|
237 | 238 | }); });
|
238 | 239 | charObj.get("gmnotes", function(gmnotes) {
|
239 | 240 | _.each( charArray, c => {
|
240 |
| - if( !_.isNull( gmnotes ) && !_.isUndefined( gmnotes) && gmnotes != "null" && gmnotes != "undefined" && !(typeof gmnotes === 'string' && gmnotes.trim() !== "") ) |
| 241 | + if( !_.isNull( gmnotes ) && !_.isUndefined( gmnotes) && gmnotes != "null" && gmnotes != "undefined" && (typeof gmnotes === 'string' && gmnotes.trim() !== "") ) |
241 | 242 | c.set( 'gmnotes', gmnotes );
|
242 | 243 | }); });
|
243 | 244 | sChat( "Duplicated: " + charObj.get( "name" ) + " " + num + " times." );
|
|
0 commit comments