|
dazed-n-confused999 Wanderer
Joined: 03 Aug 2004 Posts: 79
|
Posted: 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. |
|
|
|
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Wed Feb 12, 2014 7:47 am |
What about such pattern?
Code: |
*({@enemylist})* has just entered from the (%w). |
|
|
|
|
hadar Apprentice
Joined: 30 Aug 2009 Posts: 198 Location: my apt, in california
|
Posted: 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 |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
dazed-n-confused999 Wanderer
Joined: 03 Aug 2004 Posts: 79
|
Posted: 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. |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: 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
}
} |
|
|
|
|
dazed-n-confused999 Wanderer
Joined: 03 Aug 2004 Posts: 79
|
Posted: 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}} |
|
|
|
|
|