AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu description (https://forums.alliedmods.net/showthread.php?t=25800)

NewUser 03-20-2006 14:43

Menu description
 
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?

v3x 03-20-2006 15:32

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.

organizedKaoS 03-20-2006 15:32

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. :lol: :lol: :lol:

EDIT: v3x beat me to it :oops:

NewUser 03-20-2006 16:08

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?

v3x 03-20-2006 16:10

Your way should be fine.

Btw it's \R not /R

capndurk 03-20-2006 16:10

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.

NewUser 03-20-2006 16:18

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<<8)
#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.

capndurk 03-20-2006 16:20

Oh okay, thanks :)

NewUser 03-20-2006 16:29

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 03-20-2006 16:57

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

http://i3.photobucket.com/albums/y82.../2fort0000.jpg


All times are GMT -4. The time now is 16:35.

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