SA-MP Forums Archive
[Include] Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) (/showthread.php?tid=619862)

Pages: 1 2 3 4 5


Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Yashas - 23.10.2016

Smart Command Processor BETA
Latest Version: 0.3.2 beta (25th December 2017)

Important Issues:
  1. YSI related includes must be included before SmartCMD for it to work.
What is SmartCMD?
SmartCMD is a fast feature rich command processor which simplifies the creation and handling of commands. SmartCMD (known as iZCMD+ in its initial days), is iZCMD loaded with new features but ironically, it is faster than iZCMD. SmartCMD works on the same principle which iZCMD/ZCMD works on, i.e: create commands as public functions and call the public function when the command is used. However, there are few subtle changes in the core algorithm to make allowances for the new features.

What's new?
How to install?
SmartCMD is available as a PAWN include. Download the include from one of the download sources mentioned at the 'download' section of this topic and place it in your "pawno/include" folder.

To add SmartCMD to your script, include 'smartcmd' anywhere in your script (as long as it is included before it's use) using the following code:
Code:
#include <smartcmd>
If you are using a filterscript, ensure that you have FILTERSCRIPT defined before including SmartCMD.

Code:
#define FILTERSCRIPT
How to upgrade to SmartCMD from iZCMD/ZCMD?
Changing commands:
  1. Open Find & Replace Dialog (Ctrl + H)
  2. Provide search term as "(playerid, params[])"
  3. Set the replacement text to "(cmdid, playerid, params[])"
  4. Click on Replace All
Changing callbacks:
  1. Go to your OnPlayerCommandReceived declaration if it exists
  2. Change the declaration to "OnPlayerCommandReceived(cmdid, playerid, cmdtext[])"
  3. Go to your OnPlayerCommandPerformed declaration if it exists
  4. Change the declaration to "OnPlayerCommandPerformed(cmdid, playerid, cmdtext[], success)"
Converting iZCMD/ZCMD alternate commands to SmartCMD alternate commands:
  1. Add "ALT:alternate_name = CMD:original_name;" anywhere in your script outside executable blocks (functions).
  2. Remove the old iZCMD/ZCMD type alternate command
Replacing manual command function calls:
  1. Open Find Dialog (Ctrl + F)
  2. Search for "cmd_"
  3. Replace "cmd_urcmd(playerid, params)" with "cmd_urcmd(cid_urcmd, playerid, params)".
You can upgrade your code using SmartCMD features as you like. For example, you can assign admin levels to command using flags and check the sender's admin level in OnPlayerCommandReceived. You can do the same for other class specific commands. You can do a lot with this include. It is up to you to decide how you'll make the best use of this include.

Creating commands
You can create commands in four different ways. All the forms of command declarations are functionally identical.

For every command you create, SmartCMD creates a public function with the command's code (check Technical Details section to know more). This public function is known as the command('s) function. SmartCMD also assigns a unique number to each command which is known as command id. An invalid command id is identified with INVALID_COMMAND_ID.

Code:
COMMAND:yourcommand(cmdid, playerid, params[])
{
      return CMD_SUCCESS;
}
CMD:yourcommand(cmdid, playerid, params[])
{
      return CMD_SUCCESS;
}
command(yourcommand, cmdid, playerid, params[])
{
      return CMD_SUCCESS;
}
cmd(yourcommand, cmdid, playerid, params[])
{
      return CMD_SUCCESS;
}
When a player types "/yourcommand parameters", the command function will be called. The 'cmdid' parameter gives you the unique command id which you can use to manipulate the command and its properties. The 'playerid' parameter will have the id of the player who used the command. The 'params' array will have the text which the player typed after the command (in the given example, params will have "parameters"). If any leading spaces were present in the parameters, they will be absent in 'params' array.

You must return CMD_SUCCESS (or 1) if the command was executed successfully and CMD_FAILURE (or 0) if the command failed to execute properly. If there is no return statement in your command or if the command crashes during execution, CMD_FAILURE will be returned by default.

You can return '1' in place of CMD_SUCCESS and return '0' in place of CMD_FAILURE if you wish to.

