Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 04-12-2007, 04:21 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
You don't actually have anything in that scroll control. If you wanted to add a control to it, you would do
PHP Code:
new GuiScrollCtrl("blah")
{
  
//vars
  
  
new GuiTextCtrl("blah2")
  {
    
//vars
  
}

Currently you just have a control over it.

Why not add a way to easily add items to be sold? Make an inventory system? So far it's just an empty gui control.
Reply With Quote
  #3  
Old 04-12-2007, 04:34 PM
shadowjones shadowjones is offline
**** Scripter xD
Join Date: Apr 2007
Posts: 24
shadowjones is on a distinguished road
you should put this on your examples for GUI controls. Its a super simple script to just read and understand (of course add some //Purpose, after each line
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 05:50 AM.


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