 |
golen Newbie
Joined: 12 Jan 2007 Posts: 1
|
Posted: Fri Jan 12, 2007 5:46 am
XP Calculations |
I'm trying to create yet another XP calculator and I've been lookng through some of the examples, but am having a little difficulty in translating them to my mud.
When I log on I recieve the following text which I was planning to use to reset any variables I might use to 0.
^Welcome to Hidden Worlds! May your visit here be your best yet!
There's a command called 'stat' which produces the following output:
You have been playing for 1 hours, 13 mins, 14 seconds.
In that time, you've gained a total of 86120 experience points
and killed or had a part in killing 3 mobs, and 0 players.
You have amassed 25006 gold coins.
I'm trying to compute the following to display:
Average kills per hour
Average XP per minute
Average XP per hour
Average XP per kill
Since my answer in my area of expertise to such a request would be "what have you tried".. I submit the following for your amusement:
Trying to compute total minutes (dropping seconds because I'm not that anal)
#Trigger {^You have been playing for %d hours, %d mins} {#MATH PlayTime (%1*60)+%2) --- PlayTime doesn't get set and other variations of same got it set to 0.
Ideas or suggestions? |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Jan 12, 2007 6:35 am |
For a start, you're closing your trigger commands with a bracket () rather than a brace {} there. I'll assume that's just a typo though :P
You need to enclose the wildcards in brackets if you want them to be captured.
#trig {^You have been playing for (%d) hours, (%d) mins} {}
You could also use a multistate trigger with the Within setting:
#cond {In that time, you've gained a total of (%d) experience points} {} {Within|param=1}
Edit: I was playing with this earlier, and I've noticed that by default when you try to save the value of PlayTime in hours (which would be more useful) it loses its decimals. Anyone know how to get around this? |
|
|
|
 |
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Sun Jan 14, 2007 11:01 pm |
I see the missing brackets/braces on the trigger, too!
{#MATH PlayTime ((%1*60)+%2)}
I'm guessing that's your main problem right there, this seems pretty straightforward otherwise.
And decimals: If you attempt to do (some integer number like 90)/(some other integer number like 60), it will automatically truncate, i.e. it will tell you that the answer is 1, when in reality it is 1.5. This is a computer thing. Easy solution is to change 60 to 60.0 (@PlayTime/60.0) and then it will realize that you want decimals. |
|
|
|
 |
|
|
|
|
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
|
|