Adding default flags
Unlike other command processors, SmartCMD allows you to give default flags for commands while writing the command itself. It is 'optional', you can write a command without providing default flags and it will still compile. The flags of such commands will be initialized with zero (the default value for default flags can be changed by defining CMD_DEFAULT_FLAG).

Code:
enum (*=2)
{
     ADMIN_COMMAND = 1,
     VIP_COMMAND,
     DEBUG_COMMAND
}
COMMAND<ADMIN_COMMAND>:ban(cmdid, playerid, params[])
{
  return CMD_SUCCESS;
}
CMD<ADMIN_COMMAND>:ban(cmdid, playerid, params[])
{
  return CMD_SUCCESS;
}
command<ADMIN_COMMAND>(ban, cmdid, playerid, params[])
{
  return CMD_SUCCESS;
}
cmd<ADMIN_COMMAND>(ban, cmdid, playerid, params[])
{
  return CMD_SUCCESS;
}
That's it! No junk in OnGameModeInit or OnFilterScriptInit or anywhere else.

The flags are stored in a hidden variable which identifies itself with the command name prefixed with 'flg_'. This variable can be accessed and modified by you at runtime.

Code:
CMD:test(cmdid, playerid, params[])
{
     printf("This command's flags variable has the value: %d", flg_test);
     flg_test = ADMIN_COMMAND; //You can even change the flags by directly assigning values to the flag variable
     return CMD_SUCCESS;
}
When you don't know the command's name beforehand or when you are dealing with a general case where the command could be any command, you can obtain/modify the flags using GetCommandFlags(cmdid) and SetCommandFlags(cmdid, flags) functions.

As the name suggests, GetCommandFlags(cmdid) is used to access a command's flags and SetCommandFlags(cmdid, flags) is used to set a command's flags.

In an earlier example, flags was used as a bitmask. However, you have all the freedom to use it in whatever way you want as the flags is essentially a cell/variable associated with each command. It can be used to store an integer, float, etc.

Adding alternate command names:
SmartCMD introduces a new syntax for adding alternate names to commands. Calling the alternate command is as good as calling the actual command itself performance-wise.

Code:
CMD:spectate(cmdid, playerid, params[])
{
    //even when you use spec, sp, the cmdid passed to spectate function will always be that of the spectate command
    return 1;
}
ALT:spec = CMD:spectate;
ALT:sp = CMD:spectate;

ALT:alternate_name = CMD:original_name;
When a player uses an alternate command, SmartCMD directly calls the parent command, unlike iZCMD/ZCMD where the alternate command is first called which then calls the parent command.

The command function of the parent command which the alternate command points to (spectate in the above case), when called via an alternate command (spec, sp, view in the above case), will receive the command id of the parent command. There is no way the command function can find out if the alternate command was used or if the parent command was used. However, you must note that the alternate commands do have their own unique command id. This allows you to modify properties of an alternate command without affecting it's parent command. The alternate command also has it's own flags variable. The flags variable is initialized with the flags of it's parent command just once during initialization. Any change made to the flags of any alternate command won't affect the parent command or vice versa.

You can make two separate distinguishable commands which share the same code using the function reassignment feature. When a reassigned command is called, the parent command will be called with the alternate command's command id (you can't call it an alternate command anymore; it is just a command which has its command function assigned to another function).

In such cases, you can either use GetCommandID or use the scripter-friendly command id variables to check which command was actually used by the player.

Code:
//abc is not an alternate command to xyz but has it's command function reassigned to that of xyz
CMD:xyz(cmdid, playerid, params[])
{
      if(cmdid == cid_xyz) //directly using variables is faster than using GetCommandID
      {
              //player used /xyz
      }
      else if(cmdid == cid_abc) //cid_xyz and cid_abc are defined by SmartCMD
      {
             //player used /abc
      }
      return CMD_SUCCESS;
}
Every command has an id variable which is identified as command name prefixed with "cid_". These are fixed constants which cannot be modified.

Code:
CMD:xyz(cmdid, playerid, params[])
{
      printf("The command id of xyz is %d", cid_xyz);
      cid_xyz = 123; // error - you cannot modify a constant variable
      return CMD_SUCCESS;
}
Adding additional command functions
You can create any number of additional functions for a command. These are also known as command modes or command states.

