Creating minimap buttons
Is there a guide outthere somewhere that explains how to do this? theres a couple mods i use that id like to be able to create minimap buttons for. thanks
|
Hmm this would make an excellent template. I'll flesh one out with a "push" effect and options for "FFA" movement for square minimaps to post later. But this is one style of minimap button. Instead of the slider in options you drag the button directly.
For the icon you can use any square image in place of Interface\Icons\INV_Misc_QuestionMark. Any of the Interface\Icon files in interface.mpq will work fine as the file of MyMod_MinimapButton_Icon. Assuming your mod is named MyMod, and your SavedVariables settings is MyMod_Settings (feel free to change the convention and replace _ with . or use entirely different means): In the xml, just before the closing </Ui> add a new Button (ordinarily you'd expect a <Frame> at this level but a Button is just fine): Code:
<Button name="MyMod_MinimapButton" parent="Minimap" enableMouse="true" movable="true" hidden="false"> Code:
-- add this to your SavedVariables or as a separate SavedVariable to store its position - The icon texture in a BACKGROUND layer - The minimap tracking border in an OVERLAY layer to put the circle around the icon - A frame named MyMod_MinimapButton_DraggingFrame whose sole purpose is to contain an OnUpdate Its events: OnLoad: register the button for dragging and also for the "RightButtonUp" to register as a click (so you can use left and right clicks on the button) OnDragStart: start the OnUpdate which continually updates its position relative to cursor OnDragStop: stop the OnUpdate entirely OnClick: this function is where you'd put your code In the lua: MyMod_Settings: the SavedVariable. Make sure all references to this are the same. MyMod_MinimapButton_Reposition: Moves the minimap button. Use in VARIABLES_LOADED, PLAYER_LOGIN, PLAYER_ENTERING_WORLD, or any event after VARIABLES_LOADED and frames are rendered (which seems to be before VARIABLES_LOADED nowadays). MyMod_MinimapButton_DraggingFrame_OnUpdate: This moves the button in relationship to the current mouse position and the center of the minimap. It *only* runs while the button is being dragged. MyMod_MinimapButton_OnClick: This is where you put your code for when the button is clicked. You can use OnMouseDown and OnMouseUp instead of OnDragStart/OnDragStop, but since the buttons are moved infrequently the latter seems a safer alternative so users don't accidentally move the button just by clicking it a little awkwardly. If you use OnMouseDown or OnMouseUp you may want to check IsShiftKeyDown() or something similar. |
can i get your help with this i dont completly understand what to do
|
damn Gello
you are a genious everything workig just by putting your codes as you said only thing , i changed in xml part :: at line : 6 TOPLEFT to BOTTOM to see the icone it needs some offset, but well thkx again to have shared your knowledge :) |
:cool:Here is a downloadable copy, perhaps it will help someone who happens to stumble accross this thread
http://www.wowinterface.com/download...onoptions.html Options to show/hide the minimap button frame are included. |
Thanks :) It's working, but... how to add tooltip info onmouseover? :(
Update: did it! By adding: xml scripts: Code:
<Scripts> Code:
function PS_MinimapButton_OnEnter(self) |
All times are GMT -6. The time now is 07:03 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI