ID:753901
 
Code:
mob
verb
TurfCheck()
var/s = src.loc
if(istype(s,/turf/thing))
world<<("[s.hotdog]")

turf
var/hotdog
thing
icon='thing.dmi'
hotdog=1


Problem description:
Ok so this obviously doesn't work but the purpose of this is to check if the player is on top/standing on /turf/thing and if he is, it displays the number of hotdog the turf has. Can someone please correct this? Thank you
var/thing/thing = new

thing
parent_type = /turf
icon = 'thing.dmi'

var/hotdogs = 0

proc/check_hotdogs()

var/turf/t = locate(/thing)

if(src.loc == t)
src << "There are [thing.hotdogs] hotdogs on this turf!"

New()
hotdogs = 1
..()


mob/verb/turf_check()
thing.check_hotdogs()
^ That code's not going to work. There's all kinds of things wrong with it. They way you've done it yourself is just about right, the only thing you're missing is typecasting. Alternatively, you could use the : operator too but it's stigmatized. What I mean is:

mob/verb/turfCheck()
if( loc && istype(loc, /turf/thing) )
var/turf/s = loc
world << s.hotdogs
mob/verb/Turf_Check()
var turf/thing/thing = loc
if(istype(thing))
world << thing.hotdog