The syntax for creating an additional command function is as follows:

Code:
CMD:ban[params](cmdid, playerid, params[]) //Flags for additional command functions are redundant.
        return SendClientMessage(playerid, -1, "/ban [playerid/name] [reason]");
CMD<ACMD>:ban[help](cmdid, playerid, params[]) //You can still provide the flag if you want. It has no meaning however, i.e: it wont be used. 
        return SendClientMessage(playerid, -1, "Bans the player.");
CMD<ACMD>:ban(cmdid, playerid, params[]) //all the additional command function use the flags 
{
     //ban code
     return CMD_SUCCESS;
}
The flags of an additional command function have no meaning, they are redundant. They are there for the sake of providing the choice of readability, it matters for those who would prefer to keep the flags in additional command functions for consistency.

There must always be a command function without any specific mode. This will be the command function executed when the player types the command.

Each additional command mode/state is given a unique name inside the square brackets ([ ]). To execute an additional command function, use have to use ExecuteCommand function.

Code:
ExecuteCommand("ban", state_name, playerid, "params");
Callbacks
When a player sends a command, SmartCMD calls OnPlayerCommandReceived (if you have defined it in your script) before executing the command where you can decide if the command has to be executed or not. If the command function is allowed to execute in OnPlayerCommandReceived, SmartCMD will call the command function. After the command function finishes executing, SmartCMD will call OnPlayerCommandPerformed (if you have defined it in your script) with necessary details including the return value of the command function.

OnPlayerCommandReceived
Arguments: Return Values:
1 - Will allow the execution of the command function if it exists. If the command does not exist, OnPlayerCommandPerformed will be called with the "success" parameter as CMD_FAILURE.
0 - Will prevent the execution of the command function.

Code:
public OnPlayerCommandReceived(cmdid, playerid, cmdtext[])
{
        if(cmdid == INVALID_COMMAND_ID)
        {
                SendClientMessage(playerid, RED, "You typed an invalid command.");
                //return 1; //will call OnPlayerCommandPerformed with success value as CMD_FAILURE. 
                return 0; //won't call OnPlayerCommandPerformed
        }      
	return 1;
}
OnPlayerCommandPerformed
Arguments: Return Values:
0 or CMD_FAILURE - passes the command to other scripts for processing. If all the scripts return CMD_FAILURE or 0, the player will see the default error message, i.e "Unknown command".
1 or CMD_SUCCESS - stops the processing (does not pass the command to the next script in line)

Code:
public OnPlayerCommandPerformed(cmdid, playerid, cmdtext[], success)
{
        //a valid command but failed to complete? maybe it crashed?
        if(cmdid != INVALID_COMMAND_ID && !success) return SendClientMessage(playerid, RED," Oops! The command failed to execute properly."), 1; //write to the crash log?
	return 1; //won't send the default error message
}
If you are not using OnPlayerCommandPerformed then what you return in your command function will decide if the error message will be sent or not.

Returning 0 or CMD_FAILURE in the command function means the error message will be sent.
Returning 1 or CMD_SUCCESS in the command function means the error message won't be sent.

Defines & Macros

Defines

The defines marked with an asterisk ( '*' ) can be defined by you before including if you wish to (if not defined, the default value will be assumed). If you are defining any of them yourself, they must be done before including SmartCMD so that SmartCMD is aware of the change.

#definedefaultdescription
1MAX_PUBLIC_FUNCTIONS*1024Maximum number of public functions. If you script contains more public functions than the value set to MAX_PUBLIC_FUNCTIONS, SmartCMD will send an error message in the console in runtime. In that case, increase the value of this define.
2MAX_COMMANDS*500Maximum number of commands. If you script contains more commands than the value set to MAX_COMMANDS, SmartCMD will send error messages in the console. In that case, increase the value of this define.
3MAX_CLIENT_MSG_LENGTH144Maximum length of client message.
4MAX_FUNC_NAME32Maximum length of a PAWN function identifier (including null terminator).
5MAX_COMMAND_NAME28Maximum length of a command name (including null terminator).
6INVALID_COMMAND_ID-1Used to refer to an invalid command.
7IZCMD_ENABLE_CASE_SENSITIVITY*not definedDefining IZCMD_ENABLE_CASE_SENSITIVITY will make commands case-sensitive ("/pm" and "/PM" will be considered as different commands).
8CMD_DEFAULT_FLAG*not definedBy default, the flags will be initialized to zero if they are not specified for the command. This define lets you change the default value of default flags.
9CMD_SUCCESS1
10CMD_FAILURE0
Macros
isnull
Checks if a string is empty/null.

