ID:148449
 
does anyone here know how to detect the turf, a mob's standing on?
i tried "if (T in view(0))", but it doesn't seem to work.
any suggestions/ideas?

(just so i don't confuse you, before the if, i set T to be turf, using "var/turf/T".)
<code>loc</code> is the atom that the mob is being contained in. Usually it's a turf for mobs, but it can be any kind of atom, or null.
In response to Garthor
thanks, but i did it another way... it'll probably lag up any servers, but it's the best i've got.
it's going to look for ALL turfs in the world, and see if there's any which matches up to the mob.
oh well x.x
In response to Roara
Roara wrote:
thanks, but i did it another way... it'll probably lag up any servers, but it's the best i've got.
it's going to look for ALL turfs in the world, and see if there's any which matches up to the mob.
oh well x.x

That indeed would probably cause problems. If you tell us the reason you need it, and maybe a small snippet of coding, we may be able to help.

~>Volte
In response to Roara
Roara wrote:
thanks, but i did it another way... it'll probably lag up any servers, but it's the best i've got.
it's going to look for ALL turfs in the world, and see if there's any which matches up to the mob.
oh well x.x

Gads, are you friggin' insane?

Garthor suggested a perfectly good way: Use the mob's loc. If that's not the turf they're on, then it's an object (like a vehicle) that they're in, and you can take the loc of that and keep going until you find the turf.

Or there's another way, if you don't like that approach: Use locate(x,y,z), since the x,y,z values should always be correct. That will always give you a turf as long as your mob is somewhere on the map.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Roara wrote:
thanks, but i did it another way... it'll probably lag up any servers, but it's the best i've got.
it's going to look for ALL turfs in the world, and see if there's any which matches up to the mob.
oh well x.x

Gads, are you friggin' insane?

yes, thank you very much :P

Garthor suggested a perfectly good way: Use the mob's loc. If that's not the turf they're on, then it's an object (like a vehicle) that they're in, and you can take the loc of that and keep going until you find the turf.

it probably is perfect, but i didn't understand what the heck he said -.-

Or there's another way, if you don't like that approach: Use locate(x,y,z), since the x,y,z values should always be correct. That will always give you a turf as long as your mob is somewhere on the map.

and i don't understand that, either -.-

Lummox JR
In response to Volte
well, it's to check a variable of the turf, to see if it's high enough...
in this case, oxygen.
if it's not high enough, it'll do a bit of damage, every time the person breathes.
however, for some reason, that's the only way it'll work, and get to the part where it actualy checks the variable.

i'll try something else, and report what happens.
wish me luck.
In response to Roara
atom/movables have a var called loc. objs and mobs are atom/movables. It is where the mob currently is. It can be any kind of atom.
In response to Roara
Roara wrote:
Lummox JR wrote:
Roara wrote:
thanks, but i did it another way... it'll probably lag up any servers, but it's the best i've got.
it's going to look for ALL turfs in the world, and see if there's any which matches up to the mob.
oh well x.x

Gads, are you friggin' insane?

yes, thank you very much :P

Garthor suggested a perfectly good way: Use the mob's loc. If that's not the turf they're on, then it's an object (like a vehicle) that they're in, and you can take the loc of that and keep going until you find the turf.

it probably is perfect, but i didn't understand what the heck he said -.-

Loc is a variable, which stored the atom that the corrisponding mob in located in. If your mob was on /turf/grass, "usr.loc" would return "grass", also known as the turf you are on.

Or there's another way, if you don't like that approach: Use locate(x,y,z), since the x,y,z values should always be correct. That will always give you a turf as long as your mob is somewhere on the map.

and i don't understand that, either -.-

Virtually the same as loc. You can use locate(
x,y,z) to return the turf that is in the location of the specified coordinates.

~>Volte
In response to Volte
Actually, "usr.loc" would return the atom the mob that set the current string of procs into motion was standing on. src.loc would, however, be the turf you were standing on.
In response to Garthor
um, i didn't really fully understand that, but...
"for (T in src.loc)" and "for (T in loc)" didn't work.
by the way, it's a proc, for all mobs, if that helps :\
In response to Garthor
Garthor wrote:
Actually, "usr.loc" would return the atom the mob that set the current string of procs into motion was standing on. src.loc would, however, be the turf you were standing on.

It all depends on how you use it. Verb, proc, and how you reference it. Generally, there is no difference in usr and src when referring to the same thing using either.
mob/verb/My_verb()
usr << usr.loc
usr.ReturnLoc()
mob/proc/ReturnLoc()
src << src.loc


That would return the same loc twice.

~>Volte
In response to Volte
yeah, but how would I check the turf, with the same loc as a mob, using a proc?
In response to Roara
Roara wrote:
yeah, but how would I check the turf, with the same loc as a mob, using a proc?
mob/proc/Myproc(mob/M as mob)
var/turf/mob_loc = M.loc // Or var/turf/mob_loc = locate(M.x,M.y,M.z)


~>Volte
In response to Volte
er, the problem is, i need to create an if/for command, that'd be for the turf, which the mob's on.
In response to Roara
Roara wrote:
er, the problem is, i need to create an if/for command, that'd be for the turf, which the mob's on.

You can't expect people on the forum to do everything for you. I simply put it into an example, to show you how to refer to it. After using that, just use mob_loc to check vars.
if(mob_loc.oxygen > 5)


Read code carefully. ;]

~>Volte
In response to Volte
Volte wrote:
Roara wrote:
er, the problem is, i need to create an if/for command, that'd be for the turf, which the mob's on.

You can't expect people on the forum to do everything for you. I simply put it into an example, to show you how to refer to it. After using that, just use mob_loc to check vars.

that actualy makes sense :o

> if(mob_loc.oxygen > 5)
> <dm>


i think you forgot a / :\


Read code carefully. ;]

~>Volte

i'll try :o
In response to Roara
Roara wrote:
er, the problem is, i need to create an if/for command, that'd be for the turf, which the mob's on.

You've been shown two extremely simple methods for finding the turf. The only excuse for not understanding those is that you're not trying, and this is as far as anyone can take you.

As for an if() or a for loop, you have yet to say what you need one of those for; if you did, we could probably help you with that.

Lummox JR
In response to Lummox JR
well, you'll find out!
because i just fixed it...
... now to fix the door, give the oxygen regenerator (don't ask... yet >:) density... and find a darned host!

(if you wan't to know the error, turns out all i had to do was move something around, from BEFORE to AFTER the loop starts)