ID:157134
 
How would call be used? I've looked through the reference and from what I've read it sounds like it could be used to make dynamic calls?

Ex: Object_A was pushed so I call Proc Object_A?

Am I missing something or am I correct? If I am how would I implement the call? I keep getting errors.

Skill
parent_type=/obj/
var
energy=0
type
health=0
Click()
call(usr, src.name)
call()() is not a function you should be needing to use often. In this case, you'll just want to give the proc to the skill object itself, and call that proc with the player using it as an argument.
Eragor222 wrote:
I've looked through the reference

My mistake for my post earlier it seems I'm the one who needs to read things more thoroughly.
In response to Garthor
darn, I thought I might be able to save a line of writing
In response to Eragor222
If you really want to, you can do it as when you Click the skill it calls a mob proc with the one who clicked as the source and the name of the skill object is the argument to be used in this process. aka....

obj
skill
karate_punch // make sure to use underscores " _ "
Click() // They show up as spaces in the name
usr.useskill("[src.name]")//usr is safe to use
// usr refers to the client assosciated with
//the Click() action. most people don't use
// usr because it's tricky, but once you know
// what the usr variable is then it's a great
// tool to use, especially for this.

mob
proc
useskill(skill as text)
if(!skill) return // for the sake of errors
if(skill=="karate punch")//use a space this time.
src..... //what you want to happen goes here


This makes it easy for you to code and manage both in game and while in development, you really dont want to be in a game with alot of skill okjects and end up thinlking "Where the hell is that object" when looking for it again in code. For me, this helps alot and assinging an icon to the object make it looks very nice in the menu ;)
In response to Bravo1
Yeah that's the way I did it. I was just wondering if it could be done like that.
In response to Bravo1
You CAN do that, but it would be very, very poor design.

Also, "as [whatever]" is meaningless for proc arguments.
In response to Garthor
Garthor wrote:
You CAN do that, but it would be very, very poor design.

Also, "as [whatever]" is meaningless for proc arguments.

Considering this single proc can control all of the jutsu in my game and allows me to manage them easily I find it very good coding. Please don't knock it unless you try it because they said electric engines for cars were very poor engineering back in the 1920's and....

also, as [whatever] gives me the option to test a skill without creating the skill object, I have a verb that calls the promp and it promps me for the skill name. It's very helpful in the testing phase.
In response to Bravo1
The "as" arguments work for verbs but not for procs, that's what Garthor was referring to; if you need the name, you simply define a variable in the arguments for the proc. The as part is completely useless:
proc/My_Proc(var/argument1, argument2, etc)


If you keep adding usr.useskill by defining Click() under each attack object... it would have been better to just define what to do in that click. Easier to find by searching for one name instead of two. This is probably one reason Garthor mentioned it was a poor design.

