 |
Stowslee Wanderer
Joined: 20 Apr 2008 Posts: 69 Location: Watervliet, NY
|
Posted: 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 |
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
 |
Stowslee Wanderer
Joined: 20 Apr 2008 Posts: 69 Location: Watervliet, NY
|
Posted: 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 |
|
|
 |
|
|