ID:161023
 
Alright what I want to do is when a object is in the users direction, and in the players view of 1, a action would happen.

mob
verb
Test()
if(/turf/water in get_step(usr,usr.dir))
world << "1"
else
world << "2"

that is the only thing I came up with, which does not work at all.
Your code was almost correct, but you need to use locate() with /turf/water as the argument in this statement:

if(/turf/water in get_step(usr,usr.dir))


Otherwise, you'd be checking if the type /turf/water is in there, and a type isn't even an object!
In response to DivineO'peanut
DivineO'peanut wrote:
Your code was almost correct, but you need to use locate() with /turf/water as the argument in this statement:


Like this? It still does not work.
mob
verb
Test()
var/turf/Water/W = locate()
if(W in get_step(usr,usr.dir))
world << "1"
else
world << "2"



In response to Onimushia
get_step() returns the turf there. Since there can't be a turf in a turf...
In response to Kaiochao
mob
verb
Test()
if(locate(/turf/Water) in oview(1))
world << "1"
else
world << "2"


I got it to work using this method only problem that when the players back is towards the water, it will still perform 1
which I do not want. I want it to perform the action only when the player is in the direction of the water, with a range of 1.
In response to Onimushia
You have to use the get_step() proc to check only infront of the player and the istype() proc to check if it's /turf/Water.
mob
verb
Test()
if(istype(get_step(usr,usr.dir),/turf/Water))
world<<"1"
else
world<<"2"
In response to Onimushia
I would do something like this:
mob
verb
Test()
var/turf/T = get_step(usr,usr.dir)
if(istype(T,/turf/water))
world<<"<font color=\"blue\">Water water everywhere but not a drop to drink!</font>"
else
world<<"I'm thirsty where's the water?"
In response to Lyndonarmitage1
Nothing, but five minutes too late.
In response to Kaiochao
Damn, good point. I should really double-check what I write before I post it. :-P