[Include] r_commands - Clear and fast command processor!
#1


r_commands - Clear and fast command processor!

Hello all,
This is my first command processor, very fast and simple.
I'm building a big library and this is the smallest part of the library.

Usage
Simple, here two examples:
pawn Code:
COMMAND:test(playerid, params[]) {

}
CMD:test2(playerid, params[]) {

}
Also you can call the command public:
pawn Code:
command_test(playerid, "params");
CallBack(s)
I maked two simple callbacks to full command control:
pawn Code:
forward OnPlayerCommandSent(playerid, cmdtext[]);
forward OnPlayerCommandExecuted(playerid, cmdtext[], bool:success);
RCmd vs ZCmd
Test script:
pawn Code:
#include <r_commands>
#include <zcmd>

#define FILTERSCRIPT

public OnFilterScriptInit()
{
    new
        tick = GetTickCount(),
        tick2;

    for (new i = 0; i != 100000; i ++) // 100000 times
    {
        command_test(0, "\1");
    }
    tick2 = GetTickCount() - tick;
    printf("rcmd: %d ms", tick2);

    tick = GetTickCount();
    for (new i = 0; i != 100000; i ++) // 100000 times
    {
        cmd_test(0, "\1");
    }
    tick2 = GetTickCount() - tick;
    printf("zcmd: %d ms", tick2);
   
    return 1;
}
//==============================================================================
CMD:test(playerid, params[]) { //RCmd
    for (new i = 0; i < 500; i ++)
    {
    }
    return 1;
}
COMMAND:test(playerid, params[]) { //ZCmd
    for (new i = 0; i < 500; i ++)
    {
    }
    return 1;
}
Here the results:
Quote:

rcmd: 2187 ms
zcmd: 2253 ms

-- zcmd-rcmd = 2253-2187 = 66ms

As you see rcmd faster the zcmd in 66ms, and it's the very first version!

Download
Pastebin: http://pastebin.com/BP9wjpAY

Suggestions
* Use ****** sscanf2 plugin for make more than one parameter!
* Don't write the command name in big letters

Enjoy!

Reply
#2

Basically the same as ZCmd. It's no easier to use, and the only time difference is 66 milliseconds.

Congratulations. You have successfully made a ZCmd clone.
Reply
#3

Quote:
Originally Posted by Schurman
View Post
Basically the same as ZCmd. It's no easier to use, and the only time difference is 66 milliseconds.

Congratulations. You have successfully made a ZCmd clone.
The code of the two includes are very different and you can check this.
You can use it or not use it, but every 1ms is important.
Reply
#4

I didn't say you copied it; I said you created a clone.
Reply
#5

Quote:
Originally Posted by Schurman
View Post
I didn't say you copied it; I said you created a clone.
Ok, and what your suggestion for the next version?
Reply
#6

We have enough good command processors. Make something different.
Reply
#7

Cool. You stole my lowercase() function from ecmd, and changed the name of the return variable.

This is just an altered version of zcmd. Why can't people be original these days? FFS.
Reply
#8

Quote:
Originally Posted by Emmet_
View Post
Cool. You stole my lowercase() function from ecmd, and changed the name of the return variable.

This is just an altered version of zcmd. Why can't people be original these days? FFS.
Oh man don't cry, you want credit?

Why people searching how to say it's bad? Why you can't say that it's good? all the time: bad, bad, bad...
Reply
#9

[quote=Swimor;2172300]Oh man don't cry, you want credit?

no
Reply
#10

Quote:
Originally Posted by Emmet_
View Post
Don't be such an asshole. It's not like I own that little piece of code, I didn't put a logo on it for god sake.

Why should we say that it's good? Because it's not. We already have enough command processors, and your include uses most of zcmd.

If you can't take a bit of constructive criticism, then you really need help. Nobody gets mad over a bit of constructive criticism, unless you're a 12 year old kid who gets picked on at school.
And how your command processor is better than zcmd?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)