I am trying to use the public message logging feature, but when I start the server with the extension installed, it throws some errors.
my question is about the code - zone.setPubMsgInternalEvent(true)
it is telling me that zone is not defined. so I changed it to the zone I installed the extension for simpleChat, but it says that simpleChat is not defined.
What is this suppose to be?
here is my full file, can you look it over to see if there are any other problems? It's short
Code: Select all
/**
* Extension intialization
* This example can be used as Zone level extension
*/
function init() {
/*
enable "pubMsg" internal events
by default this event is turned off
*/
simpleChat.setPubMsgInternalEvent(true);
}
/**
* Handle internal events
*
* @param e the event object
*/
function handleInternalEvent(e) {
var d = new Date();
var currDate = d.getMonth()+"/"+d.getDate()+"/"+d.getFullYear();
var currTime = toTwelves(d.getHours(), d.getMinutes());
evtName = e.name;
if (evtName == "pubMsg") {
sourcRoom = e.room;
// the room object
senderUser = e.user;
// the sender user
message = e.msg;
// the public message
var txt = currTime+" "+senderUser+" said: "+message;
var txtFile = sourceRoom+currDate;
_server.writeFile(txtFile, txt, true);
}
}
function toTens(val) {
if (val<10) {
return "0"+val;
} else {
return String(val);
}
}
function toTwelves(hour, min) {
var amPm = "AM";
if (hour>12) {
hour = hour-12;
amPm = "PM";
} else if (hour == 0) {
hour = 12;
}
var ct = toTens(hour)+":"+toTens(min)+" "+amPm;
return ct;
}
Thanks
Russ