ID:140102
 
Code:
obj/Skills
proc/Use()
Blast
Use()
usr<<"bam"


Problem description:How do i get the skill to show up in the panels? and even get it to work?....

Use stats().
In response to R_I_C_Productions
ok >.> that helps so much...
In response to Isenggard
Isenggard wrote:
ok >.> that helps so much...

Ikr. JK
mob/
var
skills=list()
stats()
statpanel("skills")
stat(skills)
obj/skills
verb
get()
set src in usr.loc
src.loc=usr
skills+=src
In response to R_I_C_Productions
that's not what I was looking for... I wanted it so you get it when you Login.
In response to Isenggard
mob
Login()
Stat()
for(var/obj/skill/s in usr)//usr.loc if that doesn't work
statpanel("Skill")
stat(s)

In response to R_I_C_Productions
That's very wrong. At least take two seconds to run whatever you write through the compiler to error-check before you post it.
To make the skill show up in "the panels", you need to first create an instance of the skill using new(), and then output it to "the panels", using something that's going to depend on what the hell you mean by "the panels".
In response to R_I_C_Productions
I only get it working if the obj has a verb in it.

But how would I be able to like get it all working

obj/skills
proc/use()
fire
icon='lalala.dmi'
verb/fire()
usr<<"lalalal"


how would I be able to use the proc for all my skills so they share that proc. so that everytime I Click the skill it won't activate the freaking verb... I have been stuck on this for a long time
In response to Isenggard
obj/proc/what()
view() << "Now every obj has this proc"

obj/Skills
proc/what()
view() << "Now every obj under /obj/Skills has this proc"

Skill1

Skill2

Skill3


In response to Jarquille
Of course, if you ACTUALLY do that you'll get an error as you are defining the proc twice. When you want to override a proc, you need to omit the proc/ before it.
In response to Jarquille
I solved it already.

added it to stats panel, made a var for it. made a list for it. and then have it add every time I gain a skill. took a little bit but I got it all done though.

mob/Stat()
statpanel("Skills")
stat(src.Skill)
obj/var/Skill
mob/var/list/Skill = list()

And something like this
usr.skills += new Skill_Gained

I don't know if that's ugly or not but that's what I wanted it to do so yeah
In response to Isenggard
you don't really need to do that. If you want skills and normal items seperated inside the stats then you would add a variable to the skill object... example...


obj
var/skill=0
Skill_object
skill=1

mob
Stat()
if(!src.client) return //theres a chance for errors, this will remove the posibility.
statpanel("Items")
for(var/obj/o in src.contents) //usr src here, not usr.
if(!o.skill)//so if it isn't a skill, show it.
stat(o)
statpanel("skills")
for(var/obj/s in src.contents)
if(s.skill)// if it IS a skill then show it here
stat(s)
// you can differentiate with just useing istype() but I find adding a variable is just a bit easier.


As for adding the object tself just do a new/obj/skill(usr) //put the mob you want it to go to in usr such as var/mob/m or something, try not to use usr unless it's in a proc that's src is not a mob but was called by the action of said mob.
In response to Bravo1
That is rather a disgusting waste of precious processing. Why search through all of the /obj's when you can be a bit specific and look for /obj/skillas was posted earlier (and /obj/item for your snippet)?

Also, I feel like I should point out that if you have a specific list you wanted to display in the stat panels, it would be wise to read the DM reference and articles about this stuff... that way, you may pick up on some tricks.

One trick is, as seen in the article link on the right hand side (not within the body of the text when I was looking through), you can display a whole list in a panel by doing statpanel("Name of panel", /list ref) or even stat(/list):
var/list/inv = newlist(/obj/Car)
mob/Stat()
statpanel("Inventory",inv)
..()
mob/Stat()
statpanel("Inventory")
stat("Useless items\n----------")
stat(inv)
..()



Wasn't that oh so simple?
In response to GhostAnime
Your indentation in the second example is wrong. The stat()s don't go in a block under the statpanel(). Additionally, the two loops:

for(var/obj/O in src)
if(istype(O, /obj/skill))
//...

for(var/obj/skill/O in src)
//...


are equivalent, with perhaps a very very minor speedup in the second case due to internal code (but it still has to loop through every element in the list).
In response to Garthor
You guys again, First off, stat() can be on the same line as stapanel(), just so long as Stat() is before that.

Secondly, once again I made a quick easy solution for him, I'm not trying to give him good code, there's no point in doing the work for him, he should be able to take the "poor" examples I give him and make it much more efficient. There's no way in hell I'm going to give people the answers, that's just not the way to help a person.
They say, if yuo give a man a fish you feed him for a day, if you teach a man to fish you feed a man for life.

you're giving him the fish and expecting him no to come back for more, me, I'm giving him a very crappy rod and telling him "good luck" it may seem cruel or like a bad idea, but trust me, this way when the rod breaks he comes up with something much more suited to him, rather than just coming back here and asking for another one.
not a great analogy but it works I guess.
In response to Bravo1
I apologize for the extra indentation for stat(). It has been a long time since I used it and I should have left a disclaimer that it wasn't tested as shown.

When showing other snippets, it is best to show them the most efficient methods as possible. Tell me which is better to fix a car with: a wrench or a hammer?

The wrench is the more appropriate; think that has the efficient way to program. A hammer is much more crude, it may get the job done but either it will not look very pretty in the end or it'll start giving you problems down the road (most likely both!).

People like Garthor try to help make the developer UNDERSTAND what they are doing wrong and teaching them more efficient or a faster way to do something.

Would you want to keep copying and pasting a code for something that could have been shortened in one line?

Here's an example of what I mean:
// Horrible method
Talk(msg)
if(isGM(src))
world << "{GM} [src.name]: [msg]"
else if(isLord(src))
world << "{Lord} [src.name]: [msg]"
else if(isPookeman(src))
world << "{Weirdo} [src.name]: [msg]"
else
world << "{Nobody} [src.name]: [msg]"

// More better way
Talk(msg)
// Assume that a title variable has been defined and modified earlier
world << "{[src.title]} [src.name]: [msg]"


In addition, we do this so the person would not come back to the forum as much in the future., If you give a person a broken rod, they'll come back complaining and expecting to be given a better rod like how someone gave them a broken rod. Trust me, it has happened numerous of times before.

We are not trying to discourage you from programming or saying you are a horrible programmer, we are trying to impart more efficient/easier methods for the person in question AND to those in the future, who may find these topics via forum search.
In response to Bravo1
Bravo1 wrote:
I'm not trying to give him good code

THEN DON'T POST