ID:164853
 
How would I make it so that when i click on a mob, i get a statpanel with that mob's stats, and the statpanel's name is the mob's name?
This can be done with a simple built-in function - you can [look up and] set client.statobj to make all your statpanels regard to a different object. See if that does it for ya.
In response to Kaioken
Kaioken wrote:
This can be done with a simple built-in function - you can [look up and] set client.statobj to make all your statpanels regard to a different object. See if that does it for ya.

we can't find anything to do with client.statobj anywhere in the reference.
In response to Adam753
http://developer.byond.com/docs/ref/info.html#/client/var/ statobj
I'm not too sure about that statobj stuff, but this is how I'd do it.

mob
var/selected // I personal put all of my extra variables like this into a list as not to clutter up everything.

Click()
if (!ismob(usr) || !usr.client) return
usr.selected = src
// usr is the clicker, src is the clicked mobile

Stat()
if (src.selected)
var/mob/M = src.selected
statpanel(M.name)
if (M.client)
stat("Client Info") // display client stuff for src.selected
stat("Key:",M.key)
stat("Address:",!M.client.address ? "Aieee! Null!?" : M.client.address)
stat("Mobile Info") // display mobile stuff for src.selected
stat("Name:",M.name)
stat("M's Statistics:","go here")
In response to Adam753
You must've been looking VERY hard. :O
In response to Keeth
Keeth wrote:
 mob
var/selected

//------

var/mob/M = src.selected
>


You need to re-learn about typecasting. Theres no reason to do that. No, typecasting a var does NOT manipulate it at all, neither does it create any new object (on its own). Typecasting is used only for compile-time processing - mainly for error checking.
And I've already mentioned this to you in another topic.
In response to Kaioken
It works, so I don't much care about anything like that.
If he wants to be proper about it, he can just use that as an example and do it the proper way.
In response to Keeth
Yes, but I didn't refer my previous post to him or anything, but to you, so you may fix your useless bad practice (really, for example, bad/ripped codes 'work' too, by definition. 'Working' isn't necessarily 'good').
Its a really simple matter I'm sure you'll almost instantly understand if you choose not to just ignore it.
Your choice though, of course.