The difference between zcmd and strcmp
#1

Hey guys, I personally use strcmp at the moment and I found out that ninety percent here are using zcmd/dcmd/any other kind of cmd instead of strcmp.
And well, I heard that it's a bit faster in milliseconds, so I was wondering, does it really matter if I use zcmd or strcmp? Will the players actually feel the difference? If I'll have a huge mode built with strcmp with high amount of players online at the same time - will the server lag?
Reply
#2

How can I tell you,I think ZCMD will perform faster,but I don't know if server will lag for everyone,and in my point of view,if you use it togheter with sscanf,it's a lot easier than strcmp+DefaultCommand system,but it's your choice...
Reply
#3

I am not sure, but I think zcmd works by calling a function for the command, if it exists, using funcidx, and if it doesn't exist it returns 0 or whatever, so it's practically instant, where as strcmp/dcmd (same thing, just a macro..) goes

Player types /help
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /blah EXIST? NO? CARRY ON
DOES COMMAND /help EXIST? YES, CALL dcmd_help()!
Reply
#4

But my question is, will it be that effective that the players will feel the difference? Or it's mainly a point of convenience?
Reply
#5

Quote:
Originally Posted by Tomer!.$
Посмотреть сообщение
But my question is, will it be that effective that the players will feel the difference? Or it's mainly a point of convenience?
I doubt that someone will notice if you suddenly switch do ZCMD. But the point in saving those milliseconds is that all of them, from other well-scripted, fast functions, add up, and your script runs smoother in the long run.
Reply
#6

Quote:
Originally Posted by CaHbKo
Посмотреть сообщение
I doubt that someone will notice if you suddenly switch do ZCMD. But the point in saving those milliseconds is that all of them, from other well-scripted, fast functions, add up, and your script runs smoother in the long run.
What do you mean smoother in the long run? Sorry about that, I'm kinda new to scripting so I don't know the scripting language that well.
Reply
#7

After finding this comment of dice7 I've understood that there's no real difference as for the players.
But, I'm still curious, if a scripter uses zcmd instead of strcmp will it look like he's more professional as for the others?

The message I found:

Quote:
Originally Posted by dice7
Посмотреть сообщение
I actually did some test and found out that sscanf is always faster, but in 'faster' I mean in miliseconds. If a player enters 10 thousand commands at once, sscanf will process them about ~10 miliseconds faster, 100 thousand ~100 milliseconds faster and 1 million commands, sscanf will be about a second faster.

It was tested with a command with only one extra parameter ("/heal 45"), which may made them almost the same speed. But for a player to actually notice the difference, the command would probably have to be something like
"/dosomething [carid] [playerid] [playerid2] [color1] [color2] [color3] [color4] [string1] [string2] [string3] [string4] [something else 1] [something else 2]" and even that would be like half a second in speed.

The final verdict is that use that which is easier for you

Here's the code used for testing
http://pastebin.com/A16tt7CH
Reply
#8

Would anyone answer me? Is zcmd make a script look more professional?
If you'll see a scripter using zcmd and one using strcmp, will the one using zcmd look more professional as in your point of view?
Reply
#9

Lets say you have a big mode with 1000 commands being handled by strcmp and you want to switch command processors.

What command processors will give YOU the speed YOU want?
What command processors will give YOU the features YOU want?
What command processors will be easier for YOU to convert to?

See where I'm going with this? It's up to you to decide whats best for you're mode.



And to me, It's not what you use that make you look professional, It's how you use it.
Reply
#10

If you're creating a huge gamemode which contains a lot of commands, even if you use strcmp, players won't actually feel it, but it will sure cause a bit of lag, where players can't feel. This is why zcmd and sscanf are the best combine, in order to get a huge gamemode with a lot of commands in it, with having no lag at all.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)