But if I were you, I would have defined the useskill under the main object if I truely wanted attacks in one procedure (which I probably wouldn't):
Skills
Click() // Anything within this parent, unless overwritten, calls the following:
usr.useskill(lowertext(src.name))

Punch_Buggy_No_Punch_Back
Fire_FIRE_FIREEEEEE_MWAAHAHAHAHAHAHA
Note that the above is an EXAMPLE. (You can actually make stuff [no /mob, /obj, etc.] like that in BYOND, these are called datums)

Also, to make it much more efficient and clean, you are better off switch()ing the statements then keep doing an evaluation via if(skill==...
In response to GhostAnime
Thats exactly what I meant, he could use the Click under the Skill item and it calls it's name, so even objects under the obj/skill/ path will call the Click operation with the items name as the argument.

as for the As statement, I messed uip on the coding in the DM there, in my code I have it as a hidden verb so it calls it when it's endered into the command line, However I do switch it back to being a proc so that normal player who, for some reason, know that bit of code, can't do it themselves and use whatever skills they want without aactually having the object for it.
In response to Bravo1
Bravo1 wrote:
Garthor wrote:
You CAN do that, but it would be very, very poor design.

Also, "as [whatever]" is meaningless for proc arguments.

Considering this single proc can control all of the jutsu in my game and allows me to manage them easily I find it very good coding. Please don't knock it unless you try it because they said electric engines for cars were very poor engineering back in the 1920's and....

also, as [whatever] gives me the option to test a skill without creating the skill object, I have a verb that calls the promp and it promps me for the skill name. It's very helpful in the testing phase.

Just because you use it doesn't mean it's good design. A proper, object-oriented design would allow you to easily create modifications of skills (for example, Fire, Fira, Firaga), without having to create a huge number of if() statements (or a giant, unwieldy switch() statement). It makes management easier, it organizes your code better, and it's literally the entire point of an object-oriented language.

You're just doing things the hard way and don't even realize it because you've never used something better. Of course, you're free to do things however you want to, but I'm not going to let you tell people to follow your horrible design practices.
In response to Garthor
Seriously, Garthor, kncok it off, all you're doing is saying: "I'm better" When all I'm trying to say is "It's just as good."

Act your age, if it works for someone then it works, don't say it's "not good" just because you don't use it or don't like it.

my procs, my objects my this, my that, whateverr, they don't use long if() statements, they don't use long switches, they don't do anything like that, I never said they did, and you assumed they did because you think you have to point out that you're smart. My system is very compact, very managable and very clean in comparison to the countless libraries I've seen, it's even nicer than some of the stuff Shadowdarke makes, but thats only because I've been working on this object system for a very long time. All I did was give him a very simple VERY cut down version of my own and it doesn't reflect what I have at all, it's just a quick solution.

So please, until you've seen my code yourself, with your own eyes I don't want to hear anything from you about it being inefficient or bad.
Thats like me saying that Russia is the worst country when I dont know a damn thing about russia other than where it is.

Now please, leave it at this.


As an added note, you're taking this terribly off topic, I may not have started this, but I'm doing my best to end it while we're still within the realm of sanity.
In response to Bravo1
Bravo1 wrote:
Seriously, Garthor, kncok it off, all you're doing is saying: "I'm better" When all I'm trying to say is "It's just as good."

No, I am saying that object-oriented design principles are better. This is not opinion. If you continue programming long enough where you actually learn how to take an object-oriented approach, and you give up your stupid "my way is just as good regardless of the facts" mindset, you'll eventually agree with me. Until then, you're wrong.

Act your age, if it works for someone then it works, don't say it's "not good" just because you don't use it or don't like it.

A spoon can work as a knife if all you need to cut is butter. This doesn't mean you should be telling people to use spoons to cut things in general, and especially not if they are trying to eat some steak.

my procs, my objects my this, my that, whateverr, they don't use long if() statements, they don't use long switches, they don't do anything like that, I never said they did, and you assumed they did because you think you have to point out that you're smart. My system is very compact, very managable and very clean in comparison to the countless libraries I've seen, it's even nicer than some of the stuff Shadowdarke makes, but thats only because I've been working on this object system for a very long time. All I did was give him a very simple VERY cut down version of my own and it doesn't reflect what I have at all, it's just a quick solution.

So please, until you've seen my code yourself, with your own eyes I don't want to hear anything from you about it being inefficient or bad.

Blah blah blah. I don't care what you have in your own project. What I care about is what you post on these forums. What you posted here, in this thread, was bad. Therefore, I am going to tell you not to post bad things. If you don't want me to tell you to not post bad things, then only post good things.

Now please, leave it at this.


As an added note, you're taking this terribly off topic, I may not have started this, but I'm doing my best to end it while we're still within the realm of sanity.

I would spit on you for this if I could. You don't get to spew a whole bunch of crap and then say "leave it at this". You don't get to avoid criticism just because you REALLY don't want it. You can't just insist you get the last word. If you want to gracefully end this, then admit you were in the wrong and shut up. You can't sneak the last word in and say "OKAY LET'S JUST LEAVE IT AT THAT".

As for being off-topic... the topic is helping somebody learn how to program. You are anti-helping them. Preventing you from doing so is entirely on-topic. And, of course, if I were to make the thread "Bravo1, stop posting entirely" you'd complain about that too, so I'm just fine staying here.
In response to Bravo1
Bravo1 wrote:
Seriously, Garthor, kncok it off, all you're doing is saying: "I'm better" When all I'm trying to say is "It's just as good."

And what you're saying is wrong. Just because it works, doesn't mean it's right.

Compare these two paragraphs:

For example, I can drive the wrong way down a motorway. I'm getting where I want to go, so by your logic, I'm doing it right. Even though, every informed driver would tell me I'm being an idiot (probably in less kind words).

For example, you can continue to program the way you are. You're doing what you want to do, so by your logic, you're doing it right. Even though, every informed programmer would tell you you're doing it wrong (probably in less kind words).

See what I did there? I used an example of terrible driving and compared it with your programming practices.

So please, until you've seen my code yourself, with your own eyes I don't want to hear anything from you about it being inefficient or bad.

If you've posted code on this forum, which you must have, then we have seen the way you program your games. That makes this entire statement invalid. Because obviously, we have seen your code for ourselves. Maybe not all of it, but enough to make a judgement on it's stability. It doesn't take much of an example to realise when someone is doing things poorly.

Thats like me saying that Russia is the worst country when I dont know a damn thing about russia other than where it is.

The difference is, we know more about your programming practices than you do about Russia, hence the criticisms you get.

As an added note, you're taking this terribly off topic, I may not have started this, but I'm doing my best to end it while we're still within the realm of sanity.

The topic is helping the OP with their problem by providing possible solutions. If you provide a terrible solution, correcting you becomes part of the topic. There's nothing off topic about it except your unwillingness to learn from a better programmer and semi-hostile reactions towards him for trying to help you.

Garthor doesn't reply to your posts simply to mock you. He replies to you to tell you you're doing it wrong. If you can't handle being told you're doing it wrong, don't try to "help" people until you're a better programmer. It's really that simple.

And for the record, Garthor is right.
In response to Garthor
Look, let's just end this here. We're both old enough to realize fighting isn't going to get us anywhwere so let's just agree to disagree. I'm sorry if I've caused you any trouble, I was just trying to state my opinion.

It'd be great if I got an apology back as well for just, being rude about it, but, you aren't required to, the only reason you would want to apologize for all this is because you want to stop arguing and maaaaaybe not be friends, but at least to not be enemeies, either way, you don't have to if you don't want to, but still, I do apologize for all this, and the short argument on the other threads. I'm just going to stick to what I'm doing now and, when my game comes out, if you'd like, I could give you some bonus stuff or GM or something because, I really hate making enemies and thats just not what Byond is about so, let's do our best to try to be friends, or at least not hate each other =P