-
Posted by Drae on Sat, 07 Nov 2009 01:23:48
I have run into a block. I have written a program that creates and maintains a macro. I can find what button was pressed on the macro and when it calls my function, it will take different actions for different buttons. Using IsModifierKeyDown() I can tell if there is a modifier key pressed when the function is called.
Is there anyway to find which modifier key is being pressed when the function is called from the macro?
-
Posted by jnwhiteh on Sat, 07 Nov 2009 10:19:03
I have run into a block. I have written a program that creates and maintains a macro. I can find what button was pressed on the macro and when it calls my function, it will take different actions for different buttons. Using IsModifierKeyDown() I can tell if there is a modifier key pressed when the function is called.
Is there anyway to find which modifier key is being pressed when the function is called from the macro?
Your question is very abstract so I don't really know how to answer it. The same "code" you can call in Lua can always be called in a macro. But I suspect what you're trying to do just needs the macro conditional system, outlined on the WoW macro help site.
Could you be more specific about what you are trying to accomplish.. rather than how you are trying to implement it?
-
Posted by Drae on Sun, 08 Nov 2009 03:05:14
I have an addon that was originally written to overcome the Blizzard problem with the "flyable" response in Dalaran (after the expansion). The "flyable" response was fixed with the latest patch, 3.2.2. The Wintergrasp zone now is the only place where the "flyable" (condition) response is unreliable. It returns "true" when the battle is on and the zone is no longer flyable. I call a function from my addon in the macro, this function would mimic the old Macro:
#showtooltip [flyable] Albino Drake; Great Red Elekk /use [nobutton:2, flyable, nomounted] Albino Drake;[nomounted] Great Red Elekk /cancelaura [noflying] [button:2] Albino Drake /cancelaura Great Red Elekk
The older versions of my addon would have to keep track of the last area traveled to take care of the flyable state in the sewer pipes of the Underbelly and would allow flying mount in Krasus' Landing. Rather than the macro above, the addon would change the #showtooltip line to reflect the mount that would by used by the addon function that did the mounting and dismounting. Vehicles were a problem then too, and many mounts behaved as vehicles. The addon function solved all the problems at the time.
When an area is flyable, the macro would show the icon of the selected flying mount, and right clicking it would mount the flying mount. A right click would force the mounting of the riding mount (ground). If mounted or in a vehicle, clicking the macro would dismount or exit the vehicle.
Blizzard has fixed the "flyable" condition return for everywhere but Wintergrasp, and the utility of the addon is growing less and less. There are at least 100 people that use the addon and beg me to keep it current and add features. The introduction of swimming mounts and the addition of secondary mounts for non-flyable areas.
I could greatly enchance the program's utility, if I was able to identify the various modifier keys being held down when the function is called from the macro. Otherwise my simple little code, with low overhead, will have to be expanded to create a button with keybindings and a GUI to operate as I would like it to do.
I can assume the modifier keys will be held down when the function is called from the macro. I know how to evaluate whether or not a modifier key is depressed from the IsModifierKeyDown() function.
My question is whether there is a function that can return which modifier key (or combination) is depressed when the function is called. Here is the function, with a test of the IsModifierKeyDown() built into the entry portion:
function Mounty_Use() if(IsModifierKeyDown() == 1) then DEFAULT_CHAT_FRAME:AddMessage(L.cGreen.."Modifier Key Is Down"..L.cEnd); end if(Mounty.Writing == false) then Mounty.Using = true; Mounty_SetStateVariables(); Mounty_SetAreaVariables(); if(State.IsMounted) then Mounty_VehicleExit(); else local fly = Area.Flyable; local button = Mounty_GetMacroButton(); if Area.NoFly then fly = false; end if(Mounty.Fly.Status < 1) then fly = false; end if(button == 2) then fly = false; end if fly then CallCompanion("MOUNT", Mounty.Fly.ID) else CallCompanion("MOUNT", Mounty.Ride.ID) end end Mounty.Using = false; end end
And here is the macro that calls it:
#showtooltip [flyable] Albino Drake; Great Red Elekk /run Mounty_Use()
A great number of things can be put into a macro, as you know. But macros are limited, and the 255 character limitation is a block to their abilities. I am busy on other projects and would like to quickly adapt this addon to changing times and be ready for future problems that will be coming as Blizzard patches and expands.
-
Posted by jnwhiteh on Sun, 08 Nov 2009 09:03:17
There are a ton of functions: http://wowprogramming.com/docs/api_categories#keyboard
Is that what you're looking for?
-
Posted by Drae on Sun, 08 Nov 2009 22:31:27
I'll be darned! I was only able to find that one function. I should use your site for reference more often to find such things. I lived with your book when I was just starting out. I am a slow learner.
This Amazon link does not have a picture:
World of Warcraft Programming: A Guide and Reference for Creating WoW AddonsIs that the same book you purchase when you follow this link:
If they are the same book then I won't need a new picture for the link on my website:
Now if I could only learn the php I need to download a bunch of xml files like:
http://www.wowhead.com/?item=48294&xml
to my server so that I can parse them with AJAX to get the data I need to complete the desired functionality of this page:
-
Posted by jnwhiteh on Sun, 08 Nov 2009 23:53:44
The book without a cover is the second edition of the book, set to come out sometime later this year (or early next year).