Raised This Month: $140 Target: $400
 35% 

New AMXX Menu System


Post New Thread Reply   
 
Thread Tools Display Modes
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-24-2006 , 22:04   Re: New AMXX Menu System
Reply With Quote #11

Quote:
Originally Posted by k007 View Post
hawk i saw your post and i understand but im asking this guy who thinks hes the smart ass, and he thinks he could do it and u think u need to delet the item everytime u change the cvar..i want see if he could prove u wrong!
I'm speaking out of personal experiences, and the last time I even touched it was when it was still in beta stages (half the functions, which I didn't even use anyway, were totally broken or essential things were missing).

I'm not trying to spark an argument, I just think his comment "hope this will start people to sway from the old style menus" is sort of stupid as they both have their uses.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 10-24-2006 , 22:21   Re: New AMXX Menu System
Reply With Quote #12

The new menu system has grown up, some kinks worked out. You should try using it again.
__________________
Brad is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-24-2006 , 22:22   Re: New AMXX Menu System
Reply With Quote #13

Quote:
Originally Posted by Hawk552 View Post
I'm not trying to spark an argument, I just think his comment "hope this will start people to sway from the old style menus" is sort of stupid as they both have their uses.
i now agree now that i see the faults. i however, will continue to use it though.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-24-2006 , 22:45   Re: New AMXX Menu System
Reply With Quote #14

well could u guys show me how now?
k007 is offline
Send a message via MSN to k007
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-24-2006 , 23:28   Re: New AMXX Menu System
Reply With Quote #15

Code:
new something[60]
format(something, 59, "wowz... %d", get_pcvar_num(wowz))
menu_additem(menu, something, "1", 0)
you should know that...
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
k007
BANNED
Join Date: Mar 2006
Location: bacon?
Old 10-24-2006 , 23:29   Re: New AMXX Menu System
Reply With Quote #16

ok thanks man ill try it
k007 is offline
Send a message via MSN to k007
BAILOPAN
Join Date: Jan 2004
Old 10-24-2006 , 23:52   Re: New AMXX Menu System
Reply With Quote #17

Hawk: you're being ignored because what you're saying has no relevance to the tutorial. Whatever design flaws you think it has aren't relevant to teaching how to use it.

In general, menus are static. For menus that are dynamic, they're usually short lived, which means it's appropriate to destroy them and create a new one. This was an efficiency trade-off since the data structure used to store menus is O(1) lookup but O(n) for mid-insertion/deletion.

For the sake of argument, let's consider your world where you can delete items on a menu:

1. Menu broadcasts to all players.
2. Player 1 selects something on the menu.
3. Menu handler deletes item N in response to action #2.
4. Player 2 selects an item that is now keyed to the wrong slot.
5. Menu handler passes the wrong item # and screws up internal bookkeeping in your plugin.

Solving a problem like this is expensive - you need to reshuffle the entire items pool, and then create a temporary data structure on each player which re-maps the old keys to the new ones. All of this takes memory, CPU, and man-hours to test and debug, when all you had to do was start a new menu (which is what you'd do with an old menu anyway, if you look closely).

You can't just say an API is deficient at something without understanding why certain decisions were made. As soon as you add unnecessary complexity, someone will abuse it, and then you're stuck supporting it for backwards compatibility.

You're historically mostly right about newmenus. They were introduced for www.esportsea.com a while ago with extra features (the menu system there allows menus to timeout). At the same time I wrote the system for CSDM. However I thought it had too much potential to stick around there and merged it into AMX Mod X.

Note that if you're getting hung up on the dynamicness of newmenus, you've missed their entire point. The point of newmenus is abstracting menu termination and pagination, the former which is vital to state-oriented plugins (the kind I am wont to write).
__________________
egg

Last edited by BAILOPAN; 10-24-2006 at 23:56.
BAILOPAN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-25-2006 , 15:38   Re: New AMXX Menu System
Reply With Quote #18

Quote:
Originally Posted by BAILOPAN View Post
Hawk: you're being ignored because what you're saying has no relevance to the tutorial. Whatever design flaws you think it has aren't relevant to teaching how to use it.

In general, menus are static. For menus that are dynamic, they're usually short lived, which means it's appropriate to destroy them and create a new one. This was an efficiency trade-off since the data structure used to store menus is O(1) lookup but O(n) for mid-insertion/deletion.

For the sake of argument, let's consider your world where you can delete items on a menu:

1. Menu broadcasts to all players.
2. Player 1 selects something on the menu.
3. Menu handler deletes item N in response to action #2.
4. Player 2 selects an item that is now keyed to the wrong slot.
5. Menu handler passes the wrong item # and screws up internal bookkeeping in your plugin.

Solving a problem like this is expensive - you need to reshuffle the entire items pool, and then create a temporary data structure on each player which re-maps the old keys to the new ones. All of this takes memory, CPU, and man-hours to test and debug, when all you had to do was start a new menu (which is what you'd do with an old menu anyway, if you look closely).

You can't just say an API is deficient at something without understanding why certain decisions were made. As soon as you add unnecessary complexity, someone will abuse it, and then you're stuck supporting it for backwards compatibility.

You're historically mostly right about newmenus. They were introduced for www.esportsea.com a while ago with extra features (the menu system there allows menus to timeout). At the same time I wrote the system for CSDM. However I thought it had too much potential to stick around there and merged it into AMX Mod X.

Note that if you're getting hung up on the dynamicness of newmenus, you've missed their entire point. The point of newmenus is abstracting menu termination and pagination, the former which is vital to state-oriented plugins (the kind I am wont to write).
Sorry if I came off as bashing it, what I meant is that it's just undeniably easier to use the old menu system when you need to dynamically add and remove items.

Anyway, I don't think the tutorial has anything to do with me being ignored - I was responding to k007's questions of implementation, since I think for what he's doing it would be much easier to use old style menus.

But as for the system itself, it does accomplish the paging, colors etc. with flying colors, but IMO it is very very far from being the be-all end-all.

As for the design decisions, I see what you mean, but you have to remember that I'm looking at it as someone that has never used it before (although I have) and I see that there are a number of things that are very confusing (as I said before, changing items). While the implementation may be fast, it's harder to learn. Since I'm starting to repeat myself, I'm just going to leave it at old menus being better for dynamic changes, and new menus being better for more static implementations.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Identity
Member
Join Date: Mar 2007
Old 03-14-2007 , 02:24   Re: New AMXX Menu System
Reply With Quote #19

Quote:
public menu_handler(id, menu, item)
{
//we don't want to deal with them if they exited a menu
if (item == MENU_EXIT)
{
menu_destroy(menu)
//Note that you will want to destroy the menu after they do something
return PLUGIN_HANDLED
}
Quote:
//lets finish up this function with a menu_destroy, and a return
menu_destroy(menu)
return PLUGIN_HANDLED
}
amxmodx.inc
//Destroys a menu - invalidates the handle
//This is safe, as it will go through the players and make
// sure they don't have this menu set anymore.

native menu_destroy(menu);

So this really executed after last menu_destroy called and in the example above it used correctly?
Identity is offline
Minimum
Senior Member
Join Date: Jun 2006
Old 03-17-2007 , 13:04   Re: New AMXX Menu System
Reply With Quote #20

Very nice tutorial. Helped me understand the new menu system very well. +karma and credit in my plugin for you.
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
Reply


Thread Tools
Display Modes

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 10:13.


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