 |
Gwaethiel Beginner
Joined: 23 Feb 2011 Posts: 13
|
Posted: Thu Feb 21, 2013 11:08 pm
Data records creating with triggers. |
Hello!
I have a little problem. So, i want to write script, when if MUD send to me, for example:
Little stinky orc hits you with his sword, but damage was parried by big black shield.
I made trigger:
#TR {but damage was parried by %1.} {#ADD parry 1}
That works. But i wan't also to make variable which take the %1 (in this example big black shield), and add 1 to it. When %1 is different it make another record and add +1 to it.
Maybe little example:
I fight with 3 enemies.
1 of them hit me, but dmg is parried by black big helmet and orc 2 and 3 hit me, but dmg is parried by big black shield.
In variable it should look like:
black big helmet=1
big black shield=2
How can i do this? |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Feb 22, 2013 4:06 am |
1)don't use %1 in trigger patterns. It works, but it's a very bad habit. Using %1...%99 is identical to *. * matches any printable character labeled on your keyboard, so long as it's not used as one of your special characters per Special Character Preferences. Because of this wide matching, * happens to be quite slow. Read the helpfile on pattern matching to learn more about wildcards.
2)Per the pattern matching helpfile, use () to store that part of the pattern into a %1...%99 variable.
3)this is the code your trigger will run: #addkey parry "%1" %eval(%db(@parry,"%1") + 1) |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Gwaethiel Beginner
Joined: 23 Feb 2011 Posts: 13
|
Posted: Fri Feb 22, 2013 1:42 pm |
Totally edit:
I have other problem.
Sorry for example in polish, but i don't know how to write it in english:
Maly zielony goblin LEKKO RANI CIE malym ostrym sztyletem.
So, i have trigger to count hits (like "lekko rani cie' is one hit, and 'rani cie' is second hit).
I set trigger with
Pattern: lekko rani cie
Value: #ADDkey trafione {lrani=%eval( %db( @trafione, lrani) +1)}
And
Pattern: rani cie
Value: #ADDkey trafione {rani=%eval( %db( @trafione, rani) +1)}
Is there any possibility, that 'lekko rani cie' will be not counting as 'rani cie' too? |
|
|
 |
|
|
|
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
|
|