Parameters:
string: The string which has to be checked
Returns:
true - if the string is null ("" or "\1")
false - if the string is not empty

Code:
CMD:pm(cmdid, playerid, params[])
{
      if(isnull(params)) return SendClientMessage(playerid, YELLOW, "/pm [playerid/name]");

      //you can also use the following
      if(params[0] == 0) return SendClientMessage(playerid, YELLOW, "/pm [playerid/name]");

      return CMD_SUCCESS;
}
Functions
Detailed description of each function can be found inside the include.

Code:
	native DoesCommandExist(cmdid)
	native GetCommandID(const cmd[])
	native GetCommandName(cmdid, cmd[], len = sizeof(cmd))
	native GetAlternateCommands(cmdid, cmdidlist[])
	native IsCommandAlternate(cmdid)
	native GetCommandFunctionID(cmdid)
	native GetPointingCommandFunctionID(cmdid)
	native GetPointingCommandID(cmdid)
	native GetCommandFunctionName(dest[], cmdid, len = sizeof(dest))
	native GetEnabledCommandCount()
	native GetDisabledCommandCount()
	native GetTotalCommandCount()
	native EnableCommand(cmdid)
	native DisableCommand(cmdid)
	native IsCommandEnabled(cmdid)
	native SetCommandFlags(cmdid, flags)
	native GetCommandFlags(cmdid)
        native SetPointingCommandIDToSelf(cmdid)
	native ReassignCommandFunction(cmdid, const funcname[], bool:updateCID = false, bool:updatePFT = false)
	native EmulateCommandEx(cmdid, playerid, params[])
	native EmulateCommand(playerid, cmdtext[])
	native ExecuteCommand(const cmd[], command_mode, playerid, &success, params[]="")
Applications of SmartCMD features Technical Details (Optional)
Anything which can be typed and prefixed with a '/' is known as a command. The commands which can be processed are known as valid commands and the ones which don't exist are known as invalid commands. By this definition, alternate names for commands are separate commands, i.e: if you had a /spectate command which has an alternate name as /spec then /spec would be a different command but it works as an alternate for the /spectate command.

Commands & Command ID:
Every command including alternate commands is assigned a unique number known as command id. If you had a spectate command which has alternate names such as spec, spectate and spec will have different command id. This allows you to modify properties (disable, reassign, etc) of alternate commands without affecting its parent command.

The command ids start from 0 and can go upto a maximum of MAX_COMMANDS. You can get the highest command id by subtracting one from GetTotalCommandCount().

Code:
for(new i = 0, j = GetTotalCommandCount(); i < j; i++)
{
     //Loop through all the commands
}
Every command has a public function associated with it known as command function. SmartCMD converts your code into proper PAWN code for compiling.

Code:
CMD:pm(cmdid, playerid, params[])
{
       return CMD_SUCCESS;
}
CMD<ACMD>:kick(cmdid, playerid, params[])
{
       return CMD_FAILURE;
}
ALT:kik = CMD:kick;
The above code translates to

Code:
forward _CCCM:tag@pm();
public flg_pm = CMD_DEFAULT_FLAG;
stock flg@pm=flg_pm; //To avoid unused symbol warnings
public stock const cid_pm = -1; //Yes, it is -1. SmartCMD will later initilize this variable with the correct command id.
forward cmd_pm(cmdid, playerid, params[]);
public cmd_pm(cmdid, playerid, params[]) <> return izcmd_cmd_handled:0;
public cmd_pm(cmdid, playerid, params[]) <cmdMode:normal>
{
     return CMD_SUCCESS;
}

