/varcalc question

A forum for the general posts relating to MacroQuest. *DEPRECATED: This forum is no longer in public use, but remains here for your reading pleasure. Enjoy

Moderator: MacroQuest Developers

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

/varcalc question

Post by Amadeus » Thu Jul 04, 2002 11:21 pm

I'm figuring that /varcalc assumes that the answer of the calculation has to be an integer. Therefore, if I tried something like:

Code: Select all

/varcalc v5 23/10
I get an error message, right?

Would it be possible to design it so that it will "round" off and still provide an answer, or else take it to a couple decimal places? (ie, perhaps /varcalcfloat)
-------

I'm assuming that this is what caused the error in the macro I was writing, let me know if I'm off-base.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Thu Jul 04, 2002 11:57 pm

Salutations,
i get 2...
if you do /varcalc 23/10*10 you then get 20... how can you fix this you ask? its quiet simple...

Code: Select all

/varcalc v0 35
/varcalc v1 $v0/10
/varcalc v2 $v0%10
/echo $v1.$v2
there you go!!

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Fri Jul 05, 2002 3:19 am

Hmmm..I assumed that my problem was as I stated in my previous post when the following line wouldn't parse:

Code: Select all

/varcalc v5 $v1+$v11+(($v2+$v22)/10)+(($v3+$v33)/100)+(($v4+$v44)/1000)
...but perhaps that wasn't the problem. Do I need to define v5 using /varset before doing a /varcalc?

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Post by Plazmic » Fri Jul 05, 2002 5:56 am

Note: there is no () handling yet
you can get around this by

Code: Select all

/varcalc v5 $v1+$v11+$calc($calc($v2+$v22)/10)+$calc($calc($v3+$v33)/100)+$calc($calc($v4+$v44)/1000)
At least, I think that'll work
- Plazmic

Draekz
a hill giant
a hill giant
Posts: 263
Joined: Thu Aug 01, 2002 6:07 pm
Location: Winnipeg, Manitoba, Canada

Post by Draekz » Fri Aug 02, 2002 12:52 am

I dont suppose anyone who failed math in grade school would still be able to program macro's huh :?: :roll:

I dunno what that was all about but it was greek to me :P Oh well..im still determined to become a decent macro'er soo..i'll stick with it ;)