Well, I was going by the small guide to scripting i found here and I encountered an error when I made the utilities.js script: Code (text): ({ counter: 0 , afterLogIn: function (src) { sys.sendAll("Script: Hello " + sys.name(src) + ", how are you?"); sys.sendAll("You are the " + this.utilities.formatNth(++this.counter) + " person to log in this script run!"); } , beforeLogOut: function(src) { sys.sendAll("Script: Goodbye " + sys.name(src)); } , utilities: sys.exec("utilities.js") }); Utilities Code (text): ({ formatNth: function (num) { return num.toString() + (["th", "st","nd","rd"][++this.counter] || "th"); } }); And when the third person logs in it sends out the wrong rd/th/st/nd/
You're adding one to the counter twice (once when calling the function and once actually in the function). Use num instead of ++this.counter in the Utilities file.