// Scripted by *callimuc
// Edited by David K?
//#CLIENTSIDE
const layout_image = "callimuc_say3background.png";
const layout_alpha = 0.8;
const TEXT_A = "A - Close";
const TEXT_N = "Right Arrow to go to the next page.";
const TEXT_S = "Left and Right arrow to change scroll speed.";
function onCreated() {
say3_mainwindow.destroy();
say3(message);
hideimgs(203, 204);
this.textStop = 0;
this.read = 0;
}
function say3(end,text_speed,gani,message) {
//player.chat = end SPC text_speed SPC message;
this.textStop = 1;
this.ts = text_speed;
endpage = false;
skippage = false;
new GuiBitmapCtrl("say3_mainwindow") {
extent = {getimgwidth(layout_image), getimgheight(layout_image)};
position = {(GraalControl.extent[0] - extent[0]) / 2, (GraalControl.extent[1] - extent[1]) / 4};
bitmap = layout_image;
mode = 1;
alpha = layout_alpha;
active = visible = false;
new GuiScrollCtrl("say3_scroll") {
useownprofile = true;
profile.opaque = true;
profile.border = 0;
profile.fillcolor = {
0, 0, 0, 0
};
position = {10, 10};
extent = {say3_mainwindow.extent[0] - (position[0] * 2), say3_mainwindow.extent[1] - (position[1] * 2)-5};
hScrollBar = "alwaysOff";
vScrollBar = "alwaysOff";
new GuiMLTextCtrl("say3_text") {
useownprofile = true;
profile.fontcolor = {
61,23,0,225
};
position = {0, 0};
extent = {say3_scroll.extent[0], say3_scroll.extent[1]};
text = " ";
}
}
}
if (message != NULL) {
setani(gani, NULL);
this.reading = true;
disabledefmovement();
say3_mainwindow.show();
this.end = false;
with (findimg(203)) {
layer = 4;
text = TEXT_S;
style = "bl";
zoom = 0.75;
alpha = 0.8;
mode = 1;
x = say3_mainwindow.position[0] + 20;
y = say3_mainwindow.position[1] + say3_mainwindow.extent[1] + 3;
textshadow = true;
shadowoffset = {1, 1};
shadowcolor = {0, 0, 255, 255};
}
for (this.newText = 0; this.newText < message.length(); this.newText ++) {
say3_text.text = "" @ message.substring(0, this.newText) @ "";
say3_scroll.scrollToBottom();
if (message.substring(this.newText, 1) == '.'){
sleep(this.ts + .15);
}
else{
sleep(this.ts);
}
if (skippage){
break;
}
}
say3_text.text = "" @ message @ "";
say3_scroll.scrollToBottom();
sleep(.5);
this.end = true;
if (end){
hideimg(203);
endpage = 1;
with (findimg(204)) {
layer = 4;
text = TEXT_A;
style = "br";
zoom = 0.75;
alpha = 0.8;
mode = 1;
x = say3_mainwindow.position[0] + say3_mainwindow.extent[0];
y = say3_mainwindow.position[1] + say3_mainwindow.extent[1] + 3;
textshadow = true;
shadowoffset = {1, 1};
shadowcolor = {0, 0, 255, 255};
}
}
else {
with (findimg(203)) {
layer = 4;
text = TEXT_N;
style = "bl";
zoom = 0.75;
alpha = 0.8;
mode = 1;
x = say3_mainwindow.position[0] + 20;
y = say3_mainwindow.position[1] + say3_mainwindow.extent[1] + 3;
textshadow = true;
shadowoffset = {1, 1};
shadowcolor = {0, 0, 255, 255};
}
}
}
}
function onDestroySay3() {
this.textStop = 0;
say3_mainwindow.hide();
hideimgs(203, 204);
this.reading = false;
}
function onKeyPressed(key) {
if (key == 37 && this.ts >= .01 && this.reading){
if (this.ts => .3){
this.ts = .3;
}
else {
this.ts += .02;
}
}
if (key == 39 && this.ts <= .3 && this.reading){
if (this.ts <= .02){
this.ts = .01;
}
else {
this.ts -= .02;
}
}
if (key == 39 && this.end && endpage != true){
endpage = true;
this.textStop = 0;
this.read++;
onDestroySay3();
}
if (key == 38 && this.end != true){
this.page--;
}
if (key == 40 && this.end != true && this.ts > .02){
skippage = true;
}
if (key == 65 && this.reading == true){
this.read++;
enabledefmovement();
onDestroySay3();
}
}