forward _CCCM:tag@kick();
public flg_kick = (ACMD);
stock flg@kick=flg_kick;
public stock const cid_kick = -1;
forward cmd_kick(cmdid, playerid, params[]);
public cmd_kick(cmdid, playerid, params[]) <> return izcmd_cmd_handled:0;
public cmd_kick(cmdid, playerid, params[]) <cmdMode:normal>
{
     return CMD_SUCCESS;
}

public flg_kik = (CMD_DEFAULT_FLAG); //SmartCMD will later initilize this variable with the flags of its parent command, in this case, flags of kick.
stock flg@kik=flg_kik;
public stock const cid_kik = -1;
public alt_kik = -1;
stock alt@kik = alt_kik;
forward cmd_kik(cmdid, playerid, params[]);
public cmd_kik(cmdid, playerid, params[]) <> return izcmd_cmd_handled:0;
public cmd_kik(cmdid, playerid, params[]) <cmdMode:normal> //will be executed automatically during initilization
         return _izcmdp_register_alias(GetCommandID("kick"), cmdid);
If case-sensitivity is not enabled, all command names must be written in small caps.

There are two ways in which a command can call the command function of some other command.

Alternate Commands: These commands pretend to be the other command. Using /spec is identical to using /spectate. When a player uses the /spec command, the /spectate command will be called with command id that of /spectate. There is no way you can know if the player used /spectate or /spec.

Reassigned Commands: These commands call the command function of the other command but do not pretend to be that command. Suppose, /spec instead of being an alternate command to /spectate had itself reassigned to /spectate. When /spec is used by a player, the /spectate command function is called BUT "the command id passed to the /spectate command will be that of /spec".
The command id can be accessed directly by referencing the id variable. The id variable's identifier is the command name itself prefixed with "cid_", for example, "cid_spectate".

In cases where you do not know the command name beforehand, you can use GetCommandID function to obtain the command id from its name.

Function Index:
Every command has its own command function including alternate commands (command functions of alternate commands are defunct - they exist for initialization purposes only and cannot be used unless they are reassigned).

The command function identifies itself with the command name prefixed with "cmd_". You can call the command function directly as given below

Code:
cmd_test(cid_test, playerid, params[]); //calls test command
Using the above method will not trigger the OnPlayerCommandReceived or OnPlayerCommandPerformed callback. Use EmulateCommand(Ex) if you want the callbacks to be executed.
Command Flags:
Every command has its own flags, including alternate commands (flags are redundant in case of alternate commands). The alternate commands are an identical copy of their parent command except for their name. Therefore, the flags of an alternate command are initilized with that of its parent command but any changes made to the flags of the parent command wont cause any corresponding change in the flags of its alternate commands. For example, changing the flags of /spectate command does NOT alter the flags of its alternate /spec command.

These flags are essentially a tagged variable (tag of the variable is 'flags') which can store any data related to the command.

The command flags can be accessed and modified directly by referencing the flag variable. The flag variable's identifier is the command name itself prefixed with "flg_", for example, "flg_spectate".

In case you do not know the command name beforehand, you can use GetCommandFlags and SetCommandFlags to modify the flags of a command.

Command States/Modes:
SmartCMD uses the automata (state functions) feature provided in PAWN to implement command states/modes. The automata is named "cmdMode". The command function function without any mode is the default command which is executed every time a command is used unless explicitly mentioned. SmartCMD assigns the 'normal' state to the default command function.

You can change the command mode dynamically anywhere in the code using the following code,

Code:
state cmdMode:mode_name;
Whenever a command is executed, the state is set back to normal mode.

Performance Benchmarks
iZCMD Average (non-case sensitive): 1075ms
SmartCMD Average (non-case sensitive): 842ms

iZCMD Average (case-sensitive): 901ms
SmartCMD Average (case sensitive): 680ms

SmartCMD Benchmark Code: http://pastebin.com/x7tXAekb

Download

Github
Visit Github Repository

View the include

Credits
Yashas
****** - #define tricks
Crayder - constructive talks
Zeex - the concept of making public functions


Respuesta: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Unrea1 - 23.10.2016

Awesome job! +rep.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - DevHarden - 23.10.2016

Very cool!
I'll be watching this along with that I'll start playing around with it tomorrow!


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - RaeF - 23.10.2016

