|
Valdar Novice
Joined: 17 May 2003 Posts: 30 Location: USA
|
Posted: Fri May 23, 2003 9:15 pm
Need to add combine 2 things for database |
Ok my problem is i'm creating a script to auto-add items to my equipment database.
What i need to do is add up the values when an item has a mod listed twice... Example here is my pike:
Object 'sapphires rare spear Master's Thunder magic spear War Pike' is type weapon, extra flags none.
Weight is 5, value is 0, level is 55.
This item has no class restrictions.
Weapon type is spear/staff.
Damage is 6d13 (average 42).
Weapon does 1 to 50 elemental damage of type lightning.
Affects hit roll by 6.
Affects damage roll by 6.
Affects damage roll by 5.
What i need to do is take both of those "Affects damage roll by x" and add the values (11) then store them into my variable i'm using I use: #AddKey NewItem DamRoll %1 with the trigger: Affects damage roll by (%d). Only problem is i have no idea at all of how to combine the two values/if i can since they are nearly identical and in some items it will be compleatly identical...
Thanks in advance for any help :) |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri May 23, 2003 10:33 pm |
Looks like standard ROM type mud id output. Generally when there are multiple identical affects it is do to the item being enhanced by a player or imm. I would suggest you design the DB to keep them seperate so you know the base stats, but i suppose it is a little late for that. Anyhow a simple change to your addkey line will handle it.
#ADDKEY NewItem DamRoll %eval(%db(@NewItem,"DamRoll")+%1) |
|
|
|
Valdar Novice
Joined: 17 May 2003 Posts: 30 Location: USA
|
Posted: Fri May 23, 2003 11:41 pm |
Actually its not a imm/player enhance or whatever. The game generates items semi-randomly like in Diablo 2 with magics having 1 suffix and 1 prefix or whatever (although not as randomly as one might think making it actually reasonable to make a database) but with 'rare' items they can have up to 3 suffix and 3 prefix which can some times make mods stack natually (in the game D2 they are auto added and displayed.... in MUDs they dont seem to...at least not in this one [WarCraft: Legends of War if any one is curious])
Any way the script works great now! Thanks alot!! :) |
|
|
|
|
|