ID:175568
 
mob/Stat()
// Check for opened chest
for(var/obj/furniture/chests/C in oview(1,src))
if(C.open) stat("Chest",C.contents)

Here is the mob code. When ever the mob/pc is next to an opened chest I want a panel for that chest to appear for the user. Right now I can open and close chests, but nothing is happening. Any suggestions??

LJR
Are you sure you're toggling the open variable? (This would be my first guess)
If that isn't the case then try this.
mob/Stat()
var/obj/furniture/chests/C
for(C in oview(1,src)) break
if(C&&C.open) stat("Chest",C.contents)

-=Ken=-
In response to NeoHaxor
Yep I tried it anyways.. and didn't work.. you version is something I tried earlier too and it didn't work. Anyone else have any helpful suggestions?? Thanks for trying Ken.

LJR
In response to LordJR
Wait! I think I found the problem... try this!
mob/Stat()
for(var/obj/furniture/chests/C in oview(1))
if(C.open) statpanel("Chest",C.contents)

You had stat() without statpanel() and I'm not sure if it would work otherwise, but I have never seen it done before.
-=Ken=-

In response to NeoHaxor
yeah I thought of this too much earlier.. gave it a try just for kicks.. no go.. :(
In response to NeoHaxor
NeoHaxor wrote:
You had stat() without statpanel() and I'm not sure if it would work otherwise, but I have never seen it done before.

stat() will work without statpanel(), but stat() will not display a list if you supply a name argument.

stat("Label", listvar) // doesn't work
stat(listvar) // shows everything in the list

I think statpanel("Chest",C.contents) is what he wants though, so that they show up under the "Chest" tab.


Is this the only place you have a mob/Stat() proc? If you overide it in other places, you should be sure to include a ..() call so that both versions of the proc can expand on each other. Otherwise, only the last Stat() proc declared will be run.
In response to Shadowdarke
yes the only place and the code does not work.. I've since changed it back to it's original statpanel.. Just testing and trying out all kinds of things here.