Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-16-2006, 11:42 AM
Giltwist2k1 Giltwist2k1 is offline
Registered User
Giltwist2k1's Avatar
Join Date: Jun 2002
Posts: 13
Giltwist2k1 is on a distinguished road
Send a message via ICQ to Giltwist2k1 Send a message via AIM to Giltwist2k1 Send a message via Yahoo to Giltwist2k1
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;


Last edited by Skyld; 07-16-2006 at 02:15 PM.. Reason: Added PHP tags instead of CODE :)
Reply With Quote
  #2  
Old 07-16-2006, 01:43 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Use the [PHP] tag for scripts. Makes it much more legible.
Reply With Quote
  #3  
Old 07-16-2006, 11:10 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Cool simple and such but cool ;P
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 07-16-2006, 11:28 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
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.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #5  
Old 07-17-2006, 03:14 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
formatting
Reply With Quote
  #6  
Old 07-17-2006, 10:10 PM
Giltwist2k1 Giltwist2k1 is offline
Registered User
Giltwist2k1's Avatar
Join Date: Jun 2002
Posts: 13
Giltwist2k1 is on a distinguished road
Send a message via ICQ to Giltwist2k1 Send a message via AIM to Giltwist2k1 Send a message via Yahoo to Giltwist2k1
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
Reply With Quote
  #7  
Old 07-21-2006, 03:23 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
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.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #8  
Old 07-21-2006, 04:20 AM
Giltwist2k1 Giltwist2k1 is offline
Registered User
Giltwist2k1's Avatar
Join Date: Jun 2002
Posts: 13
Giltwist2k1 is on a distinguished road
Send a message via ICQ to Giltwist2k1 Send a message via AIM to Giltwist2k1 Send a message via Yahoo to Giltwist2k1
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?
Reply With Quote
Reply


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 12:11 AM.


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