EQdb
Home zMUD stuff Areas Eq EQdb WellStuffs

 

This page was updated 990402 and contains:
The basics IDgrabbing triggers Functions and variables Telltriggers and aliases the filez

The basics

This page shows some triggers and stuff for creating an EQ-database in Zmud 5.48. To work this stuff U prolly need a reasonable knowledge of how Zmud works and not assume that i or some1 else can help ya out if things fall apart. I've noticed there is still quite a few problems in working DBs in Zmud and if U use multiple ones i'm sure U'll get several Access violations.

The commands i use to do this stuff are:

#new            Create a new DBrecord

The builtinfunctions i use is:

%query          Search the DB for records with the conditions

%dbget          Get a record from the DB

And thats pretty much all the new stuff i use, so U might wanna read the help on those things before ya get started. Another new thing is the way the database type variable works tho, it can be defined with fields in it: #var Item.Name {kalle}. Finally you'd need to create a new DB or download the one i've put on this page if U like my idea of what fields should be in there. Expect a lot of Access violations while making yer DB, at least i got em :)

 

IDgrabbing triggers

Those are pretty much the same as the ones U might have used for an eqfile thingie. The only diff is really that this time U place all the results in a database type variable, and i also think this time i covered some new ground like perm spell affects.

#action {Object '(*)', Item type: (*), Worn: TAKE(*)} {#var Item { };#var Item.Name {%lower(%1)};#var Item.Type {%2};#var Item.Worn {%trim(%3)};#t+ IDdb} IDdbStart

This one is the initiating trigger. It empties the Item var, sets the Item.Name to lowercase %1, sets type and wornposition and activates the triggers to grab the rest of the iteminfo.

#action {%s({@Classlist}):%s(*)} {#var Item.%1 {%2}} IDdb

This trigger gets minlevs for every class contained in the var Classlist. The classlist should currently look like this: #var Classlist {Magician|Priest|Rogue|Fighter|Warlock|Nightblade|Templar}. U'll notice the cheap way of using %1 to set fieldname wich means the names of the minlevfields in the DB must be the full classname, the alternative is a case thingie or lots of if:s.

#action {%sAffects : (*) By (*)} {#if (%1=HITROLL) {#var Item.Hr {%2}} {#if (%1=DAMROLL) {#var Item.Dr {%2}} {#if (%1=MANA) {#var Item.Mana {%2}} {#if (%1=HIT) {#var Item.Hp {%2}} {#var Item.Affects {@Item.Affects %1 by %2}}}}}} IDdb

This one is rather important since it decides wich affects U take out of the affectsfield to their own DBfield wich makes them more easily searched. I chose to take Hr, Dr, Mana and Hps. The affects not fitting any of those conditions gets placed in Item.Affects.

#action {AC-apply is (*)} {#var Item.AC {%1}} IDdb

Grabs AC for armortypes.

#action {Affects: SLAY vs (*)} {#var Item.Slay {%trim(@Item.Slay %1)}} IDdb

Grabs slays, i added a %trim here cause them spaces made field "unclean".

#action {Damage Dice is '(%d)D(%d)'} {#var Item.Dice1 {%1};#var Item.Dice2 {%2}} IDdb

Grabs dices off weapons.

#action {Damage type is (*) ~(WEAPON (*)~)} {#var Item.DamType {%1 -%2-}} IDdb

Grabs damtypes for weapons.

#action {Has &Item.Charges charges, with &Item.ChargLeft charges left.} {#noop} IDdb

Grabs charges and charges left. U'll notice the &<variable> syntax wich simply adds in whatever is there under the name <variable> (instead of doing %w, #var Item.<variable> {%1}).

#action {Item is: (*)} {#var TempFlags {%trim(%1)};#if (%pos(ANTI-GOOD,@TempFlags)) {#var Item.aGood {1};#var TempFlags {%replace(@TempFlags,ANTI-GOOD,)}};#if (%pos(ANTI-EVIL,@TempFlags)) {#var Item.aEvil {1};#var TempFlags {%replace(@TempFlags,ANTI-EVIL,)}};#if (%pos(ANTI-NEUTRAL,@TempFlags)) {#var Item.aNeut {1};#var TempFlags {%replace(@TempFlags,ANTI-NEUTRAL,)}};#var Item.Flags {@TempFlags}} IDdb

This one is somewhat ugly written but it works for me. It takes out the alignrestricts to their own DBfields and removes those flags from the regular Flags field.

#action {Level (%d) spell of:} {#var TempSpells { };#var Item.SpellLevel {%1};#t+ IDdbSpells} IDdb

This one initiates spellgrabbing. For some reason {spell|spells} didn't work for me so i made a second one to grab from the other type:

#action {Level (%d) spells of:} {#var TempSpells { };#var Item.SpellLevel {%1};#t+ IDdbSpells} IDdb

