Skip to content
coyotte508 edited this page Jul 18, 2013 · 3 revisions

Scripting/Server/Creating Constants

PO has sys.moveNum() and sys.typeNum() functions that returns ids for a move and type respectively. If you really want to call them just once, save and use like constants in other languages you can use JavaScript's eval() function (once).

Variable names will be in upper case and all non-alphanumberic characters will be converted to underscores. For example: TYPE_PSYCHIC, MOVE_FIRE_FANG.

Moves

for (var i = 1; i < 560; i++) {
    eval("var MOVE_" + sys.move(i).toUpperCase().replace(/[^A-Z0-9]/g, "_") + " = " + i + ";");
}

Types

for (var i = 0; i < 17; i++) {
    eval("var TYPE_" + sys.type(i).toUpperCase().replace(/[^A-Z0-9]/g, "_") + " = " + i + ";");
}