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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Wed Mar 14, 2001 1:29 am   

Realms of Despair -- Equipment Database Script
 
Part I: Sample MUD output.

Typical armor:
Object 'a ring of light' is an armor, with wear location:  finger

Special properties: magic
Its weight is 2, value is 0, and level is 1.
Armor class is 5.
Affects hp by 5.
Affects dexterity by 1.


Typical weapon:
Object 'a heavy, iron-forged broadsword' is a weapon, with wear location:  wield

Special properties: magic metal
Its weight is 2, value is 0, and level is 1.
Damage is 1 to 6 (average 3).
Affects hit roll by 2.
Affects damage roll by 1.


Typical potion:
Object 'a beaker of plentiful potions' is a potion.

Special properties: magic
Its weight is 2, value is 1500, and level is 1.
Level 9 spells of: 'cure critical' 'armor' 'refresh'.


Typical wand:
Object 'a hand-carved pipe' is a staff, with wear location:  hold

Special properties: none
Its weight is 2, value is 4000, and level is 4.
Has 3(3) charges of level 11 'faerie fire'.
Affects intelligence by 2.


Equipment can affect strength, intelligence, constitution, wisdom, charisma, luck, hp, mana, moves, damage roll, hit roll, armor class, age, and saves vs. spells.

Next part: the database structure
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Wed Mar 14, 2001 1:36 am   
 
Before writing any code, the database structure must be chosen. Given what information the identify spell provides and my conception of how I'd like to use it, I set up the following fields in the database:

Name, Kind, slot, value, weight, armor, level, ACaffects, str, int, wisdom, con, dex, charisma, luck, hp, mana, moves, capacity, charges, castlevel, spellscast, hitroll, damroll, mindam, maxdam, avgdam, resists, savevspell, & affects.

Name as Text
Kind as Single Option (check 'allow others')
Wear as Option List (check 'allow others')
Restrictions as Text
Properties as Text
Weight as Number 0 to 999999
Value as Number 0 to 999999
Level as Number 0 to 60
Source as Text
AC as Number 0 to 999999
mindam as Number 0 to 999999
avgdam as Number 0 to 999999
maxdam as Number 0 to 999999
str, int, dex, con, wis, char, luck, armor, hit, dam, hp, mana, & moves as Number -999999 to +999999
Affects as Text
Saves as Text
Resists as Text
Suscepts as Text
Immunes as Text
Spells as Text
I originally made this field as an Option List, but I soon discovered that the number of options was restricted to 40, so I changed it to Text, and stored the spell lists in string lists.
castlevel as Number 0 to 60
charges as Number 0 to 999999
Type as Single Option
Capacity as Number 0 to 999999
The script will convert the qualitative size to a relative numerical size.

I also created an internal field called TotalArmor which combines the values of Armor and ACaffects. Sadly I have not gotten calculated fields or calculated sort criteria to work for me.
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Wed Mar 14, 2001 1:38 am   
 
Part III: the script



#CLASS {equip_id}
#VAR anticlasses {anti-warrior|anti-cleric|anti-ranger|anti-mage|anti-druid|anti-paladin|anti-vampire|anti-nephandi|anti-augurer}
#VAR antialignments {anti-good|anti-neutral|anti-evil} {anti-good|anti-neutral|anti-evil}

#VAR allRestrictions {anti-warrior|anti-cleric|anti-mage|anti-druid|anti-vampire|anti-thief|anti-good|anti-neutral|anti-evil}
#VAR tempalign {}
#VAR tempclass {}

#TRIGGER {^Object '(*)' is {a|an} (%w), with wear location: (%w)$} {
#VAR newrecord %null
#ADDKEY newrecord name {%1}
#ADDKEY newrecord Kind %2
#ADDKEY newrecord slotWear %3
#TEMP eqidtemptrig {^$} {
#DBLOAD eq
#NEW All @newrecord
#UNVAR newrecord

#T- eqidtemptrig
store_data

}
}
#TRIGGER {^Object '(*)' is {a|an} (%w).$} {
#VAR newrecord %null
#ADDKEY newrecord name {%1}
#ADDKEY newrecord Kind %2
#TEMP eqidtemptrig {^$} {
#DBLOAD eq
#NEW All @newrecord
#UNVAR newrecord

