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
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sun Nov 05, 2017 7:52 pm   

What's the best way to capture this
 
I'm trying to capture the monsters name, but it's not exactly convenient.

The format typically looks like this:

(mob)Jeff.
(mob)George.

etc..

However, the name changes all the time, it can sometimes be two names(never more), and there's other bits and pieces that may be added.. Some examples:

(mob)Frank Sr
(mob)Frank Sr attacking you!.
(mob)Frank Sr [wounded] [34%] attacking you!. (wounded can also be scratched or dying)
(mob)Jason [scratched] [95%].

Out of all of that, I ONLY want to capture the mobs name if it's 1 or 2 words, I want to ignore everything after that, the wounded, % and attacking you!

I can't figure out a nice way to do that :(
Reply with quote
shalimar
GURU


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

PostPosted: Sun Nov 05, 2017 8:55 pm   
 
#TR (~(mob~) ({%w|%w %w}){%s|%p}} {$mob=%replace(%1, " attacking")}

Something like that should work, but I didn't test it.
_________________
Discord: Shalimarwildcat
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sun Nov 05, 2017 11:04 pm   
 
It doesn't quite work. I had to fix the ({ mistakes, but even then it still fails if the monster has [50%] added on. Also I forgot to mention sometimes the monster will have a title after it

(mob)Billy Bob (super strong) [wounded] [40%] attacking you!.

That would be the most complex the title gets, and from that I only want Billy Bob...

Would it be easier to perhaps make multiple triggers than 1 complex trigger? This is a little beyond my abilities.
Reply with quote
shalimar
GURU


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

PostPosted: Tue Nov 07, 2017 9:24 pm   
 
well the pattern should already account for the title there in the generic way it is defined, the biggest issue I see that I made was inserting a space after the (mob)


Code:
#TR (~(mob~)({%w|%w %w}){%s|%p}} {
  $mob=%1
  $errorProofing=attacking
  #FORALL $errorProofing {$mob=%trim(%replace($mob, %i))}
  }


Something like this will allow you to easily add any other extra words besides attacking that might get mistakenly included in the mobName for one-word mobs.
_________________
Discord: Shalimarwildcat
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