WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Macro Efficiency (https://www.wowinterface.com/forums/showthread.php?t=48929)

Spawnova 02-12-14 04:51 PM

Macro Efficiency
 
I've made a macro below that uses either my ground or flying mount depending on the area and it took just about the entire 255 characters so I was wondering if anyone knew any tips or tricks to condense it so I could learn for future cases.

My code:


Lua Code:
  1. /run local p="MOUNT";
  2. for i=1,GetNumCompanions(p) do
  3.     local f=IsFlyableArea();
  4.     local _,v=GetCompanionInfo(p,i);
  5.     if v=="Obsidian Nightwing" and f==1 then
  6.         CallCompanion(p,i)
  7.     elseif v=="Vicious Skeletal Warhorse" then
  8.         CallCompanion(p,i)
  9.     end
  10. end
There is tabbing just for readability normally it would be one line.

semlar 02-12-14 04:57 PM

My mount macro consists of this..
Lua Code:
  1. #showtooltip
  2. /use [flyable] Turbo-Charged Flying Machine; Mechano-hog

Spawnova 02-12-14 04:59 PM

Wow I didn't know you could do it that way, that's interesting.

Tonyleila 02-12-14 05:20 PM

Quote:

Originally Posted by Spawnova (Post 290699)
Wow I didn't know you could do it that way, that's interesting.

mine looks like this

Code:

/userandom [nomod:alt,flyable] mount1, mount2
/userandom [nomod:ctrl,noflyable] mount1, mount2
/userandom [swimming,nomod] mount1, mount2
/dismount [mounted]


Vrul 02-12-14 05:26 PM

semlar gave you the best way but if you still wanted to see your original method shrunk a bit for educational purposes:
Code:

/run local f,p=IsFlyableArea(),"MOUNT"
for i=1,GetNumCompanions(p) do
    local _,v=GetCompanionInfo(p,i)
    if f and v=="Obsidian Nightwing" or v=="Vicious Skeletal Warhorse" then
        CallCompanion(p,i)
    end
end


Spawnova 02-12-14 07:24 PM

Thanks Vrul, that is helpful, declaring both variables at once makes much more sense.

Digital_Utopia 04-20-14 06:16 AM

One of the things that annoys me the most, is not having the appropriate mount at the press of a button, so I made this macro to limit that problem as much as possible.

This is that superawesome macro - weighing in at 248 characters.

Code:

/cast [swimming,mod:shift,nomounted][swimming,noflyable,nomounted] Sea Turtle;[swimming,mod:alt] Abyssal Seahorse;[flyable,nomod,nomounted] [swimming,flyable,nomod]Icebound Frostbrood Vanquisher; [nomounted] Mechano-Hog;
#show Smoke Bomb
/dismount


If you are swimming, and can fly - pushing it will cast the flying mount
If you are swimming, and can fly - shift-clicking will cast the sea turtle, and alt will cast the seahorse
if you are swimming and can't fly, pushing it will cast the sea turtle (and alt will cast the seahorse)
if you aren't swimming, and can fly - it will cast the flying mount
if you aren't swimming, can fly, and hit any modifier key, it will cast the ground mount
if you aren't swimming and can't fly, it will cast the ground mount
if you are mounted, it will dismount you.

The "#show Smoke Bomb" part is just to get rid of the question mark when mounted, that can be substituted for any other icon, or even removed.


All times are GMT -6. The time now is 01:54 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI