Hello, I was woundering how you could use get_step in relation with an if or multiple ifs. To check to see if its in a certain bounds. Like 5<loc<world.maxx-5.
Is there a way to get the x value of a location variable that holds the returned value from get_step?
Thanks for any help.
--Green Lime
ID:269407
![]() Jun 20 2005, 9:14 am
|
|
Teh Governator wrote:
Green Lime wrote: > var/atom/A=get_step(src,src.dir) What does that statement do exactly? Does it make A.loc = the returned result of get_step? And then I would just use A.x of course right? But what do I do with the variable will I need to delete it? Is this a shortcut of initalizing a new object? |
Green Lime wrote:
Teh Governator wrote: > > var/atom/A=get_step(src,src.dir) What does that statement do exactly? Does it make A.loc = the returned result of get_step? And then I would just use A.x of course right? You use the variable to access the new location. You said you wanted to find the "x" value, now you can. |
Green Lime wrote:
Teh Governator wrote: > > var/atom/A=get_step(src,src.dir) What does that statement do exactly? Does it make A.loc = the returned result of get_step? No, it makes A itself the returned result, exactly like you see above. A.loc is the area that turf belongs to. Incidentally, you can define this as a turf, not an atom, since get_step() always returns either a turf or null. And then I would just use A.x of course right? Correct. But what do I do with the variable will I need to delete it? Is this a shortcut of initalizing a new object? This won't initialize anything; it will just give you the turf (if any) that's already there. You don't need to delete it. Lummox JR |
var/atom/A=get_step(src,src.dir)
if(A.x==1)world<<"[A]'s x variable is one!" If you 'del(A)', you'll delete the turf since A is defined as the turf. If you leave A alone, and it's unused, the garbage collector will take it away (not the turf). Think of it as a temporary variable. Like: atom/Click() var/mob/Player/M=usr If you del(M), you del(usr). But M isn't going to be put under your vars list, nor the atom's. Did that help? It's sort of hard to explain. |
var/atom/A=get_step(src,src.dir)