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
Maruchan
Newbie


Joined: 16 Sep 2005
Posts: 5

PostPosted: Fri Sep 16, 2005 6:33 pm   

Variable Multiline triggers using Keywords.
 
I'm in a dilemma. I wrote a trigger to parse up to three lines of text, and search for keywords to indicate certain afflictions. However it is not working, and I figured someone with a keener eye might know what the problem is.

The trigger is ({@knights})*$(*)$(*)


The named variables are all okay, and contain keywords that should show up.
The text I am trying to match varies widely, but a few samples are:

With a heavy overhand stroke, Guy slams a baleful rapier of darkened steel down upon you. Guy cleanly hacks off your scalp, and blinding pain and blood reverberates across your entire head.

With a heavy overhand stroke, Guy slams a baleful rapier of darkened steel down upon you. Guy hacks off your right ear, and blood fills your ear canal, making you somewhat dizzy.

And the script is as follows:

(If anyone has ideas on how to do this more elegantly, I am all ears. I'm hacking my way along, as it is and just saw this as a viable solution.)
-------------------------------------------------------------------------------------
#if (%pos( @you, %1) OR %pos( @you, %2) OR %pos( @you, %3)) {
#noop // denotes limb and side hit //
#if %pos( left, %1) {side="left"}
#if %pos( left, %2) {side="left"}
#if %pos( left, %3) {side="left"}
#if %pos( right, %1) {side="right"}
#if %pos( right, %2) {side="right"}
#if %pos( right, %3) {side="right"}
#if %pos( arm, %1) {limb="arm"}
#if %pos( arm, %2) {limb="arm"}
#if %pos( arm, %3) {limb="arm"}
#if %pos( leg, %1) {limb="leg"}
#if %pos( leg, %2) {limb="leg"}
#if %pos( leg, %3) {limb="leg"}
#noop // denotes a chest attacks //
#if %pos( @chest, %1) {chesthit="yes"}
#if %pos( @chest, %2) {chesthit="yes"}
#if %pos( @chest, %3) {chesthit="yes"}
#noop // checks that it is not a nerve hit //
#if ((%pos( @chest, %1) OR %pos( @chest, %2) OR %pos( @chest, %3)) AND (!%pos( @nervehit, %1) OR !%pos( @nervehit, %2) OR !%pos( @nervehit, %3))) {
#noop // checks for various chest afflictions //
#if %pos( "teeth", %1) {puncturedchest_on}
#if %pos( "teeth", %2) {puncturedchest_on}
#if %pos( "teeth", %3) {puncturedchest_on}
#if %pos( "foams", %1) {puncturedlung_on}
#if %pos( "foams", %2) {puncturedlung_on}
#if %pos( "foams", %3) {puncturedlung_on}
#if %pos( "flap", %1) {openedchest_on}
#if %pos( "flap", %2) {openedchest_on}
#if %pos( "flap", %3) {openedchest_on}
#if %pos( "viciously", %1) {brokenchest_on}
#if %pos( "viciously", %2) {brokenchest_on}
#if %pos( "viciously", %3) {brokenchest_on}
#if %pos( "snap", %1) {crushedchest_on}
#if %pos( "snap", %2) {crushedchest_on}
#if %pos( "snap", %3) {crushedchest_on}
}
#noop // checks for cut arteries //
#if ((%pos( "artery", %1) OR %pos( "artery", %2) OR %pos( "artery", %3)) AND (%pos( "splurts", %1) OR %pos( "splurts", %2) OR %pos( "splurts", %1))) {
#if ((@side="left") AND (@limb="arm")) {leftarmartery_on}
#if ((@side="right") AND (@limb="arm")) {rightarmartery_on}
#if ((@side="left") AND (@limb="leg")) {leftlegartery_on}
#if ((@side="right") AND (@limb="leg")) {rightlegartery_on}
}
#noop // checks for severed limbs //
#if ((%pos( "completely", %1) OR %pos( "completely", %2) OR %pos( "completely", %3)) AND (%pos( "flies", %1) OR %pos( "flies", %2) OR %pos( "flies", %3))) {
#if ((@side="left") AND (@limb="arm")) {missingleftarm_on}
#if ((@side="right") AND (@limb="arm")) {missingrightarm_on}
#if ((@side="left") AND (@limb="leg")) {missingleftleg_on}
#if ((@side="right") AND (@limb="leg")) {missingrightleg_on}
}
#noop // checks for sliced bicep //
#if ((%pos( "bicep", %1) OR %pos( "bicep", %2) OR %pos( "bicep", %3)) AND (%pos( "flows", %1) OR %pos( "flows", %2) OR %pos( "flows", %3))) {
#if (@side="left") {slicedleftbicep_on}
#if (@side="right") {slicedrightbicep_on}
}
#if !(%pos( @headhit, %1) OR %pos( @headhit, %2) OR %pos( @headhit, %3)) {
#noop // checks for a hemiplegy //
#if ((%pos( @nervehit, %1) OR %pos( @nervehit, %2) OR %pos( @nervehit, %3)) AND (%pos( @nervehit2, %1) OR %pos( @nervehit2, %2) OR %pos( @nervehit2, %3))) {
#if (@side="left") {hemiplegyleft_on}
#if (@side="right") {hemiplegyright_on}
}
#if ((@limb="arm") AND (%pos( "limp", %1) OR %pos( "limp", %2) OR %pos( "limp", %3))) {
#if (@side="left") {fracturedleftarm_on}
#if (@side="right") {fracturedrightarm_on}
}
}
#noop // checks for head attacks //
#if (%pos( @headhit, %1) OR %pos( @headhit, %2) OR %pos( @headhit, %3)) {
#noop // checks for a slit throat //
#if ((%pos( @nervehit, %1) OR %pos( @nervehit, %2) OR %pos( @nervehit, %3)) AND (%pos( @nervehit2, %1) OR %pos( @nervehit2, %2) OR %pos( @nervehit2, %3))) {slitthroat_on}
#noop // checks for missing left and right ears //
#if ((%pos( "ear", %1) OR %pos( "ear", %2) OR %pos( "ear", %3))) {
#if (@side="left") {missingleftear_on}
#if (@side="right") {missingrightear_on}
}
#noop // checks for a missing scalp //
#if (%pos( "reverberates", %1) OR %pos( "reverberates", %2) OR %pos( "reverberates", %3)) {scalped_on}
#noop // checks for sliced forehead //
#if (%pos( "eyes", %1) OR %pos( "eyes", %2) OR %pos( "eyes", %3)) {slicedforehead_on}
#noop // checks for a broken jaw //
#if ((%pos( "shatters", %1) OR %pos( "shatters", %2) OR %pos( "shatters", %3)) AND (%pos( @bcalhits, %1) OR %pos( @bcalhits, %2) OR %pos( @bcalhits, %3))) {brokenjaw_on}
#noop // checks for a broken nose //
#if ((%pos( "savagely", %1) OR %pos( "savagely", %2) OR %pos( "savagely", %3)) AND (%pos( @bcalhits, %1) OR %pos( @bcalhits, %2) OR %pos( @bcalhits, %3))) {brokennose_on}
#noop // checks for a fractured skull //
#if ((%pos( "hard", %1) OR %pos( "hard", %2) OR %pos( "hard", %3)) AND (%pos( @bcalhits, %1) OR %pos( @bcalhits, %2) OR %pos( @bcalhits, %3))) {fracturedskull_on}
#noop // checks for a concussion //
#if ((%pos( "addled", %1) OR %pos( "addled", %2) OR %pos( "addled", %3)) AND (%pos( @bcalhits, %1) OR %pos( @bcalhits, %2) OR %pos( @bcalhits, %3))) {concussion_on}
}
#noop // checks for gut attacks //
#if (%pos( "gut", %1) OR %pos( "gut", %2) OR %pos( "gut", %3)) {
#noop // checks for a sliced gut //
#if (%pos( "pours", %1) OR %pos( "pours", %2) OR %pos( "pours", %3)) {slicedgut_on}
#noop // checks for dysentery //
#if (%pos( "intestine", %1) OR %pos( "intestine", %2) OR %pos( "intestine", %3)) {dysentery_on}
#noop // checks for impales //
#if (%pos( "impaled", %1) OR %pos( "impaled", %2) OR %pos( "impaled", %3)) {impaled_on}
#noop // checks for burst organs //
#if ((%pos( "mortally", %1) OR %pos( "mortally", %2) OR %pos( "mortally", %3)) AND (%pos( "internal", %1) OR %pos( "internal", %2) OR %pos( "internal", %3))) {burstorgans_on}
}
#noop // checks for severed tendons //
#if ((%pos( "tendon", %1) OR %pos( "tendon", %2) OR %pos( "tendon", %3)) AND (%pos( "agony", %1) OR %pos( "agony", %2) OR %pos( "agony", %3))) {
#if (@side="left") {slicedleftheel_on}
#if (@side="right") {slicedrightheel_on}
}
#noop // checks for broken legs //
#if ((%pos( "thigh", %1) OR %pos( "thigh", %2) OR %pos( "thigh", %3)) AND (%pos( "shatters", %1) OR %pos( "shatters", %2) OR %pos( "shatters", %3))) {
#if (@side="left") {brokenleftleg_on}
#if (@side="right") {brokenrightleg_on}
}
}
limb=%noop
side=%noop
check_all
Reply with quote
xenapan
Wanderer


