Thread Tools Display Modes
08-30-10, 01:54 AM   #1
Pro-Fool
A Murloc Raider
Join Date: Jun 2010
Posts: 5
Minimap - Hide In Combat?

Wondering if its possible to do this via Lua?

Using bMinimap by Blooblahguy, so would I have to question Him/Her or is it possible by some Lua changing?

Currently using the following code (Picked it from various google searching >.<) to hide it in a raid instance, however this comes with its own disadvantages sometimes (I like to stare at it when I'm not in combat for some reason)

Any help is nice, my knowledge of Lua is Very Basic.

I know you can do this via Kong Ui Hider - But it doesn't register the frame properly (with bMinimap). So Yeh

The code I use to hide in raid instance.
Code:
MinimapCluster:RegisterEvent("PLAYER_ENTERING_WORLD")
MinimapCluster:HookScript("OnEvent", function(self, event)
	if event == "PLAYER_ENTERING_WORLD" then
		if select(2, IsInInstance()) == "raid" then
			self:Hide()
		else
			self:Show()
		end
	end
end)
  Reply With Quote
08-30-10, 02:04 AM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Code:
MinimapCluster:RegisterEvent("PLAYER_REGEN_ENABLED")
MinimapCluster:RegisterEvent("PLAYER_REGEN_DISABLED")
MinimapCluster:HookScript("OnEvent", function(self, event)
	if event == "PLAYER_REGEN_ENABLED" then
		MinimapCluster:Show()
	elseif event == "PLAYER_REGEN_DISABLED" then
		MinimapCluster:Hide()
	end
end)
  Reply With Quote
08-30-10, 02:52 AM   #3
Pro-Fool
A Murloc Raider
Join Date: Jun 2010
Posts: 5
You Are Awesome!
  Reply With Quote
08-30-10, 10:34 AM   #4
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Thumbs up

you can cut the code down a bit like this if you want.

Code:
UIParent:HookScript("OnEvent",function(self,event,...)
	if event == "PLAYER_REGEN_ENABLED" then
		MinimapCluster:Show()
	elseif event == "PLAYER_REGEN_DISABLED" then
		MinimapCluster:Hide()
	end
end)
  Reply With Quote
08-30-10, 01:25 PM   #5
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Would this work with the Shift modifier, This would allow to bring up the hidden minimap in combat, at least that what I want it to do

Code:
UIParent:HookScript("OnEvent",function(self,event,...)
	if event == "PLAYER_REGEN_ENABLED" then
		MinimapCluster:Show()
	elseif event == "PLAYER_REGEN_DISABLED" and "modifier:shift" then
		MinimapCluster:Show()
	elseif event == "PLAYER_REGEN_DISABLED" then
		MinimapCluster:Hide()
	end
end)
  Reply With Quote
08-30-10, 01:38 PM   #6
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
Use IsShiftKeyDown()
  Reply With Quote
08-30-10, 03:34 PM   #7
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post

Originally Posted by Dainton View Post
Use IsShiftKeyDown()
yes this is right.

so it becomes like so.

Code:
UIParent:HookScript("OnEvent",function(self,event,...)
	if event == "PLAYER_REGEN_ENABLED" then
		MinimapCluster:Show()
	elseif event == "PLAYER_REGEN_DISABLED" or (not IsShiftKeyDown()) then
		MinimapCluster:Show()
	elseif event == "PLAYER_REGEN_DISABLED" then
		MinimapCluster:Hide()
	end
end)
  Reply With Quote
08-30-10, 03:41 PM   #8
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
Do it like how Haleth posted. Hooking the UIParent doesn't seem to work.
Code:
MinimapCluster:RegisterEvent("PLAYER_REGEN_ENABLED")
MinimapCluster:RegisterEvent("PLAYER_REGEN_DISABLED")
MinimapCluster:HookScript("OnEvent",function(self, event)
	if event == "PLAYER_REGEN_ENABLED" then
		self:Show()
	elseif event == "PLAYER_REGEN_DISABLED" then
		self:Hide()
	end
end)

Last edited by Dainton : 08-30-10 at 03:51 PM. Reason: UIParent doesn't work
  Reply With Quote
08-30-10, 03:48 PM   #9
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post

Originally Posted by Dainton View Post
Code:
UIParent:HookScript("OnEvent",function(self,event,...)
	if(event == "PLAYER_REGEN_ENABLED") or (event == "PLAYER_REGEN_DISABLED" and IsShiftKeyDown()) then
		MinimapCluster:Show()
	elseif(event == "PLAYER_REGEN_DISABLED") then
		MinimapCluster:Hide()
	end
end)
hehe, one over. gj.

a bit slow. as just got back form reading festival. and that's my excuse and im sticking to it. hehe

Last edited by weasoug : 08-30-10 at 03:51 PM.
  Reply With Quote
08-30-10, 03:57 PM   #10
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
Edited my post as it seems that using UIParent doesn't work. You'll probably need an OnUpdate to watch for the shift key.
  Reply With Quote
08-30-10, 04:26 PM   #11
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
RegisterStateDriver(MinimapCluster, "visibility", "[combat, nomod:shift] hide; show")
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Minimap - Hide In Combat?


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