ID:269647
 
This is my code
mob
Bump(M)
return
if(istype(M,/mob/shopkeeper/Curly))
global.shopcontents = M.contents


But whenever I compile it it comes up with this error:

ShopKeepers.dm:118:error:M.contents:undefined var

could someone help me.
1) Why is return before istype? Bad bad bad, the proc will stop before it reaches the next line :P

2) You put Bump(M) which is basically var/M ... what you want is Bump(atom/M) if you're planning to use Bumps for things other than mobs (like objs)... atom's have the built-in variable (the contents list) >.>
ADT_CLONE wrote:
ShopKeepers.dm:118:error:M.contents:undefined var

That'd be because M isn't pointing to anything. That and you're cancelling the proc with return before it even gets to the check.

mob
Bump(atom/M)
if(istype(M,/mob/shopkeeper/Curly))
global.shopcontents = M.contents


~Sinyc.

Edit: Whoops. Exactly what GhostAnime said. =/
In response to Sinyc
Thanks
ADT_CLONE wrote:
This is my code
global.shopcontents = M.contents


Not exactly the best idea there. Whenever you edit the shopcontents list you'll be editing the M.contents list too. More likely you need a copy of that contents list, not the list itself.

Lummox JR
In response to Lummox JR
I dont want to edit it, I just need to know what mobs contents to display