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


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Fri Oct 14, 2005 6:00 pm   

capture trigger help
 
I am trying to make a identify spell catcher to send info to my db. I can capture all the info, but in one part of the information, I am having trouble. The display can vary and I compensated for most of the info shown, but on the enchantments on gear, it can alternate between several lines and one line. Here are a few examples.

Quote:
This is a dark blue robe covered with silver runes, a medium cloth armor,
weighing approximately 6 lbs. Protection is inferior vs. Pierce, inferior
vs. Bash and inferior vs. Slash. It is of average quality and is worth
approximately 99 silver. It bears an enchantment to slightly increase magic
resistance. It bears an enchantment to slightly increase magical energy

This is a bracer enscribed with runes, a medium adamantite treasure,
weighing approximately 2 lbs. It is of above average quality and is worth
approximately 251 silver. It bears an enchantment to slightly increase
magic resistance. It bears an enchantment to slightly increase magical
energy.

This is a fur mantle, a medium fur treasure, weighing approximately 2
lbs. It is of average quality and is worth approximately 100 silver. It
bears an enchantment to slightly increase combat endurance. It bears an
enchantment to slightly increase constitution.

This is a blue spiked collar, a medium leather treasure, weighing 4 lbs.
It is of average quality and is worth approximately 100 silver.
It bears an enchantment to slightly increase strength.
It bears an enchantment to slightly increase resistance to breath weapons.
.

I can catch each one individually if I am testing and know what to expect. And I tried making several triggers, which kind of works, but they interfere with each other. For example...

Code:
It bears an enchantment to (*)

It bears an enchantment to (*$*)

The first example gets in the way with the others because it catches the first line, then it messes the whole thing up. Is there any way to make just one trigger to do it all? I tried and my attempts so far are futile. Any help would be appreciated. Thank you.


Alaric.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Oct 14, 2005 6:58 pm   
 
Sure. Start by capturing everything to a variable. I am going to assume a blank line will denote then of the identify text since you didn't include anything useful in your examples.

#TRIGGER " IDCapture" {^This is (a{n|} *)$} {IDCap="%1"}
#CONDITION {} {#IF (%line="") {#STATE IDCapture 3;#SET IDCapture 3 1} {IDCap=%concat(@IDCap," ",%line)} {looplines|param=10}
#CONDITION {*} {#STATE IDCapture 0;#ECHO IDCapture failed, number of capture lines exceeded.}
#CONDITION {} {IDCapture=%replace(%replace(%replace(@IDCap,". ","|"),". ","|")," "," ");#NOOP Further processing here} {manual}

Now the further processing section noted in bold can almost always be managed entirely by replaces. You may want to use a #FORALL to handle processing the enchantments. It will be helpful to record them in the database as a list. They seem like they might be seperate additions to the base item, that a player could affect; and therefore you want your fields to be able to query and compare in such a fashion that all enchantments are ignored.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
alaric
Novice


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Fri Oct 14, 2005 7:11 pm   
 
Thanks, I am going to have to break that all down to understand how it works, then I should be able to implement it. Not an expert scripter just yet. ;) Thanks for the help Vijilante.

Alaric.
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