Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri May 05, 2006 1:21 am   

"Smart" command line in CMUD
 
I've made a few changes to how stuff entered into the CMUD command line works compared to zMUD. I think these changes are all for the better:

1) CMUD adds a new preference called "Smart Command line". When this is on (and that's the default), then CMUD tries to be smarter about figuring out when to send the text to the MUD verbatim without parsing it.

It checks the first character of the command line to see if it's alphabetic or a punctuation character:
  • If it's your Command character (#) then the line is sent to the compiler and parsed as normal.
  • If it's your Focus character (:) then it checks the following text to see if it's a valid window name. If a valid window name is found, then the line is sent to the compiler. If it's not a valid window name, then the line is sent to the MUD without parsing.
  • If it's your Movement character (.) then it checks the following text for either a valid Path or an assignment syntax. If it's not a valid path and not a valid new path assignment, then the line is sent to the MUD without parsing.
  • If it's your History character (!), then it checks to see if the following is a number or valid starting text from your command history. If it's valid and there is nothing else after this except either a newline or ; character, then it is parsed, otherwise it is sent to the MUD.
  • If it's a < character, then it checks to see if the following text is a valid macro key or macro assignment. If not, it is sent to the MUD.
  • If the command line is surrounded in " quotes, then the quotes are removed and the rest is sent to the MUD (this also works in zMUD)
  • If the command line is surrounded in {} then the {} are removed and the line is sent to the compiler and parsed, just like the {} block of a scripting command.

Except when using " quotes to force the line sent to the MUD verbatim, the Variable character (@) can still be used to expand variables in the command line, and the Seperator (;) can still be used to put multiple commands on the same line. You can also use Shift-Enter to enter multi-line text just like in zMUD.

The Seperator (;) also gets some special handling when Smart Command line mode is enabled. CMUD looks at the characters following the ;. First it skips any whitespace, then if the next character is a valid character for the start of a command (as defined by the above rules), then the ; is recognized as a seperator. However, if something else follows the ; then the ; is treated verbatim.

For example, when using the ;) smiley CMUD detects the ) as an invalid character for the start of a new command, so it knows that the ; should be treated verbatim in this case.

2) As implied by the above rules, a new Path assignment syntax is also added to CMUD:

.path=value

will assign the value to the given path name. As with zMUD, the Key assignment syntax also works:

<keyname>=value

In addition, you can execute a macro from the command line by just giving:

<keyname>

such as <F1> to execute the macro assigned to the F1 key. I can't really see a use for this, but it fell out as a natural part of the way the parser handling the assignment statements worked.

3) Finally, another change is made in how Alias Recording is done. When using the Record Alias command in the Actions menu, CMUD starts recording the commands sent to the MUD. In zMUD, this recorded *everything* including zMUD commands. This changes in CMUD...in CMUD it only records the actual text sent to the MUD. For example, if you execute an alias called "test" that sends "hello world" to the MUD, then in zMUD it would add "test" to the recording, whereas in CMUD it adds "hello world" to the recording since that's the actual text sent to the MUD.

You can turn off Smart Command line to revert to the old method where the command is always parsed. And of course you can still turn off the "Parse" option in the Settings menu to prevent any parsing at all and to always send the text to the MUD verbatim.

All of these changes *only* effect the command line. Scripting is unchanged. (Well, things like the Path assignment still work in scripting, but the Smart Command Line stuff is disabled in scripting).

I've played around with this a bit and it works much better than zMUD at dealing with special characters. Players of MUSHes and MOOs and other variants that use a lot of special characters should be able to use CMUD a lot easier, especially when they haven't started making aliases or paths. Once you start creating paths, then the . movement character will start looking for valid path names, and if you've chosen a path name that is the same as a . command on your MUD, then CMUD will send the path instead of the command text, but players doing that should know enough about how to change this.

Any other suggestions on improvements to the Smart Command line are welcome.
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Fri May 05, 2006 6:38 am   
 
I can't say I fully understand all of the above, but I just wanted to remind you that in a MUSH, it is common to have a command line beginning with a colon, a semicolon, a dot, double quotes, or an exclamation point, and to have @-signs embedded in the line. In fact, you do some of these so often that I'd never want to have to quote them.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri May 05, 2006 5:58 pm   
 
Yep, I'm aware of that. What I basically said above is that in CMUD you *can* have a command line that starts with a colon, semicolon, dot, double-quotes, or an exclamation point and CMUD should sent it to the MUD correctly. With double-quotes, the line is sent to the MUD properly if you just start the line with " and don't end the line with ". If there are " at both the start and end of the command, then they are stripped and the stuff between the quotes is sent to the MUD.

The embedded @ signs are also not a problem. The only time the @varname is expanded on the Smart command line is if varname is a valid CMUD variable name.

For example:
Code:
"This is a @test

will send that exact text to the MUD as long as @test is not a valid CMUD variable. If @test is a CMUD variable, then it is expanded. So you just need to be careful with your CMUD variable names.

Another example:
Code:
.this is a test

Again, this is sent to the MUD as shown unless .this is a valid CMUD path that you have stored. And in this case, even if it's a valid path it won't get expanded since paths are not allowed to have stuff after them in the same command.