#T- eqidtemptrig
store_data

}
}
The next three triggers are new and allow for data mining from the auction channel. A check is made to see if the item is already in the database.
#TRIGGER {Auction: A new item is being auctioned: (*) at %x gold.} {
#VAR aucitem {%1}
auction
}
#TRIGGER {Object '*' is {a|an} (%x), special properties: (*)$} {
#IF %null( %find( @aucitem, All, Name)) {
#VAR newRecord ""
#ADDKEY newRecord Name @aucitem
#ADDKEY newRecord Kind {%1}
#LOOP %numwords( %2) {
#IF %ismember( %word( {%2}, %i), @allRestrictions) {
#ADDITEM newRecord.Restrictions %word( {%2}, %i)
} {
#ADDITEM newRecord.Properties %word( {%2}, %i)
}
}
#TEMP eqidtemptrig {^$} {
#T- eqidtemptrig
#DBLOAD eq
#NEW All @newRecord
#DBRESET
}
}
}
#TRIGGER {^Item's wear location: (%w)$} {#ADDKEY newRecord Wear %replace( "%1", " ", "|")}

The next trigger has been rewritten to consolidate anti-classes and anti-aligns into a single field named Restrictions.
#TRIGGER {^Special properties: (*)$} {
#VAR tempalign %null _nodef equip_id
#VAR tempclass %null _nodef equip_id
#LOOP %numwords( %1) {
#IF %ismember( %word( {%1}, %i), @antialignments) {#ADDITEM tempalign %word( {%1}, %i)} {#NOOP}
#IF %ismember( %word( {%1}, %i), @anticlasses) {#ADDITEM tempclass %word( {%1}, %i)} {#NOOP} }
#ADDKEY newrecord Alignment @tempalign
#ADDKEY newrecord Class @tempclass

#LOOP %numwords( %1) {
#IF %ismember( %word( {%1}, %i), @allRestrictions) {
#ADDITEM newRecord.Restrictions %word( {%1}, %i)
} {
#ADDITEM newRecord.Properties %word( {%1}, %i)
}
}

}
#TRIGGER {^Its weight is (%d), value is (%d), and level is (%d).$} {
#ADDKEY newrecord weight %1
#ADDKEY newrecord value %2
#ADDKEY newrecord level %3
}
#TRIGGER {^Damage is (%d) to (%d) ~(average (%d)~).$} {
#ADDKEY newrecord avgdam %3
#ADDKEY newrecord mindam %1
#ADDKEY newrecord maxdam %2
}
#TRIGGER {^Has (%d)~(%d~) charges of level (%d) ~'(*)~'.$} {
#ADDKEY newrecord charges %1
#ADDKEY newrecord castlevel %2
#ADDKEY newrecord Spells %3
}
#TRIGGER {^Level (%d) spells of: ~'(*)~'.$} {
#ADDKEY newrecord spellscast {%2}
#ADDKEY newrecord castlevel %1
#ADDKEY newRecord Spells %replace( {%2}, "' '", "|")
}
#TRIGGER {^Armor class is (%d).$} {#ADDKEY newrecord AC %1}
#TRIGGER {^Affects hp by (%n).$} {#ADDKEY newrecord hp %1}
#TRIGGER {^Affects dexterity by (%n).$} {#ADDKEY newrecord dex %1}
#TRIGGER {^Affects strength by (%n).$} {#ADDKEY newrecord str %1}
#TRIGGER {^Affects constitution by (%n).$} {#ADDKEY newrecord con %1}
#TRIGGER {^Affects luck by (%n).$} {#ADDKEY newrecord luck %1}
#TRIGGER {^Affects intelligence by (%n).$} {#ADDKEY newrecord int %1}
#TRIGGER {^Affects wisdom by (%n).$} {#ADDKEY newrecord wis %1}
#TRIGGER {^Affects charisma by (%n).$} {#ADDKEY newrecord char %1}
#TRIGGER {^Affects save vs spell by (%d).$} {#ADDKEY newrecord savevspell %1}
#TRIGGER {^Affects save vs (%w) by (%n).$} {#ADDITEM newRecord.Saves %concat( %1, " ", %2)}
#TRIGGER {^Affects armor class by (%n).$} {#ADDKEY newrecord armor %1}
#TRIGGER {^Affects affected_by by (*).$} {#ADDKEY newrecord affects {%1}}{#ADDITEM newRecord.Affects {%1}}
#TRIGGER {^Affects mana by (%n).$} {#ADDKEY newrecord mana %1}
#TRIGGER {^Affects moves by (%n).$} {#ADDKEY newrecord moves %1}
#TRIGGER {^Affects damage roll by (%n).$} {#ADDKEY newrecord dam %1}
#TRIGGER {^Affects hit roll by (%n).$} {#ADDKEY newrecord hit %1}
#TRIGGER {^A * appears to be of a (*) capacity.$} {#ADDKEY newrecord capacity {%1}}
#VAR allCapacities {small|small to medium|medium|medium to large|large|giant}
#TRIGGER {^{@newRecord.Name} appears to be of a ({@allCapacities}) capacity.$} {#ADDKEY newRecord capacity %ismember( {%1}, @allCapacities)}

