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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: Sun Jan 20, 2008 1:36 pm   

Command Line Variables And Spaces
 
the mud i play uses @ for color codes, but every time i enter something like:
Code:
gt @RRedText @BBlueText

it gets interpreted as:
Code:
gt @RRedText@BBlueText


i could understand it being interpretted as just gt (evaluating empty variables, not that i would like it that way) etc, but the missing trailing spaces seem to be a bug to me[/code]
_________________
The Drake Forestseer
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Sun Jan 20, 2008 2:07 pm   
 
Is gt an alias? Or is this the command line doing it for certain?
Reply with quote
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: Sun Jan 20, 2008 2:09 pm   
 
gt isn't an alias, it's just the command line itself, i use gt because it's a private invite only channel with a history function ;) works on echos, etc aswell, i actually am going off the text sent to the mud though, not the text the mud sends back, never gagged my commands :)
_________________
The Drake Forestseer
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Jan 20, 2008 6:16 pm   
 
Right. I play the same MUD, and presently, the only way to get around that is to put quotes around the whole thing. And it is coming from the command line itself. I type
Code:
gt @RRedtext @BBluetest

And it produces the same results Alluran got, which is:
Code:
(Group) Charneus: 'RedtextBluetext'

However, using the following:
Code:
gt @RRed text @BBlue text

produces it correctly:
Code:
(Group) Charneus: 'Red text Blue text'

Furthermore, going back to the first one, if I type:
Code:
gt "@RRedtext @BBluetext"

it produces:
Code:
(Group) Charneus: '"Redtext Bluetext"'

Very weird "bug" indeed.

Charneus
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sun Jan 20, 2008 6:40 pm   
 
CMUD uses the '@' to refer to variables. You can either quote the '@' symbol, change the symbol in CMUD preferences, or turn off the smart command line.

This

gt ~@RRedText ~@BBlueText

or this should work.

"gt @RRedText @BBlueText"

or

#SENDRAW gt @RRedText @BBlueText
_________________
Asati di tempari!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Jan 20, 2008 7:57 pm   
 
While that may be true, Tech (and yes, your examples do work), the colors are coming out just fine. So CMUD is reading it (and sending it raw). The problem is this:

gt @RRedtext @BBluetext

sends:

(Group) Charneus: RedtextBluetext

whereas

gt @RRed text @BBlue text

sends:

(Group) Charneus: Red text Blue text

If it was a problem, then the text and the Blue would show up as textBlue.

Not to mention that it starts to be a hassle when we want to send color codes to the MUD and we're stuck with having to escape every single one of them. Or putting quotes around the entire thing. *sigh* But we don't even have to - it works in most cases. Just when it's like the above examples, it doesn't work. If CMUD was really parsing it as a variable, then we wouldn't get the color. We wouldn't even get anything - it'd be blank. *shrug*

Charneus
Reply with quote
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: Sun Jan 20, 2008 10:46 pm   
 
And changing the variable symbol isn't something you really want to do when you're writing packages that you want to be reused
_________________
The Drake Forestseer
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jan 20, 2008 10:53 pm   
 
The smart command line can't handle everything everyone want to be able to do. That is why we have a verbatim character.
Code:
`gt @RRedtext @BBluetext


Yes there may be a bug here. Examining the differences in how it compiles and outputs shows that it does not rebuild the string exactly right when it restores the nonvariable references. Your line "gt @RRedtext @BBluetext" actually compiles to
Code:
VARREF @RRedtext
VARREF @BBluetext
ALIAS gt(2)
Then when it sees that no such alias exists it goes to the sending routine. When this finds that the variable doesn't exist it puts the original text back for that reference instead of the null that a script would get. The only record of the space being there originally is that the parameter count is 2. Essentially all the methods that are involved in building a parameter string either for %-1 or the smart command line are affected and can have missing or extra spaces. To demonstrate this use the following procedure
1. Launch CMud
2. CLose Sessions window (ESC)
3. Enter at the command line
Code:
#alias gt {#SHOW gt '%-1'};#VAR a "something"

4. Enter at the command line
Code:
gt @RRedtext @BBluetext
gt @RRedtext @a @BBluetext
gt @RRedtext something @BBluetext
gt @RRedtext @BBluetext @a
gt @RRedtext @BBluetext something
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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