|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: 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!!! |
|
|
|
hadar Apprentice
Joined: 30 Aug 2009 Posts: 198 Location: my apt, in california
|
Posted: 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>
|
|
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: 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. |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Fri Apr 25, 2014 5:17 pm |
Sure, you can stick it directly in the pattern: {@listvar}.
|
|
|
|
hadar Apprentice
Joined: 30 Aug 2009 Posts: 198 Location: my apt, in california
|
Posted: 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 |
|
|
|
|
|