ID:176337
 
Im trying to code it so if the eye client is on a certain mob you get a verb...my code is:

if(usr.client.eye == mob/units/soldiers/Commander/)
Return_to_char()
usr.client.eye = usr

Why doesnt it work? should i make a variable and have it check that instead? Thanks in advance!
-Crio
*sigh*

Why does everyone seem to have this problem?

You're trying to compare the client's eye (which is assigned to an atom), to a type path. You can't. They're completely different concepts.

What you want to do is find out whether the eye is set to a certain TYPE of atom:

<code>if(istype(usr.client.eye,/mob/units/soldiers/ Commander))</code>

You also have an indentation problem there.
In response to Crispy
where do iindent it
In response to Koolguy900095
Indenting is covered in every beginner tutorial. If you don't understand it, go back and read the tutorials again.

It also depends on what else you've put there. Show me the code around that part and I'll be able to correct it for you.
In response to Crispy
i'ved moved it to ALL spots...still dont work
In response to Koolguy900095
If I can't see code, I can't fix it.
In response to Crispy
i showed u the code in the first post
In response to Koolguy900095
Use your eyes! Actually take the time to READ my posts, goddamnit!

Crispy wrote:
It also depends on what else you've put there. <font color=white>Show me the code around that part</font> and I'll be able to correct it for you.

Sheesh. I don't know why I bother.
In response to Crispy
mob
var
health

verb
if(usr.client.eye == mob/units/soldiers/Commander/)
Return_to_char()
usr.client.eye = usr

Say(T as text)
world << "<b>[usr]</b>: <font color = blue>[T]"
Log_File<<"[src] says [T]"

See_Owner(mob in oview(7))
if(istype(mob,/mob/units/))
usr << "[mob] belongs to [mob:owner]!"
In response to Koolguy900095
You need to use istype().
In response to Garthor
i did just not in that bit of coding cuz i just copied it from the first post and put it there
In response to Koolguy900095
You have to put statements INSIDE procs/verbs. They simply do not work outside of them. Duh.

<code>verb Return_to_char() if(usr.client.eye == mob/units/soldiers/Commander/) usr.client.eye = usr</code>

There, now it's indented properly.

I haven't fixed the problem you originally posted about - you should have enough brains to work it out from the instructions I gave you in [link]
In response to Koolguy900095
it says this in my dream maker:

mob
var
credits = 100
health
damage
owner
speed
range
attack
control
moving = 0

verb
if(istype(usr.client.eye,/mob/units/soldiers/Commander))
Return_to_char()
usr.client.eye = usr


but i dont like posting every bit of my coding
In response to Koolguy900095
verb
if(istype(usr.client.eye,/mob/units/soldiers/Commander))
Return_to_char()
usr.client.eye = usr

This above is incorrect. Why? You have an if above the proc! This is correct:
verb
Return_to_char()
if(istype(usr.client.eye,/mob/units/soldiers/Commander))
usr.client.eye = usr

try that. should compile just fine.
In response to Ghaleon
BUT i want it so it only shows when the eye is on that guy NOT all the time...
In response to Koolguy900095
Then you have to add/remove the verb at runtime, or attach the verb to the mob you're watching.
In response to Koolguy900095
Not possible.

Well, actually it is possible, but it's annoying to do. :-)

Look up the <code>verbs list var</code> in the reference. (Press F1 while in Dream Maker.)