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: Thu Apr 24, 2014 2:41 am   

Help analyzing input
 
How do I analyze all incoming text and compare it to a list of keywords?

All text, not just specific repeating text, random text, etc. I want to check to see if specific words pop and act accordingly.

So for instance if I see the word fire/hot/scalding/lava/etc and I cast an ice spell, it could be in a room description, mob emote, room emote, incoming damage spell, etc, etc..

I imagine I could use %ismember, but I haven't figured out how to analyze the incoming text, and then compare it against a list. Do I just trigger (*) ?

Any help would be wonderfully appreciated!!!
Reply with quote
hadar
Apprentice


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

PostPosted: Thu Apr 24, 2014 3:20 am   
 
i would think this would work ... might be a bit laggy though, and wont take multiple lines like "burning ice" or something like that
Code:

<trigger priority="75770" repeat="true" id="7577">
  <pattern>(%w)</pattern>
  <value>#switch (%lower(%1))
            ("fire") {something here}
            ("ice") {something here}
            ("etc") {etc}</value>
</trigger>
_________________
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
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Fri Apr 25, 2014 12:47 pm   
 
Thanks hadar, it works, but it's awfully messy.

I tried using ismember but failed.

Is there a way to reference a list and then execute the command, all of the triggered words are going to have the same result.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Apr 25, 2014 5:17 pm   
 
Sure, you can stick it directly in the pattern: {@listvar}.
Reply with quote
hadar
Apprentice


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

PostPosted: Fri Apr 25, 2014 6:00 pm   
 
im assuming you have multiple variables, you can make multiple triggers using daern or do something like
Code:

#local $string
$string=%1
#if (%ismember($string,@list)) {blagh}
#if (%ismember($string,@list)) {blagh}
#if (%ismember($string,@list)) {blagh}


can always replace string for %1, i just like local that way its a quick edit for adding new lines
_________________
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
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