|
jackie Beginner
Joined: 01 Nov 2002 Posts: 10
|
Posted: Fri Nov 01, 2002 12:29 am
DB |
how can I capture the information from an identifying scroll to put it into the db? It is an eq db. It has all of the fields zmud has except comment, zone, and room.
You recite a scroll of identify which dissolves.
You feel informed:
Object 'a giant sword', Item type: WEAPON
It's made from: steel
Item is: GLOW
Weight: 20, Value: 1500, Rent: 150, Min Level: 20
Damage Dice is '5D6' for an average per-round damage of 17.5.
Proficiency type: large swords |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Nov 01, 2002 6:12 am |
First create a set of triggers to pair up the information from the id scroll with the desired keys in a record variable. If desired, you can put these triggers into a subclass so they will only be on when you are doing an id. The final trigger should disable the subclass and use the #NEW command to send the info to the database. The database window must be open and its usually necessary to do the first record manually.
When you say "it has all of the fields zmud has" I'm guessing you mean one of the sample databases. The field-names I used probably won't match, so expect to change them.
#TR {You recite a scroll of identify} {#VAR idinfo %null;#T+ identify}
#CLASS identify disable
#T- identify
#TR {Object ~'(*)~', Item type: (%w)} {#ADDKEY idinfo Name {%1};#ADDKEY idinfo Type {%2}}
#TR {It's made from: (%w)} {#ADDKEY idinfo Material {%1}}
#TR {Item is: (*)} {#ADDKEY idinfo Flags {%1}}
#TR {Weight: (%d), Value: (%d), Rent: (%d), Min Level: (%d)} {#ADDKEY idinfo Weight {%1};#ADDKEY idinfo Value {%2};#ADDKEY idinfo Rent {%3};#ADDKEY idinfo Level {%4}}
#TR {Damage Dice is ~'(%a)~' for an average per-round damage of (%d)} {#ADDKEY idinfo Dice {%1};#ADDKEY idinfo Damage {%2}}
#TR {Proficiency type: (*)} {#ADDKEY idinfo Proficiency {%1};#T- identify;#NEW all idinfo}
#CLASS 0
LightBulb
Senior Member |
|
|
|
Troubadour GURU
Joined: 14 Oct 2000 Posts: 556 Location: USA
|
Posted: Fri Nov 01, 2002 6:13 am |
Here are the triggers. You will need to add six fields to the database: Material, Properties, Value, Rent, AvgDam, and Proficiency.
These triggers store the information to a record variable named Item. When the first blank line after the message block is encountered, the information is added to the database. The database must be open for the data to be entered.
#TR {Object '(*)', Item type: (%w)} {#VAR Item ""; Item.Name = "%1"; Item.Kind = %2; #TEMP add2db {^$} {#T- add2db; #NEW All @Item}}
#TR {It's made from: (%w)} {Item.Material = %1}
#TR {Item is: (*)} {Item.Properties = "%1"}
#TR {Weight: (%d), Value: (%d), Rent: (%d), Min Level: (%d)} {Item.Weight = %1; Item.Value = %2; Item.Rent = %3; Item.Level = %4}
#TR {Damage Dice is '(%x)' for an average per-round damage of (%x).} {Item.Damage = %1; Item.AvgDam = %2}
#TR {Proficiency type: (*)} {Item.Proficiency = "%1"}
Troubadour
(Win 98, Pentium III, 550 MHz) |
|
|
|
jackie Beginner
Joined: 01 Nov 2002 Posts: 10
|
Posted: Sun Nov 03, 2002 4:21 pm |
This is what I have so far:
#TR {You recite a scroll of identify} {#VAR idinfo %null;#T+ identify}
#CLASS identify disable
#T- identify
#TRIGGER {Object ~'(*)~', Item type: (%w)} {
#ADDKEY idinfo Object {%1}
#ADDKEY idinfo Type {%2}
}
#TRIGGER {It's made from: (%w)} {#ADDKEY idinfo Material {%1}}
#TRIGGER {Item is: (*)} {#ADDKEY idinfo Flags {%1}}
#TRIGGER {Weight: (%d), Value: (%d), Rent: (%d), Min Level: (%d)} {
#ADDKEY idinfo Weight {%1}
#ADDKEY idinfo Value {%2}
#ADDKEY idinfo Rent {%3}
#ADDKEY idinfo Level {%4}
}
#TRIGGER {Item will give you following abilities: (%w)} {#ADDKEY idinfo Abilities {%1}}
#TRIGGER {Proficiency type: (*)} {#ADDKEY idinfo Proficiency {%1}}
#TRIGGER {Weapon Spell: (%w)} {#ADDKEY idinfo Spell {%1};#T- identify;#NEW all idinfo}
#CLASS 0
The problem is that in the field "Object" it puts in "idinfo" and that is the only thing it puts into the database. Anyone know why it isn't putting everything in? |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Nov 03, 2002 5:04 pm |
Try:
#NEW all {@idinfo}
instead of:
#NEW all idinfo
Kjata |
|
|
|
jackie Beginner
Joined: 01 Nov 2002 Posts: 10
|
Posted: Sun Nov 03, 2002 6:47 pm |
Thanks!!!
|
|
|
|
Sirius Newbie
Joined: 09 Oct 2002 Posts: 9 Location: USA
|
Posted: Mon Nov 04, 2002 12:04 am |
To make it work switch around the
#T- identify;#NEW all @idinfo
and make it read
#NEW all @idinfo;#T- identify
And that will put it into the dbase. |
|
|
|
jackie Beginner
Joined: 01 Nov 2002 Posts: 10
|
Posted: Thu Nov 28, 2002 1:00 am |
Anyway of capturing more than one line. I have a field called "Affects" and I want to put this in it:
Affects: STR By 2
Affects: HITROLL By 2
I wanted 2 lines in the DB field "Affects": (1st line)STR 2
(2nd linw)HITROLL 2
Anyway of doing this? Thanks |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Dec 02, 2002 6:08 am |
You can replace the -- with the separator of your choice. Be sure to reset @idinfo.affects to "" at the beginning of the identify.
#TR {Affects: (*)} {#IF (@idinfo.affects = ""} {#ADDKEY idinfo affects {%1}} {#ADDKEY idinfo affects {@idinfo.affects -- %1}}
LightBulb
Senior Member |
|
|
|
jackie Beginner
Joined: 01 Nov 2002 Posts: 10
|
Posted: Mon Dec 02, 2002 11:35 pm |
This is weird! Here is the full script so far:
#TR {You recite a scroll of identify} {#VAR idinfo %null;#T+ identify}
#CLASS identify disable
#T- identify
#TRIGGER {Object ~'(*)~', Item type: (%w)} {
#ADDKEY idinfo Name {%1}
#ADDKEY idinfo Type {%2}}
#TRIGGER {It's made from: (%w)} {#ADDKEY idinfo Material {%1}}
#TRIGGER {Item is: (*)} {#ADDKEY idinfo Flags {%1}}
#TRIGGER {Weight: (%d), Value: (%d), Rent: (%d), Min Level: (%d)} {
#ADDKEY idinfo Weight {%1}
#ADDKEY idinfo Level {%4}}
#TR {Affects: (*)} {#IF (@idinfo.affects = ""} {#ADDKEY idinfo affects {%1}} {#ADDKEY idinfo affects {@idinfo.affects -- %1}}
#TRIGGER {Item will give you following abilities: (%w)} {#ADDKEY idinfo Abilities {%1}}
#TR {Damage Dice is ~'(%a)~' for an average per-round damage of (%d)} {#ADDKEY idinfo Dice {%1};#ADDKEY idinfo Damage {%2}}
#TR {AC-apply is (%d)} {#ADDKEY idinfo AC {%1}}
#TR {This SCROLL casts: (%w)} {#ADDKEY idinfo Scroll Spell {%1}}
#TR {This WAND casts: (%w)} {#ADDKEY idinfo Wand Spell {%1}}
#TR {This STAFF casts: (%w)} {# ADDKEY idinfo Staff Spell {%1}}
#TR {This POTION casts: (%w)} {#ADDKEY idinfo Potion Spell {%1}}
#TRIGGER {Proficiency type: (*)} {#ADDKEY idinfo Proficiency {%1}}
#TRIGGER {Weapon Spell: (%w)} {#ADDKEY idinfo Weapon Spell {%1};#NEW all {@idinfo};#T- identify}
#CLASS 0
The prblem is that it doesn't work and it also makes another class besides the identify one. The class is called "#ADDKEY idinfo affects {%1}" and in the class is:
#CLASS {#ADDKEY idinfo affects {%1}}
#TRIGGER {Affects: (*)} {#IF (@idinfo.affects = ""}
#CLASS 0
Any Ideas!?!? |
|
|
|
whovind Newbie
Joined: 11 Nov 2002 Posts: 5 Location: Canada
|
Posted: Tue Dec 03, 2002 12:17 am |
quote:
Affects: STR By 2
Affects: HITROLL By 2
I wanted 2 lines in the DB field "Affects": (1st line)STR 2
(2nd linw)HITROLL 2
Anyway of doing this? Thanks
I would suggest using multiple fields rather than rows (records). Are you sure you don't mean that? |
|
|
|
Humpton Apprentice
Joined: 10 Oct 2000 Posts: 158 Location: Chicago, IL
|
Posted: Tue Dec 03, 2002 1:43 am |
I'm still learning to use the DataBase so I don't really understand the code. However, I've frequently created classes like you describe.
It looks like it's coming from this line (I'm assuming you cut and pasted)
#TR {Affects: (*)} {#IF (@idinfo.affects = ""} {#ADDKEY idinfo affects {%1}} {#ADDKEY idinfo affects {@idinfo.affects | %1}}
You've got a '}' instead of a ')' in the test part of the #IF. You're also short one '}' to close out the #TR part.
I think it should look like this...
#TR {Affects: (*)} {#IF (@idinfo.affects = "") {#ADDKEY idinfo affects {%1}} {#ADDKEY idinfo affects {@idinfo.affects | %1}}}
Hope this helps!
Stay JOLLY!
H
___
Humpton lives like he types.... fast, and full of mistakes!
Core 2651: For those who prefer the future to the past. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Dec 03, 2002 1:51 am |
Actually, it should look like this (if I don't put in any new typos)
#TR {Affects: (*)} {#IF (@idinfo.affects = "") {#ADDKEY idinfo affects {%1}} {#ADDKEY idinfo affects {@idinfo.affects -- %1}}}
I don't recommend using the list separator | INSIDE a field. Database record variables also use this special character. Get something that works first, before you go looking for problems.
LightBulb
Senior Member |
|
|
|
Humpton Apprentice
Joined: 10 Oct 2000 Posts: 158 Location: Chicago, IL
|
Posted: Tue Dec 03, 2002 1:55 am |
I defer to your solution, of course. But...
it's still missing one closing '}'. The one that is just before #IF has no matching close.
Stay JOLLY!
H
___
Humpton lives like he types.... fast, and full of mistakes!
Core 2651: For those who prefer the future to the past. |
|
|
|
Humpton Apprentice
Joined: 10 Oct 2000 Posts: 158 Location: Chicago, IL
|
Posted: Tue Dec 03, 2002 1:57 am |
Did you edit your response while I was typing mine? It's now fine.
A '{' is missing from infornt of the %1 now, I believe.
Stay JOLLY!
H
___
Humpton lives like he types.... fast, and full of mistakes!
Core 2651: For those who prefer the future to the past. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Dec 03, 2002 2:05 am |
Heh, I was editing my response (to eliminate new typos) while you were trying to point them out. Nope, there's not supposed to be a { in front of the second %1. It's this:
#ADDKEY variable key {value}
#ADDKEY idinfo affects {@idinfo.affects -- %1}
A concatenation of the previous affects with the latest one.
I counted the {'s and }'s, I'm 99% certain I have them right.
LightBulb
Senior Member |
|
|
|
jackie Beginner
Joined: 01 Nov 2002 Posts: 10
|
Posted: Wed Dec 04, 2002 1:15 am |
I am getting exetremly frustrated with this!!! I looked and looked and LOOKED to see what is wrong with the script, but can't seem to find anything wrong with it. When I put all the triggers outside of a class it works fine, but a major clutter. I try to make it when the class is always enabled, but it only puts the stuff in the variable but not the DB. What it is supposed to do is enable the class, then enter all the data into the variable, then add it all to the DB, then disable the class. Any ideas why this won't do it?:
#TR {You recite a scroll of identify} {#VAR idinfo %null;#T+ identify}
#CLASS identify
#TRIGGER {Object ~'(*)~', Item type: (%w)} {
#ADDKEY idinfo Name {%1}
#ADDKEY idinfo Type {%2}
}
#TRIGGER {It's made from: (%w)} {#ADDKEY idinfo Material {%1}}
#TRIGGER {Item is: (*)} {#ADDKEY idinfo Flags {%1}}
#TRIGGER {Weight: (%d), Value: (%d), Rent: (%d), Min Level: (%d)} {
#ADDKEY idinfo Weight {%1}
#ADDKEY idinfo Level {%4}
}
#TRIGGER {Affects: (*)} {#IF (@idinfo.Affects = "") {#ADDKEY idinfo Affects {%1}} {#ADDKEY idinfo Affects {@idinfo.Affects -- %1}}}
#TRIGGER {Item will give you following abilities: (*)} {#ADDKEY idinfo Abilities {%1}}
#TRIGGER {Damage Dice is ~'(%a)~' for an average per-round damage of (%d)} {
#ADDKEY idinfo Dice {%1}
#ADDKEY idinfo Damage {%2}
}
#TRIGGER {AC-apply is (%d)} {#ADDKEY idinfo AC {%1}}
#TRIGGER {This SCROLL casts: (*)} {#ADDKEY idinfo ScrollSpell {%1}}
#TRIGGER {This WAND casts: (*)} {#ADDKEY idinfo WandSpell {%1}}
#TRIGGER {This STAFF casts: (*)} {#ADDKEY idinfo StaffSpell {%1}}
#TRIGGER {This POTION casts: (*)} {#ADDKEY idinfo PotionSpell {%1}}
#TRIGGER {Proficiency type: (*)} {#ADDKEY idinfo Proficiency {%1}}
#TRIGGER {Weapon Spell: (*)} {
#ADDKEY idinfo WeaponSpell {%1};#NEW all {@idinfo};#T- identify}
#CLASS 0
Thanks for any help!!! |
|
|
|
Sirius Newbie
Joined: 09 Oct 2002 Posts: 9 Location: USA
|
Posted: Thu Dec 05, 2002 1:15 am |
quote:
#TRIGGER {Weapon Spell: (*)} {
#ADDKEY idinfo WeaponSpell {%1};#NEW all {@idinfo};#T- identify}
Well you see it will only add all the stuff to the database if the trigger matches the text, so it will only put everything in the database and work properly if the item has a weapon spell. Try this :
#TR {You recite a scroll of identify} {#VAR idinfo %null;#T+ identify;#SHOW -------------------------------------------}
#TR {-------------------------------------------} {#NEW all {@idinfo};#T- identify}
#CLASS identify disable
#TRIGGER {Object ~'(*)~', Item type: (%w)} {
#ADDKEY idinfo Name {%1}
#ADDKEY idinfo Type {%2}}
#TRIGGER {It's made from: (%w)} {#ADDKEY idinfo Material {%1}}
#TRIGGER {Item is: (*)} {#ADDKEY idinfo Flags {%1}}
#TRIGGER {Weight: (%d), Value: (%d), Rent: (%d), Min Level: (%d)} {
#ADDKEY idinfo Weight {%1}
#ADDKEY idinfo Level {%4}}
#TRIGGER {Affects: (*)} {#IF(@idinfo.Affects = "") {#ADDKEY idinfo Affects {%1}} {#ADDKEY idinfo Affects {@idinfo.Affects -- %1}}}
#TRIGGER {Item will give you following abilities: (*)} {#ADDKEY idinfo Abilities {%1}}
#TRIGGER {Damage Dice is ~'(%a)~' for an average per-round damage of (%d)} {
#ADDKEY idinfo Dice {%1}
#ADDKEY idinfo Damage {%2}}
#TRIGGER {AC-apply is (%d)} {#ADDKEY idinfo AC {%1}}
#TRIGGER {This SCROLL casts: (*)} {#ADDKEY idinfo ScrollSpell {%1}}
#TRIGGER {This WAND casts: (*)} {#ADDKEY idinfo WandSpell {%1}}
#TRIGGER {This STAFF casts: (*)} {#ADDKEY idinfo StaffSpell {%1}}
#TRIGGER {This POTION casts: (*)} {#ADDKEY idinfo PotionSpell {%1}}
#TRIGGER {Proficiency type: (*)} {#ADDKEY idinfo Proficiency {%1}}
#TRIGGER {Weapon Spell: (*)} {#ADDKEY idinfo WeaponSpell {%1}}
#CLASS 0
This should work
|
|
|
|
|
|