The next two triggers were rendered superfluous by changes above.
#TRIGGER {^Level (%d) spells of: ~'(*)~' ~'(*)~'.$} {
#ADDKEY newrecord spellscast %concat( %2, ",", %3)
#ADDKEY newrecord castlevel %1
}
#TRIGGER {^Level (%d) spells of: ~'(*)~' ~'(*)~' ~'(*)~'.$} {
#ADDKEY newrecord spellscast %concat( %2, ",", %3, ",", %4)
#ADDKEY newrecord castlevel %1
}

#TRIGGER {^Affects resistant by (%w).$} {#ADDKEY newrecord resists %1}
#TRIGGER {^Affects resistant by (*)$} {#ADDITEM newRecord.Resists {%1}}
#TRIGGER {^Affects susceptible by (*).$} {#ADDITEM newRecord.Suscepts {%1}}
#TRIGGER {^Affects immune by (*)$} {#ADDITEM newRecord.Immunes {%1}}
#ALIAS store_data {
#IF !%null( %find( @newRecord.Name, All, Name)) {#YESNO "A duplicate item already exists, add anyway?" {#NOOP} {#ABORT 1}}
#PROMPT newRecord.Source "Source Mob or Shop?"
#IF (@newRecord.Kind = "weapon") {#PICK {p:Weapon Proficiency Type?} {o:1} {unknown:newRecord.Type=unknown} {bludgeons:newRecord.Type=bludgeons} {long blades:newRecord.Type="long blades"} {short blades:newRecord.Type="short blades"} {flexible arms:newRecord.Type="flexible arms"} {talonous arms:newRecord.Type="talonous arms"} {pugilism:newRecord.Type=pugilism}}
#DBLOAD eq
#NEW All @newRecord
#DBRESET
}

#CLASS 0
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Thu May 31, 2001 6:09 pm   
 
Part IV: a short explanation of the script

Most of triggers are filling in the data into the newrecord database variable. However, the first trigger sets up a temporary trigger which fires on the first blank line after the block of text output by the MUD. When this trigger fires, it checks to see if there is an item with the same name in the database. If there is it asks if you want to add the item anyway. It subsequently asks you to type in the name of the Source. You should put in the area and mob here. Finally, if it is a weapon, it will ask you what weapon proficiency is applicable to it. It then loads the eq database and adds the information in @newrecord using the #NEW command.

Troubadour
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Apr 06, 2002 7:29 pm   
 
Here's a copy of the script suitable for cutting and pasting. Paste it into a text file then use the Import Text... option is the Settings window.

