ID:1698365
 
(See the best response by Kaiochao.)
Code:
mob
verb
Observe(mob/M in world)
if(usr.Search==1)
client.eye = usr
usr.Search = 0
return
if(usr.Search==0)
usr.Search = 1
usr.client.eye=M
usr.client.perspective=EYE_PERSPECTIVE
return


Problem description:
So the problem that i have, is that when in view of M, and you click observe again it still brings up the list of mobs in the world, ive played around with the code and tried coding it in way in which the list doesn't appear if search = 1 but i cant find a way to not bring up the list.
(Also, no matter who i click in the list when Search=1 it does bring the view back to usr)

It is because you have mob/M in world inside your verb arguments. Remove it, and use an input when search is 0.
Best response
Actually, I think there could be a few ways to solve this while preserving the verb input arguments.
// one way would be to change the list to choose from:
// a list with one item will not cause a popup,
// so we choose from that if we're already observing.
mob
var
tmp
observing = FALSE

verb
observe(mob/M in (observing ? list(0) : world)
if(observing)
client.eye = src
client.perspective = MOB_PERSPECTIVE
observing = FALSE

else
client.eye = M
client.perspective = EYE_PERSPECTIVE
observing = TRUE

// another way could be to use verb replacement:
// you start off with a verb called "observe" that starts observing
// when you start observing something, that verb is replaced with
// another verb called "observe" that stops observing
mob
verb
observe_start(mob/M in world)
set name = "observe"
Observe(M)

observer
verb
observe_stop()
set name = "observe"
Observe()

proc
Observe(M)
client.eye = M || src
if(client.eye == src)
client.perspective = MOB_PERSPECTIVE
verbs -= /mob/observer/verb/observe_stop
verbs += /mob/verb/observe_start
else
client.perspective = EYE_PERSPECTIVE
verbs -= /mob/verb/observe_start
verbs += /mob/observer/verb/observe_stop
they both actually give me a runtime error...