Joined: 26 May 2004
Posts: 68

PostPosted: Fri Sep 16, 2005 8:07 pm   
 
thats alot of stuff.. im not entirely sure of your method.. but i would use variables in the pattern.

With a heavy overhand stroke, Guy slams a baleful rapier of darkened steel down upon you. Guy @bodydamage

then you fill your variable @bodydamage as a list {cleanly hacks off your scalp, and blinding pain and blood reverberates across your entire head. |hacks off your right ear, and blood fills your ear canal, making you somewhat dizzy. }

since you really arent too interested in the other parts of the line.. maybe just shorten it to the affliction part and just have

%w @bodydamage

and leave the rest out. that said, you will need further help on this (if I got something right) as im not sure how to deal with finding out WHICH body damage hit you took.. just that you took body damage.
_________________
Player on Realms of Despair. realms.game.org port 4000. Join us today!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Sep 17, 2005 12:24 pm   
 
I would suggest trying the %trigger predefined variable. I never played with it on a multiline trigger, but it should contain all 3 lines. The other way to go is combine %1, %2 and %3 into a single variable at the beginning of your script. In either case this will allow you to cut the size of the script down by 50%.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Maruchan
Newbie


Joined: 16 Sep 2005
Posts: 5

PostPosted: Sat Sep 17, 2005 12:30 pm   
 
Would %looplines work here? It says match pattern over N lines (only stops matching when used in multistate trigger)

And the three lines can vary greatly between weapons, weapontypes, hacking/cutting/bashing/smashing/slicing/pounding/etc variable words within the attack, and the actual attack type. That said, I believe %trigger would be a bit tedious. The two lines I showed above were very similar, and I'm trying to encompass a very large amount of messages with initial half-line swing type messages and keyword affliction messages being the only similarity.
Reply with quote
psyber624
Newbie


Joined: 17 Sep 2005
Posts: 5

PostPosted: Sun Sep 18, 2005 5:08 am   
 
my recommendation is simillar to xena pans, but more focused. Instead of putthing the whole phrase in there, put the pertinent info. For instance..
{ear|hand|leg|right|left|....., then use wild cards to pick up what was put in there, and this if statements to determine what it was. still not elegant, but better than some.
Reply with quote
Maruchan
Newbie


Joined: 16 Sep 2005
Posts: 5

PostPosted: Sun Sep 18, 2005 5:12 am   
 
%pos( @stringlist, @triggerlines) doesn't work, from what I tried.
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