|
Francezca Beginner
Joined: 09 Nov 2001 Posts: 11 Location: New Zealand
|
Posted: Fri Nov 09, 2001 11:07 pm
Auto Database |
Please help with auto database entries
I have tried to modify the scripts written in previous posts but have failed
My MUD output looks as follows...
You try to figure out what Quirky's Clogs of Calamity is.
You say 'The armor is magic nopurge burnproof sticky.'
You say 'It is owned by Francezca.'
You say 'It weighs 3, and its level of power is 10.'
You say 'It provides an armor class of 7 pierce, 8 bash, 8 slash, and 9 vs. magic.'
You say 'Affects saves by -5.'
You say 'Affects damage roll by 5.'
You say 'Affects hit roll by 10.'
You say 'Affects wisdom by 8.'
You say 'Affects vitality by 8.'
You say 'Affects luck by 4.'
You say 'Affects constitution by 12.'
You say 'Affects hp by 50.'
You have a feeling that there might be something else that you didn't remember.
Some times you have to id the item more than once because of the last line of the text above. So basically the one abovw is a failed ID.
A weapon ID looks like...
You try to figure out what an Ashannari is.
You say 'The weapon is none.'
You say 'It weighs 0, and its level of power is 60.'
You say 'The weapon is a dagger.'
You say 'It does stab damage of 8d9 (average 40).'
You say 'Affects damage roll by 6.'
You say 'Affects dexterity by 16.'
You say 'Affects hp by 50.'
and a potion.....
You try to figure out what Coven's Potion of Protecting is.
You say 'The potion is hum.'
You say 'It weighs 8, and its level of power is 90.'
You say 'It has level 70 spells of: 'stone skin' 'sanctuary' 'shield' 'reserved'.'
A completely failed ID looks like...
You try to figure out what Dagger of Malice is.
Hmm... you cant seem to place it from any tales you've heard.
It would be great if it didn't duplicate entries also.
Any help would be greatly appreciated.
Thanks,
Frannie |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Sat Nov 10, 2001 1:11 pm |
I think this should work for you:
#ALIAS id {
#T+ Identify
#VARIABLE NewItem %null
Identify "%1"
}
#CLASS {Identify}
#VARIABLE NewItem {}
#VARIABLE Record {}
#TRIGGER {You try to figure out what &{NewItem.Name} is.} {#TEMP {^$} {
#IF (!%null( %query( &Name = @NewItem.Name & &Level = @NewItem.LeveL, All))) {
#SAY {Item already exists}
#VARIABLE Record %null
#VARIABLE NewItem %null
} {
#NEW All {@NewItem}
#SAY {Item added}
#DBSAVE
#VARIABLE Record %null
#VARIABLE NewItem %null
}
#T- Identify
}}
#TRIGGER {You say 'The &%w{NewItem.Type} is &{NewItem.Flags}.'} {}
#TRIGGER {You say 'It weighs &%d{NewItem.Weight}, and its level of power is &%d{NewItem.Level}.'} {}
#TRIGGER {You say 'It provides an armor class of &%d{NewItem.Armor_vs_Piercing} pierce, &%d{NewItem.Armor_vs_Bashing} bash, &%d{NewItem.Armor_vs_Slashing} slash, and &%d{NewItem.Armor_vs_Magic} vs. magic.'} {}
#TRIGGER {You say 'Affects saves by (*).'} {NewItem.Saves = %1}
#TRIGGER {You say 'Affects wisdom by (*).'} {NewItem.Wisdom = %1}
#TRIGGER {You say 'Affects luck by (*).'} {NewItem.Luck = %1}
#TRIGGER {You say 'Affects hp by (*).'} {NewItem.HP = %1}
#TRIGGER {You say 'Affects constitution by (*).'} {NewItem.Constitution = %1}
#TRIGGER {You say 'Affects hit roll by (*).'} {NewItem.Hit_Roll = %1}
#TRIGGER {You say 'Affects damage roll by (*).'} {NewItem.Damage_Roll = %1}
#TRIGGER {You say 'Affects dexterity by (*).'} {NewItem.Dexterity = %1}
#TRIGGER {You say 'It does &%w{NewItem.Damage_Type} damage of &{NewItem.Weapon_Damage}.'} {}
#TRIGGER {You say 'It has level &%d{NewItem.Spell_Level} spells of: &{NewItem.Spells}.'} {}
#TRIGGER {No way! You are still fighting!} {
#VARIABLE NewItem %null
#T- Identify
}
#TRIGGER {Hmm... you cant seem to place it from any tales you've heard.} {
#VARIABLE NewItem %null
#T- Identify
}
#CLASS 0
Use the alias to activate the Identify class and the triggers inside it. The first trigger fires off the name and creates a temporary trigger which fires off the first blank line, namely the end of the block of text. All variables are added to a database variable called "NewItem", and at the end the contents of that variable is tested against any existing entries in your database. If it already exists it won't be added. If your id fails or is incomplete the class is shut off, preventing further processing.
Basically this is what I use, modified a bit to work for your output. Change the database fields to what you have set up yourself.
Acaila |
|
|
|
Francezca Beginner
Joined: 09 Nov 2001 Posts: 11 Location: New Zealand
|
Posted: Sun Nov 11, 2001 11:20 pm |
Thanks for your help...
I created the alias specified in your script and attempted to copy the body of the script into the identify class script. Unfortunately it didn't accept it, when I clicked save it would just remove all the additions (which was strange because there were no syntax errors). Eventually I managed to make all the triggers and then shifted them into the identify class.
When I attempted to ID an item, alas, it didn't work It actually kept creating its own new trigger outside the identify class.
Reading over this, I am not making much sense, however, maybe you could test the script using one of the identify examples I pasted into the original message. Then I will know if the script doesn't work or if it's just me.
P.S. I am one of the 'clever' people who unwittingly upgraded to the beta version of ZMUD.
Thanks heaps,
Frannie |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Mon Nov 12, 2001 10:49 am |
What you need to do is just copy & paste all of this into the command line and press enter. That should work for getting it in.
I'm using the same triggers for my identify, just modified a little, if there's no syntax error then at least we know the syntax is still okay.
I've created this for version 6.16, I don't know what the changes are for version 6.22 beta, so that could be why it's not working either.
I'll try to test it later when I'm back home, maybe I'll find a mistake somewhere....
Acaila |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Mon Nov 12, 2001 4:51 pm |
Well, I've checked the code, and have found not mistakes in it (as far as I can see anyway). I know no way to check it with your output unless you give me the adress of the mud you're referring to.
Another thing...to successfully capture the output and put it into a database you need to have the database open, and have the field exactly named as I have put in the triggers.
e.g:
For the following trigger to be captured effectively:
#TRIGGER {You say 'Affects constitution by (*).'} {NewItem.Constitution = %1}
You need to manually create a field in the database called "Constitution". Do that for all triggers or replace the fields in the triggers by your own fieldnames.
Btw, what do you mean exactly by: "It actually kept creating its own new trigger outside the identify class."
Acaila |
|
|
|
Francezca Beginner
Joined: 09 Nov 2001 Posts: 11 Location: New Zealand
|
Posted: Tue Nov 13, 2001 11:52 pm |
Ok I created a Database called NewItem and had it open at the time.
I made all the Fields in the database that were needed and tested it while the database was open.
The orphan trigger I was talking about was the ^$ (the temporary trigger your spoke of), it gets created outside the Identify class. Everytime I run the id alias it creates another one of these Triggers. So what I did was put '#say Made this 1' at the beggining of the temp trigger and #say Made this 2' at the end of the trigger. Both of these fired and showed on the screen, but the 'item entered' and 'item already exists' in your code did not.
Hope this helps, still can't get it going :)
I'd give you the address of the MUD but you wouldnt have the id skill anyway. Maybe you could email me on snh@mustard.co.nz and I can give you a char to test with.
Thanks
Frannie |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Wed Nov 14, 2001 9:42 am |
Okay, so the problem lies in the temporary trigger. What if we change that into a permanent one?
Change:
#ALIAS id {#T+ Identify;#VARIABLE NewItem %null;Identify "%1"}
To:
#ALIAS id {Identify "%1"}
And change:
#TRIGGER {You try to figure out what &{NewItem.Name} is.} {#TEMP {^$} {#IF (!%null( %query( &Name = @NewItem.Name & &Level = @NewItem.LeveL, All))) {#SAY {Item already exists};#VARIABLE Record %null;#VARIABLE NewItem %null} {#NEW All {@NewItem};#SAY {Item added};#DBSAVE;#VARIABLE Record %null;#VARIABLE NewItem %null};#T- Identify}}
To:
#TRIGGER {You try to figure out what (*) is.} {#T+ Identify;NewItem = %null;NewItem.Name = "%1"}
#TRIGGER {^$} {#IF (!%null( %query( &Name = @NewItem.Name & &Level = @NewItem.LeveL, All))) {#SAY {Item already exists};#VARIABLE Record %null;#VARIABLE NewItem %null} {#NEW All {@NewItem};#SAY {Item added};#DBSAVE;#VARIABLE Record %null;#VARIABLE NewItem %null};#T- Identify}
Put the trigger "you try to figure out....." outside your identify folder, the ^$ trigger inside it.
If this doesn't work then I'll just have to test it myself....
Acaila |
|
|
|
Yull Newbie
Joined: 14 Nov 2001 Posts: 1 Location: USA
|
Posted: Wed Nov 14, 2001 8:13 pm |
You seem to be pretty good at scripting...I'm using zmud 6.22 and i'm trying to set up a script for the same purpose as the other guy you answered the question for except my MUD out puts it's ID code as:
You recite a bone-white parchment scroll.
Object 'a long barbed falchion' is type weapon, extra flags bless magic twohanded.
Weight is 0, value is 1278, level is 40.
Damage is 2d9.
Affects damage roll by 3.
Affects hit roll by 3.
any idea of a script that would work for this? |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Wed Nov 14, 2001 11:08 pm |
There are quite a few examples on this forum for database scripts. You could check those for similar mud output and just tweak them a little to suit your needs.
The general idea is, you create an alias to activate the triggerclass. Then you capture the values in each sentence into a database variable. When the block of text is received entirely deactivate the triggerclass and add the database variable to your existing database. The end of the block of text can be a certain line that is always at the end, or just an empty line (^$).
EXAMPLE
Mud Output:
Affects damage roll by 3.
Trigger to capture this:
#TRIGGER {Affects damage roll by &%d{NewItem.Damage_Roll}.} {}
Or:
#TRIGGER {Affects damage roll by (%d).} {#ADDKEY NewItem Damage_Roll %1}
These two triggers do exactly the same thing, only the syntax is different.
I'm using 6.16, so if things work differently in 6.22 then someone please correct me.
Acaila |
|
|
|
Francezca Beginner
Joined: 09 Nov 2001 Posts: 11 Location: New Zealand
|
Posted: Fri Nov 16, 2001 1:11 pm |
After much ado, I got it to work. Thanks you very much Acaila.
For anyone who's interested, I ended up with.
#CLASS {identify}
#VARIABLE item
#VARIABLE record
#TRIGGER {You try to figure out what &{Item.Name} is.} {#T+ identify}
#TRIGGER {You say 'It weighs &%d{Item.Weight}, and its level of power is &%d{Item.Level}.'} {}
#TRIGGER {You say 'It provides an armor class of &%d{Item.Armor_vs_Piercing} pierce, &%d{Item.Armor_vs_Bashing} bash, &%d{Item.Armor_vs_Slashing} slash, and &%d{Item.Armor_vs_Magic} vs. magic.'} {}
#TRIGGER {You say 'Affects saves by (*).'} {Item.Saves = %1}
#TRIGGER {You say 'Affects wisdom by (*).'} {Item.Wisdom = %1}
#TRIGGER {You say 'Affects luck by (*).'} {Item.Luck = %1}
#TRIGGER {You say 'Affects hp by (*).'} {Item.HP = %1}
#TRIGGER {You say 'Affects constitution by (*).'} {Item.Constitution = %1}
#TRIGGER {You say 'Affects hit roll by (*).'} {Item.Hit_Roll = %1}
#TRIGGER {You say 'Affects damage roll by (*).'} {Item.Damage_Roll = %1}
#TRIGGER {You say 'It does &{Item.Damage_Type} damage of &{Item.Weapon_Damage}.'} {}
#TRIGGER {You say 'It has level &%d{Item.Spell_Level} spells of: &{Item.Spells}.'} {}
#TRIGGER {You say 'The &%w{Item.Type} is &{Item.Flags}.'} {}
#TRIGGER {$} {#if (!%null( %query( &Name = @Item.Name, All))) {
#SAY {Item already exists}
#VARIABLE Record %null
#VARIABLE Item %null
} {
#T- identify
#DBLOAD items
#NEW All @Item
#DBSAVE items
#ECHO {Item added to Database.}
#UNV Item
}}
#TRIGGER {You say 'Affects agility by (*).'} {Item.Agility = %1}
#TRIGGER {You say 'Affects intelligence by (*).'} {Item.Intelligence = %1}
#TRIGGER {You say 'Affects strength by (*).'} {Item.Strength = %1}
#TRIGGER {You say 'Affects vitality by (*).'} {Item.Vitality = %1}
#TRIGGER {You say 'Affects dexterity by (*).'} {Item.Dexterity = %1}
#TRIGGER {You say 'Affects discipline by (*).'} {Item.Discipline = %1}
#TRIGGER {You say 'Affects charisma by (*).'} {Item.Charisma = %1}
#CLASS 0
#ALIAS id {
#T+ Identify
#VARIABLE Item %null
Lore "%1"
}
Frannie |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Fri Nov 16, 2001 2:21 pm |
So basically what you're saying is #TRIGGER {^$} failed, but #TRIGGER {$} works correctly? That's strange but I'm glad it now works for you.
Acaila |
|
|
|
|
|