![](templates/Classic/images/spacer.gif) |
mbalvetti Newbie
Joined: 12 Mar 2007 Posts: 6 Location: Italy
|
Posted: 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 |
|
|
![](templates/Classic/images/spacer.gif) |
Fang Xianfu GURU
![](images/avatars/1763170544a2093e7e85da.gif)
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
![](templates/Classic/images/spacer.gif) |
mbalvetti Newbie
Joined: 12 Mar 2007 Posts: 6 Location: Italy
|
Posted: 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 |
|
|
![](templates/Classic/images/spacer.gif) |
Fang Xianfu GURU
![](images/avatars/1763170544a2093e7e85da.gif)
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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} |
|
|
![](templates/Classic/images/spacer.gif) |
mbalvetti Newbie
Joined: 12 Mar 2007 Posts: 6 Location: Italy
|
Posted: 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 |
|
|
![](templates/Classic/images/spacer.gif) |
Fang Xianfu GURU
![](images/avatars/1763170544a2093e7e85da.gif)
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
![](templates/Classic/images/spacer.gif) |
mbalvetti Newbie
Joined: 12 Mar 2007 Posts: 6 Location: Italy
|
Posted: Mon Mar 19, 2007 9:56 am |
Thanks a lot, everything works great now :))
mbalvetti |
|
|
![](templates/Classic/images/spacer.gif) |
|
|