AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Making a menu [noob one] (https://forums.alliedmods.net/showthread.php?t=173550)

Misery 12-07-2011 01:54

Making a menu [noob one]
 
Hi,

I have a rather noob question.
For my defense I'm not very used to pawn.

2 questions for you...

1- How do I put a colors in show_menu()? Are there esc sequences for red, green, blue, etc etc...
2- What are those \y and \R sequences I see? Also whats ^n? Replaces the C89's newlines \n?

That's rather idiot question, and it's true I could find it myself but... I'm trying to save time here.

Thanks!

Misery

quark 12-07-2011 02:35

Re: Making a menu [noob one]
 
The colors in Menu are /y yellow, /r red and /w white,
^n yes, is new line.

fysiks 12-07-2011 02:45

Re: Making a menu [noob one]
 
^ is the standard escape character in Pawn (or at least for our compiler).


Quote:

Originally Posted by quark (Post 1608970)
The colors in Menu are /y yellow, /r red and /w white,
^n yes, is new line.

For clarification, you need to use backslashes and not forward slashes.

\R (not the case) is for right alignment (which is approximately in the middle of your screen.

kotinha 12-07-2011 05:33

Re: Making a menu [noob one]
 
Emp` has a good tutorial about menus: http://forums.alliedmods.net/showthread.php?t=46364

It explains almost everything :P

Misery 12-07-2011 12:35

Re: Making a menu [noob one]
 
Thanks alot guys, those thing were not obvious to me!

Also, could some1 explain me this line
Code:

register_menucmd( register_menuid("\yOptions:"), 1023, "menu_cmd" )
1-What does the register_menuid() do? Does it generate a unique id based on the menu's title?
2-Also, is "menu_cmd" the function which shows the menu?

Thanks!

Misery

fysiks 12-07-2011 20:32

Re: Making a menu [noob one]
 
Quote:

Originally Posted by Misery (Post 1609243)
Thanks alot guys, those thing were not obvious to me!

Also, could some1 explain me this line
Code:

register_menucmd( register_menuid("\yOptions:"), 1023, "menu_cmd" )
1-What does the register_menuid() do? Does it generate a unique id based on the menu's title?
2-Also, is "menu_cmd" the function which shows the menu?

Thanks!

Misery

1. I've never quite understood the purpose because the result of that function is never used IIRC. The string you use there is what you use in show_menu() to uniquely identify the menu.

2. menu_cmd is the function that is called when an option is chosen for the menu corresponding to the register_menuid(...). Look at how other plugins use that menu system.

But, remember that that code you posted is an entirely different menu system than the one posted above (the thread by Emp'). Unless you have a specific reason for the menu style you posted above I would recommend the one in the link.

Misery 12-08-2011 13:47

Re: Making a menu [noob one]
 
So basically...
register_menuid() is useless?
Let's sayd I had two menus with the same string... it will generate the same menuid for the twos? Not very secure?

fysiks 12-08-2011 16:15

Re: Making a menu [noob one]
 
Quote:

Originally Posted by Misery (Post 1609850)
So basically...
register_menuid() is useless?
Let's sayd I had two menus with the same string... it will generate the same menuid for the twos? Not very secure?

It's not useless, maybe poorly implemented. You would think it would work like pointers but it doesn't. Don't expect it to change as the development is basically dead for AMX Mod X.

Misery 12-09-2011 21:01

Re: Making a menu [noob one]
 
Quote:

Originally Posted by fysiks (Post 1609440)
1. I've never quite understood the purpose because the result of that function is never used IIRC. The string you use there is what you use in show_menu() to uniquely identify the menu.

Is there any other method to achieve the same result?
Because frankly, register_menuid() is a piece of shit.

fysiks 12-09-2011 23:20

Re: Making a menu [noob one]
 
Quote:

Originally Posted by Misery (Post 1610568)
Is there any other method to achieve the same result?
Because frankly, register_menuid() is a piece of shit.

Did you happen to read Post #4? Doesn't seem like it.


All times are GMT -4. The time now is 11:56.

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