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
nojathon
Beginner


Joined: 21 Feb 2011
Posts: 15

PostPosted: Sat Oct 29, 2022 10:36 pm   

How to capture a mob short description as a trigger?
 
There is a skill called grapple that is a type of rescue, except it has to target the mob, not the multi in order to rescue the multi. Is there a way to capture the short description of a mob to make the trigger to "grapple MOBNAME".

So I'm fighting, then the mob targets MULTI1.

An immortal guardian switches and hits MULTI1 very hard!
An immortal guardian pummels MULTI1 hard.

In this case, I would want to "grapple guardian" or "immortal guardian".

There are about a thousand different mobnames. Rescue triggers are easy because you only have to target one name, your Multi. This one is more difficult because you have to target the mobname. Would this require a mob database? Any ideas?
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 168

PostPosted: Sun Oct 30, 2022 3:54 am   
 
#TR {An (%a) switches and hits * hard|very hard!} {grapple %1}
#TR {An (%a) pummels * hard|very hard!} {grapple %1}


assuming MULTI1 is a potential list of targets as well...
Reply with quote
shalimar
GURU


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

PostPosted: Sun Oct 30, 2022 2:02 pm   
 
Given language rules, every possible variant won't start with 'An', some might have an 'a', or 'the', or even a numerical count instead.
You can also merge both into a single trigger.

Code:

#TR {(*) {switches and hits|pummels} * {very |}hard!} {
  $target=%word(%1, %numwords(%1))
  grapple $target
  }
_________________
Discord: Shalimarwildcat
Reply with quote
zilch
Newbie


Joined: 07 Feb 2020
Posts: 8

PostPosted: Sat Jan 28, 2023 12:39 pm   
 
I have been working on something similar to track target data.
You will need a string list keyword_blacklist to store words you want removed.

Code:

//Init $keywords to stop compiler errors
#LOCAL $keywords
//Replaces most symbols and converts into string list
$tempString = %lower(%replace(%replace(%replace(%replace(%replace(%replace(%replace($tempString, ",", ""), "'", ""), ".", ""), ~", ""), ~), ""), ~(, ""), " ", "|"))
$keywords = $tempString
//loop string list and removed know descriptives
#FORALL ($tempString) {
  $word = %trim(%i)
  #IF (%ismember(%lower($word), @keyword_blacklist)) {
    $keywords = %trimleft(%remove($word, $keywords))
  }
}
//Convert back to string literal
$keywords = %trim(%replace($keywords, "|", " "))
//Return only the first keyword
#RETURN %word($keywords, 1)
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