|
Sniegov Beginner
Joined: 17 Oct 2000 Posts: 10 Location: Poland
|
Posted: Wed Nov 26, 2003 12:35 pm
Root and power |
How can i calculate root and powers in zmud?
For exemp. 6^3.6=632.91
ver: zmud 6.62 |
|
|
|
hatespyware Apprentice
Joined: 16 Dec 2002 Posts: 103
|
Posted: Wed Nov 26, 2003 1:25 pm |
You can use sqrt to find square roots. For exponentiation, I guess you'd have to roll your own. Something like this:
Code: |
#CLASS {pow}
#ALIAS pow {#SCRIPT {function pow(x,y):pow=x^y:end function}
%mss(pow(%1,%2))}
#CLASS 0
|
would probably meet your needs.
I am most interested as to why you would ever need to exponentiate to non-integral powers, though. Also, I'm dubious as to your success in using zMud's own scripting language for anything complex, mathematically. |
|
|
|
Sniegov Beginner
Joined: 17 Oct 2000 Posts: 10 Location: Poland
|
Posted: Wed Nov 26, 2003 1:31 pm |
re up: Thx, it is simple, in LPmuds your exp is calculate from definition:
* F_EXP_TO_STAT - conversion from (acc) experience points to the stat.
* F_STAT_TO_EXP - conversion from a stat to experience points.
*
* 0.27777777 ~= 1.0/3.6; the one point extra in F_STAT_TO_EXP is to account
* for rounding errors.
*/
#define F_EXP_TO_STAT(xp) (ftoi(pow((10.0 * itof(xp)), 0.27777777)))
#define F_STAT_TO_EXP(stat) (ftoi(pow(itof(stat), 3.6) / 10.0) + 1)
Thank you very much. |
|
|
|
hatespyware Apprentice
Joined: 16 Dec 2002 Posts: 103
|
Posted: Wed Nov 26, 2003 1:38 pm |
Interesting. Thanks for sharing. I hope you post whatever you're working on when you're done, since it looks pretty nifty.
p.s. I went and had a look at the URL that you registered to this forum with. Shame on you! |
|
|
|
hatespyware Apprentice
Joined: 16 Dec 2002 Posts: 103
|
Posted: Wed Nov 26, 2003 1:40 pm |
p.s.s. Glad you got to see my reply before being deleted for sheer stupidity.
|
|
|
|
|
|