|
Qweth Newbie
Joined: 10 Sep 2010 Posts: 5
|
Posted: Fri Sep 10, 2010 9:18 am
Gold Database |
I am looking to have a database or other method of recording the average amount of gold that is dropped by different mobs.
I wanted to get the info from the mud text "You get number coins from the corpse of mobname. "
I could do this from zmud help into a database or something except how do I store multiple coin values for each mob in order to obtain the average?
Any help would be awesome, thanks for your time,
Bob |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Sep 10, 2010 4:31 pm |
There are several approaches. The simplest would be to create a db with two fields, one for the mobname and one for a list of all coin drops. The data would end up looking something like the following:
Code: |
Name: Goblin Gold: {10|20|5|200|30|15|15} |
The drawback to that is that it can get very big. If all you're interested in is the average gold drop that a 3 field database may be more efficient. You would essentially keep a running total of the average gold drop. The db fields would be mobname, mobkilled, avg_gold. The data would look something like the following:
Code: |
Name: Goblin Killed: 217 Avg Gold: 17.8 |
|
|
_________________ Asati di tempari! |
|
|
|
Qweth Newbie
Joined: 10 Sep 2010 Posts: 5
|
Posted: Thu Dec 16, 2010 12:51 pm |
Right.. I think I would like either of those, or even keep 20-30 values of gold dropped, and also an average. Unfortunately I would not know how to derive average gold drop from having # mobs killed and a previous average. Or how to get a DB field which would be the average of all the values of gold as in your first example.
Once again, thank you for your time.
Bob |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Dec 16, 2010 4:58 pm |
To get the new average it's fairly simple.
If PA is the previous average, and NK is the number killed then you can get the new average by this formula
Code: |
NA = ((PA * NK) + EK) / (NK + 1) |
Where NA is the new average and EK is the experience you got from that last kill. You would store the new average and add one (1) to NK. As for working with Database Variables, you should just read up on how to use them. Other commands and functions you'll find useful are #ADDKEY, %dbkey and #SHOWDB. |
|
_________________ Asati di tempari! |
|
|
|
Qweth Newbie
Joined: 10 Sep 2010 Posts: 5
|
Posted: Fri Dec 17, 2010 4:53 am Nice! |
Awesome. Thank you for the formula. You have been way helpful, I figured out the DB once so 3 fields should not be difficult.
Peace |
|
|
|
|
|