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


Joined: 23 Jul 2005
Posts: 26

PostPosted: Sat Jul 23, 2005 7:16 pm   

#math
 
Hi
i got a problem with my triggers
just trying to devide two variables, and output them
to another variable with decimals
some help plz ?
Reply with quote
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Sat Jul 23, 2005 9:05 pm   
 
#math number3 %float(@number1)/@number2
Reply with quote
Aselarin
Beginner


Joined: 23 Jul 2005
Posts: 26

PostPosted: Sat Jul 23, 2005 9:33 pm   
 
Hmm.. still only puts out whole numbers
Reply with quote
Ahmeket
Newbie


Joined: 21 Jul 2005
Posts: 3

PostPosted: Sat Jul 23, 2005 9:36 pm   
 
I don't think #MATH itself can return float.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Jul 23, 2005 9:55 pm   
 
#VAR number3 %eval(%float(@number1)/@number2)
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Aselarin
Beginner


Joined: 23 Jul 2005
Posts: 26

PostPosted: Sat Jul 23, 2005 10:06 pm   
 
is it possible to set it to only show 2 desimals ? got like 14 atm
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Jul 23, 2005 10:43 pm   
 
#VAR number3 %format("&0.2f", %eval(%float(@number1)/@number2))

This format should also work but I prefer the full syntax version
#VAR number3 %format(2, %eval(%float(@number1)/@number2))
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Aselarin
Beginner


Joined: 23 Jul 2005
Posts: 26

PostPosted: Sat Jul 23, 2005 11:30 pm   
 
there has got to be something wrong with my zmud, or something,
%format command don't seem to work at all, and when it does,
it's only working on numbers that can be devided,
like 2/2=1, 4/4=2, but if i try 3/2 it only shows as blank
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 24, 2005 1:06 am   
 
Works for me, Ase. Are you sure your variables are the same as used in the %format()? That was about the only way I was able to get a blank. If they are the same, perhaps you are not using %float() or maybe you have a missing parenthesis somewhere?
_________________
EDIT: I didn't like my old signature
Reply with quote
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Sun Jul 24, 2005 3:23 am   
 
Aselarin wrote:
Hmm.. still only puts out whole numbers


#var number1 3500
#var number2 1000
#math number3 %float(@number1)/@number2
#show @number1/@number2 = @number3

3500/1000 = 3.5

It works for me, Aselarin.
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