View Single Post
  #4  
Old 12-13-2009, 06:15 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Ok, nm on that, I got it. Was just mixing stuff up the wrong way. Instead of having what I posted before. You can see the difference in the code posted below.

Having different problems now. I used a GuiMLTextCtrl in a GuiScrollCtrl to show up the chat. Now if you touch ANY npc that uses this, it will not work if you touched on already. Not sure why this happens. Also, if you hit right scroll button, you cant go back left. kinda weird. Here's the entire thing.

PHP Code:
function onCreated()
{
  
this.db findnpc("NpcChat");
}
function 
onActionServerSide(){
  if (
params[0] == "getText")
  {
    
//3 is for array. 1 is for strings and 0 is for numbers.
    
if (params[1].type() == 1)
    {
        
triggerClient("weapon"this.name"getText"this.db.(@params[1]).info);
    }
    if (
params[1].type() == 3)
    {
      if (!(
params[2]))
        
triggerClient("weapon"this.name"getText2"this.db.(@params[1][0]).info);
      if (
params[2])
        
triggerClient("weapon"this.name"getText2"this.db.(@params[1][1]).info);
    }
  }
  if (
params[0] == "getReply")
  {
    
temp.idtype params[2];
    if (
idtype.type() == 1)
      
triggerClient("weapon"this.name"getReply"this.db.(@params[2]).infoparams[1]);
    if (
idtype.type() == 3)
    {
      if (!(
params[3]) && !(params[4]))
        
triggerClient("weapon"this.name"getReply2"this.db.(@params[2][0]).infoparams[1]);
      if (
params[3] && !(params[4]))
        
triggerClient("weapon"this.name"getReply3"this.db.(@params[2][1]).infoparams[1]);
    }
  }

}
//#CLIENTSIDE
function onActionClientSide(){
  if (
params[0] == "getText")
  {
    
temp.setup params[1];
    
Npc_Chat_Window1.setText(temp.setup[0]);
    
Npc_Chat_MultiLine1.setText(temp.setup[1]);
    
Npc_Chat_ItemList.clearrows();
    
Npc_Chat_ItemList.addrow(0temp.setup[2]);
    
Npc_Chat_ItemList.addrow(1temp.setup[3]);
    
Npc_Chat_ItemList.addrow(2temp.setup[4]);
    
Npc_Chat_ItemList.addrow(3temp.setup[5]);
    
temp.img temp.setup[6];
    
Npc_Chat_Image1.image temp.img;
  }
  if (
params[0] == "getText2")
  {
    
temp.setup params[1];
    
Npc_Chat_Window1.setText(temp.setup[0]);
    
Npc_Chat_MultiLine1.setText(temp.setup[1]);
    
Npc_Chat_ItemList.clearrows();
    
Npc_Chat_ItemList.addrow(0temp.setup[2]);
    
Npc_Chat_ItemList.addrow(1temp.setup[3]);
    
Npc_Chat_ItemList.addrow(2temp.setup[4]);
    
Npc_Chat_ItemList.addrow(3temp.setup[5]);
    
temp.img temp.setup[6];
    
Npc_Chat_Image1.image temp.img;
    
this.textarray true;
  }
  if (
params[0] == "getReply")
  {
    
temp.setup params[1];
    
Npc_Chat_Window1.setText(temp.setup[0]);
    if (
params[2] == 0)
    {
      
Npc_Chat_MultiLine1.setText(temp.setup[7]);
    }
    if (
params[2] == 1)
    {
      
Npc_Chat_MultiLine1.setText(temp.setup[8]);
    }
    if (
params[2] == 2)
    {
      
Npc_Chat_MultiLine1.setText(temp.setup[9]);
    }
    if (
params[2] == 3)
    {
      
Npc_Chat_MultiLine1.setText(temp.setup[10]);
    }
    
Npc_Chat_ItemList.clearrows();
    
temp.img temp.setup[6];
    
Npc_Chat_Image1.image temp.img;
  }
  if (
params[0] == "getReply2")
  {
    if (!(
this.replyarray))
    {
      
temp.setup params[1];
      
Npc_Chat_Window1.setText(temp.setup[0]);
      if (
params[2] == 0)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[7]);
      }
      if (
params[2] == 1)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[8]);
      }
      if (
params[2] == 2)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[9]);
      }
      if (
params[2] == 3)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[10]);
      }
      
