Raised This Month: $ Target: $400
 0% 

Making a menu [noob one]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Misery
Senior Member
Join Date: Dec 2010
Old 12-07-2011 , 01:54   Making a menu [noob one]
Reply With Quote #1

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
Misery is offline
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 12-07-2011 , 02:35   Re: Making a menu [noob one]
Reply With Quote #2

The colors in Menu are /y yellow, /r red and /w white,
^n yes, is new line.
__________________

Check out My Plugins:
qServerInfo ; ASKTAG

Last edited by quark; 12-07-2011 at 02:39.
quark is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-07-2011 , 02:45   Re: Making a menu [noob one]
Reply With Quote #3

^ is the standard escape character in Pawn (or at least for our compiler).


Quote:
Originally Posted by quark View Post
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.
__________________
fysiks is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 12-07-2011 , 05:33   Re: Making a menu [noob one]
Reply With Quote #4

Emp` has a good tutorial about menus: http://forums.alliedmods.net/showthread.php?t=46364

It explains almost everything
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
Misery
Senior Member
Join Date: Dec 2010
Old 12-07-2011 , 12:35   Re: Making a menu [noob one]
Reply With Quote #5

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
Misery is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-07-2011 , 20:32   Re: Making a menu [noob one]
Reply With Quote #6

Quote:
Originally Posted by Misery View Post
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.
__________________

Last edited by fysiks; 12-07-2011 at 20:33.
fysiks 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 11:56.


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