Hola, necesito ayuda con este script ( https://github.com/po-devs/rpg-scripts ), me tira el siguiente error (error de controlador de Sesión: Línea 157. TypeError: Resultado de la expresión 'pokelist' [definir] no es un objeto), on line 157 of pokelist appears this: var pokes = pokelist.split ("\ n"); ¿Cómo puedo solucionarlo? Gracias
Echa en falta el archivo en "db/pokes/stats.txt" Ese script es de dos anos de edad var pokelist = sys.getFileContent("db/pokes/stats.txt"); var pokes = pokelist.split("\n"); If you don't have a file at that location then pokelist will not be an object.
pokeinfo.loadBaseStats = function loadBaseStats() { var pokelist = sys.getFileContent("db/pokes/stats.txt"); var pokes = pokelist.split("");//\n var pokedb = {}; for (var x = 0; x < pokes.length; x++) { var data = pokes[x].split(" "); if (data.length != 7) { continue; } var thepokeid = data[0].split(":"); var thepoke = parseInt(thepokeid[0],10) + 65536*parseInt(thepokeid[1],10); pokedb[thepoke] = [parseInt(data[1],10), parseInt(data[2],10), parseInt(data[3],10), parseInt(data[4],10), parseInt(data[5],10), parseInt(data[6],10)]; } pokeinfo.baseStats = pokedb; }; Script Warning in sys.read(filename): No such file or directory <native>('db/pokes/stats.txt') at -1 loadBaseStats() at scripts/pokeinfo.js:156 loadData() at scripts/pokeinfo.js:56 <global>() at scripts.js:36 Script Check: Fatal script error on line 157: TypeError: Result of expression 'pokelist' [undefined] is not an object. loadBaseStats() at scripts/pokeinfo.js:157 loadData() at scripts/pokeinfo.js:56 <global>() at scripts.js:36