#action {Permanent level (%d) (*)} {#var Item.PermLev {%trim(%1)};#var Item.PermSpell {%trim(%2)}} IDdb

This one grabs permspells.

#action {Weight: &Item.Weight, Value: &Item.Value} {#wait 1000;#t- IDdb
#var Item;#if (@ExistsDB(@Item.Name)=1) {#show Fanns i DB} {newdb;#show ADDING to DB}} IDdb

This one ties it all up. The reason i chose this is cause U cant know what pattern will end the IDspam, if U use item store or overseer U wont see the "an item scroll dissolves" msg so i chose to add a waitstate to this pattern wich always appears in any identify occation. It grabs wieght and value (wich i currently dont use, just store), and after a second it disactivate IDgrabbing triggs, checks if the item exits in the database using this function: "#func ExistsDB {%if(!%null(%query(%pos(%1,&Name))),1,0)} DB" and if not adds it. As U can see it only checks the name of the item wich has some wierd effects, like not adding the item shadow if U have a shadow protector or not adding any item just named "sword" if U have an item with keyword sword in the DB. I chose to make it this "easy" way and it works for me, but U could easily modify it to also search say value as well.

As U saw there was another triggerset activated in those triggers if the item contained spells. Those are a bit of a rushjob with lots of untidy solutions using replace to get rid of spam, but they seem to work satisfactory:

#action {(*)} {#if (%pos(spells of,%1)=0) {#var TempSpells {@TempSpells %1}}} IDdbSpells

This one grabs every single line, but also checks to make sure it dont get "spells of" line (untidy but works it seems).

#action {$} {#t- IDdbSpells;#var Item.Spells {%trim(%replace(@TempSpells,a scroll of identify dissolves.,))}} IDdbSpells

This one stops the grabbing on the first empty line, and makes sure the "identify dissolves" pattern is removed.

Some wands/staffs also have affects, wich will then be listed after the spells, so we also need a backuptrigg to stop grabbing the spelllines then:

#action {Can affect you as :} {#t- IDdbSpells;#var Item.Spells {%trim(%replace(@TempSpells,Can affect you as :,))}} IDdbSpells

 

Functions and variables

I also use a few functions like the one to search the db for an existing item. Most of them have to do with creating a tidy way of telling some1 info from the DB, depending on the item type etc. I've divided the info that can be told into cathegorys wich i then tell depending on itemtype. Here are the cathegoryfunctions:

#func DBcommon {&+w'@TempItem.Name' &+n@TempItem.Type %if(%eval(@TempItem.Worn)<>"",(%trim(@TempItem.Worn)),) &+cM@TempItem.Magician P@TempItem.Priest R@TempItem.Rogue F@TempItem.Fighter W@TempItem.Warlock N@TempItem.Nightblade T@TempItem.Templar&+n %if(%eval(@TempItem.Flags)<>"",%trim(@TempItem.Flags),)}

#func DBaffectsplus {%trim(@TempItem.Affects)%if(%eval(@TempItem.Hr)<>0,&+g Hr:@TempItem.Hr&+n,)%if(%eval(@TempItem.Dr)<>0,&+g Dr:@TempItem.Dr&+n,)%if(%eval(@TempItem.Mana)<>0,&+g Mana:@TempItem.Mana&+n,)%if(%eval(@TempItem.Hp)<>0,&+g Hp:@TempItem.Hp&+n,)%if(!%null(%eval(@TempItem.PermSpell)),&+g Perm Spell Lev:@TempItem.PermLev @TempItem.PermSpell&+n,)%if(%eval(@TempItem.aGood),&+r aG&+n,)%if(%eval(@TempItem.aNeut),&+r aN&+n,)%if(%eval(@TempItem.aEvil),&+r aE&+n,)}

#func DBweapon {@{TempItem.Dice1}d@TempItem.Dice2 (Avg:@TempItem.Avg->Tot:%eval(@TempItem.TotAvg)) @TempItem.DamType%if(%eval(@TempItem.Slay)>"".,&+n Slay:@TempItem.Slay)}

Those three returns some basic info depending on the stuff in the temporary item variable. But to connect those with actual items i use another set of functions:

#func tellArmoDB {@DBcommon, AC@TempItem.AC @DBaffectsplus}

#func tellGeneralDB {@DBcommon @DBaffectsplus}

#func TellPotScrollDB {@DBcommon, lev: @TempItem.SpellLevel @TempItem.Spells @DBAffectsPlus}

#func tellWandStaffDB {@DBcommon, Charges:@TempItem.ChargLeft (%eval(@TempItem.Charges)) lev: @TempItem.SpellLevel @TempItem.Spells @DBAffectsPlus}

#func tellWeapDB {@DBcommon, @DBweapon@DBaffectsplus}

We also need the "main-function" that does the trick on any item:

