|
leonardofaoro Novice
Joined: 07 Feb 2008 Posts: 40 Location: Italy
|
Posted: Thu Mar 13, 2008 3:39 am
Database Trigger |
Hello,
I'd like to create a trigger that capture the information of an item identification and stores the info into the database.
I've tried in many ways, but I don't seem to achieve it.
These are examples of what an identify returns to my mud.
You recite a scroll of identify which dissolves.
----------------------------------------------------------------------
an antelope statuette is a type of wand made from base-material
It can be taken and worn on TAKE HOLD
Its weight is 6 and its valued at 54000 coins.
This wand casts haste
It has 3 maximum charges and 3 remaining.
----------------------------------------------------------------------
or
You recite a scroll of identify which dissolves.
----------------------------------------------------------------------
the guardian longsword is a type of weapon made from base-material
It can be taken and worn on TAKE WIELD
It is unlocateable anti-disarm
Its weight is 9 and its valued at 0 coins.
If worn it will give you --
3 to your Damroll
2 to your Hitroll
Wanted Weapon Balance: (base)-======0==================-(tip)
Actual Weapon Balance: (base)-======0==================-(tip)
This balance gives the weapon 30 speed, 120 accuracy and 40 evasion.
The two handed weapon is a 90cm Longsword that can slash at 10D10 damage.
or
You recite a scroll of identify which dissolves.
----------------------------------------------------------------------
a mystical ivory charm necklace is a type of armor made from base-material
It can be taken and worn on TAKE NECK
Its weight is 5 and its valued at 100 coins.
If worn it will give you --
3 to your Damroll
1 to your Hitroll
2 to your Intelligence
-15 to your Maxhit
AC-apply is 4
----------------------------------------------------------------------
If any of you has an idea of how to do it, please let me know, I'd be fine even if you point me to some documentation to do it myself.
Thank you very much. |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Fri Mar 14, 2008 2:05 am |
I think it might help if you specify what exact information you want to capture. Do you want to capture ALL of the information? Meaning the name of the item, type of item, where it can be worn, value of the item, and so on.
|
|
|
|
leonardofaoro Novice
Joined: 07 Feb 2008 Posts: 40 Location: Italy
|
Posted: Fri Mar 14, 2008 2:29 am |
oldguy2 wrote: |
I think it might help if you specify what exact information you want to capture. Do you want to capture ALL of the information? Meaning the name of the item, type of item, where it can be worn, value of the item, and so on. |
I'd like to put in DB this data as example for record 1
ItemName: a mystical ivory charm necklace
WearLock: TAKE NECK
Weight: 5
Value: 100
Damroll: 3
Hitroll: 1
Int: 2
-15: MaxHit
AC: 4 |
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Fri Mar 14, 2008 4:38 am |
There is a very good example of how to do that here under Loop Lines. This will help you set up your triggers properly to capture your data. The rest is just a matter of creating the db and putting the captured data into it. A sample db record would look like this:
Code: |
#NEW "" {Name=WearLock|Weight=5|Value=100|Damroll=3|Hitroll=1|Stats="Int=2"|AC=4|Maxhit=-15}
|
Note that Stats is a record variable. If you had in addition wis and con, for instance, it would look like this:
Code: |
#NEW "" {Name=WearLock|Weight=5|Value=100|Damroll=3|Hitroll=1|Stats="Int=2|Con=8|Wis=4"|AC=4|Maxhit=-15}
|
This is a bit tricky so you could do it this way:
Code: |
#NEW "" {Name=WearLock|Weight=5|Value=100|Damroll=3|Hitroll=1|Stats="Int=2,Con=8,Wis=4"|AC=4|Maxhit=-15}
|
and then use %word to turn it back into record variable. I am sure the GURUs can give you a better way to do it.
You would add each record in that manner. |
|
_________________ Sic itur ad astra. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Mar 14, 2008 2:21 pm |
I don't think a loop lines trigger will work for this, because it looks like there is a variable number of lines in the identify. Does the mud send a line of hyphens "---------------" just before and after the identify text? If so, one way to do it would be to have a class, called identify perhaps, which is turned on and off by a multistate trigger. The first state would trigger on "You recite a scroll of identify which dissolves." and do nothing, the second state would trigger on the first hyphen line and do #t+ identify, and the third state would trigger on the closing hyphen line and do #t- identify.
Within the identify class, you would create a set of triggers to catch all the various information you want. |
|
|
|
leonardofaoro Novice
Joined: 07 Feb 2008 Posts: 40 Location: Italy
|
Posted: Wed Mar 19, 2008 12:41 am |
Thank you Rahab, can you post an example too?
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Mar 20, 2008 12:27 pm |
I'll try to write up and test an example as soon as I can, but things are a bit busy right now.
|
|
|
|
|
|