ID:815377
 
Keywords: locate
(See the best response by Murrawhip.)
Code:
obj
Control_Console
icon='Console.dmi'
Click()
set src in oview(1)
switch(alert("Do you want to activate the Glasglow?",,"Yes","No"))
if("Yes")
var/mob/Glasgow/K = locate(/mob/Glasgow) in world
if(K)
if(K.pilot==usr)
usr.client.eye=K
else
usr<<"There is no Glasgow"


Problem description:Yeah I know im doing it wrong somehow but it keeps saying there no glasgow in the world when indeed there is:P.If anyone figures out my mistake or an alternate working coding method I could use instead,thanks.

It looks right. How sure are you that there is a /mob/Glasgow in the world? (keep in mind that for it to be "in world", it has to be on the map, and not in a null location. You could try dropping the "in world" if this is not the case)

Also, please don't mix tabs and spaces for indentation, and don't use a single space for indentation. It'll hurt the eyes of any helpful soul who has to read your code.

Oh, and the src setting (set src in oview(1)) only works for verbs, not processes like Click(). You need to do something like if(get_dist(src, usr) <= 1) instead.
Lol I appreciate that your trying to help but there is indeed a glasgow in the map, its location is not null.
Make sure in if(K) that it is indeed K?
I ran your code.
First I had no mob on the map - it said there was no Glasgow.
Then I had the mob on the map, and it said there was a Glasgow.

Your code is correct. (other than the set src statement)
In response to Dr.DraX
what else would it be? o.o
Thanks guys. I appreciate everyone trying to help my dillema. Keep the ideas coming for me plz. I personally haven't a clue what it is since the Glasgow is
1.The only knightmare in the world until I make sure everything runs fine on it
2.Very much in the world sitting right next to CC
Can you confirm that you've addressed
Oh, and the src setting (set src in oview(1)) only works for verbs, not processes like Click(). You need to do something like if(get_dist(src, usr) <= 1) instead.

This issue? Murrawhip seems to indicate that once fixed ( I assume he also re-indented your code ) the code performed as expected.
Best response
I reindented the code as it didn't compile otherwise. I've never had much luck mixing space-indented code with tab indented code.
I didn't remove the set src statement - it just doesn't do anything useful.

Full code I used here:
mob/Glasgow/var/pilot
obj
Control_Console
icon='Console.dmi'
Click()
set src in oview(1)
switch(alert("Do you want to activate the Glasglow?",,"Yes","No"))
if("Yes")
var/mob/Glasgow/K = locate(/mob/Glasgow) in world
if(K)
if(K.pilot==usr)
usr.client.eye=K
else
usr<<"There is no Glasgow"


Can you please right-click the Glasgow on the map, goto Edit, then copy the 'type' var and paste it here.
WOOOOOOOW im bak at my laptop , got off work and now I see xD

It was the Glasgow itself, the dam thing.

Thanks Murrawhip and everyone else who helped me!