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
mbalvetti
Newbie


Joined: 12 Mar 2007
Posts: 6
Location: Italy

PostPosted: Sun Mar 18, 2007 6:57 pm   

Alias problem
 
On my mud to send a message i use the syntax:

think Hello

To send it in green I use the syntax

think $c0010 Hello

When I try to make an alias as

'tv' --> 'Think $c0010 '

I read on the screen

John think '

This syntax on ZMud works well.

How can I put an alias on CMud for this command ?

Thanks in advance,

mbalvetti
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Mar 18, 2007 7:58 pm   
 
Your problem comes because $c0010 looks like a local variable. In an alias, quote it out with ~, making ~$c0010. On the command line you also have the option of starting the line with `, which quotes the entire line.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
mbalvetti
Newbie


Joined: 12 Mar 2007
Posts: 6
Location: Italy

PostPosted: Mon Mar 19, 2007 7:51 am   re: Alias Problem
 
I tried to do what you suggested:

Alias name: 'tv'
Alias command: 'think (alt 126)-> ~$c0010 '
Alias use: 'tv Hello'

don't work

From command line: 'think $c0010 Hello'

work well

Thanks again,
mbalvetti
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Mar 19, 2007 8:24 am   
 
The reason that first alias won't compile is because of the brackets around "alt 126" - they need to be quoted as well, giving you:

#alias tv {think ~(alt 126~)-> ~$c0010}

which compiles fine. Note, however, that it doesn't include anywhere for the parameters of the alias to go. If they're supposed to follow on from that text, change it to:

#alias tv {think ~(alt 126~)-> ~$c0010 %-1}
Reply with quote
mbalvetti
Newbie


Joined: 12 Mar 2007
Posts: 6
Location: Italy

PostPosted: Mon Mar 19, 2007 9:08 am   
 
Hi, now the alias seems to work but...

Alias: tv
Alias Command: 'think ~$c0010 %1 %2 %3 %4 %5 %6 %7 %8'
Comment: Every %n send one word .

if Alias command is: think ~$c0010 %1 %2 %3 %4
and the text is: 'tv test a long word to see if everything is ok !
the output is: 'John think test a long word'

and if : 'think ~$c0010 %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11'
and the text is: 'tv test a long word to see if everything is ok !
the output is: 'John think test a long word to see if everything is ok !

Maybe or for sure i am not clever enough to understand what to do :)

Thanks,

mbalvetti
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Mar 19, 2007 9:25 am   
 
Each %nn variable contains one parameter. Parameters are separated by spaces, that's why it only puts one word of normal text in each variable. Each variable %-nn contains the nnth variable and every variable following it. %-1 contains every parameter, %-2 contains every parameter but the first, and so on. In my example above I use %-1 to automatically append everything you type to go onto that channel.
Reply with quote
mbalvetti
Newbie


Joined: 12 Mar 2007
Posts: 6
Location: Italy

PostPosted: Mon Mar 19, 2007 9:56 am   
 
Thanks a lot, everything works great now :))

mbalvetti
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