|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: 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 ? |
|
|
|
Full Throttle Wanderer
Joined: 07 Dec 2004 Posts: 65
|
Posted: Sat Jul 23, 2005 9:05 pm |
#math number3 %float(@number1)/@number2
|
|
|
|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: Sat Jul 23, 2005 9:33 pm |
Hmm.. still only puts out whole numbers
|
|
|
|
Ahmeket Newbie
Joined: 21 Jul 2005 Posts: 3
|
Posted: Sat Jul 23, 2005 9:36 pm |
I don't think #MATH itself can return float.
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Jul 23, 2005 9:55 pm |
#VAR number3 %eval(%float(@number1)/@number2)
|
|
|
|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: Sat Jul 23, 2005 10:06 pm |
is it possible to set it to only show 2 desimals ? got like 14 atm
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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)) |
|
|
|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: 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 |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Full Throttle Wanderer
Joined: 07 Dec 2004 Posts: 65
|
Posted: 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. |
|
|
|
|
|