Hello community i made this topic to gather around all the useful stocks and function that had been created/written by the community, feel free to post/create any useful global functions/stocks that can help us coders with creating plugins and shorten our coding time : 3
~ LIST ~
Seperate_Digital_Categories
PHP Code:
stock Seperate_Digital_Categories(const charSeperator=' ', const szString[], szValue[], len) { new iStrLen = strlen(szString), index = -1, iCounts;
I don't think that this is all that helpful. It's an entirely too vauge grouping and will just get lost.
"Seperate_Digital_Categories", what in the world does that mean?
Exterminate"? I don't think that that word has any usefulness in the context of programming. The concept of deleting or removing something based on "before or after a certain date" is known as pruning IIRC. Also, the default values that you've assigned to this function make it do absolutely nothing which doesn't make any sense. If a default value doesn't actually do anything then it shouldn't exist.
I don't think that low-level stocks should be writing anything to any files, calling process should be the one to do that.
I don't think that this is all that helpful. It's an entirely too vauge grouping and will just get lost.
I have to disagree with you, i think this thread would be very helpful and will make stuff much easier among programming plugins, because you don't have to rethink the whole logarithm and consume time for something already been done.
Quote:
Originally Posted by fysiks
"Seperate_Digital_Categories", what in the world does that mean?
its a simple function divides/separates 3 numbers in a string into a single digital houses. ex: "1000000" will be "1 000 000"
Quote:
Originally Posted by fysiks
Exterminate"? I don't think that that word has any usefulness in the context of programming. The concept of deleting or removing something based on "before or after a certain date" is known as pruning IIRC. Also, the default values that you've assigned to this function make it do absolutely nothing which doesn't make any sense. If a default value doesn't actually do anything then it shouldn't exist.
You are correct i just copied that from an old thread, feel free to improve it.
Quote:
Originally Posted by fysiks
I don't think that low-level stocks should be writing anything to any files, calling process should be the one to do that.
IN addition this topic is going to be extreme helpful for new beginners.
Perhaps you should provide documentation about what you think your functions do so people don't have to guess based on the confusing function names.
Quote:
Originally Posted by Natsheh
its a simple function divides/separates 3 numbers in a string into a single digital houses. ex: "1000000" will be "1 000 000"
The one posted here that was created by Bugsy is much better for reusable code. The delimiter to be used can easily be added as the fourth parameter with a default value of ','.
Quote:
Originally Posted by Natsheh
You are correct i just copied that from an old thread, feel free to improve it.
I'm unable to edit your post.
Quote:
Originally Posted by Natsheh
IN addition this topic is going to be extreme helpful for new beginners.
That is debatable. If you teach poor or confusing code, they'll learn those same bad habits. But I guess that's the nature of the internet, both good and bad exist.
Perhaps you should provide documentation about what you think your functions do so people don't have to guess based on the confusing function names.
I highly agree with you, i will find a free time to work on the documentation.
Quote:
Originally Posted by fysiks
The one posted here that was created by Bugsy is much better for reusable code. The delimiter to be used can easily be added as the fourth parameter with a default value of ','.
The difference between my function and bugsy function that bugsy function deals with integers while my code deal with strings, and it can be useful to dig out my numbers out of characters.
Quote:
Originally Posted by fysiks
I'm unable to edit your post.
You can notify me with a post, and I'll edit the first post after all this thread was meant for everyone to contribute.
The difference between my function and bugsy function that bugsy function deals with integers while my code deal with strings, and it can be useful to dig out my numbers out of characters.
That doesn't make any sense. Where would that even be used?
Just a simple stock to add a little detail on too low values.
If a message has 0.1, instead of 0.100 as default %0.3f will display
It will convert to only 0.1
Converts 0.101 to 0.1
Converts 0.111 to 0.1
Converts 0.010 to 0.01
Converts 0.011 to 0.01
0.001 stays 0.001
@EFFx on formatLowNumber can't you use floatround and then strip the zeros left?
To be honest I didn't try. The original stock was checking whole string message and if inside it contains a low float number, it converts... like
"Something happened blabla 0.01 seconds or time"
The stock takes everything besides the low float number and converts it. Instead of just adding %0.2f and having 0.10 when the value is 0.1, it prints 0.1 instead. The older version also finds players name inside the message, to avoid having a low float number inside the players name and thinking it's the actual low number. If you add as example %0.5f and have a number 0.00100, it'll print 0.001 only.
Not sure if with floatround it'll do 100x faster than that stock, but I've found this a long time ago and used so many times.