ID:809365
 
Code:
    join(mob/M)
usr.group.Add(M) // add M to usr's group
view() << "[M] joins [usr]."


Problem description:
at runtime, when right click the mouse on usr, the join verb is displayed. how to stop that from happening because i don't want usr joining its own usr group. i have tried -usr but that does not work
It will appear regardless. Just add a check in the verb to rule out the possibility of the user joining.
What you could also do:
mob/verb //<-This I'm assuming, since you didn't provide it
join()
set src in oview()
// ^This allows you to right-click a mob in your view
// and from the popup menu, select "join".
// note:
// src is the mob you're joining.
// usr is you.

// A couple improvements:
if(usr in src.group)
usr << "You're already in [src]'s group!"
return

src.group += usr
view() << "[usr] joins [src]."
    join(mob/M)
usr.group.Add(M) // add M to usr's group
view() << "[usr] joins [M]."
input("display usr group") in usr.group
if(usr.group.Remove(M))
usr << "[M] removed"


to verify that the mob has joined the usr group, i have added an input statement. the input statement will only work and display the usr group if the "if" statement is commented. the code is acting as if the "if" statement is executed before the "input" statement. could someone please explain this strange behavior.

thank you Kaiochao. i will study your code
input() is not used this way. I suggest you use the DM Reference and/or F1 in Dream Maker and learn some more about DM's syntax.
In response to Albro1
input() can be used that way if you're just displaying information. It's not often used like that, since usually you expect to use an input to get... input. But it's the same as calling any other proc. For example, some people call step() in its own line by itself, but it actually returns a value that people don't often care about.

I'm not sure what the actual issue is, though. The input() proc is supposed to pause the procedure at the line it's called in, and resume after the input has been resolved.
Albro1. whats wrong with the syntax. i pressed f1 and read the input statement and it should work. it is very similar to any other list in an input statement.
to make my point clear. the following will work but the usr.group will not

     input("display usr group", "test") in usr
Did some testing, it seems as though as though it won't work if there's only one object in the list or if all the objects in the list are the same object, if you catch my drift.

This is presumably because with "input()", you generally want to make the user make a choice, and therefore input something. It's not normally used to display information.

My advice if you're set on using input() to add at the top of your list usr.group "Group members:", so as to provide an alternate option.

However, he's right that if you're not wanting feedback, then don't really use input. Use a browse() proc and HTML to produce only readable output. You can make it look prettier too. Something like:

var/group_menu = "Group members:"
for(var/mob/M in usr.group)
group_menu += (M.name + " is a member of the group!)
usr << browse(group_menu)

In response to Gamer_cad
I hadn't considered that the input() was closing because there was only one member in the group. I forgot that you yourself aren't in your own group, haha.

The way to fix this is to "add a Cancel button to the input."
input(...) as null|anything in List

In this case, List is src.group.