|
nancmkt13 Newbie
Joined: 19 Jun 2010 Posts: 1
|
Posted: Sun Jun 20, 2010 7:06 am
Cmud, Regex |
Quote: |
1. I know the general consensus is that Regex is better than the basic script. My question though is why - is it faster, more stable, what?
|
Regex is only faster because it does not go through any sort of preprocessing to translate, fix, modify, or otherwise optimate the pattern. Thus, the "faster" part only comes about if you can already write top-notch regex patterns. If you do it inefficiently or have to get complex, it's not going to be any faster than in Zscript and might possibly even be slower. With Zscript, Zugg applies all these tricks and can also tap into CMud/Zscript functionality that is in no way available to regex.
Basically, a good way to sum up why #REGEX, %regex(), %subregex() and other regex-related commands/functions exist is to attract players who know how to use regex already and are perhaps hung up about switching to CMud because they have to relearn how to write trigger patterns (more specifically, they would rather not have to relearn it).
So, in essence, unless you absolutely know it's a functionality that Zscript just cannot handle you should never be using straight regex even if you know how. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Jun 20, 2010 6:29 pm |
Regex is more powerful. You can, to my knowledge, do more with Regex than the simple basic built in script. But you can also make more mistakes and more unintentional matches. If it's just simple matching you need and you can think of how to do it in the built-in script then you stick to that. If the built-in script comes up short, that's when you turn to Regex.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jun 21, 2010 12:37 am |
Regex is not "better" than zscript patterns. A better description is that it is more powerful. There are things you can do in regex that are difficult or impossible to do in zscript patterns. I believe that in actuality, zscript patterns are actually translated into regex patterns for execution, so it is not actually faster or better in any other way. If you can write the pattern you need as zscript, you probably should, because it is simpler. If you can't, then go ahead and use regex.
As for whether to switch from Zmud to Cmud--it depends on what you want. If Zmud is working for you, then fine. But Zmud is no longer supported. There will not be any further development, or bugfixes, on it. Cmud is a lot more stable than Zmud. It can do everything that Zmud can, and several things that it can't. When the public version 3.xx comes out, it will have a number of new features for the mapper, in particular. In many ways, Cmud is much more rigorous and compliant with general coding practices than Zmud is. There is an active group supporting other users on the Cmud forums. I haven't visited the Zmud forums in years, so I don't know how much user support there is there currently.
The downsides of switching--you will probably have to modify many of your scripts, because Zmud let you do things which it shouldn't have and which Cmud does not allow. It is likely that at least some of your old scripts will not work without some changes. There will be a learning curve to understand the differences between Zmud and Cmud scripting (which Zugg has tried to keep as few as possible). |
|
|
|
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Mon Jun 21, 2010 12:44 am |
If you do upgrade, it gives you an option to import all your old .mud files. Once you do that, it gives you a nice compatibility report on what changes to your scripts you need to make. It's actually really simple, in my opinion.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|