#CLASS {equip_id}
#ALIAS store_data {
#IF !%null( %find( @newRecord.Name, All, Name)) {#YESNO "A duplicate item already exists, add anyway?" {#NOOP} {#ABORT 1}}
#PROMPT newRecord.Source "Source Mob or Shop?"
#IF (@newRecord.Kind = "weapon") {#PICK {p:Weapon Proficiency Type?} {o:1} {unknown:newRecord.Type=unknown} {bludgeons:newRecord.Type=bludgeons} {long blades:newRecord.Type="long blades"} {short blades:newRecord.Type="short blades"} {flexible arms:newRecord.Type="flexible arms"} {talonous arms:newRecord.Type="talonous arms"} {pugilism:newRecord.Type=pugilism}}
#DBLOAD eq
#NEW All @newRecord
#DBRESET
}
#VAR allRestrictions {anti-warrior|anti-cleric|anti-mage|anti-druid|anti-thief|anti-vampire|anti-good|anti-neutral|anti-evil}
#VAR allCapacities {small|small to medium|medium|medium to large|large|giant}
#TRIGGER {Object '(*)' is {a|an} (%x), with wear location: (*)$} {
#VAR newRecord %null %null equip_id
#ADDKEY newRecord Name {%1}
#ADDKEY newRecord Kind %2
#ADDKEY newRecord Wear %replace( "%3", " ", "|")
#TEMP eqidtemptrig {^$} {
#T- eqidtemptrig
store_data
}
}
#TRIGGER {Object '(*)' is {a|an} (%x).$} {
#VAR newRecord %null %null equip_id
#ADDKEY newRecord Name {%1}
#ADDKEY newRecord Kind %2
#TEMP eqidtemptrig {^$} {
#T- eqidtemptrig
store_data
}
}
#TRIGGER {^Special properties: (*)$} {
#LOOP %numwords( %1) {
#IF %ismember( %word( {%1}, %i), @allRestrictions) {#ADDITEM newRecord.Restrictions %word( {%1}, %i)} {#ADDITEM newRecord.Properties %word( {%1}, %i)}
}
}
#TRIGGER {^Its weight is (%d), value is (%d), and level is (%d).$} {
#ADDKEY newRecord Weight %1
#ADDKEY newRecord Value %2
#ADDKEY newRecord Level %3
}
#TRIGGER {^Damage is (%d) to (%d) ~(average (%d)~).$} {
#ADDKEY newrecord mindam %1
#ADDKEY newrecord maxdam %2
#ADDKEY newrecord avgdam %3
}
#TRIGGER {^Has (%d)~(%d~) charges of level (%d) ~'(*)~'.$} {
#ADDKEY newrecord charges %1
#ADDKEY newrecord castlevel %2
#ADDKEY newrecord Spells {%3}
}
#TRIGGER {^Level (%d) spells of: ~'(*)~'.$} {
#ADDKEY newRecord castlevel %1
#ADDKEY newRecord Spells %replace( {%2}, "' '", "|")
}
#TRIGGER {^Armor class is (%d).$} {#ADDKEY newrecord AC %1}
#TRIGGER {^Affects hp by (%n).$} {#ADDKEY newRecord hp %1}
#TRIGGER {^Affects dexterity by (%n).$} {#ADDKEY newRecord dex %1}
#TRIGGER {^Affects strength by (%n).$} {#ADDKEY newRecord str %1}
#TRIGGER {^Affects constitution by (%n).$} {#ADDKEY newRecord con %1}
#TRIGGER {^Affects luck by (%n).$} {#ADDKEY newRecord luck %1}
#TRIGGER {^Affects intelligence by (%n).$} {#ADDKEY newRecord int %1}
#TRIGGER {^Affects wisdom by (%n).$} {#ADDKEY newRecord wis %1}
#TRIGGER {^Affects charisma by (%n).$} {#ADDKEY newRecord char %1}
#TRIGGER {^Affects save vs (%w) by (%n).$} {#ADDITEM newRecord.Saves %concat( %1, " ", %2)}
#TRIGGER {^Affects armor class by (%n).$} {#ADDKEY newRecord armor %1}
#TRIGGER {^Affects affected_by by (*).$} {#ADDITEM newRecord.Affects {%1}}
#TRIGGER {^Affects mana by (%n).$} {#ADDKEY newRecord mana %1}
#TRIGGER {^Affects moves by (%n).$} {#ADDKEY newRecord mv %1}
#TRIGGER {^Affects damage roll by (%n).$} {#ADDKEY newRecord dam %1}
#TRIGGER {^Affects hit roll by (%n).$} {#ADDKEY newRecord hit %1}
#TRIGGER {^{@newRecord.Name} appears to be of a ({@allCapacities}) capacity.$} {#ADDKEY newRecord capacity %ismember( {%1}, @allCapacities)}
#TRIGGER {^Affects resistant by (*)$} {#ADDITEM newRecord.Resists {%1}}
#TRIGGER {^Affects susceptible by (*).$} {#ADDITEM newRecord.Suscepts {%1}}
#TRIGGER {^Affects immune by (*)$} {#ADDITEM newRecord.Immunes {%1}}
#TRIGGER {You have now obtained experience level (%d)!} {
#VAR myLevel %1
wimpy
}
#TRIGGER {Object '*' is {a|an} (%x), special properties: (*)$} {
#IF %null( %find( @aucitem, All, Name)) {
#VAR newRecord ""
#ADDKEY newRecord Name @aucitem
#ADDKEY newRecord Kind {%1}
#LOOP %numwords( %2) {
#IF %ismember( %word( {%2}, %i), @allRestrictions) {#ADDITEM newRecord.Restrictions %word( {%2}, %i)} {#ADDITEM newRecord.Properties %word( {%2}, %i)}
}
#TEMP eqidtemptrig {^$} {
#T- eqidtemptrig
#DBLOAD eq
#NEW All @newRecord
#DBRESET
}
}}
#TRIGGER {Auction: A new item is being auctioned: (*) at %x gold.} {
#VAR aucitem {%1}
~auction
}
#TRIGGER {^Item's wear location: (%w)$} {#ADDKEY newRecord Wear %replace( "%1", " ", "|")}
#CLASS 0



