Well it was fun griefing my client-rc'ers on Zodiac but this should be dealt with.
It needs to filter out HTML tags sent through RC messages.
My current hack fix to prevent the tags from continuing to wreak havoc:
PHP Code:
//#CLIENTSIDE
/*
Hack fix due to ScriptRCRCchat.onTextChanged not working.
*/
function ScriptedRCWindow.onWake() {
onWatchRC();
}
function ScriptedRCWindow.onShow() {
onWatchRC();
}
function onWatchRC() {
// Quits looping until onScrolled can takeover completely.
if (ScriptedRCScroll.scrollpos[1] > 0) return;
checkRC();
this.scheduleevent(0.05, "WatchRC", "");
}
function ScriptedRCScroll.onScrolled() {
checkRC();
}
/*
Checks RC for new messages / text.
*/
function checkRC() {
// Prevent Scroll Looping
if (this.last == ScriptedRCRCchat.text.length()) return;
// Get Last Line
temp.rcchat = ScriptedRCRCchat.text;
for (temp.i = temp.rcchat.length(); temp.i > 0; temp.i--) {
temp.char = temp.rcchat.charat(temp.i);
if (temp.char == "\\" && temp.lastchar == "n") {
temp.lbpos = temp.i + 2;
break;
}
temp.lastchar = temp.char;
}
// Determine Last Message
temp.lastmsg = temp.rcchat.substring(temp.lbpos);
if (temp.lastmsg.pos("</font>") >= 0) {
temp.from = temp.lastmsg.substring(0, temp.lastmsg.pos("</font>")+7);
temp.textmsg = temp.lastmsg.substring(temp.lastmsg.pos("</font>")+7);
temp.textmsg = temp.from @ filter(temp.textmsg);
}
else temp.textmsg = temp.lastmsg;
// Alter Text
temp.oldspos = @ScriptedRCScroll.scrollpos;
ScriptedRCRCchat.text = ScriptedRCRCchat.text.substring(0, temp.lbpos) @ temp.textmsg;
if (temp.oldspos != (@ScriptedRCScroll.scrollpos)) {
ScriptedRCScroll.scrolltobottom();
}
// Record Length
this.last = ScriptedRCRCchat.text.length();
}
// Filter's <font> tags.
function filter(msg) {
temp.mpos = msg.pos("<font");
if (temp.mpos == -1) return msg;
temp.cpos = msg.substring(temp.mpos).pos(">");
while (temp.mpos >= 0 && temp.cpos >= 0) {
msg = msg.substring(0, temp.mpos) @ msg.substring(temp.mpos+temp.cpos+1);
temp.mpos = msg.pos("<font");
temp.cpos = msg.substring(temp.mpos).pos(">");
}
return " " @ msg.trim();
}