Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-12-2007, 10:45 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Shop Menu

Heyo guys, I had never really scripted anything using Gui Controls before, so I decided to try something tonight.

Had a bit of help from Twinny, on the "button.onAction()" functions.

Anyway, here's a basic menu class that is brought up once you enter the level containing the class (preferably a shop ). I left the some space inbetween the buttons and chat. You can put your icons or whatever there, or even rearrange it. Just so you have something to start you off/help you out!

Class:
PHP Code:
//#CLIENTSIDE
function onPlayerEnters() {

  new 
GuiWindowCtrl(Stan_Window) {
    
profile "GuiBlueWindowProfile";
    
extent "300 300";
    
50;
    
50;
    
text "Shop Window";
    
visible true;
    
canResize false;

    new 
GuiScrollCtrl(Stan_Window_Scroll) {
      
profile "GuiBlueScrollProfile";
      
extent "250 100";
      
Stan_Window.width 275;
      
Stan_Window.height 110;
      
visible true;
      
hscrollbar "alwaysOff";
      
vscrollbar "dynamic";
    }

    new 
GuiButtonCtrl(Stan_Window_Buy) {
      
profile "GuiBlueButtonProfile";
      
extent "97 25";
      
position "5 23";
      
text "Buy";
    }

    new 
GuiButtonCtrl(Stan_Window_Sell) {
      
profile "GuiBlueButtonProfile";
      
extent "98 25";
      
position "101 23";
      
text "Sell";
    }

    new 
GuiButtonCtrl(Stan_Window_Leave) {
      
profile "GuiBlueButtonProfile";
      
extent "97 25";
      
position "198 23";
      
text "Leave";
    }

    new 
GuiMLTextCtrl(Stan_WindowText) {
      
profile "GuiBlueMLTextProfile";
      
Stan_Window.width 265;
      
Stan_Window.height 100;
      
text "Welcome to my store!";
    }
  }
}

function 
Stan_Window_Buy.onAction()
Stan_WindowText.setText("What would you like to buy?");

function 
Stan_Window_Sell.onAction()
Stan_WindowText.setText("What would you like to sell?");

function 
Stan_Window_Leave.onAction()
Stan_WindowText.setText("Leaving so soon? Come back again!"); 
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
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:40 AM.


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