Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
rml8827
Newbie


Joined: 26 Feb 2005
Posts: 4

PostPosted: Sat May 19, 2007 4:28 pm   

MERC Database Script Please
 
ACCKK,
I know this has been addressed and I've searched thru the archives, but I'm finally tired of banging my head against the keyboard. I need a script to load my EQ and WEA databases in Dragon Swords.
Here is a typical output from the recite identify command for a piece of armor and a weapon:

Object: fur loincloth Type: armor
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Flags: anti-nec magic bless anti-evil anti-mag anti-cle anti-kni anti-sag anti-dru anti-pri anti-psi oiled
Weight: 5 Value: 0 Level: 148
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Armor class: 15
Location: take waist
Condition: [perfect]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Affects strength by 3
Affects intelligence by -3
Affects hp by 180
Affects damroll by 6
Affects hitroll by 10
Affects mana by 18
Affects damroll by 1
Affects ac by -16

Object: adamantite dragon sword Type: weapon
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Flags glow magic oiled
Weight: 15 Value: 46666 Level: 108
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Max Damage: 80
Average Damage: 54
Min Damage: 28
Proficiency: standard
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Affects strength by 1
Affects dexterity by 1
Affects intelligence by 1
Affects wisdom by 1
Affects constitution by 1
Affects ac by -10
Affects mana by 200
Affects hp by 200
Affects hitroll by 30
Affects damroll by 30

Some specific questions are:
Should I have separate Armor and Weapon database?
For the example in zMUD where there are boxes to check for AntiClass, how do these work?

Thanks in advance for the help, I really appreciate it!!

Ron
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat May 19, 2007 9:50 pm   
 
You don't really need separate databases for them, I personally use a generic EQ database. The anti-Class options are defined because some muds have items that certain classes can't use. So if a mage couldn't use the adamantite dragon sword it would have a mage anti-class.

There may be some slight errors here, I'm doing off the top of my head base on my own triggers, but you should get the general idea
Code:

#CLASS {identify}
#ALIAS ADDtoDB {#DBLOAD Equipment;#IF (%query( (&Name==@CurItem.Name)&&(&Level==@CurItem.Level)&&(&Value==@CurItem.Value))) {#NOOP} {#NEW @CurItem.Kind {@CurItem}};#DBSAVE Equipment;#UNVAR CurItem}
#VAR AffectKey {hit rollHitdamage rollDamarmor classAChpHealthmanaManamovesMovessave vs spellSpellSavestrengthStrengthintelligenceIntelligencewisdomWisdom}
#VAR DBCompare {}
#VAR AlignList {good|neutral|evil|anti-good|anti-neutral|anti-evil}
#VAR FlagList {rare|magic|glow|hum|nodisarm|nodrop}
#VAR FlagsKey {nosacNo SacrificenolootNo Lootno_auctionNo AuctionnodisarmNo DisarmnosaveNo SavenodropNo Drop}
#VAR CurItem {} {}
#TRIGGER "identify" {You recite Scroll of Identify.} {#VAR CurItem "" {} identify}
#COND {Object: (*) Type: (%w)} {#ADDKEY CurItem Name {%1};#ADDKEY CurItem Kind {%2};}
#COND {Flags: (*)$} { #IF (%trim( %3) <> "none") {#FORALL %replace( %3, " ", "|") {#IF (%ismember( %i, @AlignList)) {#ADDITEM Align %i} {#IF (%ismember( %i, @FlagList)) {#ADDITEM Flags %i} {#ADDITEM Flags %db( @FlagsKey, "%i")}}};#ADDKEY CurItem Alignment %replace( @Align, "|", ",");#ADDKEY CurItem Flags %replace( @Flags, "|", ",");#UNVAR Align;#UNVAR Flags} }
#COND {^Weight: (%d), Value: (%d), Level: (%d)} {#ADDKEY CurITem Weight %1;#ADDKEY CurItem Value %2;#ADDKEY CurItem Level %3;#T+ AffectsCheck;#T+ WeaponCheck; #T+ ArmorCheck}

#TRIGGER "ArmorCheck" {Armor class: (%d)} {#ADDKEY CurItem Armor %1}
#COND {Location: (*)} {#ADDKEY CurItem Wear {%replace( "%1", ".", "")}}
#COND {Condition: ~[(*)~]} {#ADDKEY CurItem Wear {%1}}

#TRIGGER "WeaponCheck" {Max Damage: (%d)} {#ADDKEY CurItem MaxDamage %1}
#COND {Average Damage: (%d)} {#ADDKEY CurItem AvgDamage %1}
#COND {Min Damage: (%d)} {#ADDKEY CurItem MinDamage %1}
#COND {Proficiency: (*)} {#ADDKEY CurItem Proficiency %1}

#TRIGGER {$} {#T- AffectsCheck;#T- ArmorCheck;#T- WeaponCheck;#IF (@Debug) {#STWIN + %expanddb( @CurItem, %cr, ": ");#STWIN + @align l;#STWIN + @flags l};ADDToDB;#CLASS identify 0;#STATE identify 0}
#TRIGGER {^{You do not have that scroll.|You lost your concentration.}} {#STATE identify 0;#CLASS identify 0}

#TRIGGER "AffectsCheck" {Affects (*) by (%n)} {#ADDKEY CurItem %db( @AffectKey, "%1") %2} "" {disable}
#CLASS  0


This should get you 95% of the way there.
Couple of notes...
- I put the location for Armor into the 'Wear' field.
- I do a lookup in the Affects variable to get the proper name for what you are affected by
- I left my AddToDB alias that checks first to see if you have the equipment already in the DB before you add it.

I hope that helps. (and forgive whatever typos there may be)
_________________
Asati di tempari!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net