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
karthic
Wanderer


Joined: 28 Aug 2001
Posts: 86
Location: USA

PostPosted: Thu Dec 13, 2001 5:36 am   

VERY complicated trigger
 
mornin..
these are the patters i need to test.. i would like to be able to test them in AS FEW AS POSSIBLE trigger as possible...
All the ALL CAPS WORDS need to be the stored words, (eg: FIRSTNAME, %1, LASTNAME %2......)
forgot to mention... the TITLE can be one or two words... hehe..



You see FIRSTNAME LASTNAME, a RACE.
You see FIRSTNAME LASTNAME of elanthia, a RACE.
You see FIRSTNAME LASTNAME, a RACE GUILD.
You see FIRSTNAME LASTNAME of elanthia, a RACE GUILD.
You see TITLE FIRSTNAME LASTNAME, a RACE.
You see TITLE FIRSTNAME LASTNAME of elanthia, a RACE.
You see TITLE FIRSTNAME LASTNAME, a RACE GUILD.
You see TITLE FIRSTNAME LASTNAME of elanthia, a RACE GUILD.

then.. you've got others for thieves..
You see a fellow thief, FIRSTNAME LASTNAME, a RACE.
You see a fellow thief, FIRSTNAME LASTNAME of elanthia, a RACE.
You see a fellow thief, FIRSTNAME LASTNAME, a RACE GUILD.
You see a fellow thief, FIRSTNAME LASTNAME of elanthia, a RACE GUILD.
You see a fellow thief, TITLE FIRSTNAME LASTNAME, a RACE.
You see a fellow thief, TITLE FIRSTNAME LASTNAME of elanthia, a RACE.
You see a fellow thief, TITLE FIRSTNAME LASTNAME, a RACE GUILD.
You see a fellow thief, TITLE FIRSTNAME LASTNAME of elanthia, a RACE GUILD.

this catagory the title.. is a fake one.. and the secondtitle is a real title.... both need to be stored.. but this section prolly needs to be different from the others
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME, a RACE.
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME of elanthia, a RACE.
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME, a RACE GUILD.
You see You see TITLE (a thief SECONDTITLE) FIRSTNAME LASTNAME of elanthia, a RACE GUILD.

i know that's alot but.. take it as a challenge..
when i look at someone.. anyone of thoes formats could show up... this is extremly hard from what i have been trying...
thank you sooo much
karthic


karthic


karthic
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Thu Dec 13, 2001 5:56 am   
 
well, it depends on what you want the trigger to do. a good starting place would be this:

#tr {^You see (*), a (*).$} {
class_title_name = %replace(%1," ","|")
#if %pos(" ",%2) {race_guild = %replace(%2," ","|")} {race = %2}
}

this will give you two variables, and then you play around with them however you want. looping through to remove the "a" or "fellow " if it exists, looking at the last item in the var class_title_name will be the lastname, and the second to last item will be the first name, the third to last item will allways be the persons real title (thief fakeout or not) etc. etc.


You could change the trigger pattern to this:

#tr {^You see (*).}

and have all the info in one variable, split it into a stringlist, and work with it that way, but i thought that might not be wise, since items and what not might cause it to fire. if you want some more input, just post what you want the trigger to do i'll be glad to help.
Emit
Reply with quote
karthic
Wanderer


Joined: 28 Aug 2001
Posts: 86
Location: USA

PostPosted: Thu Dec 13, 2001 6:23 am   
 
i need each and everything that is in CAPS to be in its own variable, to store in a database...
that should give ye an idea what i need..
FIRSTNAME LASTNAME TITLE RACE CLASS
all need to be in thier own variable..
i can play around with the actual trigger body.. i just need a trigger to catch all of that.. and only that.. in as few tiggers as possible... i believe i have 6 right now..
i would like less... hopefully 2 or 3.. thanks
karthic

karthic
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Dec 13, 2001 6:07 pm   
 
#TR {You see (%w) (%w), a (%w)} {#VAR firstname %1;#VAR lastname %2;#VAR race %3}

#TR {You see (%w) (%w) (%w), a (%w)} {#VAR title %1;#VAR firstname %2;#VAR lastname %3;#VAR race %4}

#TR {You see (%w) (%w) (%w) (%w), a (%w)} {#VAR title %1+" "+%2;#VAR firstname %3;#VAR lastname %4;#VAR race %5}

--------------------------

#TR {You see (%w) (%w), a (%w) (%w)} {#VAR firstname %1;#VAR lastname %2;#VAR race %3;#VAR guild %4}

#TR {You see (%w) (%w) (%w), a (%w) (%w)} {#VAR title %1;#VAR firstname %2;#VAR lastname %3;#VAR race %4;#VAR guild %5}

#TR {You see (%w) (%w) (%w) (%w), a (%w) (%w)} {#VAR title %1+" "+%2;#VAR firstname %3;#VAR lastname %4;#VAR race %5;#VAR guild %6}

--------------------------

Similar sets of triggers for elanthians, thieves, and elanthian thieves.

#TR {You see (%w) (%w), of elanthia, a (%w)} {#VAR firstname %1;#VAR lastname %2;#VAR race %3}

--------------------------

#TR {You see a fellow thief, (%w) (%w), a (%w)} {#VAR firstname %1;#VAR lastname %2;#VAR race %3}

--------------------------

#TR {You see a fellow thief, (%w) (%w), of elanthia, a (%w)} {#VAR firstname %1;#VAR lastname %2;#VAR race %3}

and by now you should be able to figure out how to handle the fake titles