Npc_Chat_ItemList.clearrows();
      
temp.img temp.setup[6];
      
Npc_Chat_Image1.image temp.img
      
this.replyarray true;
      
this.replyarray2 false;
      
scheduleEvent(4"onReadAgain"null);
    }
  }
  if (
params[0] == "getReply3")
  {
    if (!(
this.replyarray2))
    {
      
temp.setup params[1];
      
Npc_Chat_Window1.setText(temp.setup[0]);
      if (
params[2] == 0)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[7]);
      }
      if (
params[2] == 1)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[8]);
      }
      if (
params[2] == 2)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[9]);
      }
      if (
params[2] == 3)
      {
        
Npc_Chat_MultiLine1.setText(temp.setup[10]);
      }
      
Npc_Chat_ItemList.clearrows();
      
temp.img temp.setup[6];
      
Npc_Chat_Image1.image temp.img;
      
this.replyarray2 false;
      
this.replyarray false;
      
this.textarray false;
    }
  }

}
function 
onReadAgain()
{
  
triggerServer("weapon"this.name"getText"this.mynpcidthis.textarray);
}
public function 
OpenWindowdata ){
  
this.mynpcid temp.data;
  if (
Npc_Chat_Text1 != NULL)
  {
    
Npc_Chat_Window1.destroy();
  }
  
this.textarray false;
  
triggerServer("weapon"this.name"getText"this.mynpcidthis.textarray);
  new 
GuiWindowCtrl("Npc_Chat_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "211,231";
    
useOwnProfile true;
    
profile.bitmap "guiarm_window.png";
    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Loading...";
    
309;
    
88;
    
    new 
GuiScrollCtrl("Npc_Chat_MultiLine1_Scroll") {
       
profile GuiBlueScrollProfile;
       
useOwnProfile true
       
profile.bitmap "guiarm_scroll.png"
       
height 130;
       
hscrollbar "dynamic";
       
vscrollbar "dynamic";
       
width 150;
       
46;
       
//y = 143;

       
new GuiMLTextCtrl("Npc_Chat_MultiLine1") {
         
profile GuiBlueMLTextProfile;
         
height 130;
         
//horizsizing = "width";
         
text "Loading...";
         
width 150;
       }
    }
    new 
GuiScrollCtrl"Npc_Chat_Scroll" ) {
      
this.width 176;
      
this.height 75;
      
profile.bitmap "guiarm_scroll.png";
      
this.19;
      
this.143;

      
this.hScrollBar "alwaysOff";
      
this.vScrollBar "dynamic";

      new 
GuiTextListCtrl"Npc_Chat_ItemList" ) {
        
profile.bitmap "guiarm_window.png";
        
this.width 25;
        
this.height 33;
      }
    }
    new 
GuiShowImgCtrl("Npc_Chat_Image1") {
      
9;
      
partx 0;
      
party 60;
      
partw 50;
      
parth 36;
      
width 150;
      
height 150;
      
image "block.png";
    }
  }
}
function 
Npc_Chat_ItemList.onDblClick(entryid,entrytext,entryindex) {
  if (
entryid == 0)
  {
    if (
entrytext != "")
    {
      
triggerServer("weapon"this.name"getReply"entryidthis.mynpcidthis.replyarraythis.replyarray2);
    }
  }
  if (
entryid == 1)
  {
    if (
entrytext != "")
    {
      
triggerServer("weapon"this.name"getReply"entryidthis.mynpcidthis.replyarraythis.replyarray2);
    }
  }
  if (
entryid == 2)
  {
    if (
entrytext != "")
    {
      
triggerServer("weapon"this.name"getReply"entryidthis.mynpcidthis.replyarraythis.replyarray2);
    }
  }
  if (
entryid == 3)
  {
    if (
entrytext != "")
    {
      
triggerServer("weapon"this.name"getReply"entryidthis.mynpcidthis.replyarraythis.replyarray2);
    }
  }

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...



Last edited by sssssssssss; 12-13-2009 at 06:49 PM..
Reply With Quote