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
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Jan 17, 2004 7:24 am   

getting one word from a * matched pattern
 
Ok I need to know if this is possible and how it can be done if this is possible

Some names Are just one word- Jeff
Some names have a pretitle with one or two words- The Great Jeff
some names have a postitle- Jeff, the assassin
and some have both- The Great Jeff, the Assissin

Now my trigger captures all versions of the name but I want to know from there if it is possible to remove the pretitle if its there remove the post title and comma (they always follow a comma)if its there (the name is always right before the comma on the posttitle) and then take the single word name left and remove the last letter so that in all four cases I end up with Jef stored

This Version here will work great on the first two examples
Code:
%copy( %word( {%1}, %numwords( {%1})), 1, %len( %word( {%1}, %numwords( {%1})))-1)
but it won't work for postitles
Reply with quote
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: Sat Jan 17, 2004 8:01 am   
 
temp=%1
%word( %word( @temp, 1, ","), %numwords( %word( @temp, 1, ",")))
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Jan 17, 2004 8:47 am   
 
ok Thats almost what I need now I need it to take the name in this case Jeff and strip off the last letter making Jef
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Jan 17, 2004 11:42 am   
 
Ok I finaly have it doing what I want so heres a short breakdown

Code:
#var no_title {%copy( %word( %word( "%1", 1, ","), %numwords( %word( "%1", 1, ","))), 1, %len( %word( %word( "%1", 1, ","), %numwords( %word( "%1", 1, ","))))-1)}


#tri {(*) asks you, 'orb'} {make orb;give orb @no_title(%1)}


so now when

The Great Jeff, the assassin asks you, 'orb'
make orb
give orb Jef
Reply with quote
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: Sun Jan 18, 2004 6:22 am   
 
Just out of curiosity, why do you need it to be Jef instead of Jeff?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Jan 18, 2004 6:52 am   
 
so I don't cast my spell or give items to mobs/doppelgangers which have to have full name typed out
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