Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-22-2004, 11:28 AM
middo middo is offline
VHE Monkey
middo's Avatar
Join Date: Aug 2002
Location: California
Posts: 327
middo is on a distinguished road
Send a message via AIM to middo
A Great Menu GUI Method

While many people won't agree with me, I found a nice way of making menus for Graal.

The menu is extremely flexible if set up right. Although there are a few aspects I could polish.

DISCLAIMER: It's late, I'm tired, don't feel like making everything 100% clear, I'll unfog later. It also might a little buggy, but this has worked before.

NPC Code:

if (created) {
setstring this.button_close,exit;
setstring this.button_next,next;
this.menux=80; //screenx of menu
this.menuy=120; //screen y of menu
this.menuwidth=300; //pixel width of menu
this.menuheight=400; //pixel height of menu
this.buttonxw=50; //pixel width of default buttons
this.buttonyh=20; //pixel height of default buttons
}

if (keypressed&&strequals(#p(1),q)&&this.menu_open != true) {
this.menu_open=true;
this.menu=1;
timeout=.05;
}


if (this.menu_open==true) {
//MENU 1
if (this.menu==1) {
setstring this.buttons,next,close; /*These will tell the show-function what buttons to show */
showimg 200,@b@This is a menu!,this.menux+20,this.menuy+10;
changeimgvis 200,5;
changeimgcolors 200,1,1,0,1;
}
if (this.menu==2) {
setstring this.buttons,close
showimg 200,@b@MENU #2 OMG!,this.menux+20,this.menuy+10;
changeimgvis 200,5;
changeimgcolors 200,1,1,0,1;
}

//button click control
for (i=0;i<strlen(this.buttons);i++) {
showimg 201+i,@b@#I(this.buttons,i),this.menux+10,this.men uy+this.menuheight-((this.buttonyh+1)*i);
changeimgvis 201,5;

if (mousescreenx in |this.menux+10,this.menux+10+this.buttonxw|&&mouse screeny in |this.menuy-((this.buttonyh+1)*i),this.menuy-((this.buttonyh+1)*i)-this.buttonyh|) {
changeimgcolors 201+i,1,0,0,1;
if (leftmousebutton) {
changeimgcolors 201+i,.2,0,0,1;
setstring this.cmd,#I(this.button_#I(this.buttons,i),1);
command(); //Calls the command for the button, should be within the
//strings declare at the start
}
}
}

function command() {
if (!strequals(#s(this.cmd),)) {
if (strequals(#s(this.cmd),exit)) {
close();
}
if (strequals(#s(this.cmd),next)) {
this.menu++;
}
}
setstrng this.cmd,;
clear();
}
timeout=.05;
}
function close() {
this.menu_open=0;
this.menu=0;
for (i=200;i=<300;i++) hideimg i;
}

function clear() {
for (i=0;i=<300;i++) hideimg i;
}



It's messy, simple, and probably not very ideal, but im tired, and it works for me, so blegh. Go knock yourselves out.
I would post the more complete version, but I'm not sure if the guys on Atrius would be mad or not.

Last edited by Loriel; 11-22-2004 at 02:43 PM..
Reply With Quote
  #2  
Old 11-22-2004, 03:18 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
i donno what to think of this one, dont get me wrong its a cute little menu if you just wanna throw something on there without getting to complex its ok , but maybe its just my personaly opinion cause my qmenu is huge haha , then again my qmenu has never been done before though either =D
__________________

Reply With Quote
  #3  
Old 11-22-2004, 10:47 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
I just mad eone yesterday, very low quality but it's custom . basically its a bunch of polygons and text, and the weapon images. And you have to press a next and back button to get to each one (or you can say a number to go to that weapon). I will make a better one later but it suits the purpose for now.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #4  
Old 11-23-2004, 03:18 AM
Andares Andares is offline
Scr1pt3r-ish
Andares's Avatar
Join Date: Mar 2004
Posts: 55
Andares is on a distinguished road
Send a message via AIM to Andares
Bleh...
I have no image.
You hold down q, the menu appears. Like GK.
You have drag-and-drop.
Can't figure out how to place the dropped item well
__________________
Quote:
<Wan> Can I have a poll? Do people mind if I talk about sexual intercourse between two human beings?
<Kai> Wan, I think the problem is that it's basically ALL you talk about
<Wan> Ahhhhhh
Aim: AtariTandy | Job: Sanstrata)
Reply With Quote
  #5  
Old 11-23-2004, 03:50 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
have it so once you drop an item get the current num of items in the qmenu and use the same equation that u used to space out the items , but add the value that returned when you droped the item in the equation of the item spacing.
__________________

Reply With Quote
  #6  
Old 11-24-2004, 10:30 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
I don't know about you, But Jenn made like a gui thing on era, It looked amazing and the code was all in the editor, It was set out perfectly :O
__________________
Reply With Quote
  #7  
Old 11-24-2004, 10:57 AM
middo middo is offline
VHE Monkey
middo's Avatar
Join Date: Aug 2002
Location: California
Posts: 327
middo is on a distinguished road
Send a message via AIM to middo
I made a really cool GUI for Atrius.
A nice Party system too.

The GUI control is pretty much what I posted there.
With some custom displays on each menu, and a forced x/y position (defined in button strings)

Also.
I had a cool little refresh system.
Every 1-2 seconds, it would request a minipacket from the NPCServer (requesting a DB NPC) and would send/recieve information based on everyones stats in your party.
So active updating of player stats in your party (shown in bottom left of screen, yet no one is in my party in that screen)
Attached Thumbnails
Click image for larger version

Name:	atrius.JPG
Views:	247
Size:	38.9 KB
ID:	30233  
Reply With Quote
  #8  
Old 11-24-2004, 04:14 PM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by middo
I made a really cool GUI for Atrius.
A nice Party system too.

The GUI control is pretty much what I posted there.
With some custom displays on each menu, and a forced x/y position (defined in button strings)

Also.
I had a cool little refresh system.
Every 1-2 seconds, it would request a minipacket from the NPCServer (requesting a DB NPC) and would send/recieve information based on everyones stats in your party.
So active updating of player stats in your party (shown in bottom left of screen, yet no one is in my party in that screen)
It looks very nice.
Reply With Quote
  #9  
Old 11-24-2004, 09:52 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally Posted by middo
Every 1-2 seconds, it would request a minipacket from the NPCServer (requesting a DB NPC) and would send/recieve information based on everyones stats in your party.
Would most likely cause a lot of server traffic if there were a lot of players on at once
Reply With Quote
  #10  
Old 11-24-2004, 11:21 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally Posted by Python523
Would most likely cause a lot of server traffic if there were a lot of players on at once
I think not since there probably would be less people in a party...
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #11  
Old 11-26-2004, 12:10 PM
middo middo is offline
VHE Monkey
middo's Avatar
Join Date: Aug 2002
Location: California
Posts: 327
middo is on a distinguished road
Send a message via AIM to middo
Jagen, now that I think back, it was once every 5 seconds.
And with a general graal max of around 100 players, it wouldnt be THAT bad.
Plus it doesnt ping if your not in a party.
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 07:49 PM.


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