View Single Post
  #19  
Old 09-03-2011, 11:23 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I think it would be better if I post the script I currently have and work around that.
PHP Code:
function onActionServerSide() {
  if (
params[0] == "addclass") {
    
clientr.class = params[1]; //Adds the player flag
  
}
}

//#CLIENTSIDE
function onCreated() {
  if (
clientr.class == NULL) { //To prevent multi-class choosing
    
new GuiWindowCtrl("Class_Window1") {
      
profile = GuiBlueWindowProfile;
      
clientrelative = true;
      
clientextent = "320,240";
      
canclose = false;
      
canmaximize = false;
      
canminimize = false;
      
canmove = true;
      
canresize = false;
      
closequery = false;
      
destroyonhide = true;
      
text = "Choose your class!";
      
x = 517;
      
y = 203;
      
profile.fontstyle = "b";

      new 
GuiScrollCtrl("Class_MultiLine1_Scroll") {
        
profile = GuiBlueScrollProfile;
        
height = 60;
        
hscrollbar = "dynamic";
        
vscrollbar = "dynamic";
        
visible = true;
        
width = 316;
        
hscrollbar = "alwaysOff";
        
x = 2;
        
y = 2;

        new 
GuiMLTextCtrl("Class_MultiLine1") {
          
profile = GuiBlueMLTextProfile;
          
height = 51;
          
horizsizing = "width";
          
plaintext = "<center> Please choose the class below you wish to take on an epic journey and become the greatest warrior in the game! Choose wisely! You can't change it!";
          
text = "<center> Please choose the class below you wish to take on an epic journey and become the greatest warrior in the game! Choose wisely! You can\'t change it!";
          
width = 291;
        }
      }
      new 
GuiScrollCtrl("Class_TextList1_Scroll") {
        
profile = GuiBlueScrollProfile;
        
height = 138;
        
hscrollbar = "alwaysOff";
        
vscrollbar = "dynamic";
        
width = 316;
        
x = 2;
        
y = 65;
        
visible = true;

        new 
GuiTextListCtrl("Class_TextList1") {
          
profile = GuiBlueTextListProfile;
          
height = 34;
          
horizsizing = "width";
          
sortcolumn = 134406400;
          
sortmode = "value";
          
width = 312;
          
updateclasseslist();
          
profile.fontsize = 15;
          
seticonsize(1, 23);
          
profile.fontstyle = "b";
          
profile.textshadow = true;
        }
      }
      new 
GuiButtonCtrl("Class_Button1") {
        
profile = GuiBlueButtonProfile;
        
text = "Choose";
        
width = 314;
        
x = 3;
        
y = 206;
      }
    }
  }
}

function 
Class_Button1.onAction() {
  
triggerserver("gui", this.name, "addclass", Class_TextList1.selected.text);
  
Class_Window1.destroy();
}

function 
UpdateClassesList() {
  
clearrows();
  
addrow(0, "Archer");
  
addrow(1, "Wizard");
  
addrow(2, "Knight");
  
addrow(3, "Alchemist");
  
addrow(4, "Dark Mage");
  
addrow(5, "Light Mage");
  
addrow(6, "Elf");
  
addrow(7, "Necroshade");
  
addrow(8, "Paladin");
  
addrow(9, "Troll");
  
addrow(10, "Human");
  if (
clientr.isStaff) { //Special classes.
    
addrow(11, "God");
    
addrow(12, "Destroyer");
    
addrow(13, "Summoner");
  }
} 
As you can see I am using a function to add the rows to the TextList Control. I was wondering how I could include the usage of variables in the function called UpdateClassList();

I was actually hoping to achieve something like this...
PHP Code:
// Snippet taken from crow's "Very awesome staff panel"
this.classStats = { 
    { 
"Class1", "Desc1" }, 
    { 
"Class2", "Desc2" } 
  }; 
} 
(This snippet was taken from Crows "Very awesome staff panel")
and then I could change the description and name of the classes easily at the top of the script. Can this be done?
__________________
Reply With Quote