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 10-31-2002, 02:48 PM
Era_Admin1 Era_Admin1 is offline
Registered User
Join Date: Oct 2002
Location: Melbourne, Victoria, Australia
Posts: 23
Era_Admin1 is on a distinguished road
Send a message via ICQ to Era_Admin1 Send a message via AIM to Era_Admin1
Auto Menu Class

Here's a little menu class I made a long time ago...it's useful in those cases where you just "can't be bothered". The instructions are commented inside the code.
NPC Code:

/* Strings, Variables and Arrays needed to be set: *
* - #v this.maxIndex: The lowest index so the images in this class don't overtake *
* the images from the calling npc. *
* - #s this.style: The style of the text. e.g. b - bold, c - centre etc... *
* - #sA this.menuOptions: String array of what you want the player to select from *
* - #v this.menux: x pos of menu items *
* - #v this.menuy: y pos of menu items *
* - *boolean* this.menuOpen: So this class knows when to show the menu items. *
* *
* To detect if a player has clicked on a menu item add this to the calling npc: *
* if (strequals(#s(this.select),ITEMNAME)) { <dostuff> } *
* Be sure to tell this class that afterwards no item is selected: *
* setstring this.select,; *
* Add that after the last command in the menu click detection. */
//#CLIENTSIDE
if (created) timeout = 0.05;
if (timeout) {
if (this.menuOpen == true) {
for (i=0;i<sarraylen(this.menuOptions);i++) {
showimg this.maxIndex-i,@verdana@/*delph*/#s(this.style)@#I(this.menuOptions,i),this.menux,t his.menuy + (i*15);
changeimgzoom this.maxIndex-i,0.7;
changeimgvis this.maxIndex-i,4;
if (this.maxLen < strlen(#I(this.menuOptions,i))) this.maxLen = strlen(#I(this.menuOptions,i));
if (mousescreenx in |this.menux,this.menux + this.maxLen*7| &&
mousescreeny in |this.menuy + (i*15),this.menuy + (i*15) + 15|) {
if (mousebuttons == 1 && this.mouseDown == false) {
setstring this.select,#I(this.menuOptions,i);
}
changeimgcolors this.maxIndex-i,1,1,0,1;
} else changeimgcolors this.maxIndex-i,1,1,1,1;
}
if (mousebuttons == 1) this.mouseDown = true;
else this.mouseDown = false;
} else for (i=0;i<sarraylen(this.menuOptions);i++) hideimg this.maxIndex-i;
timeout = 0.05;
}

__________________
Reply With Quote
  #2  
Old 11-01-2002, 12:48 AM
sage_chaozu sage_chaozu is offline
Registered User
sage_chaozu's Avatar
Join Date: Feb 2002
Location: Florida, USA
Posts: 143
sage_chaozu will become famous soon enough
Send a message via ICQ to sage_chaozu Send a message via AIM to sage_chaozu Send a message via MSN to sage_chaozu Send a message via Yahoo to sage_chaozu
Talking Hey I used that

I used that on Era for the *secret project name*.. lol

Maybe a part for text not selectable would be good to add.
Reply With Quote
  #3  
Old 11-01-2002, 02:18 AM
Psycho_Goldfish42 Psycho_Goldfish42 is offline
Registered User
Join Date: Sep 2002
Posts: 24
Psycho_Goldfish42 is on a distinguished road
testing it

If only I "could be bothered" to see what it does...
Reply With Quote
  #4  
Old 11-01-2002, 11:38 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Re: Auto Menu Class

Quote:
Originally posted by Era_Admin1
NPC Code:

/* Strings
*
* - #s this.style
* - #sA this.menuOptionsthis.maxIndex-i,1,1,1,1;

I think there are no this. strings clientside. I guess local. strings would be the best in this situation.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #5  
Old 11-02-2002, 06:46 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
Re: Re: Auto Menu Class

Quote:
Originally posted by Com013

I think there are no this. strings clientside. I guess local. strings would be the best in this situation.

God i hope you are j/king.
Reply With Quote
  #6  
Old 11-02-2002, 10:19 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Re: Re: Re: Auto Menu Class

Quote:
Originally posted by R0bin



God i hope you are j/king.
No, I'm not joking. I just don't know whether what I wrote is correct. As far as I know this. strings are clientside apearing in the normal flag list, so every NPC can access them.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
  #7  
Old 11-02-2002, 10:33 PM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
There are, on servers w/ npcs server.
__________________

subliminal message: 1+1=3
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 04:11 PM.


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