I have made a tell verb and it works fine but I need to know how to make it so that it only shows Players in the list if people to tell not npcs. I tryed doing mob/PC but it didn't work.
Tell(M as mob in world, msg as text)
set src in oview()
M << "\icon[usr] [usr] tells you: [msg]"
ID:261416
Mar 1 2002, 12:45 pm
|
|
This is a tutorial from Ensya. The actual proc it makes is pretty useless, since you can just do what Rcet said. But the concept is a good one to learn in case similar situation come up, but don't have such an easy solution.
<FONT SIZE=5> Limited Return procs</FONT> |
In response to Rcet
|
|
Like this?
Tell(client/C as client in world, msg as text) set src in oview() M << "<font color=#6666FF>\icon[usr] [usr] tells you: [msg]</font>" ERROR::: Mob.dm:38:error: Bad input type: client |
In response to Rcet
|
|
I don't believe clients are listed in world.contents. Also, "as client" will fail on compile, since client isn't a valid filter.
There are a couple of others options, though. A) Maintain a list of players. Add to it on Login(), remove from it on Logout(). Tell(mob/M in players_list, msg as text) M << "\icon[usr] [usr] tells you: [msg]" 2) have player mobs and NPC mobs be of different types: Tell(mob/player/M in world, msg as text) M << "\icon[usr] [usr] tells you: [msg]" III) What Foomer said. This adds a bit of overhead compared to option A, though, as it has to cycle through a bunch of mobs and rebuild the list everytime someone tries to tell something to someone. Its a good method to use in a lot of other occasions, though, I just wouldn't do it when dealing with the whole world. [Edit:] I should have read your post more clearly, and not just the replies. 2 is the option you want, since players are already of type /mob/PC. What you tried to do, I think, is filter like "M as mob/PC", which doesn't work. What you want to do it make sure that PCs are the only valid argument to the verb, which is what my code above does. You might want to keep option A in mind, though. Its a little more flexible, and can really be helpful in a lot of coding situations. -AbyssDragon |
In response to AbyssDragon
|
|
I get what your saying on number 2, I tryed it but it still seems to be letting you use the verbs on npcs. I have my npcs under mob/NPC and players under mob/PC. I think thats what you ment about making them different.
|
In response to Little Sally
|
|
Ok, try this:
mob or mob ...OR... mob hehe.. hope i helped. -Rcet |
In response to Rcet
|
|
Ok ty so much ;)
|
In response to AbyssDragon
|
|
AbyssDragon wrote:
I don't believe clients are listed in world.contents. Also, "as client" will fail on compile, since client isn't a valid filter. Deadron's Players library stores online clients in a GameController. (I tend to favor event loops as offered by Event Loop's GameController anyway.) |
Best solution to this problem (both in terms of server overhead, and clarity at runtime) is to reword the verb from the target's perspective, like so:
mob/pc/verb/tell(message as text) set src in oview() //or world. or whatever. Now, usr is the teller, and src is the tellee. With this method, you will only see the verb in right-click menus if the thing you're clicking on is an actual pc, and if there's no other pcs in the targetable area, the verb will not clutter the list. |
Tell me if that works.
-Rcet