#TR {You see (%w) a thief (%w) (%w) (%w), a (%w)} {#VAR faketitle %1;#VAR title %2;#VAR firstname %3;#VAR lastname %4;#VAR race %5}


I don't see how you got it down to 6 triggers, I'd figure 15-20. Good luck.


LightBulb
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Thu Dec 13, 2001 6:56 pm   
 
quote:

... i believe i have 6 right now..
i would like less... hopefully 2 or 3.. thanks
karthic



I can't get it to less than 6... 3 for catching 1-word titles, and 3 for catching 2-word titles.

You could likely get it to 2(one for 1-word, one for 2-word) but the syntax is eluding me. I'll try later.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Thu Dec 13, 2001 10:06 pm   
 
I've managed to create 3 triggers out of all this. It's possible to put them all in one, but given the size and complexity of the word processing mathematics nesseccary I would strongly recommend against that.

I'm very interested to hear if these even work btw :) (in theory they should, but a syntax error is easily made with this)

#TRIGGER {You see (*) ~(a thief (*)~) (*), a (*).} {Title = "%1";SecondTitle = "%2";FirstName = %word( "%3", 1);LastName = %word( "%3", 2);#IF (%numwords( "%4") = 1) {Race = %4} {Race = %word( "%4", 1);Guild = %word( "%4", 2)}} "Test"
#TRIGGER {You see (*), a (*).} {#VARIABLE a %replace( "%1", " ", "|");#IF (%ismember( "thief", @a)) {#ABORT};#IF (%word( %numwords( "%1")) <> "elanthia") {#IF (%numwords( "%1") = 2) {FirstName = %word( "%1", 1);LastName = %word( "%1", 2)};#IF (%numwords( "%1") = 3) {Title = %word( "%1", 1);FirstName = %word( "%1", 2);LastName = %word( "%1", 3)};#IF (%numwords( "%1") = 4) {Title = %word( "%1", 1) %word( "%1", 2);FirstName = %word( "%1", 3);LastName = %word( "%1", 4)}} {#IF (%numwords( "%1") = 4) {FirstName = %word( "%1", 1);LastName = %word( "%1", 2)};#IF (%numwords( "%1") = 5) {Title = %word( "%1", 1);FirstName = %word( "%1", 2);LastName = %word( "%1", 3)};#IF (%numwords( "%1") = 6) {Title = %word( "%1", 1) %word( "%1", 2);FirstName = %word( "%1", 3);LastName = %word( "%1", 4)}};#IF (%numwords( "%4") = 1) {Race = %4} {Race = %word( "%4", 1);Guild = %word( "%4", 2)}} "Test"
#TRIGGER {You see a fellow thief, (*), a (*).} {#IF (%word( %numwords( "%1")) <> "elanthia") {#IF (%numwords( "%1") = 2) {FirstName = %word( "%1", 1);LastName = %word( "%1", 2)};#IF (%numwords( "%1") = 3) {Title = %word( "%1", 1);FirstName = %word( "%1", 2);LastName = %word( "%1", 3)};#IF (%numwords( "%1") = 4) {Title = %word( "%1", 1) %word( "%1", 2);FirstName = %word( "%1", 3);LastName = %word( "%1", 4)}} {#IF (%numwords( "%1") = 4) {FirstName = %word( "%1", 1);LastName = %word( "%1", 2)};#IF (%numwords( "%1") = 5) {Title = %word( "%1", 1);FirstName = %word( "%1", 2);LastName = %word( "%1", 3)};#IF (%numwords( "%1") = 6) {Title = %word( "%1", 1) %word( "%1", 2);FirstName = %word( "%1", 3);LastName = %word( "%1", 4)}};#IF (%numwords( "%2") = 1) {Race = %2} {Race = %word( "%2", 1);Guild = %word( "%2", 2)}} "Test"

Okay, just copy and paste that mess in. It will be created in a trigger class called "Test".

Acaila
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Dec 13, 2001 11:37 pm   
 
#TR {You see *{~(|}*{~)|}*, *.$} {
TempCap=%replace(%trigger,"You see ", "")
TempCap=%remove("a fellow thief, ", @TempCap)
TempCap=%remove(" of elanthia", @TempCap)
TempCap=%replace(@TempCap,"~(a thief ", "~(")
TempCap=%replace(@TempCap," a ", " ")
#IF (%pos("~(",@TempCap)) {
SecondTitle=%copy(@TempCap,%pos("~(",@TempCap,),%eval(%pos("~)",@TempCap)-%pos("~(",@TempCap)+1))
TempCap=%remove(%concat(%quote(@SecondTitle)," "),@TempCap)
SecondTile=%copy(@SecondTitle,2,%eval(%len(@SecondTitle)-1))
}
LastName=1
#WHILE (not (%ends(%word(@TempCap,@LastName),","))) {#ADD LastName 1}
FirstName=%word(@TempCap,%eval(@LastName-1))
Race=%word(@TempCap,%eval(@LastName+1))
#IF (%ends(@Race,".")) {
Race=%remove(".",@Race)
Guild=""
} {
Guild=%remove(".",%word(@TempCap,%eval(@LastName+2)))
}
LastName=%remove(",",%word(@TempCap,@LastName))
Title=%copy(@TempCap,1,%eval(%pos(@FirstName,@TempCap)-1))
}

There you go minimum is 1 trigger. However some users indicate that having more generic triggers degrades performance. Also I have heard and seen that * does not match special characters like (). The main reason being that they can wreak havoc on your scripts if they are unexpected. So make very sure to have a care when using this trigger. I suggest you have it turn on and off as you look at people. Also the trigger is fixated to the end of line you may wish to switch that.
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