#func DBsearchResult {%if(%null(%eval(@TempItem.Name)),@tellDBtype Couldn't find that in my DB i'm afraid,%if(%eval(@TempItem.Type)=WEAPON,@TellDBtype @tellWeapDB,%if(%eval(@TempItem.Type)=ARMOR,@tellDBtype @tellarmoDB,%if(%eval(@TempItem.Type)=WAND or %eval(@TempItem.Type)=STAFF,@tellDBtype @tellWandStaffDB,%if(%eval(@TempItem.Type)=POTION or %eval(@TempItem.Type)=SCROLL,@tellDBtype @tellPotScrollDB,@tellDBtype @tellGeneralDB))))}

And i also use a variable for knowing what way to give the info:

#var tellDBtype {tell @asker}

 

Telltriggers and aliases

I also use some triggers and aliases to tell the info to someone else. Since i've had a hard time coding good "freetext" queries i've sofar limited it to "hardcoded" queries with one or two searchconditions. This is what i use currently:

#alias findDB {#var UtDB {%query(%pos(%0,&Name))}}

An alias to search if a pattern exists in the namefield of the database storing the resulting recordnumbers in the variable UtDB.

#alias findDBClass {#var UtDB {%query(&%1=%2)}}

#alias findDBHRDR2 {#var UtDB {%query((&Worn=%0) & (&Hr=2) & (&Dr=2))}}

#alias findDBDR3 {#var UtDB {%query((&Worn=%0) & (&Dr=3))}}

#alias findDBHR2 {#var UtDB {%query((&Worn=%0) & (&Hr=2))}}

The above four aliases should be considered examples of how to make this type of triggers, there is nothing limiting ya except the number of fields U chose to make in the DB really.

Now to connect the above queries with tells you need something like the following aliases and triggers wich should be pretty selfexplanatory. The only new thing is %dbget wich gets the record of a certain number into the variable.

#alias showIDDB {FindDB %lower(%0);#if (%numitems(@UtDB)<10) {#forall @UtDB {#var TempItem {%dbget(%i)};@DBsearchResult}} {@tellDBtype Sorry, your request had over 10 matches, and will not be processed, due to excessive spam}}

This one uses FindDB to do the query, then checks to see the result isen't to many records (limited to 10) if under 10 it gets each item then tells it. To use the other queries above i use the following aliases:

#alias showidDBClass {FindDBClass %1 %2;#if (%numitems(@UtDB)<10) {#forall @UtDB {#var TempItem {%dbget(%i)};@DBsearchResult}} {@tellDBtype Sorry, your request had over 10 matches, and will not be processed, due to excessive spam}}

#alias showidDBHRDR2 {FindDBHRDR2 %1 %2;#if (%numitems(@UtDB)<10) {#forall @UtDB {#var TempItem {%dbget(%i)};@DBsearchResult}} {@tellDBtype Sorry, your request had over 10 matches, and will not be processed, due to excessive spam}}

#alias showidDBDR3 {FindDBDR3 %1 %2;#if (%numitems(@UtDB)<10) {#forall @UtDB {#var TempItem {%dbget(%i)};@DBsearchResult}} {@tellDBtype Sorry, your request had over 10 matches, and will not be processed, due to excessive spam}}

So i just exchange the "find"-alias for the correct one for the interesting search, wich of course could be coded nicer but this way works. Finally we need the triggers to execute the aliases:

#action {^(%w) {asks|tells} you 'ID:(*)'} {#var Asker {%1};showiddb %2} DB

This one just saves the Asker in a var, then executes the search_and_tell alias.

#action {^(%w) {asks|tells} you 'ID({@Classlist}):(*)'} {#var Asker {%1};showiddbClass %2 %3} DB

Same thing for minlevel search on a specific class. And thats the way they all work. To give ppl a chance to use this stuff i also added a help thingie:

#action {^(%w) {asks|tells} you 'IDhelp'} {tell %1 IDsearches: ~"&+WID: ~<name~>~"&+n Ex: &+RID: morg&+n, ~"&+WIDHRDR2: ~<Worn(IDhelp worn)~>&+n~" Ex: &+RIDHRDR2: about&+n, ~"&+WID~<Classname(Magician,Warlock)~>:~<Level~>&+n~"Ex: &+RIDMagician: 55&+n ;tell %1 --~"&+WIDDR3: ~<worn~>~"&+n Ex: &+RIDDR3: head&+n more help: IDhelp worn} DB

And a help on what positions there are, as ppl typo them a lot:

#action {^(%w) {asks|tells} you 'IDhelp worn'} {tell %1 Availible wearpositions: hold, head, neck, finger, arms, elbow, hands, wrist, shield, waist, body, about, legs, knee, feet and wield} DB

The filez

My database from 990426 containing 314 items can be downloaded here (shift-click).

A .mud file with the stuff explained above can be downloaded here (shift-click).

1