Hello everybody,
It's me Noof, and I took about a week break or so from posting sorry about that, was working on my game :=) .
I have a neat little script I put together, since I am not currently employed on a graal server, my effort was not 100% put into the design and there is one bug I know of but I can fix it another day,
How to use it!
(1). Type in "/shop" , (Pretty unique, huh? haha).
(2). Navigate to the "Hat Shop" button.
(3). Buy the hats you would like.
(4). Go to the inventory to select the hat you would like to wear.
Why did I kind of stop working on this?
Well from the start the naming conventions that I've used are complete, B L O O P , and I found it hard to go back and add more buttons because it was getting out of control, anyway here is the code below, if used please credit me other than that it is free to use. Since this is mostly GUI based their is not much real powerful type of code other than the changing player attributes and some if statements and vars .
C O D E
PHP Code:
/*
Planning algrithm.
on Player Chats,
if shop,
bring up question GUI ("what Kind of shop"),
get answer and react,
if hat was clicked, run hat shop func
if other was clicked, other func will run along with the GUI,
along with all kinds of functions and GUI's to apear with it,
might use GUI/might Not.
---NOOOOOOF*
*/
//#CLIENTSIDE
function onCreated() {
Equi1.hide();
Equi2.hide();
Equi3.hide();
//onRun(); // testing purposes DELETE
}
function Shop_Button.onMouseDown() {
Main_Shop.hide();
new GuiWindowCtrl("Hat_Shop") {
profile = GuiBlueWindowProfile;
x = 400;
y = 80;
width = 500;
height = 400;
text = "Shop V.1.0";
opacity = "no";
new GuiTextCtrl("Test_Text1") {
profile = GuiBlueTextProfile;
x = 110;
y = 25;
height = 50;
this.coins = 30000;
text = "Coins:" SPC this.coins;
}
new GuiButtonCtrl("Inv_Btn") {
profile = GuiBlueButtonProfile;
x = 10;
y = 25;
width = 100;
height = 30;
text = "Hat Inventory!";
}
new GuiBitmapButtonCtrl("Hat_1") {
x = 10;
y = 60;
width = 192;
height = 144;
normalbitmap = "Haat.png";
mouseoverbitmap = "onedollar.png";
pressedbitmap = "dollarcheck.png";
}
new GuiBitmapButtonCtrl("Hat_2") {
x = 230;
y = 60;
width = 192;
height = 144;
normalbitmap = "ski-hat.png";
mouseoverbitmap = "onedollar.png";
pressedbitmap = "dollarcheck.png";
}
new GuiBitmapButtonCtrl("Hat_3") {
x = 10;
y = 230;
width = 192;
height = 144;
normalbitmap = "hat1.png";
mouseoverbitmap = "onedollar.png";
pressedbitmap = "dollarcheck.png";
}
}
}
function onPlayerChats() {
if (player.chat == "/shop") {
Equi1.hide();
Equi2.hide();
Equi3.hide();
onRun();
}
}
function onRun() {
player.chat = "";
//NEW GUI Stuff GOES HERE
new GuiWindowCtrl("Main_Shop") {
profile = GuiBlueWindowProfile;
x = 400;
y = 80;
width = 500;
height = 100;
text = "Shop V.1.0";
opacity = "no";
new GuiButtonCtrl("Shop_Button") {
profile = GuiBlueButtonProfile;
x = 20;
y = 50;
width = 100;
height = 30;
text = "Hat Shop";
}
}
}
this.bought1 = false;
function Hat_1.onMouseDown() {
this.bought1 = true;
this.coins = 30000;
this.coins = this.coins - 1000;
Test_Text1.text = this.coins;
say2("You bought Hat 1!");
}
this.bought2 = false;
function Hat_2.onMouseDown() {
this.bought2 = true;
this.coins = 30000;
this.coins = this.coins - 1000;
Test_Text1.text = this.coins;
say2("You bought Hat 1!");
}
this.bought3 = false;
function Hat_3.onMouseDown() {
this.bought3 = true;
this.coins = 30000;
this.coins = this.coins - 1000;
Test_Text1.text = this.coins;
say2("You bought Hat 3!");
}
function Inv_Btn.onMouseDown() {
Equi1.hide();
Equi2.hide();
Equi3.hide();
Hat_Shop.hide();
Hat_Inv.show();
new GuiWindowCtrl("Hat_Inv") {
Equi1.hide();
Equi2.hide();
Equi3.hide();
profile = GuiBlueWindowProfile;
x = 400;
y = 80;
Equi1.hide();
Equi2.hide();
Equi3.hide();
width = 500;
height = 400;
text = "Inventory";
opacity = "no";
new GuiButtonCtrl("Shop_Button21") {
profile = GuiBlueButtonProfile;
x = 200;
y = 30;
width = 100;
height = 30;
text = "Shop";
}
Equi1.hide();
new GuiButtonCtrl("Equi1") {
profile = GuiBlueButtonProfile;
x = 10;
y = 25;
z = 600;
width = 100;
height = 30;
text = "Hat 1!";
}
Equi3.hide();
new GuiButtonCtrl("Equi3") {
profile = GuiBlueButtonProfile;
x = 10;
y = 90;
z = 600;
width = 100;
height = 30;
text = "Hat 3!";
}
Equi2.hide();
new GuiButtonCtrl("Equi2") {
profile = GuiBlueButtonProfile;
x = 10;
y = 50;
z = 600;
width = 100;
height = 30;
text = "Hat 2!";
}
}
if (this.bought1 == true) {
Equi1.show();
}
if (this.bought2 == true) {
Equi2.show();
}
if (this.bought3 == true) {
Equi3.show();
}
function Shop_Button21.onMouseDown() {
Hat_Inv.hide();
Hat_Shop.show();
Equi1.hide();
Equi2.hide();
Equi3.hide();
}
function Equi1.onMouseDown() {
player.attr[1] = "haat.png";
}
function Equi2.onMouseDown() {
player.attr[1] = "ski-hat.png";
}
function Equi3.onMouseDown() {
player.attr[1] = "hat1.png";
}
}
V I D E O
I M A G E S Y O U W I L L N E E D :
PdyeyzQ.png wOvW05P.png 7S9tAfM.png 3rU2XN1.png 0HvbcWC.png