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
jimbabwe
Beginner


Joined: 25 Feb 2002
Posts: 18
Location: USA

PostPosted: Fri Nov 15, 2002 9:38 pm   

Capturing and Evaluating?
 
I am trying to capture a numeric variable, store it, divide it by 5, and store that. If i can just capture it,divide it, and then store it, that works as well. A sample of what i am trying to capture would be this:
"An item weighs 5, and Has a value of 10000"
i am trying to capture the value, divide by 5, and store that number in my status bar.
This is what i have so far
#TR {and Has a value of (%d)"} {#VAR itemvalue %1}
then i figured i could use #EVAL to do the dividing and capturing of the result, but when i use
#EVAL {@itemvalue/5}
it Does the math, and it immediately puts the result on the next line, before any more mud output. as such, i can not manage to capture it so i can use it as a second variable.

Can anyone give me any hints as to what i am doing wrong? Thank you very much in advance :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Nov 15, 2002 10:24 pm   
 
#MATH twentypercent {@itemvalue/5}
#VAR twentypercent %eval(@itemvalue/5)

LightBulb
Senior Member
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Nov 15, 2002 11:44 pm   
 
Or if your always going to be dividing by 5...
#TR {and Has a value of (%d)~"} {#VAR itemvalue %eval(%1/5)}
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