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
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Sun Apr 19, 2009 2:38 am   

How to match a name from lists?
 
I have 5 lists of players depending on their guild profession.
Knights, mages, sorcerers, rangers, ect.
When I target a person for battle, I usually only use the first 3 or 4 letters of their name (its much quicker as some names have 10 letters and only one vowel)

I want the attack alias to be able to make a check with only the first 3 or 4 (or however many I use) letters of the name against the full name in the list.

example:
alias name: J
value:
#var newtarg %1
#IF (%ismember( @NEWTARG, @KNIGHTLIST)) {swld = 1} {#IF (%ismember( @NEWTARG, @MAGELIST)) {swld = 2} {#IF (%ismember( @NEWTARG, @THIEFLIST)) {swld = 3} {#IF (%ismember( @NEWTARG, @SEERLIST)) {swld = 4} {#IF (%ismember( @NEWTARG, @BARDLIST)) {swld = 5} {swld = 6}}}}}
poisonload (alias that uses poisons most deadly to a certain type of person determined by the value of @swld)
jab @newtarg


I'm not sure if there is an easy command for this or if it requires some fancy trickery or maybe its not possible.
Someone point me in the right direction please.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4690
Location: Pensacola, FL, USA

PostPosted: Sun Apr 19, 2009 7:43 am   
 
you would be wanting somthing like...

#IF (%match(%expandlist(@magelist), "%q{@newtarg}"))
_________________
Discord: Shalimarwildcat
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Apr 19, 2009 12:46 pm   
 
wow
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Tue Apr 21, 2009 2:48 am   
 
This is what I have now.
#var target %1
#IF (%match(%expandlist(@knightlist), "%q{@target}")) {swld = 1} {#IF (%match(%expandlist(@magelist), "%q{@target}")) {swld = 2} {#IF (%match(%expandlist(@thieflist), "%q{@target}")) {swld = 3} {#IF (%match(%expandlist(@seerlist), "%q{@target}")) {swld = 4} {#IF (%match(%expandlist(@bardlist), "%q{@target}")) {swld = 5} {swld = 6}}}}}
#show @swld

@swld never changes, it always ends up as a 6
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Tue Apr 21, 2009 1:02 pm   
 
EDIT: [insert hasty observation]

This matched 'cow' in the second list:

#IF (%match( %expandlist( @magelist), @target)) {}

Though it would also match and use 'cowly' in your knightlist if there was a cowly person there. Must be some easy check for all that.
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Tue Apr 21, 2009 5:43 pm   
 
Changed it to this.

#IF (%match( %expandlist( @knightlist), @target)) {#say knight} {#IF (%match( %expandlist( @magelist), @target)) {#say mage} {#IF (%match( %expandlist( @thieflist), @target)) {#say thief} {#IF (%match( %expandlist( @seerlist), @target)) {#say seer} {#IF (%match( %expandlist( @bardlist), @target)) {#say bard} {#say anyone}}}}}

#$%#n'-A that works!

Thanks everyone.
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