|
Darkwytch Novice
Joined: 20 Feb 2004 Posts: 41 Location: USA
|
Posted: 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?
|
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: 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). |
|
|
|
digits Beginner
Joined: 17 Jul 2004 Posts: 15
|
Posted: 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) |
|
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: 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?" |
|
|
|
digits Beginner
Joined: 17 Jul 2004 Posts: 15
|
Posted: 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 |
|
|
|
Darkwytch Novice
Joined: 20 Feb 2004 Posts: 41 Location: USA
|
Posted: 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
|
|
|
|
misterbalrog Apprentice
Joined: 26 Oct 2004 Posts: 108
|
Posted: 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! |
|
|
|
|
|