|
Ceres Wanderer
Joined: 25 May 2006 Posts: 88
|
Posted: Thu Jul 17, 2008 2:22 pm
CMUD [2.32] Start lines with commands |
I have only recently began looking at converting my old zMud scripts over to CMUD and cannot believe how badly this change breaks my scripts and makes it extremely difficult to debug them.
From the CMUD documentation:
Quote: |
Each line of your scripts in CMUD must start with a command, either a zScript command or a literal command to be sent to the MUD. In zMUD, this worked:
Code:
#forall @SomeList {%i}
and each item from @SomeList would be sent to the MUD. Some zScript commands that can be used to reproduce the old behaviour are #CALL, #EXEC, #SEND (which is slightly different to its zMUD counterpart) and #SENDRAW.
Code:
#forall @SomeList {#exec %i}
will do the same thing as the above zMUD example. |
In zMud anything Not recognised as an alias would be sent to the mud AND most importantly be shown within the main window whereas in CMUD the text is sent to the mud however it is NOT displayed. This change is rediculous IMNSHO and in my opinion scripts should behave just as they do from the command line. As an example consider the following:
If on the command line I type: inventoru (I have typoed the word 'inventory') the typoed word and response 'What?' are displayed within the main window. All is well and good as I can see what caused the erroneous output from the mud.
Alternately, I may have an alias or trigger which calls the alias with the typoed inventoru in it. In this instance the only thing displayed is the 'What?'
Is there any way for CMUD to emulate the behaviour of zMud?
The change to require 'Each line of your scripts in CMUD must start with a command, either a zScript command or a literal command' is effectively turning anything that does not follow this convention into a #SEND |
|
|
|
Rorso Wizard
Joined: 14 Oct 2000 Posts: 1368
|
Posted: Thu Jul 17, 2008 3:47 pm Re: CMUD [2.32] Start lines with commands |
When I tried it undefined aliases are sent to the MUD, and the text sent is displayed in yellow text.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 17, 2008 5:08 pm |
Sorry, but this isn't going to change. The problem is that what you were doing in zMUD was ambiguous and couldn't handle special characters in your text. For example, let's just take a look at the example from the help file that you posted above:
Code: |
#forall @SomeList {%i} |
OK, now, what happens one of the items in @SomeList is "a=1". The question is, do you want CMUD to *execute* this statement (and assign a value of 1 to the @a variable)? Or do you want to *send* this text to the MUD as it is?
The problem is that some people in zMUD were using this syntax to send stuff to the MUD, but other people were using this syntax to execute aliases and other scripts (like entering it on the command line). Because different people were using the same syntax to do different things, there were problems and conflicts.
Now, in zMUD, it always *executed* the text as if it was entered on the command line. This had a lot of bad side-effects and wasn't what most people intended...they wanted to send command to the MUD. So in CMUD, it always *sends* the text to the MUD instead of executing it. If you want to execute it like you typed it on the command line, then you need to use #EXEC.
You are apparently one of the people who wanted it to execute the text instead of send it to the MUD. But other people had other ideas. Especially novice scripters who just wanted to send commands to the MUD. We decided that anyone who *wanted* to execute their text as a script instead of sending it to the MUD would be knowledgeable enough to add the #EXEC command to make it clearer.
In zMUD, the command line and the scripts were treated the same. In CMUD, there is a "smart command line" feature that performs additional processing on the command line to handle special characters and other syntax used by many MUDs. Scripts are expected to adhere to more strict syntax rules, while the command line is allowed to have invalid scripts that are sent to the MUD.
For example, $ is for local variables in CMUD. If you type:
hello $test
on the command line, it will send this to the MUD as expected. But if you try to define an alias to do this:
#ALIAS abc {hello $test}
then it gives an error message that "$test" is not a valid local variable.
So yes, script syntax is more strict in CMUD. That is required for CMUD to compile the scripts and give the speed performance. It allows CMUD to use a well-defined parser for syntax highlighting and many other features that zMUD did poorly because zMUD didn't have a rigorous parser and allowed a lot of sloppy scripting. |
|
|
|
Ceres Wanderer
Joined: 25 May 2006 Posts: 88
|
Posted: Thu Jul 17, 2008 6:48 pm |
Thanks for the explanation Zugg.
Now that I am aware of it and that it is intentional I will modify my script/s. |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Thu Jul 17, 2008 8:28 pm |
You may find it quicker when doing larger-scale modifications, to copy/paste the xml for the whole package into a word processor, and use 'find' (sometimes find-replace) for some of it. Then you just copy/paste it all back.
|
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 17, 2008 8:39 pm |
One other "trick" to also keep in mind...
The #ONINPUT triggers will fire on any text sent to the MUD (except for when using #SENDRAW). So you can actually set up an "alias" using #ONINPUT that would fire on both the command line text *and* text sent from a script. |
|
|
|
|
|