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
Darkwytch
Novice


Joined: 20 Feb 2004
Posts: 41
Location: USA

PostPosted: Sat Dec 11, 2004 7:27 pm   

adding ?
 
Hello.. i was wondering is it possible to add one variable to another variable together and get a number? if so how would i go about doing it? and how would i to it where i could show others if i wished to?
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Sat Dec 11, 2004 10:43 pm   
 
just do

#var variablename {@variableoneyouwanttoaddwith + @variabletwoyouwanttoaddwith}

Or simply just do an alias likes this

#alias added {say [@variableone+@variabletwo]}

the [] clauses should evaluate the expression therein. If you have it on (it's on by default).
Reply with quote
digits
Beginner


Joined: 17 Jul 2004
Posts: 15

PostPosted: Sun Dec 12, 2004 10:09 am   
 
if you want to do it in a quick fashion %eval is good
Code:
#sa %eval(@variable1 + @variable2)
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Sun Dec 12, 2004 11:36 am   
 
#sa is just the same as #echo and will only display it for yourself and not to others.

and I chose the [] manner since it should evaluate the expression inside and it's less typing :P

it's easier to type: "say [@var1 + @var2] and so forth, but perhaps [@blah1+@blah2] would suit you better?"
instead of: "say %eval(@var1 + @var2) and so forth, but perhaps %eval(@blah1+@blah2) would suit you better?"
Reply with quote
digits
Beginner


Joined: 17 Jul 2004
Posts: 15

PostPosted: Sun Dec 12, 2004 11:59 am   
 
ofc, both works... it a matter of taste and how you want to code...
i preferr %eval, since it's more explainatory codewise than the [] version...
then again there's more commands for the same thing... #math for example...

oh, and i don't care much about how much typing - i usually just hack my triggers once ;P
Reply with quote
Darkwytch
Novice


Joined: 20 Feb 2004
Posts: 41
Location: USA

PostPosted: Sun Dec 12, 2004 2:29 pm   
 
Thanks for helping me.. I found that %eval(var1+var2) or %eval(%1+%2) works great for what i need... not necessarily in that number but it works and adds things together great.. i appriciate it.. thanks thats something nifty to know :D
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Sun Dec 12, 2004 5:08 pm   
 
digit, ah well, I figured he wanted to send the command evaluation directly from the command prompt or some such. Thus in a typing aspect it would be easier to use [].

But anyway. Problem solved!
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