|
MtnBkr16 Newbie
Joined: 18 Oct 2005 Posts: 4 Location: USA
|
Posted: Sun Feb 26, 2006 4:00 am
Matching this trigger pattern... |
Code: |
4220h, 3058m, 18800e cexkdb-|21:53:26.572|-[+10e]ir
Glancing into the Rift, you see:
[ 93] bayberry bark [ 75] bellwort flower [ 122] black cohosh
[ 292] bloodroot leaf [ 1] blue ink [ 1] blueberry
[ 5] diamond dust [ 5] eagle's feather [ 209] echinacea
[ 169] ginger root [ 198] ginseng root [ 485] goldenseal root
[ 2] green ink [ 76] hawthorn berry [ 3] ice
[ 294] irid moss [ 279] kelp [ 97] kola nut
[ 55] lady's slipper r [ 240] lobelia seed [ 120] myrrh gum
[ 3] piece of stag's [ 291] prickly ash bark [ 72] prickly pear
[ 1] purple ink [ 2] rope [ 114] sileris
[ 89] skullcap [ 72] slippery elm [ 60] valerian
[ 71] weed [ 2] wood [ 3] yellow ink
|
Ok, here's what I need to do. I need to trigger off of these lines, store the amounts and names of each into a database so that I can quickly see if I have the needed herbs for something. For instance: I need a health vial, which takes valerian, goldenseal, myrrh, and ginseng. I want to be able to quickly view how many of those herbs I have by entering a command "checkhealthherbs".
This is the closest I've come to matching the line:
Code: |
%s~[%s%d~] %w%s~[%s%d~] %w%s ~[%s%d~] %w
|
Only problem is that the wildcards don't seem to want to store into any variables, not to mention that if the herb name has any spaces in it, the pattern won't match.
Could anyone help me out with figuring out how to arrange this pattern properly and maybe a bit about how to go about storing them into a database as well?[/code] |
|
|
|
MtnBkr16 Newbie
Joined: 18 Oct 2005 Posts: 4 Location: USA
|
Posted: Sun Feb 26, 2006 5:58 am |
I got some help and figured it out. Thanks anyhow!
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Feb 26, 2006 5:59 am |
I would say go for the good old multiline capture script and do the parsing at the end instead of in the trigger pattern.
Code: |
#CLASS RiftCapture
#VARIABLE Rift {}
#VARIABLE RiftTemp {} {}
#TRIGGER "RiftCap" {^Glancing into the Rift, you see:} {Rift="";RiftTemp=""}
#COND {} {#IF (%match(%line,"%dh") {#STATE RiftCap 3;#SET RiftCap 3 1} {RiftTemp=%concat(@RiftTemp,"|",%subchar(%insert("|",%insert("|",%line,56),28),"][","="))}} {looplines|param=20}
#COND {*} {#SHOW Failed to match prompt during rift capture, adjust param higher or correct other error}
#COND {} {#FORALL @RiftTemp {#ADDKEY Rift {%trim(%word("%i",2,"="))} {%trim(%word("%i",1,"="))}}} {manual}
#CLASS 0 |
If you really want to match the pattern though:
~[&4~][%w%s]~[&4~][%w%s]~[&4~][%w%s] |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Feb 26, 2006 6:09 am |
First, to capture information you need to use parentheses, like so:
(%d)
You can combine wildcards as well as plain text in parentheses.
Second, if you want to capture multiple words, you need use either the range pattern or the * wildcard:
[A-Za-z ] -- literal version
[%w%s] -- with Use Wildcards in Stringlist preference enabled
In your case, if you went with the wildcards I would use %x so that you can also capture the ' in stag's or lady's. In addition, to avoid having to remove extra spaces I would use something like this:
[%x%s]%a
This would ensure that you end your match on a letter rather than a space.
With all these wildcards, however, this is probably going to be a slow trigger. Does the content and format of this list change any? If not, you could probably just use a 11- or 12-state trigger where each line has wildcards for the numbers and spaces and plain text for each herb on the line. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Strakc Apprentice
Joined: 31 Jan 2006 Posts: 106 Location: Virginia Beach, Virginia
|
Posted: Sun Feb 26, 2006 6:42 am |
that looks like to be achaea ever check out, http://my.win.psu.edu/jkd10/palisade.html third one down. its setup for lusternia, but it may still work for achaea not 100% sure. Basically it tracks everything in your rift and belts, then lets you use a function that lets you display the amount of that item, i use it on lusternia for my herbalist
|
|
|
|
|
|
|
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
|
|