[Server Scripting] RPG Fail

Discussion in 'Server and Client Scripting' started by Onters, Jan 7, 2015.

  1. Onters

    Onters New Member

    Joined:
    Jan 7, 2015
    Messages:
    3
    Likes Received:
    1
    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
     
    Last edited: Jan 7, 2015
  2. MidwayMarshall

    MidwayMarshall woof Forum Moderator Developer Forum Moderator Developer

    Joined:
    Jun 13, 2014
    Messages:
    303
    Likes Received:
    170
    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.
     
    Last edited: Jan 8, 2015
  3. Onters

    Onters New Member

    Joined:
    Jan 7, 2015
    Messages:
    3
    Likes Received:
    1
    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
     
  4. MidwayMarshall

    MidwayMarshall woof Forum Moderator Developer Forum Moderator Developer

    Joined:
    Jun 13, 2014
    Messages:
    303
    Likes Received:
    170
    Did you add the file?
     
  5. Kase

    Kase Member

    Joined:
    Mar 12, 2014
    Messages:
    148
    Likes Received:
    3
    Yea, file is missing.