Troubadour
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Sat Jul 13, 2002 11:49 pm   
 
Wow, nice job, if there was an alias in there to state the number of total items in the database, that would rock too.

Evangelist
www.phidar.com
Reply with quote
Logic
Beginner


Joined: 30 May 2002
Posts: 17
Location: Denmark

PostPosted: Sat Aug 03, 2002 9:38 am   
 
Hi

I have installet the script and is seem to works but I can't see where the data is store, is there any way to get the data to a file on my harddisk

I'am running ver 6.32

Logic
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sun Aug 04, 2002 8:00 pm   
 
Thank you Evangelist. An alias to count all the records would be:

#AL numdbitems {#DBLOAD Eq; #SAY There are %count(Name,All) items in the database.}

Logic, the database must be open for the script to work. Press the DB button to open it and to set it up.

Troubadour
Reply with quote
Anomander
Newbie


Joined: 26 Aug 2002
Posts: 2
Location: United Kingdom

PostPosted: Mon Aug 26, 2002 4:33 pm   
 
This looks usefull, I have just started looking into the features of database population by using triggers, having a little difficulty getting it working, do you know of any tutorial, example documents that I would benefit from reading.

Thanks,


Anomander
Anomandaris
Elder JAMAT
Reply with quote
gasolin
Novice


Joined: 17 Aug 2002
Posts: 31
Location: Denmark

PostPosted: Wed Aug 28, 2002 7:04 pm   
 
Hi

Just want to say that I LOVE this script.

But please update it so it works after the shattering, please :)
Reply with quote
double0fro
Beginner


Joined: 19 May 2002
Posts: 15

PostPosted: Mon Sep 02, 2002 12:26 am   
 
So I brought this script in and I love it. Just one problem though. Some items on the mud I play have a bunch of special
properties, and the script only seems to be grabbing two. Any ideas?
Also, is there ANY way to add items to the DB with out the DB window being open?
Reply with quote
brecconary
Newbie


Joined: 26 Sep 2002
Posts: 1
Location: USA

PostPosted: Thu Sep 26, 2002 11:57 pm   
 
Troubador,

I am writing my own set of db-building trigs, and i must say yours have been very helpful. I've made a few departures from the way yours are built, but I've taken some ideas of yours as well. I like your idea of prompting on weapon type. I've added capability to get current room name from the mapper, and i'm also working on a maxlevel/minlevel function to record the highest and lowest encountered levels of a particular item.


if someone can clarify a few points for me about getting data into the db...

1) one issue with RoD is that enchants/glory get added on a second line:

