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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Sniegov
Beginner


Joined: 17 Oct 2000
Posts: 10
Location: Poland

PostPosted: 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
Reply with quote
hatespyware
Apprentice


Joined: 16 Dec 2002
Posts: 103

PostPosted: 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.
Reply with quote
Sniegov
Beginner


Joined: 17 Oct 2000
Posts: 10
Location: Poland

PostPosted: 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.
Reply with quote
hatespyware
Apprentice


Joined: 16 Dec 2002
Posts: 103

PostPosted: 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!
Reply with quote
hatespyware
Apprentice


Joined: 16 Dec 2002
Posts: 103

PostPosted: Wed Nov 26, 2003 1:40 pm   
 
p.s.s. Glad you got to see my reply before being deleted for sheer stupidity.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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