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?....
ID:140102
![]() May 8 2010, 11:25 am
|
|
Code:
obj/Skills Problem description:How do i get the skill to show up in the panels? and even get it to work?.... |
![]() May 8 2010, 12:58 pm
|
|
Use stats().
|
Isenggard wrote:
ok >.> that helps so much... Ikr. JK mob/ |
mob |
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".
|
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 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 |
obj/proc/what() |
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.
|
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() 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 |
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 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. |
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() Wasn't that oh so simple? |
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) 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). |
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. |
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 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. |