|
yipfur Beginner
Joined: 12 Jan 2003 Posts: 13 Location: Australia
|
Posted: Sun May 02, 2004 10:01 am
basic database help inputing infomation |
Hello, first up I would like to say a big thank you to Zugg and your wife for creating such a wonderfull piece off software with Zmud. I really like it and have been using it for a few years. I have buttons, triggers, maps ect now I want to play with the database.
My problem;
I have read and re-read the help files, looked through the forums but I can't figure out how to make the database work how I want. I do have a basic database working and can even get the infomation into it but it is not going in correctly, repeating entries and putting the wrong infomation into the fields.
Here is an example of the mud output information I am trying to get into my armour database;
---------
> vurdere hauberk
The black mail hauberk is pretty poor at stopping pierce attacks.
The black mail hauberk is poor at stopping blunt attacks.
The black mail hauberk is average at stopping sharp attacks.
The black mail hauberk protects your chest, legs, arms, abdomen and back.
> vurdere gauntlets
The pair of metal gauntlets is good at stopping pierce attacks.
The pair of metal gauntlets is extremely good at stopping blunt attacks.
The pair of metal gauntlets is excellent at stopping sharp attacks.
The pair of metal gauntlets protects your hands
----------
I have a database with the fields off;
name,sharp,blunt,pierce,position
Basicaly when I use the vurdere command I would like to get the name off the item and how good it is at defending against certain types off attacks and then what the item protects on the body. I would like to have the information contaned in one recored and I would like to be able to update record if the armours proporties change and a way to echo the information to the screen if I want to know about a certain type off armour.
This is the script that I have at the moment;
#CLASS {vurdere}
#ALIAS vurdere {
#IF %null( %find( @Item.Name, All, Name)) {#NOOP} {#ABORT 1}
#DBLOAD armour
#NEW All @Item
#DBRESET
}
#TRIGGER {The (*) is (*) at stopping pierce attacks.} {
#ADDKEY Item {Name=%1|pierce=%2}
vurdere
}
#TRIGGER {The (*) is (*) at stopping sharp attacks.} {
#ADDKEY Item {Name=%1|sharp=%2}
vurdere
}
#TRIGGER {The (*) is (*) at stopping blunt attacks.} {
#ADDKEY Item {Name=%1|blunt=%2}
vurdere
}
#TRIGGER {The (*) protects your (&position).} {
#ADDKEY Item {Name=%1|protects=%position}
vurdere
}
#CLASS 0
If one off you gurus could just start me off and get me moveing in the right direction I would be very greatful.
thanks
yipfur |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun May 02, 2004 5:20 pm |
If 'vurdere' is the command you send to identify equipment, then you probably need to rename your alias (or delete it and move its script to the triggers).
#NEW is only used for creating new records. Modifying existing records is done with #ADDKEY or #DBPUT.
%find() returns a list of records whose first column contains the string. This means, for instance, that if you already have a record for "black mail hauberk" you won't be able to add a record for "mail hauberk", since %find( mail hauberk) will match either of them. Use %query() so that you can limit the query to exact matches.
The 'armour' database should already be open as the current database when you do your %find or %query. so there's no need to use #DBLOAD. If #DBLOAD is needed at all, it would be before the %find or %query. You shouldn't need to use #DBRESET either, since you haven't used #FIND or #QUERY.
Instead of having #IF do #NOOP or #ABORT, just take the appropriate action.
#TR {The (*) is (*) at stopping pierce attacks.} {
#IF %query( "%1" = &name, All) {
#DBPUT %query( "%1" = &name, All) pierce {%2}
} {
#NEW All {name=%1|pierce=%2}
}}
Untested. May need minor modifications, such as using "&name" instead of &name. |
|
|
|
yipfur Beginner
Joined: 12 Jan 2003 Posts: 13 Location: Australia
|
Posted: Mon May 03, 2004 9:53 am |
Thankyou for your help Lightbulb. It took me a while but I figured out what all that meant. :) very important to get those spaces right. anyway this is what I ended up with.
#CLASS {armour}
#TRIGGER {The (*) is (*) at stopping pierce attacks.} {#IF %query( "%1" = &name, All) {#DBPUT %query( "%1" = &name, All) pierce {%2}} {#NEW All {name=%1|pierce=%2
}}}
#TRIGGER {The (*) is (*) at stopping sharp attacks.} {#IF %query( "%1" = &name, All) {#DBPUT %query( (%1) = &name, All) sharp {%2}} {#NEW All {name=%1|sharp=%2
}}}
#TRIGGER {The (*) is (*) at stopping blunt attacks.} {#IF %query( "%1" = &name, All) {#DBPUT %query( "%1" = &name, All) blunt {%2}} {#NEW All {name=%1|blunt=%2
}}}
#TRIGGER {The (*) protects your (*).} {#IF %query( "%1" = &name, All) {#DBPUT %query( "%1" = &name, All) protects {%2}} {#NEW All {name=%1|protects=%2
}}}
#TRIGGER {You heft the (*) and guess that it weighs about (*) pounds.} {#IF %query( "%1" = &name, All) {#DBPUT %query( (%1) = &name, All) weight {%2}} {#NEW All {name=%1|weight=%2
}}}
#CLASS 0
I guess its not very flash but it is getting the infomation "correctly" in so thats a giant leap. I have noticed that the whole output window and my buttons disapear and then come back every time the trigger activates but I am putting this down to a slow machine. (pentium 133) am I right in thinking that?
If you could help me some more I would be very greatfull, so I will risk it and ask some more questions, if that is ok?
Would you be able to point me in the right direction to get the infomation out off the protects line, for example 'The mail shirt protects your abdomen, chest and back.' Idealy I would like to have a seperate field for each type that armour protects (eg head, neck, legs etc) so I can use views to look for different types off protection. (sorry I don't have a clue how to go about that).
Also if you could recomend a way to make sure the infomation from those triggers is going into the armour database would make it much easier for me, I was planing to have a weapons, and cloths (amoungst others) databases too, when i figure out this database stuff, so at the moment I am makeing sure the armour database is open and turning the class on and off with #t- armour at the command line. For instance if I weighed a weapon it will put the infomation into armour database with what I have at the moment as the mud output is the same for all items when they are weighed, do I need to put an identical trigger in another class like #class weapons and turn the classes on and off as I need them and manually open which ever database I need?
I hope I am not being wrong by asking for more help I really do appreciate what you have done for me so far, just getting the stuff into the database is a big step and I am very happy about it.
thanks
yipfur |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon May 03, 2004 6:22 pm |
You should probably use Option List as the field-type for Protects. You probably know all the possible body-parts that armour could protect, so you should be able to make a complete list and you won't need Allow Others. The preferred input for option lists is comma-separated values, so all that's needed is to change " and " to ", ".
#TRIGGER {The (*) protects your (*).} {#IF %query( "%1" = &name, All|ar) {#DBPUT %query( "%1" = &name, All|ar) protects {%replace( "%2", " and ", ", ")}} {#NEW All|ar {name=%1|protects=%replace( "%2", " and ", ", ")}}}
You can have multiple databases open. It's usually best to just keep them all open and use #DBLOAD when you want to change which one is the current database. With most database commands and functions you can specify which database to use, so it isn't even necessary to switch the current database except for your own convenience.
The databases are identified by the first two characters of the database name, so try to keep those unique. You already have an 'armour' database so don't make an 'archery' database.
Identical triggers (such as weight) for different databases will need to be separated by using classes. It might be simpler to put all equipment in the same database and separate the various types (armour, weapons, etc) using Views. That's an individual decision, so use whichever method you prefer. |
|
|
|
yipfur Beginner
Joined: 12 Jan 2003 Posts: 13 Location: Australia
|
Posted: Tue May 04, 2004 11:57 pm |
Thank you lightbulb. I couldn't have got a database up and running with out your help.
|
|
|
|
|
|
|
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
|
|