Another example:
Code:
!this is a test

Again, since command history recall with the ! character doesn't allow other words after it, CMUD knows that it should send this to the MUD untouched.

But:
Code:
!this

could be a valid CMUD history recall command where the previous command that starts with "this" is recalled from the command history. So this might be an ambigous command. To force it to be sent to the MUD, enclose it in quotes:
Code:
"!this"

and the quotes will be stripped and !this will be sent to the MUD. Putting quotes around the entire command might be easier in some cases than escaping each individual character.

And of course you can still always go change the special characters just like you can in zMUD. But with the smarter command line in CMUD, you shouldn't have to change special characters as much.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri May 05, 2006 6:24 pm   
 
Oh yeah, and remember that you can also disable the expansion of @varname in the command line by turning off the Expand Vars preference in the Parser page. However, unlike in zMUD, when ExpandVars is turned on and @varname is not a valid variable reference, then the @varname string is returned on the command line, rather than a null value. For example, in zMUD "This is a @test" would return "This is a " if @test was not defined. In CMUD it properly returns "This is a @test" on the command line.

This wasn't possible in zMUD because the command line used the same rules as the scripts and in scripts you want @varname to return a null string if it's not defined. But in CMUD since the command line has it's own compile and parsing mode, I can do more of these tricks to enable the command line to be more useful for MUSHes.
Reply with quote
lonewolfachaea
Beginner


Joined: 05 May 2006
Posts: 10
Location: Biddulph, Stoke-On-Trent, Staffordshire

PostPosted: Fri May 05, 2006 9:26 pm   
 
Will it be possible to set up single triggers/aliases/etc that you can fire off which send a command to the mud but are -not- displayed to you without having to use the #gag command which causes system slowdown?

Example <current>: trigger=you are knocked down, value=stand, result=you see the command to stand fire in the mud and you stand.

<proposed>: trigger=you are knocked down, value=#hide stand, result=you do not see the command to stand fire in the mud and you stand. (reducing spam)

Note: sorry if this is already possible, I know how to hide all trigger reactions, but not specified ones.
_________________
Human salvation lies in the hands of the creatively maladjusted. -Martin Luther King Jr
Reply with quote
Kiasyn
Apprentice


Joined: 05 Dec 2004
Posts: 196
Location: New Zealand

PostPosted: Fri May 05, 2006 9:33 pm   
 
you can use #SEND {woo} to send woo silently.. but it isnt protected by the spam protection feature sadly..
_________________
Kiasyn
Owner of Legends of Drazon
Coder on Dark Legacy
Check out Talon, an easy IMC connection.
Reply with quote
lonewolfachaea
Beginner


Joined: 05 May 2006
Posts: 10
Location: Biddulph, Stoke-On-Trent, Staffordshire

PostPosted: Fri May 05, 2006 11:01 pm   
 
What is the spam protection feature?

Thanks for answering me with #send, I didn't know about that and it will significantly reduce the spam because 1) it doesn't produce that anoying blank line you get after every command is sent (not sure why you get that), and 2) when it comes to systems that use a LOT of commands to do a single thing, i can at least hide the commands now without the slowdown caused by #gag.



-edit-

Ok, sorry Zugg, I didn't know if this fucntion existed or if it was connected to what you were discussion.

I've moved it to here: http://forums.zuggsoft.com/phpbb/viewtopic.php?p=92597#92597
_________________
Human salvation lies in the hands of the creatively maladjusted. -Martin Luther King Jr

Last edited by lonewolfachaea on Sat May 06, 2006 11:00 am; edited 1 time in total
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri May 05, 2006 11:30 pm   
 
Zugg I was messing about on a MUSH I used to be on years ago today after reading this thread. As there are many @ commands and often you will start the command line off with one like I did today with '@decompile me' any chance of getting it to ignore that totally even if it does match a variable but only if the @ is the first character. It might do this already but I didn't pick up on that from what you have said so far.
_________________
Taz :)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat May 06, 2006 4:50 am   
 
lonewolfachaea, please start a new post to discuss a new issue. What you posted has nothing to do with the smart command line in CMUD that we are talking about here.

Taz, that's an excellent idea. I'll add that to the parser so that @ as the first character on the command line is ignored as a variable reference.

Since I've never played MUSHes myself, I'm really relying on feedback from people on this. My current implementation is based upon a couple of emails from MUSH users using zMUD and having problems. If there is a link to a page with lots of example MUSH commands, I'd be interested in seeing that.
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Sat May 06, 2006 9:36 am   
 
I'm trying to convince a friend of mine who MUSHes daily to compile a list of frequent command line input. Though an example page is a good idea I'll go do a google search for you.
<edit>
http://www.fantasyalternative.org/mush/basics.html
common input listed there but mostly what you have already eg " ; : + @
</edit>
_________________
Taz :)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat May 06, 2006 5:20 pm   
 
OK cool, thanks for the link. All of the example commands on that page work just fine in CMUD Smile

And yeah, an amazing number of them fail in zMUD. So this should get MUSH players more excited about CMUD.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net