Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Y3KPanic
Novice


Joined: 21 Apr 2004
Posts: 34

PostPosted: Mon Jul 12, 2004 8:37 am   

Extremely Difficult Trigger
 
Hello, a pattern in my MUD is giving me tons of trouble, and I have no idea how I would go about triggering off of it.

The pattern is as follows:

A *****ly stinging overcomes your body, fading away into numbness.

However, there are always exactly three *'s, placed randomly within this message, each one replacing a letter. Also, one letter or space next to one of these *'s may be cut out, randomly. Here are some sample messages:

A *****ly stingin*overcomes yo*r body, fading away into numbness.
A *****ly stinging overcomes your body,*fading away into num**ss.
A *****l*stinging overcomes your b*dy, fa*ing away into numbness.
A p*ickl*stinging overcomes your body, fadin* away into numbness.
A *****ly stingi*g overcomes your *dy, fading away into n*mbness.
A *ickl* stinging overcomes your body, fading *way into numbness.
A pr*ckly stinging *erc*mes your body, fading away into numbness.

This is my current pattern, but it does not account for the single disappearing letter or space:

{A|~*}{ |~*}{p|~*}{r|~*}{i|~*}{c|~*}{k|~*}{l|~*}{y|~*}{ |~*}{s|~*}{t|~*}{i|~*}{n|~*}{g|~*}{i|~*}{n|~*}{g|~*}{ |~*}{o|~*}{v|~*}{e|~*}{r|~*}{c|~*}{o|~*}{m|~*}{e|~*}{s|~*}{ |~*}{y|~*}{o|~*}{u|~*}{r|~*}{ |~*}{b|~*}{o|~*}{d|~*}{y|~*}{,|~*}{ |~*}{f|~*}{a|~*}{d|~*}{i|~*}{n|~*}{g|~*}{ |~*}{a|~*}{w|~*}{a|~*}{y|~*}{ |~*}{i|~*}{n|~*}{t|~*}{o|~*}{ |~*}{n|~*}{u|~*}{m|~*}{b|~*}{n|~*}{e|~*}{s|~*}{s|~*}{.|~*}

Is anyone able to shed some light on this problem for me?
Reply with quote
Y3KPanic
Novice


Joined: 21 Apr 2004
Posts: 34

PostPosted: Mon Jul 12, 2004 8:39 am   
 
Ahhh, it seems the censor took out the "p r i c k" in "*****ly". I hope you can still understand my problem.
Reply with quote
Thinjon100
Apprentice


Joined: 12 Jul 2004
Posts: 190
Location: Canada

PostPosted: Mon Jul 12, 2004 9:06 am   
 
Maybe this isn't exactly what you were lookign for, but it might help from a logical standpoint... since there are exactly 3 asterisks, but there are 10 words, wouldn't it be feasibly to create a state machine that triggered itself on the individual words, and if it counted 7 words from the pattern (since the stars can only mess up 3 of them potentially), then trigger your action?

An afterthought... I wouldn't count the 'A' in the beginning as a word, so adjust numbers to 9, and 6 respectively :)

Wish I could help you with more specific code, but I'm still rather new at it myself... just hope this might put you on a different track.
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Mon Jul 12, 2004 2:28 pm   
 
Code:
#CLASS {distance}
#ALIAS distance {#SS "VBScript" function min(a, b, c)
   min = a
   if a < b and a < c then
      min = a
  end if
  if b < a and b < c then
     min = b
  end if
  if c < a and c < b then
     min = c
  end if
end function

str1 = %1
str2 = %2

redim tst2(len(str1),len(str2))

' Initialize the array.
for i = 0 to len(str1)
  tst2(i, 0) = i
next
for i = 0 to len(str2)
  tst2(0, i) = i
next

for i = 1 to len(str1)
    for j = 1 to len(str2)
        cost = 1
        if mid(str1, i, 1) = mid(str2, j, 1) then
                cost = 0
        end if
        tst2(i, j) = min(  tst2(i-1, j-1) + cost, tst2(i, j-1) + 1, tst2(i-1, j) + 1)
    next
next

set v = sess.MakeVar("dist", "0", "0", "")
v.Value = tst2(len(str1), len(str2))
}
#ALIAS showdistance {distance %1 %2;#echo @dist}
#ALIAS findmatch {bestmatch=400000;beststring = "unknown";
       #forall @matches {distance %1 "%i";
                         #if (@bestmatch > @dist) {
                             bestmatch = @dist;beststring = %i
                          }};
                #show '@beststring' at distance @bestmatch}
#VAR matches {}
#CLASS 0


How to use:
Add the strings to match to the 'matches' string list variable. Then run 'findmatch "text"' to see an example.

Example:
I add "A prickly stinging overcomes your body, fading away into numbness." to the string list.

Then I run:
findmatch "A p*ickl*stinging overcomes your body, fadin* away into numbness."
-> 'A *****ly stinging overcomes your body, fading away into numbness.' at distance 4

Which means that this is the most likely string. Let's try something really stupid:
findmatch "Woooooo!!"
->'A *****ly stinging overcomes your body, fading away into numbness.' at distance 61

The lower the distance the more close it is to the original sentence. If the distance is 0 then the strings are equal. The beauty about this is that it shouldn't matter how the anti-trigger system "damages" the text - as long as we don't need the contest and there are no ambiguities the correct closest match should be found.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jul 13, 2004 1:06 am   
 
A solution to this was found a long time ago. The they changed it around some to make it harder to initially trigger the detection, but it isn't that hard. Start with a word list.
#VAR WordList {*****ly|stinging|overcomes|fading|numbness}
Note: They only do a limited number of asterisks, the word list for a given line must exceed that number to assure a match on one uncorrupted word.

Now add a trigger that matches on the word list then uses a reverse matching method.
#TR {{@WordList}} {#IF (%match("A *****ly stinging overcomes your body, fading away into numbness.", %line)) {#NOOP we got a match, do something}}
Since the character they use "*" is pattern wildcard we can directly use the line sent as the pattern in our match function, and use the correct line in what would be the normal input position.

This is untested, but the theory is accurate.
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Wed Jul 14, 2004 8:40 am   
 
Vijilante wrote:
A solution to this was found a long time ago. The they changed it around some to make it harder to initially trigger the detection, but it isn't that hard. Start with a word list.
#VAR WordList {*****ly|stinging|overcomes|fading|numbness}
Note: They only do a limited number of asterisks, the word list for a given line must exceed that number to assure a match on one uncorrupted word.

Now add a trigger that matches on the word list then uses a reverse matching method.
#TR {{@WordList}} {#IF (%match("A *****ly stinging overcomes your body, fading away into numbness.", %line)) {#NOOP we got a match, do something}}
Since the character they use "*" is pattern wildcard we can directly use the line sent as the pattern in our match function, and use the correct line in what would be the normal input position.

This is untested, but the theory is accurate.


This is really clever! Smile. It is a mystery why some MUDs try to make anti-triggering systems. Especially when the workaround was that easy.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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