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
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Sat Aug 23, 2008 1:29 pm   

Question about string lists and a basic math issue
 
Easy one first, I am attempting to make an experience tracker. I receive output from the MUD stating the experience gained per kill.

Experience Gained: 924 (Bashing) [total: 8042914]

The total being the amount gained towards next level - which in this case = 35000000

I am fairly sure that my equation is right, my issue is at the point I am at I recieve 0.(X)% per level. How can I get the #ECHO command to output this number in decimal form.

This is the code I am using, obviously it doesn't work:
#MATH div1 (%1*100)
#VARIABLE percentgain %eval( @div1/35000000)"%" to your next level.
#ECHO You have gained @percentgain towards your next level.


My next question is how to use a trigger to check a list of possible afflictions in the following format and apply each affliction to a variable:
PROMPT -
You are:
blind.
deaf.
an insomniac.
Equilibrium Used: 0.75 seconds
PROMPT -

Any gestures in the right direction would be greatly appreciated.


Thank you
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Aug 23, 2008 8:25 pm   
 
For the math, more than likely zMud is assuming you're working with integers and will do the rounding.. so modifying your code like so

Code:
#VARIABLE percentgain %format("&0.4f&s",%eval( %float(@div1)/35000000),"%")
#ECHO You have gained @percentgain towards your next level.


Look up %float and %format for more info. If div1 is very small then you will still get 0%, you can increase the precision by changing 4f to 8f.

To do the second one the easiest way is something like:

Code:
#TRIG {You are:} {T+ Afflict}
#COND {Equilibrium Used} {T- Afflict}
#TRIG Afflict {(*).} {#IF (%1 == "blind"} { Set your blind affliction HERE }


Read up on #TRIGGERS for more information. Note, the code is off the top of my head, but should be close enough to what you want.
_________________
Asati di tempari!
Reply with quote
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Sun Aug 24, 2008 12:58 am   
 
Thank you that actually helped out a lot more than I had expected, and I also found that %norm seems to do the same thing when used with %left. As long as it is used right.

Thanks for taking the time to assist a novice
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