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
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Thu Mar 12, 2009 11:17 am   

Trigger with a string variable used as a pattern.
 
I've got something like that:
Code:

<class name="Pogon" id="4658">
  <trigger priority="5" id="4682">
    <pattern>@ucieknier {podazaja|podaza|w panice wybiega|w panice umyka} na (*).$</pattern>
    <value>#echo " "
#switch (%1)
  (polnoc)            {#echo %ansi(bold,red)%concat("    / \    ",%crlf,"     |     ",%crlf)%ansi(green)%concat("     |     ",%crlf,"     o     ")}
  (poludnie)          {#echo %ansi(green)%concat("     o     ",%crlf,"     |     ",%crlf)%ansi(bold,red)%concat("     |     ",%crlf,"    \ /    ")}
  (wschod)            {#echo %ansi(green)%concat("           ",%crlf,"     o---")%ansi(bold,red)%concat("->         ")}
  (zachod)            {#echo %ansi(bold,red)%concat("           ",%crlf,"<-")%ansi(green)%concat("---o       ")}
  (polnocny-wschod)   {#echo %ansi(green)%concat("         _ ",%crlf,"         /|",%crlf,"       /   ",%crlf,"     o     ")}
  (polnocny-zachod)   {#echo %ansi(green)%concat(" _         ",%crlf,"|\         ",%crlf)%ansi(green)%concat("   \       ",%crlf,"     o     ")}
  (poludniowy-wschod) {#echo %ansi(green)%concat("      o     ",%crlf,"        \   ",%crlf,"          \ ",%crlf,"           _|")}
  (poludniowy-zachod) {#echo %ansi(green)%concat("      o     ",%crlf,"    /       ",%crlf,"  /         ",%crlf,"|_           ")}
  (gore)              {#echo %ansi(green)%concat("            ",%crlf," /\  /\  /\ ")%ansi(yellow)%concat(" u   uu   u ")}
  (dol)               {#echo %ansi(yellow)%concat("            ",%crlf)%ansi(green)%concat(" \/  \/  \/ ")}
#echo " "</value>
  </trigger>
  <trigger priority="46850" id="4685">
    <pattern>(*) {uciekl|uciekla} ci.</pattern>
    <value>#ADDITEM uciekinier %1</value>
  </trigger>
  <var name="uciekinier" type="StringList" sorted="true" id="4686"/>
  <trigger priority="46870" id="4687">
    <pattern>Nie atakujesz nikogo.$</pattern>
    <value>ucieknier=%null</value>
  </trigger>
  <alias name="pl" id="4688">
    <value>uciekinier=%null
#DELitem uciekinier {}</value>
  </alias>
  <trigger priority="46960" id="4696">
    <pattern>Decydujesz sie nie atakowac</pattern>
    <value>uciekinier=%null</value>
  </trigger>
</class>


Everything is working fine, excepting a pattern. It should catch only things contained in variable. But it isn't.
Code:

@ucieknier {podazaja|podaza|w panice wybiega|w panice umyka} na (*).$

Additionaly, if I put:
Code:

^{> |}

before the pattern, the trigger won't fire. I have no idea why. That marks are the only ways of sendind me information from mud. I was checking that using #echo. What should I change, add ? Actually I tried even delete the blank line in string list. It doesn't work too. Trigger draws marks in all situation, when appear:
Code:

{podazaja|podaza|w panice wybiega|w panice umyka} na (*).$

and any sign before that text. It doesn't matter what is in variable.
Grrr.

Sincerely,

Nayuko
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Mar 12, 2009 1:53 pm   
 
At the time that the trigger goes off, are you certain that the variable @ucieknier actually has a non-null value? I see that you have triggers adding and removing values from it, so that would be the first thing to check. Another would be to check whether you have more than one variable @ucieknier in different places, which could easily mess things up.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 12, 2009 3:01 pm   
 
Are "ucieknier" and "uciekinier" different words, or a typo? You use them both in that script, but "ucieknier" is never actually given a value, so that's the problem.

Also, if you're using a stringlist in a trigger pattern, you need to do {@varname} because the stringlist will be expanded to item1|item2|item3. For that to work in a trigger pattern it needs to be {item1|item2|item3}.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Thu Mar 12, 2009 4:11 pm   
 
The uciekinier and ucieknier aren't the same variable, but should be. Anyway, that's not the problem. Because the code just resets that unexpected variable. After changing pattern to:

Code:

{@ucieknier} {podazaja|podaza|w panice wybiega|w panice umyka} na (*).$

I still don't have expected result :/
Trigger is drawing in all situations after text:
podazaja|podaza|w panice wybiega|w panice umyka} na (*).
and the value of the variable isn't needed at all. I have no idea what is going on...

And, yes, I am sure that the variable uciekinier aren't empty. But as I checked out, it doesn't matter :(
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Mar 12, 2009 8:26 pm   
 
The trigger that adds values is using uciekinier, but your trigger pattern is using ucieknier.
Reply with quote
Nayuko
Novice


Joined: 17 Jun 2008
Posts: 41

PostPosted: Thu Mar 12, 2009 8:37 pm   
 
Oh my god!!!!
Thank you man. I am so blind! Grrrr.

Sincerely!

Nayuko
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