View Single Post
  #1  
Old 02-23-2011, 12:38 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Post Buy System Help!

Class:
PHP Code:
//#CLIENTSIDE
function onActionLeftMouse() {
Buy_Window1.show();
  new 
GuiWindowCtrl("Buy_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "320,240";

    
canclose false;
    
canmaximize false;
    
canminimize false;
    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Buy This Item?";
    
509;
    
203;

    new 
GuiButtonCtrl("Buy_Button1") {
      
profile GuiBlueButtonProfile;
      
text "Buy Item";
      
width 80;
      
118;
      
133;
    }
    new 
GuiTextCtrl("Buy_Text1") {
      
profile GuiBlueTextProfile;
      
height 20;
      
width 8;
      
143;
      
9;
    }
    new 
GuiTextCtrl("Buy_Text2") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Would you like to buy?";
      
width 108;
      
106;
      
35;
    }
    new 
GuiTextCtrl("Buy_Text3") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text this.item;
      
width 39;
      
135;
      
51;
    }
    new 
GuiTextCtrl("Buy_Text4") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "For...";
      
width 25;
      
145;
      
66;
    }
    new 
GuiTextCtrl("Buy_Text5") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text this.price;
      
width 44;
      
132;
      
86;
    }
    new 
GuiButtonCtrl("Buy_Button2") {
      
profile GuiBlueButtonProfile;
      
text "No thank you.";
      
width 80;
      
118;
      
185;
    }
  }
  
Buy_Window2.hide();
  new 
GuiWindowCtrl("Buy_Window2") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "320,206";

    
canclose false;
    
canmaximize false;
    
canminimize false;
    
canmove true;
    
canresize true;
    
closequery false;
    
destroyonhide false;
    
text "Receipt";
    
853;
    
88;

    new 
GuiTextCtrl("Buy_Text6") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Item:";
      
width 22;
      
140;
      
24;
    }
    new 
GuiTextCtrl("Buy_Text7") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text this.item;
      
width 39;
      
131;
      
44;
    }
    new 
GuiTextCtrl("Buy_Text8") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Receipt";
      
width 36;
      
134;
    }
    new 
GuiTextCtrl("Buy_Text9") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Price:";
      
width 27;
      
135;
      
70;
    }
    new 
GuiTextCtrl("Buy_Text10") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text this.price;
      
width 44;
      
126;
      
92;
    }
    new 
GuiButtonCtrl("Buy_Button3") {
      
profile GuiBlueButtonProfile;
      
height 22;
      
text "Take My Item, I agree that I bought this item!";
      
width 320;
      
184;
    }
    new 
GuiTextCtrl("Buy_Text11") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text "Weapon Name:";
      
width 73;
      
115;
      
114;
    }
    new 
GuiTextCtrl("Buy_Text12") {
      
profile GuiBlueTextProfile;
      
height 20;
      
text this.weapon;
      
width 60;
      
122;
      
141;
    }
    
Buy_Window2.hide();
  }
}

function 
Buy_Button1.onAction() {
  
Buy_Window1.hide();
  
Buy_Window2.show();
}

function 
Buy_Button2.onAction() {
  
Buy_Window1.hide();
}

function 
Buy_Button3.onAction() {
  
Buy_Window2.hide();
  
buy2(this.weaponthis.pricethis.item);

The public function buy2
PHP Code:
public function buy2(abc)
{
temp.weapon;
temp.price;
temp.name;
player.rupees -= temp.price;
addweapon(temp.weapon);
player.chat "I bought a "@temp.name@"! For "@temp.price@"!";

The NPC
PHP Code:
join("object_buy");
//#CLIENTSIDE
function onCreated()
  {
  
this.item "Ghost";
  
this.price "2500";
  
this.weapon "Morphs/Ghost";

What I need help with?
Whenever I use the system this.item, this.price, and this.weapon ALWAYS = 0 in the actual GUI when you use it! Now I dont really know how to get that to say the NPCs variables, please help!
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!


Reply With Quote