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
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Sat Apr 24, 2021 12:07 am   

I'm stumped
 
the following code snippet has been manually tested for pattern match for all possible matches... yet it consistently fails to fire for about 6-8 matches... the same ones too
I am at a loss as to what's going on lol.

Code:
<trigger name="AlphabetDungeon" priority="9540" regex="true" id="954">
  <pattern>^M:Letter (\w)\.$</pattern>
  <value>$mobList="A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z"
#IF (%ismember(%1,$mobList)) {kList = %additem("letter",@kList)}</value>
</trigger>


I use 'k' to 'kill %pop(kList)'

or for automated version #IF (%numitems(@kList) > 0) {kill %pop(kList)} in my kTrig

a full run through all 28 rooms of this area ( room 1 has nothing to kill )
Code:
            Letter a :
            Letter f :
            Letter b :
            Letter c :
            Letter d :
            Letter e :
            Letter h :
            Letter m :
            Letter l :
            Letter k :
            Letter n :
            Letter o :
            Letter t :
            Letter y :
            Letter x :
            Letter w :
            Letter v :
Reply with quote
shalimar
GURU


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

PostPosted: Fri Apr 30, 2021 12:16 pm   
 
#IF (%ismember(%1,$mobList)) {kList = %additem("letter",@kList)}

This snippet of code in particular confuses me for the following reasons:

1. The odds of a false positive firing seems too low to bother with the error-proofing in using an #IF, though its always good to check
2. It's always doing the same thing anyway, not even incorporating %1 in the %additem.

What good is having @klist with a value of "letter|letter|letter|letter|etc"?
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Fri Apr 30, 2021 11:59 pm   
 
After reading your comment, and reviewing the whole trig... it's my bad habit of over-complicating things needlessly.

You are correct in that it is moot to do it this way as the pattern will always be "M:Letter ?" where ? is one of the letters in the alphabet.

Originally the trigger was used in a more universal setting and instead of 'M:Letter' it was 'M:\w+' to match a large number of descriptive wording.
Very rarely would any monster in a room be a single word so it was used to match and ignore the first word.

The reason for the %additem in this case is another moot point as it is a single entity per room, but some rooms in different areas will call for help
and using %additem to append to the kList will allow me to ensure I will clear the room fully before progressing to the next.
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