Why i have to do this: Code (Javascript): ({ afterNewMessage : function(msg) { if(msg == "Script Check: OK") { this.expForNextLevel(345); } } , expForNextLevel : function(pokeNum) { var Erratic = [347, 348, 334, 411, 366, 346, 408, 349, 456, 368, 367, 345, 457, 350, 290, 291, 409, 292, 410, 333, 313, 335]; var Fast = [] var MediumFast = [] var MediumSlow = [] var Slow = [] var Fluctuating = [] if(Erratic.indexOf(pokeNum) != -1) { var Group = "Erratic"; } if(Fast.indexOf(pokeNum) != -1) { var Group = "Fast"; } if(MediumFast.indexOf(pokeNum) != -1) { var Group = "Medium Fast"; } if(MediumSlow.indexOf(pokeNum) != -1) { var Group = "Medium Slow"; } if(Slow.indexOf(pokeNum) != -1) { var Group = "Slow"; } if(Fluctuating.indexOf(pokeNum) != -1) { var Group = "Fluctuating"; } sys.sendAll(Group); } }) And not this? Code (Javascript): ({ afterServerStartUp : function() { var Erratic = [347, 348, 334, 411, 366, 346, 408, 349, 456, 368, 367, 345, 457, 350, 290, 291, 409, 292, 410, 333, 313, 335]; var Fast = [] var MediumFast = [] var MediumSlow = [] var Slow = [] var Fluctuating = [] } , afterNewMessage : function(msg) { if(msg == "Script Check: OK") { this.expForNextLevel(345); } } , expForNextLevel : function(pokeNum) { if(Erratic.indexOf(pokeNum) != -1) { var Group = "Erratic"; } if(Fast.indexOf(pokeNum) != -1) { var Group = "Fast"; } if(MediumFast.indexOf(pokeNum) != -1) { var Group = "Medium Fast"; } if(MediumSlow.indexOf(pokeNum) != -1) { var Group = "Medium Slow"; } if(Slow.indexOf(pokeNum) != -1) { var Group = "Slow"; } if(Fluctuating.indexOf(pokeNum) != -1) { var Group = "Fluctuating"; } sys.sendAll(Group); } })
(If I'm understanding right what are you talking about) Because those vars are local to a function, and those are different functions :} Make them global if you need to (maybe with a prefix).
The 'var' keyword says it's a local variable. If you want to use it in another function you need to make it global, so remove the "var" keyword. Edit: Ninjad ^^
I suggest to leave var as is but move them all outside of ({ }) though :} ___ Ninja achievement unlocked!