Thread Tools Display Modes
02-12-14, 04:51 PM   #1
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
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.
  Reply With Quote
02-12-14, 04:57 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
My mount macro consists of this..
Lua Code:
  1. #showtooltip
  2. /use [flyable] Turbo-Charged Flying Machine; Mechano-hog
  Reply With Quote
02-12-14, 04:59 PM   #3
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Wow I didn't know you could do it that way, that's interesting.
  Reply With Quote
02-12-14, 05:20 PM   #4
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Originally Posted by Spawnova View Post
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]
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
02-12-14, 05:26 PM   #5
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
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
  Reply With Quote
02-12-14, 07:24 PM   #6
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
Thanks Vrul, that is helpful, declaring both variables at once makes much more sense.
  Reply With Quote
04-20-14, 06:16 AM   #7
Digital_Utopia
A Flamescale Wyrmkin
 
Digital_Utopia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 110
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.
__________________
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Macro Efficiency

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off