Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 05-21-2012, 04:40 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Same as last time...

Instead of with image, so it works in other say3's (Maybe I did something wrong) and I find it easier to work with, I've made them gui texts.

Also, if you have ..., it won't pause for time+1 after each dot, it will now do the three dots the pause.

Somehow I'd like to add a going back button, and I'd like to show the scroll speed that will be visually appealing still.

PHP Code:
// 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(203204);
  
this.textStop 0;
  
this.read     0;
}

function 
say3(message,gani,text_speed,end) {
  if (
gani == null){
    
gani "idle";
  }
  if (
text_speed == null){
    
text_speed .1;
  }
  
//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 = {1010};
      
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 = {00};
        
extent   = {say3_scroll.extent[0], say3_scroll.extent[1]};
        
text     " ";
      }
    }
  }
  
say3_mainwindow.visible true;
  if (
message != NULL) {
    
setani(ganiNULL);
    
this.reading true;
    
disabledefmovement();
    
say3_mainwindow.show();
    
this.end false;
    new 
GuiTextCtrl("say3_text2") {
      
position = {say3_mainwindow.position[0]+20,say3_mainwindow.position[1] + say3_mainwindow.extent[1]-15};
      
height 20;
      
text  TEXT_S;
    }
    
this.punctuations = {'.','!','?',';',':'};
    
this.punctuations2 = {'.','!','?',';',':'};
    for (
this.newText 0this.newText message.length(); this.newText ++) { 
      
say3_text.text "<font size = 20><b>" message.substring(0this.newText) @ "</b></font>";
      
say3_scroll.scrollToBottom();
      if (
message.substring(this.newText-13) == "..."){
        
sleep(.5);
        
this.newText++;
        
say3_text.text "<font size = 20><b>" message.substring(0this.newText) @ "</b></font>";
        
sleep(.5);
        
this.newText++;
        
say3_text.text "<font size = 20><b>" message.substring(0this.newText) @ "</b></font>";
        
sleep(this.ts+1);
      }
      else if (
message.substring(this.newText-11in this.punctuations2){
        
sleep(this.ts .5);
      }
      else if (
message.substring(this.newText-11in this.punctuations){
        
sleep(this.ts 1);
      }
      else{
        
sleep(this.ts);
      }
      if (
skippage){
        break;
      }
    }

    
say3_text.text "<font size = 20><b>" message "</b></font>";
    
say3_scroll.scrollToBottom();
    
sleep(.5);
    if (
end == false){
      
endpage 1;
      
say3_text2.text TEXT_A;
    }
    else {
      
say3_text2.text TEXT_N;
    }
    
this.end true;

  }
}

function 
onDestroySay3() {
  
this.textStop 0;
  
say3_mainwindow.hide();
  
say3_text2.text ="";
  
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){
    
skippage true;
  }    
  if (
key == 65 && this.reading == true){
    
this.read++;
    
enabledefmovement();
    
onDestroySay3();
  }  

__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.