ID:174227
 
I have been trying to get this to work for a couple days now. After reading and reading, I have tried various formats.

All I want to do is have the player click on a tile...if the tile is empty, it should display the tile name...if there is an object in the tile, it should display Move [object] and then will go into more code.

The following code is the best I've come up with so far (at least I don't get errors on compile) but now I get runtime errors as follows

runtime error: Cannot read null.contents
proc name: Click (/client/Click)
usr: AdminBiff (/mob)
src: AdminBiff (/client)
call stack:
AdminBiff (/client): Click(the grass (10,28,1) (/turf/floor), the grass (10,28,1) (/turf/floor))

Here is the code;

var/turf/T = locate(x,y,z)
client/Click(O)
if (locate(/obj) in T.contents)
usr << "Move [O]."
else
usr << "[O]."
// ..()


PLEASE, someone help...I am pulling out what little hair I have left. :)

Mark
AdminBiff wrote:
Here is the code;

var/turf/T = locate(x,y,z)
client/Click(O)
if (locate(/obj) in T.contents)
usr << "Move [O]."
else
usr << "[O]."
// ..()

You can't expect locate() to work right at all outside of a proc; the var/turf/T line should be inside Click(), not outside. But then, that line won't be much good to you unless you change the x,y,z.
client/Click(atom/O, turf/T)
if(!isturf(T)) // click in statpanel; T is a string here
return
// O might be an obj, or T itself
// find if there's an object on T
O = locate(/obj) in T
if(O)
usr << "Move [O]"
else
usr << "No move"

Lummox JR
In response to Lummox JR
My hair thanks you! Works great!

Hope you stick around, I am sure I will have many more questions before I am through :)

Mark