ID:2204456
 
(See the best response by Nadrew.)
Code:
        Stat()
statpanel("Inventory", contents)
statpanel("Player")
stat("")
stat("Health","[health]/[max_health]")
stat("Mana","[mana]/[max_mana]")
stat("Rage","[mana]/[max_mana]")
stat("Attack",atk)
stat("Defense",def)
stat("")
stat("Skills:","")
var/tmp/i
for(i=1;i<=skill_names.len,i++)
stat("",skill_names[i])

Placeholder skill list:
var
global
list
skill_names= list(
"Flaming Fireball",
"Cutting Edge"
)

Problem description:
I want to when I click in a skill in the stats, to exceute that skill (or a proc at least)

Best response
You'd want to display actual objects in the panel, then you could use their Click() proc to execute whatever you need.

obj
skill
Fireball
Iceball

Click()
usr << "You have cast [src]!"

mob
var/list/my_skills = newlist(/obj/skill/Fireball,/obj/skill/Iceball)
Stat()
..()
statpanel("Skills",my_skills)
Wouldn't creating a list with the objects create more objects of the same type?

Also, wouldn't it be better if I put all the skills in a single proc? (The skill is chosen via an argument)

Anyways, I'll try your suggestion.
That was purely an example to show you how displaying objects in statpanels works, it was in no way meant to be applied directly to what you're doing.

You should most definitely not be putting all of your skills in a single proc. Using datums/objects for this is always a better route.

Skill
parent_type = /obj
proc
Execute(mob/user)
// This will be shared across all /Skill children.
// You should put anything the skills have in common here such as resource usage and checking if it's possible to use it.
// Returning 1 if it's successful or 0 otherwise.


Fireball
Execute(mob/user)
if(..(user)) // Make sure the parent passes.
// Now do stuff specific to the fireball here.


Iceball
Execute(mob/user)
if(..(user))
// And stuff specific to the iceball here.


Click() // When any /Skill is clicked
Execute(usr) // Call Execute() with usr passed.


Now when you want to learn a skill you simply do:

if((locate(skill_type) in skills))
src << "You already have that skill!"
return
skills += skill_type


Where skill_type would be something like /Skill/Fireball.
If you want the skill card with the obj beside it check here http://www.byond.com/forum/?post=2200408