ok what I want to do is have the user in a variable like so...
mob
proc
blah()
var/client/e=usr
blah2(e)
blah2(var/client/e)
e<<"You have won!"
Get what I'm saying?
so like even if the usr's switching around mobs a lot ( changing usr.client.mob a lot) I can still refer to him and still message him, etc. I haven't tried this idea yet but would just the above work?
I want the convenience of storing this variable e on every mob he owns, so that no matter what mob he is currently playing I can contact him or whatever based off of what mobs are in the area I'm calling.
ALSO
if you wanted to just check for a mob in a very distinct area
can you do that with
for(var/mob/M as mob in Ruralarea(this is the area))
or how would I do that exactly?
ID:267230
Jan 21 2003, 8:35 am (Edited on Jan 21 2003, 8:43 am)
|
|
Jon Snow wrote:
ok what I want to do is have the user in a variable like so... Considering usr is unsafe in most procs, no, that won't work. In a verb it could work, if the code was right. But you're not calling blah2() with the client; you're calling it with the mob. I want the convenience of storing this variable e on every mob he owns, so that no matter what mob he is currently playing I can contact him or whatever based off of what mobs are in the area I'm calling. It looks to me, then, as if you're making the mistake of thinking usr is a client; it's not. usr is a mob. What you probably want to do is store a reference to the client instead. ALSO locate() will work too. Lummox JR |
Why not just give everything to clients instead of mobs? That way, you avoid all the pain associated with switching mobs.
|
In response to Skysaw
|
|
Skysaw wrote:
usr is not safe in a proc. yikes I can't send messages directly to my_client... like when I do src.my_client<<"Hello" nothing shows, which is what I need hehe, so even if my client isn't directly controling that mob it will still work? |
In response to Jon Snow
|
|
Jon Snow wrote:
yikes I could've sworn sending messages directly to a client would work. But if it doesn't, try sending to client.mob instead. Lummox JR |
In response to Lummox JR
|
|
I forgot to put var/client/my_client!!
Thanks for the help though very much appreciated!! |
In response to Lummox JR
|
|
Lummox JR wrote:
Jon Snow wrote: Sending to the client works. |
In response to Skysaw
|
|
for(var/mob/M as mob in ruralarea) doesn't work.
(note ruralarea is the name of the area) so how would I go about cycling through all mobs in ruralarea with for? Like what's the proper way |
If you want to keep track of the client variable, you can do this:
mob
var/client/my_client
Login()
..()
my_client=client