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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
KholdStare88
Newbie


Joined: 08 Feb 2008
Posts: 2

PostPosted: 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?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: 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
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


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

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
KholdStare88
Newbie


Joined: 08 Feb 2008
Posts: 2

PostPosted: Fri Feb 08, 2008 6:27 pm   
 
Thanks a lot guys. #ALIAS nickname {#ONINPUT {%q%1%q} {#SUB {%-2}}} seems to work really well.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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