Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gift Script: GS2 GUI Tailor (https://forums.graalonline.com/forums/showthread.php?t=67387)

Giltwist2k1 07-16-2006 11:42 AM

Gift Script: GS2 GUI Tailor
 
I'm sick to death of going on servers that have "/setcoat black" or whatnot. Here's a no-frills GUI that impliments all the basic functions of a tailor without the need for tedius chat-commands. Feel free to use and edit at your will. Also available on Graal.net

PHP Code:

//Created by Giltwist
//#CLIENTSIDE
function onweaponfired(){
showtailor();
}
function 
showtailor(){
if (!
tailormenu.active)
{
settimer(1);
new 
GuiWindowCtrl("tailormenu")  
   {    
    
width 325;   
    
height 156;

    
client.tailorx;    
    
client.tailory;  

    
canMove true;      
    
canResize false;   
    
canMaximize false;
    
canClose false;
    
canMinimize false;
    
tile true;
    
text "Outfit";  
    
visible true;
// Color Attributes    
parts={"Skin","Shoes","Sleeves","Coat","Belt"};
for (
m=0;m<5;m++){

new 
GuiMLTextCtrl("text" parts[m]){
    
width 60;   
    
height 25;
allowcolorchars=true;
parsetags=true;
    
10;    
    
27+25*m;  
    
text "<font size=20 color='black'>" parts[m] @ ":</font>"
  }
  
new 
GuiPopUpMenuCtrl("tailor" parts[m]){
width=70;
height=25;
x=75;
y=25+25*m;

addcolors();
canMove false;     
    
canResize false;   
    
canMaximize false;
    
canClose false;
    
canMinimize false;
    
tile true;
    
visible true;
    
    
thiso.catchevent(this,"onSelect","updatecolor");
}
}
//Body

new GuiMLTextCtrl("bodytext"){
    
width 50;   
    
height 25;
allowcolorchars=true;
parsetags=true;
    
160;    
    
27;  
    
text "<font size=20 color='black'>Body:</font>"
  }
  
new 
GuiTextEditCtrl("tailorbody")
{
width=100;
height=25;
x215;
y25;
canMove false;      
    
canResize false;   
    
canMaximize false;
    
canClose false;
    
canMinimize false;
    
tile true;
    
visible true;
text=player.bodyimg;

}
//Head

new GuiMLTextCtrl("headtext"){
    
width 50;   
    
height 25;
allowcolorchars=true;
parsetags=true;
    
160;    
    
52;  
    
text "<font size=20 color='black'>Head:</font>"
  }
  
new 
GuiTextEditCtrl("tailorhead")
{
width=100;
height=25;
x215;
y50;
canMove false;      
    
canResize false;   
    
canMaximize false;
    
canClose false;
    
canMinimize false;
    
tile true;
    
visible true;
text=player.headimg;

}
//Sword

new GuiMLTextCtrl("swordtext"){
    
width 50;   
    
height 25;
allowcolorchars=true;
parsetags=true;
    
160;    
    
77;  
    
text "<font size=20 color='black'>Sword:</font>"
  }
  
new 
GuiTextEditCtrl("tailorsword")
{
width=100;
height=25;
x215;
y75;
canMove false;      
    
canResize false;   
    
canMaximize false;
    
canClose false;
    
canMinimize false;
    
tile true;
    
visible true;
text=player.swordimg;

}
//shield

new GuiMLTextCtrl("shieldtext"){
    
width 50;   
    
height 25;
allowcolorchars=true;
parsetags=true;
    
160;    
    
102;  
    
text "<font size=20 color='black'>Body:</font>"
  }
  
new 
GuiTextEditCtrl("tailorshield")
{
width=100;
height=25;
x215;
y100;
canMove false;      
    
canResize false;   
    
canMaximize false;
    
canClose false;
    
canMinimize false;
    
tile true;
    
visible true;
text=player.shieldimg;

}

}
GraalControl.makefirstresponder(true);
}
else
{
client.tailorx=tailormenu.x;
client.tailory=tailormenu.y;
tailormenu.destroy();
}
}

function 
addcolors(){
this.colors={"white","yellow","orange","pink","red","darkred","lightgreen","green","darkgreen","lightblue","blue","darkblue","brown","cynober","purple","darkpurple","lightgray","gray","black","transparent"};
for (
this.i=0;this.i<this.colors.size();this.i++){
(
"tailor" parts[m]).addrow(this.ithis.colors[this.i]);
(
"tailor" parts[m]).text=this.colors[player.colors[m]];
}
}

function 
updatecolor(temp.part,temp.colnum)
{
player.colors[parts.index(temp.part.substring(6))]=temp.colnum;
}

function 
tailorbody.onAction(temp.body){
player.bodyimg=temp.body;
settimer(.1);
GraalControl.makefirstresponder(true);
}
function 
tailorhead.onAction(temp.body){
player.headimg=temp.body;
settimer(.1);
GraalControl.makefirstresponder(true);
}
function 
tailorsword.onAction(temp.body){
player.swordimg=temp.body;
settimer(.1);
GraalControl.makefirstresponder(true);
}
function 
tailorshield.onAction(temp.body){
player.shieldimg=temp.body;
settimer(.1);
GraalControl.makefirstresponder(true);
}

//File not found check
function ontimeout(){
tailorbody.text=player.bodyimg;
tailorhead.text=player.headimg;
tailorsword.text=player.swordimg;
tailorshield.text=player.shieldimg;



Novo 07-16-2006 01:43 PM

Use the [PHP] tag for scripts. :) Makes it much more legible.

Angel_Light 07-16-2006 11:10 PM

Cool ^^ simple and such but cool ;P

ForgottenLegacy 07-16-2006 11:28 PM

Oh, wow, what awesome timing. I am working on adding a TON to my TGConsole script, and it looks as if it'll be 2000 lines by the end of the updates.

One of the new things I am adding is a fully-functioning tailor that allows the saving and loading of outfits.
...I should also make a way to delete outfits o_O...

Either way, since it's for my TGConsole, I'm not sure I'm going to release it, but I might just release it anyway.

Python523 07-17-2006 03:14 AM

formatting :(

Giltwist2k1 07-17-2006 10:10 PM

Quote:

One of the new things I am adding is a fully-functioning tailor that allows the saving and loading of outfits.
...I should also make a way to delete outfits o_O...
Yeah, I plan on putting that in mine as well, and it shouldn't be too hard, what with multidimensional arrays. However, I'm not THAT generous

Quote:

formatting :(
God, you're as bad as Kai. At least it works and I've made it pretty effecient. I mean, yeah, there's more work to be done, but its good enough for every other server but mine ;)

ApothiX 07-21-2006 03:23 AM

Quote:

Originally Posted by Giltwist2k1
God, you're as bad as Kai. At least it works and I've made it pretty effecient. I mean, yeah, there's more work to be done, but its good enough for every other server but mine ;)

If you are releasing a script for people to learn from, it is expected that you use proper techniques within. The poor formatting shown in your script is not only extremely hard to read, but will also teach newer scripters [inadvertantly] that it is alright not to format your code.

Giltwist2k1 07-21-2006 04:20 AM

Formatting is purely a convention of uniformity. Formatting does not adversely affect the performance of a script. Honestly, indenting is not that big of a deal. I'm keeping one command to a line, I've nested if's instead of doing unusual &&'s and the like. I use descriptive variable names. Heck, I even throw in line breaks between unrelated blocks of code. What makes it so hard to read?


All times are GMT +2. The time now is 06:50 AM.

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