ID:179378
 
There are two things I was wondering if I could do as far as right-click menus are concerned:

A] Can I make it so some menus items only show if mob.name="(my, or my op's name)", like for boot and the like? Right now it just says you can't if you click it and your not an op.

and

B] Can I make sub-items, like:

Dreq
- Melee
- Sword
- Fist
- Spells
- Flame
- Ice
- Ops
- Kick Player
- Reboot World

As this would REALLY clean up my menus in the future ^_^

Thanks!
This is a bit of a complicated way, and I'm sure theres simpler methods, but what I would do is just make sure those verbs are under your mob/admin or whateve you use for your admins, and then the normal mobs won't see it.

Not sure how far you've come along in your game, but what you'll probably want to do sooner or later is set it to flag your byond key as an admin or something. Using deadrons char handling, I just add something like

switch(src.client.key)
if ("Zagreus")
new_mob = new /mob/Owner()

if ("BobJr")
new_mob = new /mob/GM/BobJr()

at the end of the char creation stuff. then put all my verbs under mob/Owner/verb or mob/GM/verb

Edit: Actualy, I missed the entire point of your post, talking abotu SUBMMENUS sorry, doh! *slaps self on head*
Just make a new mob type for admins/GMs and give the verbs only to that type.
In response to Zakarth
That's gonna make my menus get REALLY long as I make more of my game ^_^
In response to Dreq
You can use the new HUD system, but there's no way to edit the right click menu.
In response to Nadrew
New HUD system? I must have missed that. Is there a section in the faq or a demo explaining what it is? (I know what the acronym means, don't need to explain that :p)
In response to English
Download the new BYOND beta, and download my demo http://www.byond.com/hub/nadrew/nadrewshuddemo
In response to Nadrew
I don't have the beta yet of byond. Are there any major bugs or anything with it? If there are I'd rather not update to it yet, but if there are only a few minor ones then I'll switch.
In response to Dreq
Dreq wrote:
That's gonna make my menus get REALLY long as I make more of my game ^_^

Two things to consider:

One, the right-click menu is a context menu... if you properly "type" your verbs, you'll only get verbs that are appropriate (or semi-appropriate) to the object you're clicking on/situation you're clicking in. You can have hundredsverbs, but if you're specific enough in your coding, the existing program will help pare down the choices.

There's basically two things that go into the right-click menu. One is the verbs that you, the clicker, have... the other is the verbs that the object has. If you have "fighting" verbs, for instance, they should be declared under the mob who'll be fighting, like so:

mob/verb/punch(mob/target as mob in oview(1))

This tells the client program that this should only appear in the right-click menu if the thing being clicked on is a mob, it's visible, and it's one square away from you. You won't get the punch verb if you're clicking on a signpost, and you won't get it if you try to punch someone who's too far away.

You can also make two different 'branches' of mobs:

mob/combatant
verb/punch(mob/target as mob in oview(1))

mob/pacifist

Mobs of type mob/combatant can punch, mobs of type pacifist cannot. This is the solution to your boot problem as well.

The flipside is what verbs the thing being clicked has. If you wanted to, you could declare your combat verbs from the target's point of view:

mob/regular_mob/verb/punch()
set src in oview(1)
mob/guy_with_glasses

If you do this this way, you can only punch a regular_mob that's one square away and visible... and it's that mob's verb that's being called, not your own. A mob with glasses simply doesn't have a punch verb to call.


The second thing to consider is that anything DM can do, you can do better. Did you know that objects (mobs, objs, turfs, and areas) have a variable called verbs that a list you can add to and subtract from almost at will? Read up on it... and then imagine the possibilities. What if your character doesn't have any fighting verbs unless you put the character in fighting mode? Or didn't have advanced emote/social/communication verbs unless you entered social mode? You could make all the modes toggleable, so people could have as many or as few verbs as they wanted showing up at a time. If you don't want to mess with the verb list, consider making invisible objs that have all the fighting verbs, all the social verbs, etc, and have their src = usr.contents. When you hit the "main" fight verb, one of these objects is created in your inventory... unless you already have one, in which case it's destroyed.

None of these will quite give you sub-menus... but they're all powerful tools for verb management.