if(Locate X,Y,Z)
What will cause this to be true or fasle?
ID:174738
Jul 23 2003, 5:50 am
|
|
In response to DBHavenMaster
|
|
I want to know, what if(Locate X,Y,Z) needs to be true
|
You probably mean:
<code> if(locate(x,y,z)) </code> Well, look at what the locate proc does. You give it (in this case) three coordinates and it gives you the turf that is at those coordinates. If the coordinates are invalid (off the map) then the expression wold evaluate as being false. If there is a valid turf at those coordinates then it would be true. |
In response to OneFishDown
|
|
Thanks, thats what I needed
I got another question, how would I use locate to manipulate a turf? Exemple: I have turf/someturf/var/value1 at 1,1,1 With locate(1,1,1) how would I be able to check value1? |
In response to FranquiBoy
|
|
<code> turf var value1 mob verb check_turf() var/turf/someTurf = locate(1,1,1) if(someTurf.value1 == 3) //blah </code>
I think that's what you mean, I'm not sure though. |
In response to OneFishDown
|
|
I mean, if every turf has a variable called value, I input coordinates and it will give me value for that turf
|
In response to FranquiBoy
|
|
FranquiBoy wrote:
I mean, if every turf has a variable called value, I input coordinates and it will give me value for that turf<code> //input coordinates var/turf/someTurf = locate(x,y,z) world << "value1 of [x],[y],[z] is [someTurf.value1]"</code> |
In response to OneFishDown
|
|
Thank you very much, this breaks down the wall I hit on my map
|
mob/verb/checkloc()
if (usr.loc == locate(1,1,1))
usr << "Hi"
else
usr << "Nope"
That works.
.::DBHavenMaster::.