Raised This Month: $ Target: $400
 0% 

Menu description


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 03-20-2006 , 14:43   Menu description
Reply With Quote #1

How would you make a little sub-descriptive menu? You know how you see the item and the cost of the item on war3, that's what I'm trying to do.

Example:
Code:
[War3] Shopmenu:                $ Cost:
1. Item 1                       500$
Edit: Also notice how the $ Cost section is a different color. Is what I am describing only for Counter-Strike?
NewUser is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-20-2006 , 15:32  
Reply With Quote #2

Just do:
Code:
nLen = format(szMenuBody , 255 , "[Buy Menu]\R Cost"); nLen += format(szMenuBody , (255 - nLen) , "1. Something\R $%d" , get_cvar_num("blah_cost"));
I'm not sure if you're familiar with that style of menus but that's just an example.

\R makes it align it to the right.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
organizedKaoS
Senior Member
Join Date: Feb 2006
Old 03-20-2006 , 15:32  
Reply With Quote #3

If I remember correctly, it would go on the formatted line. Since you have to format the lines of your menu, you would add the cost of the item displayed on that line as well.

EDIT: v3x beat me to it
organizedKaoS is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 03-20-2006 , 16:08  
Reply With Quote #4

Thanks. Just out of curiosity, would this work as well?

Code:
new menu[256]; new key (1<<0|2<<0) new len = format(menu,sizeof(menu), "Menu: /R Cost:^n") add(menu,sizeof(menu), "^n1. Item 1 /R $%d", get_cvar_num("item1_cost"))

Also, is [new len = format(menu,sizeof(menu), "Menu: /R Cost:^n")] required? Would it still work if I just used format alone without the new statement?
NewUser is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-20-2006 , 16:10  
Reply With Quote #5

Your way should be fine.

Btw it's \R not /R
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 03-20-2006 , 16:10  
Reply With Quote #6

No, the menu keys are a problem:

Quote:
Menu Key Defines:

/* Menu keys */
#define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1)
#define MENU_KEY_3 (1<<2)
#define MENU_KEY_4 (1<<3)
#define MENU_KEY_5 (1<<4)
#define MENU_KEY_6 (1<<5)
#define MENU_KEY_7 (1<<6)
#define MENU_KEY_8 (1<<7)
#define MENU_KEY_9 (1<<8)
#define MENU_KEY_0 (1<<9)
Err.. at least, I think they are.
capndurk is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 03-20-2006 , 16:18  
Reply With Quote #7

Quote:
Originally Posted by capndurk
No, the menu keys are a problem:

Quote:
Menu Key Defines:

/* Menu keys */
#define MENU_KEY_1 (1<<0)
#define MENU_KEY_2 (1<<1)
#define MENU_KEY_3 (1<<2)
#define MENU_KEY_4 (1<<3)
#define MENU_KEY_5 (1<<4)
#define MENU_KEY_6 (1<<5)
#define MENU_KEY_7 (1<<6)
#define MENU_KEY_8 (1<<7)
#define MENU_KEY_9 (1<<
#define MENU_KEY_0 (1<<9)
Err.. at least, I think they are.
That's the old fashion way. You can have as many menus as you want without using MENU_KEY_#.

Just use;
Quote:
new key (1<<0|2<<0|3<<0|4<<0|5<<0|6<<0|7<<0|8<<0|9<<0|0<<0 )
within the menu 'show' function.

Each #<<0 is counted as which key the user pushes.

Like it states above...
"#define MENU_KEY_1 (1<<0)"

It's the same concept as using what I've shown above.
NewUser is offline
capndurk
Senior Member
Join Date: Feb 2006
Old 03-20-2006 , 16:20  
Reply With Quote #8

Oh okay, thanks
capndurk is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 03-20-2006 , 16:29  
Reply With Quote #9

Wait. My mistake. They don't all end with zeros.

(1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<8 ) etc.

1<<0 is the last key. Mostly used for the exit key.
NewUser is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 03-20-2006 , 16:57  
Reply With Quote #10

@ v3x: I guess it only works for counter-strike?

NewUser is offline
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 -4. The time now is 16:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode