Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Dakina
Novice


Joined: 22 Apr 2011
Posts: 36
Location: Colorado

PostPosted: Fri Oct 14, 2011 6:00 am   

Where do I find how to add 2 variables together?
 
Hi, Im trying to figure out how to add variable1+variable2, and output the total. Where can I find how to do this? I find the "tutorial" and help files very hard to navigate
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Oct 14, 2011 12:50 pm   
 
It may be hard to find in the help files because it is so trivial. The way to add the values of variables is: (@variable1 + @variable2)

So you can do something like:
$total = (@variable1 + @variable2)
#SHOW $total

You can probably even just do:
#SHOW (@variable1 + @variable2)

Basically, simply putting a mathematical expression within parentheses causes it to be treated as a mathematical expression. No need for the obsolete #MATH function from Zmud.
Reply with quote
Dakina
Novice


Joined: 22 Apr 2011
Posts: 36
Location: Colorado

PostPosted: Fri Oct 14, 2011 6:05 pm   Adding Variables
 
Thats what I originally figured, but tried
Var1/var2 in a guage and instead got a/b as the output
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Oct 14, 2011 7:20 pm   
 
Did you put parentheses around it?
Reply with quote
Dakina
Novice


Joined: 22 Apr 2011
Posts: 36
Location: Colorado

PostPosted: Sat Oct 15, 2011 7:44 pm   Dividing 2 variables from each other
 
Thanks, it was the parentheses I overlooked.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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