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: Wed Feb 12, 2014 3:54 am   

matching long names from enemy lists
 
I would really like the option to change targets easily if a new bad guy enters the room.
Problem is everyone changes their monikers constantly.
As an example I would capture:
Bad Bart the Terrible has just entered from the west.

(*) has just entered from the (%w).

The real name is Bart, the other stuff is just fluff.
I was thinking about something like the code below, it works as long as there is no fluff around the name.

#IF (%match( %expandlist( @enemylist), %1)) {newtarget = %1}

Im not real sure what to do.
Someone please point me in the right direction.
Reply with quote
rozdwojeniejazni
Wanderer


Joined: 13 Aug 2011
Posts: 74

PostPosted: Wed Feb 12, 2014 7:47 am   
 
What about such pattern?
Code:
*({@enemylist})* has just entered from the (%w).
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Wed Feb 12, 2014 2:47 pm   
 
maybe if the first/last parts are on a set list you can do
Code:

^{@pretitle}(%w){@posttitle} has just entered from the (%w).


i mean it would take a bit to capture all the pretitle and post title stuff, but it would work after they are created
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Feb 12, 2014 5:41 pm   
 
You could perhaps use %pos(), but you'd probably need to somehow determine that the arrival wasn't a mob.
_________________
EDIT: I didn't like my old signature
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Wed Feb 12, 2014 7:38 pm   
 
I thought about using the %pos function, so far this is all I got.

(*) has just entered from the (%w).

#forall @enemylist {#IF %pos(%1, %i)} {#show whoomp there it is}

It cycles though the list but doesnt seem to stop when It gets to the matching name.
Honestly I'm not too sure what this does, even if I did manage to get it to stop on the
correct name in the list, Im not too sure how to stick it into some new variable.
Again totally lost.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Wed Feb 12, 2014 8:04 pm   
 
%i will contain each item in the list as it loops through (you even use it in your %pos function). If you want to stick it in some variable, just use the usual "variable = %i". To stop the loop in the middle, use the #break command. All together, it would look something like this:
Code:
#forall @enemylist {
  #if %pos(%1, %i) {
    enemy = %i
    #break
  }
}
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Wed Feb 12, 2014 8:53 pm   
 
Yep! got my mojo working once again. Thanks everyone.
Had to change it up just a tad, but this works.

#forall @enemylist {#var newtarg %i;#if %pos( @newtarg, %1) {#break}}
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