Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-12-2009, 07:02 AM
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
Gui Problems

Im having issues getting data from a dbnpc and putting it in gui, again. Im not sure why, but in this situation, all the values in the array in the dbnpc are showing up in the main window text on the gui. It should be splitting it up. Worked for a while, until I added some stuff in.

PHP Code:
function onCreated()
{
  
this.db findnpc("NpcChat");
}
function 
onActionServerSide(){
  if (
params[0] == "getText"){
    
triggerClient("weapon"this.name"getText"this.db.info);
  }

}
//#CLIENTSIDE
function onActionClientSide(){
  if (
params[0] == "getText"){
    
temp.setup params[1];
    
NpcChat_Window1.setText(temp.setup[0]);
    
NpcChat_Text1.setText(temp.setup[1]);
    
//temp.list = "";
    //temp.data = {params[1][2], params[1][3], params[1][4], params[1][5]};
    //for (temp.line: temp.data) {
    //  temp.list @= temp.line @ "\n";
    //}
    
NPC_Chat_ItemList.addrow(temp.setup[2]);
    
NPC_Chat_ItemList.addrow(temp.setup[3]);
    
NPC_Chat_ItemList.addrow(temp.setup[4]);
    
NPC_Chat_ItemList.addrow(temp.setup[5]);
    
temp.img temp.setup[6];
    
NpcChat_Image1.image temp.img;
  }

}
public function 
OpenWindowdata ){
  if (
NpcChat_Text1 != NULLNpcChat_Window1.destroy();
  
triggerServer("weapon"this.name"getText");
  new 
GuiWindowCtrl("NpcChat_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 
GuiTextCtrl("NpcChat_Text1") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "";
      
width 42;
      
76;
    }
    new 
GuiScrollCtrl("NpcChat_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
useOwnProfile true
      
profile.bitmap "guiarm_scroll.png"
      
height 75;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 176;
      
19;
      
143;

      new 
GuiMLTextCtrl("NpcChat_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 32;
        
horizsizing "width";
        
text "Loading...";
        
width 151;
      }
      new 
GuiMLTextCtrl("NpcChat_MultiLine2") {
        
profile GuiBlueMLTextProfile;
        
height 66;
        
horizsizing "width";
        
text "Loading...";
        
width 151;
      }
      new 
GuiMLTextCtrl("NpcChat_MultiLine3") {
        
profile GuiBlueMLTextProfile;
        
height 32;
        
horizsizing "width";
        
text "Loading...";
        
width 151;
      }
      new 
GuiMLTextCtrl("NpcChat_MultiLine4") {
        
profile GuiBlueMLTextProfile;
        
height 32;
        
horizsizing "width";
        
text "Loading...";
        
width 151;
      }
    }
    new 
GuiScrollCtrl"Npc_Chat_Scroll" ) {
      
this.width 250;
      
this.height 330;
      
      
this.19;
      
this.143;
      
      
this.hScrollBar "alwaysOff";
      
this.vScrollBar "dynamic";
      
      new 
GuiTextListCtrl"Npc_Chat_ItemList" ) {
        
this.width 250;
        
this.height 330;
      }
    }
    new 
GuiShowImgCtrl("NpcChat_Image1") { 
      
9
      
partx 0;
      
party 60;
      
partw 50;
      
parth 36;
      
width 150
      
height 150
      
image "block.png"
    } 
  }

and in the dbnpc NpcChat as a flag:
PHP Code:
info"Ramerd","You like girls?","YOURE ***!","I'm ***","","NO WAY!""head22.png"
Like i said, the
PHP Code:
NpcChat_Window1.setText(temp.setup[0]); 
is showing up the entire array, and shouldnt be as far as I can see. None of the other texts or lines are getting any values at all.
__________________
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...


Reply With Quote
  #2  
Old 12-12-2009, 07:14 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Show the code where you initialize the info array, it should look something like this:

PHP Code:
function onCreated() {
  
this.info = {
    
"Ramerd",
    
"You like girls?",
    
"YOURE ***!",
    
"I'm ***",
    
"",
    
"NO WAY!"
    
"head22.png"
  
};

Also you don't need to specify "weapon" in triggerclient either.

PHP Code:
function onCreated() {
  
player.triggerClient(this.name"getText"this.db.info);

Works fine too
__________________
Quote:
Reply With Quote
  #3  
Old 12-12-2009, 07:24 AM
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
I just typed it in the dbnpc flag for now, nothing initializes it yet.
__________________
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...


Reply With Quote
  #4  
Old 12-12-2009, 07:28 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by sssssssssss View Post
I just typed it in the dbnpc flag for now, nothing initializes it yet.
That's probably the source of your problem then :P Just use the code I supplied you then, it's usually a better idea to let scripts change values and variables especially when dealing with arrays.
__________________
Quote:
Reply With Quote
  #5  
Old 12-12-2009, 09:26 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quotes in a DBNPC's flag makes it think it's part of a sub-array.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:35 PM.


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