Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-08-2011, 08:46 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
Chest class

So I made my own custom chest and I think its pretty good (for my abilities at least). I'm curious as to how I can improve it or if anyone sees anything wrong with it.

Thank you

PHP Code:
function onActionTakeItem() {
  
player.addweapon(params[0]);
  
serverr.chestitems.remove(params[0]);
  
player.chat "Received " params[0] @ "!";
}

function 
onActionAddItem() {
  
player.removeweapon(params[0]);
  
serverr.chestitems.add(params[0]);
  
player.chat "Added " params[0] @ "!";
}

function 
onActionAddItemList() {
  
serverr.chestitems = {"Public/pig132/Strafe""Personal/pig132/Boots"};
}


//#CLIENTSIDE
function onCreated() {  
  
//triggeraction(this.x + 1, this.y + 1, "AddItemList");
  
  
new GuiWindowCtrl("Chest_Main") {
    
profile GuiBlueWindowProfile;
    
    
visible false;
    
    
player.x;
    
player.y;
    
    
width 200;
    
height 200;
    
    
canmaximize canminimize canresize canclose false;
    
destroyonhide false;
    
    
text "Chest";
    
  new 
GuiScrollCtrl("Chest_Scroll") {
    
profile GuiBlueScrollProfile;
    
    
10;
    
30;
    
    
width 130;
    
height 160;
    
    
hScrollBar "dynamic";
    
vScrollBar "alwaysOff";
    
  new 
GuiTextListCtrl("Chest_List") {
    
profile GuiBlueTextListProfile;
    
    
0;
    
width 130;
    
fitparentwidth true;
    
    
clearrows();
    
addrow(0serverr.chestitems[0]);
    
addrow(1serverr.chestitems[1]);
    
setSelectedRow(0);
  }
  }
  
  new 
GuiButtonCtrl("Button_Take") {
    
profile GuiBlueButtonProfile;
    
    
145;
    
30;
    
width 40;
    
height 25;
    
text "Take";
  }
  
  new 
GuiButtonCtrl("Button_Add") {
    
profile GuiBlueButtonProfile;
    
    
145;
    
60;
    
width 40;
    
height 25;
    
text "Add";
  }
  
  new 
GuiButtonCtrl("Button_Close") {
    
profile GuiBlueButtonProfile;
    
    
145;
    
165;
    
width 40;
    
height 25;
    
text "Close";
  }
  }
// main window (200 x 200)
}

function 
onPlayerTouchsme() {
  
Chest_Main.show();
}

function 
Button_Close.onAction() {
  
Chest_Main.hide();
}

function 
Button_Take.onAction() {
  
this.item Chest_List.getselectedtext();
  
this.ritem Chest_List.getselectedid();
  
triggeraction(this.1this.1"TakeItem"this.item);
  
Chest_List.removerowbyid(this.ritem);
}

function 
Button_Add.onAction() {
  
this.additem player.weapon.name;
  
triggeraction(this.1this.1"AddItem"this.additem);
  
Chest_List.addrow(rowcount 1this.additem);

Reply With Quote
 


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 08:42 PM.


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