ID:179187
 
Click(src in oview(1))

This is what I have right now, but I only want to let the player to be able to click the object if they are within oview(1) of it. What do I need to do to get this right?

LJR
LordJR wrote:
Click(src in oview(1))

This is what I have right now, but I only want to let the player to be able to click the object if they are within oview(1) of it. What do I need to do to get this right?

You have to override the contents of the Click() proc, eg:

obj/Click()
if(usr in oview(src,1))
// do your proc
Well.. Im not quite sure but ill try..
obj
expieriment_obj
Click()
var/next_to_obj = locate(usr) in oview(1)
if(next_to_obj)
//clicky stuff here


Lemme know if that worked

-Rcet
LordJR wrote:
Click(src in oview(1))

This is what I have right now, but I only want to let the player to be able to click the object if they are within oview(1) of it. What do I need to do to get this right?

The easiest and fastest way is this:
Click()
if(get_dist(src,usr)>1) return
...

oview() has its benefits but what it does is make up a list of items in a certain range, which you don't need here. All you need to do is check on the range, which get_dist is perfectly good for.

Lummox JR
In response to Lummox JR
Thanks guys, I liked this one the best and it works perfect! Thanks ;)

LJR

The easiest and fastest way is this:
Click()
> if(get_dist(src,usr)>1) return
> ...

oview() has its benefits but what it does is make up a list of items in a certain range, which you don't need here. All you need to do is check on the range, which get_dist is perfectly good for.

Lummox JR