|
[_SnArF_] Beginner
Joined: 16 Nov 2000 Posts: 20 Location: USA
|
Posted: Sat Jan 11, 2003 5:43 am
Problem's catching items for DB action |
For some reason, I'm not able to capture some MUD text with my triggers so I can add it into the DB... I'm at my wits end on how to accomplish this easily... so I figured I'd ask for a bit of help...
My triggers:
#TRIGGER {your (%w) by (%n) points} {#addkey NewItem "%1" "%2"}
#TRIGGER {your (%w) (%w) by (%n) points} {#addkey NewItem "%1 %2" "%3"}
#TRIGGER {your save vs (%w) by (%n) points} {#addkey NewItem "save vs %1" "%2"}
The MUD output I'm having trouble capturing...
When worn, it affects your charisma by 5 points, your hp by 40 points,
your mana by 40 points, your wisdom by 3 points and your intelligence by 2 points.
The problem:
For some reason, it's not capturing the "your mana by 40 points..." line, and just ignoring it... Any reason why it's doing that, or maybe there's an easier way to get it to work? I can post all my triggers/full ID of the item/the item according to the triggers/any other info necessary... but I just can't figure this one out for the life of me
---------------
We're going to eat all of your food and steal all of your beer. |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Sat Jan 11, 2003 6:17 am |
i'm going to take a shot and say.. that's all one big line, word wrapped? or wrapped by the mud? or actually two lines?
so far as i know, a trigger will only fire once per line. but then, as i type this i realize, your charisma and hp are being captured fine.. arent they?
if only the first of the stats is being captured correctly, then its a case of the trigger only firing once. try looking into "reparse" triggers. something like this might work:
#tr {When worn, } {}
#cond {charisma by (%d)} {#addkey NewItem "charisma" "%1"} "reparse"
#cond {hp by (%d)} {#addkey NewItem "hp" "%1"} "reparse"
#cond {mana by (%d)} {#addkey NewItem "mana" "%1"} "reparse"
#cond {wisdom by (%d)} {#addkey NewItem "wisdom" "%1"} "reparse"
#cond {intelligence by (%d)} {#addkey NewItem "intelligence" "%1"} "reparse"
(i just tested this and it seemed to work good with the test line you gave )
--edit--
heh, i just looked up at your post, and realized that the sample output was wrapped in "code" "/code" and might have originally been 2 lines (those tags make text all one line when copied, don't ask me why). the reparse trigger i posted will work if the output was one line. if its two you'll have to find something else. |
|
|
|
[_SnArF_] Beginner
Joined: 16 Nov 2000 Posts: 20 Location: USA
|
Posted: Sat Jan 11, 2003 8:39 am |
Yeah, it's straight from the mud, wrapped and all... Here's everything:
TRIGGERS:
#CLASS {AutoID} {disable}
#TRIGGER {This object, (*) can be referred to as '(*)'.} {#addkey NewItem long "%1";#addkey NewItem names "%2"}
#TRIGGER {It is worth (%d) copper, and is of the (%d){st|nd|rd|th} level of power.} {#addkey NewItem worth %1;#addkey NewItem level %2}
#TRIGGER {It is made of (*) and weighs (*).} {#addkey NewItem material "%1";#addkey NewItem weight "%2"}
#TRIGGER {When worn, it protects you against piercing for (%d),$bashing for (%d), slashing for (%d) and magic for (%d) points each.} {#addkey NewItem ACP %1;#addkey NewItem ACB %2;#addkey NewItem ACS %3;#addkey NewItem ACM %4}
#TRIGGER {$} {#t- AutoID;#if (%find( @NewItem.long, All|Items, long)) {#yesno {Item **@NewItem.long** Found, add anyway?} {Yes:#new Items {@NewItem}}} {#new Items {@NewItem}};#var NewItem ""}
#TRIGGER {your (%w) by (%n) points} {#addkey NewItem "%1" "%2"}
#TRIGGER {your (%w) (%w) by (%n) points} {#addkey NewItem "%1 %2" "%3"}
#TRIGGER {your save vs (%w) by (%n) points} {#addkey NewItem "save vs %1" "%2"}
#TRIGGER {It can cause (*) points of damage, at average (%d).} {#addkey NewItem "weapon dice" "%1";#addkey NewItem "weapon average" %2}
#TRIGGER {Within it {is|are} contained the (*) spel{l|ls}, of the (%d){st|nd|rd|th} level.} {#addkey NewItem spells "%1";#addkey NewItem "spell level" %1}
#CLASS 0
TRIGGER {----------------------------------------$} {#t+ AutoID;#var NewItem ""}
MUD OUTPUT (minus the ***RETURN***, threw those in there just to make sure we're on the same page here)
---------------------------------------- ***RETURN***
This object, the Great Crown of the Svirfnebli can be referred to as 'crown'. ***RETURN***
It is worth 50000 copper, and is of the 52nd level of power. ***RETURN***
It is made of gem and weighs 14 pounds 15 ounces. ***RETURN***
It radiates light. ***RETURN***
It has been imbued with a blessing. ***RETURN***
It seems to be made for a gnome to use. ***RETURN***
When worn, it affects your charisma by 5 points, your hp by 40 points, ***RETURN***
your mana by 40 points, your wisdom by 3 points and your intelligence by 2 points. ***RETURN***
SHOWDB @NewItem:
long: the Great Crown of the Svirfnebli
names: crown
worth: 50000
level: 52
material: gem
weight: 14 pounds 15 ounces
charisma: 5
mana: 40
---------------
We're going to eat all of your food and steal all of your beer. |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Sat Jan 11, 2003 6:16 pm |
ah, as i suspected then, your trigger is only firing once on those lines. Thats why only the first data on each line is being captured. You'll want to experiment more with "reparse" triggers and probably "within|pararm=1" triggers.
i can write triggers that will capture right for this object, but i'm guessing the output is subject to change without notice, right? there might not always be two lines, the output doesn't come in the same order, etc. well, regardless, here's something to try:
#tr {charisma by (%d)} {#addkey NewItem charisma "%1"} {AutoID}
#tr {hp by (%d)} {#addkey NewItem hp "%1"} {AutoID}
#tr {mana by (%d)} {#addkey NewItem mana "%1"} {AutoID}
#tr {moves by (%d)} {#addkey NewItem moves "%1"} {AutoID}
#tr {strength by (%d)} {#addkey NewItem strength "%1"} {AutoID}
#tr {wisdom by (%d)} {#addkey NewItem wisdom "%1"} {AutoID}
#tr {intelligence by (%d)} {#addkey NewItem intelligence "%1"} {AutoID}
#tr {dexterity by (%d)} {#addkey NewItem dexterity "%1"} {AutoID}
#tr {constitution by (%d)} {#addkey NewItem constitution "%1"} {AutoID}
and since these are all different triggers, they should all fire correctly
--untested and i'm assuming patterns about constitution and strength etc.-- |
|
|
|
|
|
|
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
|
|