function z(str1, str2) {
var t_string = str1;
var regular = /%(d|n|r|s|t)/g;
var t_color = new Array();
var counter = 0;
var t_array = new Array();
var t_colourFore1 = world.GetVariable("colour_fore1");
var t_colourFore2 = world.GetVariable("colour_fore2");
var t_colourDisplay = world.GetVariable("colour_display");
var t_colourBack1 = world.GetVariable("colour_back1");
var t_colourReceive = world.GetVariable("colour_receive");
var t_colourSend = world.GetVariable("colour_send");
while ((t_color = regular.exec(t_string)) != null) {
t_array[counter] = t_color.index;
t_array[counter + 1] = t_color.lastIndex;
t_array[counter + 2] = t_color[1];
counter += 3;
}
if(str2 == null) zb();
if(t_array[0] == null) world.ColourTell(t_colourFore1, t_colourBack1, str1);
else {
if(t_array[0] != "0") world.ColourTell(t_colourFore1, t_colourBack1, t_string.substring(0, t_array[0]));
for(var k = 0; k <= counter; k += 3) {
if(t_array[k + 3]) {
if(t_array[k + 2] == "d") world.ColourTell(t_colourDisplay, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
else if(t_array[k + 2] == "n") world.ColourTell(t_colourFore1, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
else if (t_array[k + 2] == "r") world.ColourTell(t_colourReceive, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
else if (t_array[k + 2] == "s") world.ColourTell(t_colourSend, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
else if (t_array[k + 2] == "t") world.ColourTell(t_colourFore2, t_colourBack1, t_string.substring(t_array[k + 1], t_array[k + 3]));
}
else {
if(t_array[k + 2] == "d") world.ColourTell(t_colourDisplay, t_colourBack1, t_string.substr(t_array[k + 1]));
else if(t_array[k + 2] == "n") world.ColourTell(t_colourFore1, t_colourBack1, t_string.substr(t_array[k + 1]));
else if (t_array[k + 2] == "r") world.ColourTell(t_colourReceive, t_colourBack1, t_string.substr(t_array[k + 1]));
else if (t_array[k + 2] == "s") world.ColourTell(t_colourSend, t_colourBack1, t_string.substr(t_array[k + 1]));
else if (t_array[k + 2] == "t") world.ColourTell(t_colourFore2, t_colourBack1, t_string.substr(t_array[k + 1]));
}
}
}
if(str2 == null) world.ColourTell(t_colourDisplay, t_colourBack1, "\n");
}
i think this solved my whole color script stuff...
Edited by Nick to add [code] to make it more readable. |