Questions concerning a constructor/Class

Started by Mötley, May 09, 2016, 01:27 PM

Previous topic - Next topic

Mötley

What is the Max limit of scripting a lot in a constructor before any possibility of lagging the server or doing any damage to the efficiency of a server?

^^^ Is that even possible?

I have maybe somewhere around 20 - 30 scripting items that are array values Like weapons that I would prefer to add to the class but I feel that I could mess a lot up.  I prefer not to use array methods and attempt to add these values into a class. So I was kinda curious to having two, class, constructor. to separate the servers files into a more efficient build

to help separate the data as well ensure that the system files(server files) are clean..


If anyone could point me in a good direction I would appreciate that. as I want to keep this build very clean.

But there is some things that Will require many classes so I think it would be best to just script within differnt classes and attempt to not use a constructor in those different classes

I'm just lost in methods :P

Murdock

Constructors aren't any different in execution than regular functions..

Mötley

Answers that question. I know if you want certain functions say MD5 wou will need to use ::MD5. just an example.

So basically as long as there is not crappy laggy scripts everything's good.

Is there any good way to separate the data? also what about the 20 to 30 different array values? If there not account related just create a class for this? ( I never really used classes or constructors just many arrays xD) Classes are correct way of valid scripting.. yet quicker!!

DizzasTeR

Quote from: Mötley on May 09, 2016, 03:00 PMIs there any good way to separate the data? also what about the 20 to 30 different array values? If there not account related just create a class for this? ( I never really used classes or constructors just many arrays xD) Classes are correct way of valid scripting.. yet quicker!!

Squirrel may be having the advantage of OOP but you can't say arrays are bad, you can do almost all the stuff a class can do with arrays and tables but you don't have to complicate yourself.

Quote from: Mötley on May 09, 2016, 03:00 PMSo basically as long as there is not crappy laggy scripts everything's good.

Yes.

Quote from: Mötley on May 09, 2016, 03:00 PMAnswers that question. I know if you want certain functions say MD5 wou will need to use ::MD5. just an example.

Its all about environments, you need to learn how environments work in-order to use the complete benefit of classes.

Mötley

That's what I am trying to understand.
As I said before I never at one time used a class and would use soo many arrays.

What I like about scripting into the class/constructor is the fact let's say a check for a password on a login.

Instead of a local to get the password I can just get the value from the class. Very nice method of scripting. I try everything I can to NOT have any locals.

I finally took into consideration to just script everything into the class/constructor and see how the outcome turns instead of focusing on being perfect. This way I can move quickly and see what I really want to do afterwards.

QuoteIts all about environments, you need to learn how environments work in-order to use the complete benefit of classes.
Any good pointers as to what you are referring to? I probably already get it to an extent but I want better.

KAKAN

oh no

DizzasTeR

Motley, having locals isn't bad since locals are faster as they are not stored in global table.