Affects hit roll by 7.
Affects damage roll by 6.
Affects hit roll by 3.
Affects damage roll by 5.

(thats a neph enchanted sai, btw.)

if #addkey calls the same db field twice, does the value reset? or is there a way to make it add?

2) similarly, with "option list" do the entries append or replace?

3) is there a way to trigger on up to two or more words?

eg: triggertext: these words work.
or triggertext: also this
or treggertext: sample

i.e. can you write one trigger that triggers off the beginning of that text, then manipulates the rest of the text as separate variables or %w words?

given that there would be either 3 or 2 or 1 word, I can write three different triggers and it'll work, but it looks sloppy.

thanks in advance!
Brecco
Reply with quote
seamer
Magician


Joined: 26 Feb 2001
Posts: 358
Location: Australia

PostPosted: Thu Dec 26, 2002 2:46 pm   
 
How is this script affected by the db format in 6.40? Any different?

Why oh WHY did I have pass door on...
Reply with quote
nostra
Wanderer


Joined: 23 May 2001
Posts: 68
Location: Sweden

PostPosted: Fri Jan 24, 2003 1:37 am   
 
I'm trying to transfer this script to Materiamagica (which should be fairly straightforward). However, I have one question:

1. Materiamagica uses a fancy thousand decimal seperator. My question is how do I write a code that ignores the comma? (see below example).

---->

Item 'a seashell belt' is type clothing, alignment 500, made of leather,
has keywords 'seashell belt leather', and can be equipped around the waist.
This item weighs 0 stones and 85 pebbles, and is valued at 50,300 gp.
This level 241 item has the attributes: identified insulated wont-fuse unbreakable
A seashell belt is in excellent condition.
This item has a special enchantment.
*Your personality must be greater than or equal to 16 to use this item.
*This item may be repaired 3 more times.
This belt is crafted of fine leather, woven together around several
colorful seashells. It is quite sturdy and strong, and fastens with a brass
clasp.
Reply with quote
doomfyre
Apprentice


Joined: 03 Jan 2002
Posts: 152
Location: USA

PostPosted: Fri Jan 24, 2003 5:29 am   
 
Use %n rather than %d to capture decimal numbers. They will then store to the variable without the commas.
Reply with quote
mrmook
Beginner


Joined: 14 Jun 2003
Posts: 16
Location: USA

PostPosted: Tue Sep 09, 2003 8:10 pm   
 
Im new at databases.. and zmud..
i really just want this script so i can figure out whats going on a lil easier..
i tried and tried to get this workin for my mud.. but heres the output for a few of the items...

Weapon
Object 'Sword Quest Ancient' is type weapon made of unknown material.
Wear flags take wield nosac, extra flags glow hum burnproof quest.
Weight is 3, value is 1000qp, level is 202.
Weapon type is sword.
Damage is 202d5 (average 606).
Damage type is slice.
Weapons flags: flaming nodisarm
Affects damroll by 20.
Affects hitroll by 20.

Item
an Amulet of the Ancients costs 2500 questpoints.
Object 'amulet quest ancient' is type portal made of unknown material.
Wear flags take hold nosac, extra flags glow magic burnproof quest.
Weight is 0, value is 833qp, level is 202.
Affects wisdom by 1.
Affects hitroll by 10.
Affects damroll by 10.
Affects ac by -50.
Adds achilles_heel affect.
Affects skill enhanced damage by 2.

Armor
a BreastPlate of the Ancients costs 2500 questpoints.
Object 'breastplate quest ancient' is type armor made of unknown material.
Wear flags take body nosac, extra flags glow hum burnproof quest.
Weight is 2, value is 833qp, level is 202.
Armor class is 202 pierce, 202 bash, 202 slash, and 202 vs. magic.
Affects strength by 1.
Affects dexterity by 1.
Affects wisdom by 1.
Affects intelligence by 1.
Adds absorb affect.
Affects move by 125.
Affects mana by 125.
Affects hp by 125.
Affects damroll by 40.
Affects hitroll by 40.

as far as i can see all i really need is triggers..
Reply with quote
WDog
Newbie


