ID:179386
 
I was wondering if it is possible to show a certain statpanel IF a certain var equals 1,

I am also wondering how I would get a certain player's HP var to be shown in a stat in the panel
        var/E = usr.watched
statpanel("Watched")
stat("Stamina:", "[E.HP]")
<dm>
of course I get:

bleh.dm:262:error:E.HP:bad var

All this trouble for an Admin verb that
lets my Admins Watch people and their
stats *sigh*

any help will be appreciated
Due to the fact that the compiler doesnt know what E is, it gives you a bad variable. Try var/mob/M = usr.watched and use M instead.

Alathon
In response to Alathon
Okay, var/mob/M I originally went with var/M, as for a Hidden Stat Panel, I figured out how come I couldnt get that to work, I wasnt doing the if() properly, and I wasnt setting the right var

who`d`a thought that a few little letters caused so much trouble,
Here's a pretty simple way to view others stats using a for() loop;

mob/Stat()
..()
statpanel("Other people's stats")
for(var/mob/M in world)
stat("[M]'s stat:","[M.health]")


Change that example to work.

As for your other question here's another example:

mob
var
haspanel = 0

mob/Stat()
..()
if(haspanel)
statpanel("New panel")
else
return

mob/verb/Add_panel()
if(usr.haspanel)
usr.haspanel = 0
else
usr.haspanel = 1


In response to Nadrew
I`ve gotten what I need to work perfectly, except when the player being watched logs out it produces alot of cannot read null.HP errors, so I need to fix that.

I especialy like that I can Delete Items out of the player`s invintory, and such so that if they get ahold of an Admin only Item, They'll lose it, of course, they'd be lucky to have only Lost it, because i`m gonna make my Admin only items do somthing really bad to normal users if they try to use it(mabey del())

In response to Pillsverry
Pillsverry wrote:
I`ve gotten what I need to work perfectly, except when the player being watched logs out it produces alot of cannot read null.HP errors, so I need to fix that.

Try this:
var/mob/E = usr.watched
if(E)
statpanel("Watched")
stat("Stamina:", "[E.HP]")

You need to check if usr.watched==null, you see, because it can change.

Lummox JR