ID:169159
 
I would like to make it so that when my "sbform" variable is 1, when you click a turf (wall/grass/water/any turf), you get teleported there. I tried the following 3 ways:
mob/var/sbform=0
turf
Click()
if(!usr.sbform)return
usr.loc=turf.loc
//of course i realized that wouldnt work for an obvious reason

turf
Click(turf/T)
if(!usr.sbform)return
usr.loc=T.loc
//got teleported back to coord 1,1,1 for some reason 0-0

and i tried this
mob
Click(turf/T)
if(!usr.sbform)return
else
usr.x=T.x;usr.y=T.y;usr.z=T.z
//this also just simply didnt work


Any ideas?
The turf isn't "turf". turf is not a variable, or anything in that code. The turf is src in your first two examples, since the Click() procedure belongs to it.

Simply usr.loc = src should work. Mobs' locs are usually turfs themselves. src.loc would be an area.
In response to Jon88
lol, your in luck buddy i just did this for my game
client
DblClick(turf/T)
usr.loc = locate(T.x,T.y,T.z)
In response to Cheetoz
Lmfao, thats simply great. Thanks. (God I'm an idiot)
In response to Cheetoz
Er, no, that's kinda' the wrong way to do it. It has usr abuse and who knows if that's a turf!
client
DblClick(turf/t)
if(!isturf(t))return
mob.loc=t

That should work.
In response to Ol' Yeller
I'm not sure but I think you should be doing DblClick(atom/A) and then run the isturf() check.
In response to Ol' Yeller
Ol' Yeller wrote:
Er, no, that's kinda' the wrong way to do it. It has usr abuse and who knows if that's a turf!

There is no usr abuse. Click() and DblClick() are usr-safe. It's not like orcs and other NPCs have mice to click with. :P
In response to Jon88
Click() and DbleClick() are pretty much verbs anyway. Initiated by the player.
In response to Jon88
I thought it was wrong to do it that in client/Click(), meh, I guess I'm wrong. =/
In response to Elation
Elation wrote:
Click() and DbleClick() are pretty much verbs anyway. Initiated by the player.

atom/Click() and atom/DblClick() are virtually as good as verbs, and usr is safe there unless you've done some serious tampering with the way they're called.

client/Click() and client/DblClick() are verbs, and ergo usr is 100% safe there unless you call these verbs manually.

Lummox JR
In response to Ol' Yeller
Usr is actually safe in Click(). NPCs aren't well known for, you know, clicking stuff with a mouse.
turf/Click()
if(usr.sbform) usr.loc=src


It doesn't need to be very fancy. Note that usr is safe in Click() and DblClick(), because NPCs don't have mice, but usr won't be safe in other procs. Just a preemptive strike there.