Joined: 01 Sep 2003
Posts: 5
Location: Australia

PostPosted: Mon Sep 15, 2003 10:41 am   
 
In reply to Brecconary

quote:
1) one issue with RoD is that enchants/glory get added on a second line:

Affects hit roll by 7.
Affects damage roll by 6.
Affects hit roll by 3.
Affects damage roll by 5.


I use this trigger
Code:
#TRIGGER {Affects damage roll by (%n)~.$} {#ADDKEY NewRecord DR %eval( @NewRecord.DR + %1)}

This setup requires that the variable NewRecord be set to %null befor capaturing data. eg
Code:
#var test %null
#T+ capIDinfo

Note that the order of the arguments for %eval is important if @Record.Key is empty.
Code:
#VAR Test %Null
#VAR Num 4
#SAY %eval( @Test.Num + @Num)
Outputs 4
Code:
#VAR Test %Null
#VAR Num 4
#SAY %eval( @Num + @Test.Num)
Outputs Nothing
Code:
#ADDKEY Test Num 10
#VAR Num 4
#SAY %eval( @Test.Num + @Num)
Outputs 14
Code:
#ADDKEY Test Num 10
#VAR Num 4
#SAY %eval( @Num + @Test.Num)
Outputs 14

Hope this helps

Dave
Reply with quote
palio
Novice


Joined: 30 Jul 2003
Posts: 36

PostPosted: Wed Oct 15, 2003 8:34 am   
 
I converted the above script to my mud and I now have it doing everything but I am having a problem

the name goes into the @var newRecord just fine but for some reason it does not put the name over to the database. It seems to work sometimes but darned if I can figure out why it starts and stops almost seemingly on its own whim. It actually seems as if maybe its the zmud database thats deleting the names but i could be off there