*When all of existing command processor just not enough*


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Yashas - 23.10.2016

Quote:
Originally Posted by RaeF
View Post
*When all of existing command processor just not enough*
There are few features in SmartCMD which are completely new and the design is completely different. I haven't seen a command processor which passes command ids to the callbacks and commands instead of the command name yet.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - ExTaZZ69 - 23.10.2016

I really apreciate your effort! The documentation is awesome.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Max_Andolini - 23.10.2016

Amazing.


Respuesta: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Whyd - 23.10.2016

Really nice!


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - oMa37 - 23.10.2016

Good job! +REP.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Max_Andolini - 23.10.2016

How to call a command?


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - SyS - 23.10.2016

Pretty decent include .Thanks to you.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - SecretBoss - 23.10.2016

Quote:
Originally Posted by eco1999
Посмотреть сообщение
How to call a command?
Код:
cmd_yourcommand(playerid, " "); // if you are using params
cmd_yourcommand(playerid); // if you are not using params



Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Max_Andolini - 23.10.2016

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
Код:
cmd_yourcommand(playerid, " "); // if you are using params
cmd_yourcommand(playerid); // if you are not using params
No, i find.

native EmulateCommandEx(cmdid, playerid, params[])
native EmulateCommand(playerid, cmdtext[])


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - SecretBoss - 23.10.2016

Quote:
Originally Posted by eco1999
Посмотреть сообщение
No, i find.

native EmulateCommandEx(cmdid, playerid, params[])
native EmulateCommand(playerid, cmdtext[])
EmulateCommand will re-create the command, calling the command is much faster than recreating it.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Battallboi - 23.10.2016

Any comparison between this and Pawn.CMD?

I mean this has tons of features but in terms of speed which is better?


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Dayvison_ - 24.10.2016

Maybe you can add ReassignCommandFunctionForPlayer?

This is very good, i have some issues with pawn.cmd i certainly will use


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Gammix - 24.10.2016

Command declaration is what i found interesting. ☺


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - CantBeJohn - 24.10.2016

The fight for the fastest command processor is starting to seem more competitive than the Trump vs Hilary campaign.


I'm just going to keep switching to the fastest regardless though and this seems pretty nice.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - Yashas - 24.10.2016

Test code for SickAttack's include: http://pastebin.com/EJR7y49A

Results:
Quote:

[14:56:51] 1068
[14:56:52] 1078
[14:56:53] 1075
[14:56:54] 1070
[14:56:55] 1079
[14:56:56] 1071
[14:56:57] 1091
[14:56:58] 1063
[14:57:00] 1067
[14:57:01] 1062
[14:57:01] Average: 1072.40

SmartCMD test code: http://pastebin.com/ZWxA6p6a

Quote:

Results:
[14:57:48] 933
[14:57:49] 939
[14:57:50] 951
[14:57:51] 942
[14:57:52] 923
[14:57:53] 954
[14:57:54] 928
[14:57:55] 912
[14:57:55] 907
[14:57:56] 915
[14:57:56] Average: 930.40

Interesting, this include without dirty bloated code is faster than SickAttack's include. Moreover, I haven't added any performance improvement code to the callbacks so in principle SmartCMD is more faster than the timings shown in this test.


Re: Smart Command Processor (Scripter-friendly, feature rich and fast) (aka iZCMD+) - CantBeJohn - 24.10.2016

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Test code for SickAttack's include: http://pastebin.com/EJR7y49A

Results:


SmartCMD test code: http://pastebin.com/ZWxA6p6a

Results:
[14:57:48] 933
[14:57:49] 939
[14:57:50] 951
[14:57:51] 942
[14:57:52] 923
[14:57:53] 954
[14:57:54] 928
[14:57:55] 912
[14:57:55] 907
[14:57:56] 915
[14:57:56] Average: 930.40

Interesting, this include without dirty bloated code is faster than SickAttack's include. Moreover, I haven't added any performance improvement code to the callbacks so in principle SmartCMD is more faster than the timings shown in this test.
Nice, not sure if I was clear enough in my other post but I was going to switch over to this regardless if SickAttack's was faster or not. This just looks really nice and I see some useful stuff I can use.