 |
KholdStare88 Newbie
Joined: 08 Feb 2008 Posts: 2
|
Posted: Fri Feb 08, 2008 3:55 am
"Nicknames" |
Hey, does anyone know how to do something like "Nicknames" on the Portal client?
Nicknames are similar to aliases, but they apply to not just the beginning of input but for everywhere in the input. It doesn't substitute/mask, but rather replace directly in the put. Nicknames should not replace/mask output.
For example, if the nickname of wp is weapon, then when you input "take wp box," the command sent to the MUD would be "take weapon box."
Does anyone know how to do something similar to this? |
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Feb 08, 2008 4:19 am |
Use #ONINPUT.
#ONINPUT {wp} {#SUB {weapon}}
will allow you to type "take wp box" and it'll send "take weapon box" to the MUD.
Charneus |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Feb 08, 2008 4:20 am |
#oninput {%bwp%b} {#substitute weapon}
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Feb 08, 2008 4:21 am |
Ninja'd
But.
You want to use the %b so that ewp or wpe for example doesn't get replaced. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Feb 08, 2008 4:25 am |
EDIT: Fixed it to show the correct one, and also using Fang's confidence that they don't need to be escaped...
By the way, if you're comfortable using "nickname" or whatnot to set subs up on the fly, use this alias:
#ALIAS nickname {#ONINPUT {%q%1%q} {#SUB {%-2}}}
Then all you have to do is type:
nickname wp weapon
nickname arm armor
and whatnot.
Yes, this is untested, but it /should/ work. If not, add ~'s in front of the %qs.
Charneus |
|
Last edited by charneus on Fri Feb 08, 2008 2:04 pm; edited 1 time in total |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Feb 08, 2008 10:31 am |
It's not %b, it's %q - the regex is \b. So:
#ONINPUT {%qwp%q} {#SUB {weapon}}
I'm fairly sure you don't need to quote the %s in Charneus' script. |
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Feb 08, 2008 2:18 pm |
I think I had trouble with %q at some point in the past. At any rate %b works wonderfully, although it is undocumented it compiles to \b.
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
KholdStare88 Newbie
Joined: 08 Feb 2008 Posts: 2
|
Posted: Fri Feb 08, 2008 6:27 pm |
Thanks a lot guys. #ALIAS nickname {#ONINPUT {%q%1%q} {#SUB {%-2}}} seems to work really well.
|
|
|
 |
|
|