ID:1687757
 
Keywords: client, crossed
(See the best response by Pokemonred200.)
Code:
mob/Unit
Crossed()
winset(usr,"something","is-visible=true")


Problem description:

Is there any way to use usr.client within a Crossed() proc?? Because I want when one unit is crossed a window to pop up to the usr.

I've read in the reference that there is no client/Crossed, so is there an efficient way to do it?? Should I create a Client proc for Crossed or could I detect this collision with Move which is a client proc????
You need to ensure that the atom that called Crossed() is a mob, and also has a client.

mob/Unit
Crossed(atom/movable/o)
if(istype(o,/mob))
var/mob/m = o
if(m.client)
winset(m,"something","is-visible=true;")
So a client is assigned to the object controlled by the player right?? The thing is that the mob does not have a client.

The mob is just a unit on the main map and when it interacts with another unit a window must pop-up on the player that owns the unit.
So
1.Can I explicitly assign a client to the mob(when being clicked or created or something)same to its owner??

2.This mob has an Owner var (ranging from 1-6)depending on which player owns it. So can I create a getClient() proc that receives the mob.Owner and returns the appropriate Client?? And if so how could I store the players client refference??

Something like:Code:
GetClient(var/Pointer)
switch(Pointer)
case 1: return referenceToPlayer1Client;
case 2: return referenceToPlayer2Client;
case 3: return referenceToPlayer3Client;
case 4: return referenceToPlayer4Client;
case 5: return referenceToPlayer5Client;
case 6: return referenceToPlayer6Client;
1. Yes, you can set a variable to an object. I don't see how you wouldn't know this already, considering src, usr, client.mob, mob.client, etc. are all just variables referring to an object.
2. Way overcomplicated
Ok just tested 2 and works fine, about 1 I don't exactly get the client datum the more I learn about it the more confusing it gets...

So just to be sure
src is like the this pointer in C++ right??
usr is the player, a var to its mob
client.mob ,don't have a clue
mob.client a built-in var inside mobs (npcs don't have a client)
Also does a mob gets its client var by the Login() proc ??

and procs get the usr variable form the verb that called it right??
In response to Victorqr
Best response
Victorqr wrote:
Ok just tested 2 and works fine, about 1 I don't exactly get the client datum the more I learn about it the more confusing it gets...

So just to be sure
src is like the this pointer in C++ right??
usr is the player, a var to its mob
client.mob ,don't have a clue
mob.client a built-in var inside mobs (npcs don't have a client)
Also does a mob gets its client var by the Login() proc ??

and procs get the usr variable form the verb that called it right??

1: Yes
2: The player that called the verb, yes
3: client.mob is the mob that's attached to the client, so taking client.mob from mob.client brings you back to the original mob
4: Yes, yes it is. it refers to the attached client (it's a circular reference!)
5: I'm pretty sure Login() is called when the client is attached.
6: Yes.