#CLASS {equip_id}
#ALIAS store_data {#IF !%null( %find( @newRecord.Name, All, Name)) {#YESNO "A duplicate item already exists, add anyway?" {#NOOP} {#ABORT 1}};#PROMPT newRecord.Source "Where Item Located?";#DBLOAD eq;#NEW All @newRecord;#DBRESET}
#VAR newRecord {Nameleggings quest ancientTypearmorMaterialunknown materialWeartake legs nosacExtramagic|burnproof|questWeight0Value833qpLevel202acpierce202acbash202acslash202acmagic202dam5affectaccelerationmana242mv242Hit20Source} {}
#TRIGGER {^Object '(*)' is type (%w).$} {#VAR newRecord %null %null equip_id;#ADDKEY newRecord Name {%1};#ADDKEY newRecord Type %2;#TEMP eqidtemptrig {^$} {#T- eqidtemptrig;store_data}}
#TRIGGER {^Wear flags (*), extra flags (*).$} {#ADDKEY newRecord Wear {%1};#ADDKEY newRecord Extra %replace( "%2", " ", "|")}
#TRIGGER {^Weight is (%d), value is (*), condition is (%d), level is (%d).$} {#ADDKEY newRecord Weight %1;#ADDKEY newRecord Value {%2};#ADDKEY newRecord Condition %3;#ADDKEY newRecord Level %4}
#TRIGGER {^Damage is (*) ~(average (%d)~).$} {#ADDKEY newRecord Damage %1;#ADDKEY newRecord avgdam %2}
#TRIGGER {^Has (%d)~(%d~) charges of level (%d) '(*)'.$} {#ADDKEY newRecord charges %1;#ADDKEY newRecord castlevel %2;#ADDKEY newRecord Spells {%3}}
#TRIGGER {^Level (%d) spells of: ~'(*)~'.$} {#ADDKEY newRecord castlevel %1;#ADDKEY newRecord Spells %replace( {%2}, "' '", "|")}
#TRIGGER {^Armor class is (%d) pierce, (%d) bash, (%d) slash, and (%d) vs. magic.$} {#ADDKEY newRecord acpierce %1;#ADDKEY newRecord acbash %2;#ADDKEY newRecord acslash %3;#ADDKEY newRecord acmagic %4}
#TRIGGER {^Affects hp by (%n).$} {#ADDKEY newRecord hp %1}
#TRIGGER {^Affects dexterity by (%n).$} {#ADDKEY newRecord dex %1}
#TRIGGER {^Affects strength by (%n).$} {#ADDKEY newRecord str %1}
#TRIGGER {^Affects constitution by (%n).$} {#ADDKEY newRecord con %1}
#TRIGGER {^Affects luck by (%n).$} {#ADDKEY newRecord luck %1}
#TRIGGER {^Affects intelligence by (%n).$} {#ADDKEY newRecord int %1}
#TRIGGER {^Affects wisdom by (%n).$} {#ADDKEY newRecord wis %1}
#TRIGGER {^Affects charisma by (%n).$} {#ADDKEY newRecord char %1}
#TRIGGER {^Affects save vs (%w) by (%n).$} {#ADDITEM newRecord.Saves %concat( %1, " ", %2)}
#TRIGGER {^Affects ac by (%n).$} {#ADDKEY newRecord ac %1}
#TRIGGER {^Affects affected_by by (*).$} {#ADDITEM newRecord.Affects {%1}}
#TRIGGER {^Affects mana by (%n).$} {#ADDKEY newRecord mana %1}
#TRIGGER {^Affects move by (%n).$} {#ADDKEY newRecord mv %1}
#TRIGGER {^Affects damroll by (%n).$} {#ADDKEY newRecord dam %1}
#TRIGGER {^Affects hitroll by (%n).$} {#ADDKEY newRecord Hit %1}
#TRIGGER {^{@newRecord.Name} appears to be of a ({@allCapacities}) capacity.$} {#ADDKEY newRecord capacity %ismember( {%1}, @allCapacities)}
#TRIGGER {^Adds resistance to (*)$} {#ADDITEM newRecord.Resists {%1}}
#TRIGGER {^Affects susceptible by (*).$} {#ADDITEM newRecord.Suscepts {%1}}
#TRIGGER {^Adds immunity to (*)$} {#ADDITEM newRecord.Immunes {%1}}
#TRIGGER {^Item's wear location: (%w)$} {#ADDKEY newRecord Wear %replace( "%1", " ", " , ")}
#TRIGGER {Adds (%w) affect.} {#ADDKEY newRecord affect %replace( "%1", " ", "|")}
#TRIGGER {^Has (%d) charges of level (%d) '(*)'.$} {#ADDKEY newRecord charges %1;#ADDKEY newRecord castlevel %2;#ADDKEY newRecord Spells {%3}}
#TRIGGER {^Affects alignment by (%n).$} {#ADDKEY newRecord align %1}
#TRIGGER {^Object '(*)' is type (%x) made of (*).$} {#VAR newRecord %null %null equip_id;#ADDKEY newRecord Name {%1};#ADDKEY newRecord Type %2;#ADDKEY newRecord Material {%3};#TEMP eqidtemptrig {^$} {#T- eqidtemptrig;store_data}}
#TRIGGER {^Weapon type is (*).$} {#ADDKEY newRecord weaponType {%1}}
#TRIGGER {^Weapons flags: (*)$} {#ADDKEY newRecord WepFlag %replace( "%1", " ", "|")}
#TRIGGER {^Weight is (%d), value is (*), level is (%d).$} {#ADDKEY newRecord Weight %1;#ADDKEY newRecord Value {%2};#ADDKEY newRecord Level %3}
#CLASS 0
Reply with quote
Anyday
Newbie


Joined: 18 Nov 2003
Posts: 1

PostPosted: Tue Nov 18, 2003 7:06 pm   
 
Yes i loaded your script and it works fine, except for when im looking in the database. If i scroll all the way to the left in db view and scroll back the name of item changes from its name to a 0 for every item. Any idea what is going on.
Thanks Alot
Reply with quote
Skilganon
Newbie


Joined: 07 Sep 2004
Posts: 1

PostPosted: Tue Sep 07, 2004 8:04 pm   
 
Pardon my obvious shortcomings when it comes to triggers. I thought I followed all of your instructions
but it doesn't seem to be working for me. I set a new database called eq. Set up the fields per your
instructions. I went through settings and imported the script. I have the database open when I cast
ID and it doesn't seem to be capturing any information?

Any help would be greatly appreciated.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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