killerogue
04-12-2007, 11:45 AM
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:
//#CLIENTSIDE
function onPlayerEnters() {
new GuiWindowCtrl(Stan_Window) {
profile = "GuiBlueWindowProfile";
extent = "300 300";
x = 50;
y = 50;
text = "Shop Window";
visible = true;
canResize = false;
new GuiScrollCtrl(Stan_Window_Scroll) {
profile = "GuiBlueScrollProfile";
extent = "250 100";
x = Stan_Window.width - 275;
y = 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";
x = Stan_Window.width - 265;
y = 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!");
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:
//#CLIENTSIDE
function onPlayerEnters() {
new GuiWindowCtrl(Stan_Window) {
profile = "GuiBlueWindowProfile";
extent = "300 300";
x = 50;
y = 50;
text = "Shop Window";
visible = true;
canResize = false;
new GuiScrollCtrl(Stan_Window_Scroll) {
profile = "GuiBlueScrollProfile";
extent = "250 100";
x = Stan_Window.width - 275;
y = 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";
x = Stan_Window.width - 265;
y = 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!");