A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!
Moderator: MacroQuest Developers
-
EQBot_man
- a ghoul

- Posts: 111
- Joined: Mon May 17, 2004 6:35 pm
Post
by EQBot_man » Mon Aug 02, 2004 4:20 pm
This is just some math I worked out that might be of interest. Maybe put it into a custom UI or something or just put it into a small 1KB macro and punch it everytime you want to know how long its going to take for you to reach full mana. Nothing big but pretty helpful to me a lot of times:
My code wasn't that good. This code is from "Some Guy" below that I've just copied and pasted here so that when a random person reads this post 2 months from now they won't have to search the thread for the best one. Use this:
Code: Select all
/echo ${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}/10]}]}m ${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]}s
Last edited by
EQBot_man on Wed Aug 04, 2004 1:26 pm, edited 2 times in total.
-
Sparr
- a hill giant

- Posts: 159
- Joined: Mon Jun 24, 2002 5:41 am
Post
by Sparr » Mon Aug 02, 2004 5:09 pm
i did this in the Frequency UI thread. except i only used seconds, the m/s labels take up too much space :)
-
Drumstix42
- a grimling bloodguard

- Posts: 808
- Joined: Mon May 03, 2004 4:25 pm
Post
by Drumstix42 » Mon Aug 02, 2004 6:51 pm
Isn't nesting so fun :)
-
bob_the_builder
- a hill giant

- Posts: 275
- Joined: Tue Jul 22, 2003 1:22 pm
Post
by bob_the_builder » Mon Aug 02, 2004 9:29 pm
I get a divide by 0 if no mana. So
/if [(${Me.PctMana}!=0) ${Int[${Math.Calc[((${Me.MaxMana}-${Me.CurrentMana})/${Me.ManaRegen})/10]}]}m${Int[${Math.Calc[(${Math.Calc[${Math.Calc[((${Me.MaxMana}-${Me.CurrentMana})/${Me.ManaRegen})/10]}-${Int[${Math.Calc[((${Me.MaxMana}-${Me.CurrentMana})/${Me.ManaRegen})/10]}]}]})*60]}]}s]
That right?
Bob
-
Sparr
- a hill giant

- Posts: 159
- Joined: Mon Jun 24, 2002 5:41 am
Post
by Sparr » Mon Aug 02, 2004 10:35 pm
sadly, that probably still wont work. for some freakish reason MQ evaluates things even when it shouldnt. you have to put a ${If[]} around the divisor.
-
EQBot_man
- a ghoul

- Posts: 111
- Joined: Mon May 17, 2004 6:35 pm
Post
by EQBot_man » Tue Aug 03, 2004 2:53 am
There is a 6 second time from when you get rezed until you get your first tick of mana that you are 0m, and more like 2 seconds by the time you zone and the world pops around you. Just don't use it during those 2 long seconds. I know its tempting. But if you really can't wait I guess this would work:
Untested, but I'm sure its correct:
Code: Select all
/if (!${Me.CurrentMana}==0) /echo ${Int[${Math.Calc[((${Me.MaxMana}-${Me.CurrentMana})/${Me.ManaRegen})/10]}]}m${Int[${Math.Calc[(${Math.Calc[${Math.Calc[((${Me.MaxMana}-${Me.CurrentMana})/${Me.ManaRegen})/10]}-${Int[${Math.Calc[((${Me.MaxMana}-${Me.CurrentMana})/${Me.ManaRegen})/10]}]}]})*60]}]}s
-
Sparr
- a hill giant

- Posts: 159
- Joined: Mon Jun 24, 2002 5:41 am
Post
by Sparr » Tue Aug 03, 2004 3:34 am
heh, its in my UI, i dont get an option of when to not use it.
a) that still wont work, the divide by zero happens even if the /if fails
b) "/if (!A==0)" can be replaced with "/if (A)"
-
Cr4zyb4rd
- Plugins Czar
- Posts: 1449
- Joined: Tue Jul 20, 2004 11:46 am
Post
by Cr4zyb4rd » Tue Aug 03, 2004 6:16 am
Math's not my specialty, but it seems to me that a few well-placed |1 should fix your problem, at the possible cost of pretending you have 1 mana or 1 regen at the time. No?
-
Some Guy
- a ghoul

- Posts: 119
- Joined: Thu Apr 29, 2004 5:32 pm
Post
by Some Guy » Tue Aug 03, 2004 3:12 pm
Code: Select all
${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}/10]}]}m ${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/${If[${Me.ManaRegen}>0,${Me.ManaRegen},1]}%10*6]}]}s
-
Cr4zyb4rd
- Plugins Czar
- Posts: 1449
- Joined: Tue Jul 20, 2004 11:46 am
Post
by Cr4zyb4rd » Tue Aug 03, 2004 3:42 pm
Code: Select all
${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/(${Me.ManaRegen}|1)/10]}]}m ${Int[${Math.Calc[(${Me.MaxMana}-${Me.CurrentMana})/(${Me.ManaRegen}|1)%10*6]}]}s
|1 is a bit less bloaty than an extra If and the required extra variable specification...but that works too.
-
Sparr
- a hill giant

- Posts: 159
- Joined: Mon Jun 24, 2002 5:41 am
Post
by Sparr » Tue Aug 03, 2004 4:12 pm
|1 will turn 0 into 1, but it will also turn 2 into 3, 4 into 5, 6 into 7.
X | 1 == X + !(X%2)
-
Cr4zyb4rd
- Plugins Czar
- Posts: 1449
- Joined: Tue Jul 20, 2004 11:46 am
Post
by Cr4zyb4rd » Tue Aug 03, 2004 4:46 pm
o.O
Told you math wasn't my specialty. :) Makes sense though, now that I think about it...I'm so used to using conditional || that I assumed a bitwise or would work, without really pondering what it did.
*hangs head in shame*