Thread Tools Display Modes
10-18-05, 06:16 AM   #1
Trunk
A Kobold Labourer
Join Date: Oct 2005
Posts: 1
TurnOrActionStart() problem...

Im making a simple mod that allows me to toggle "mouse turn" mode instead of having to hold the right mouse button pressed. With the mod I can bind a key to toggle this behavior.

I hook the TurnOrActionStart/Stop functions and make them do nothing while Im on locked mode. I only have one problem. If I enter "mouse turn" mode and any frame appears where the mouse cursor was when I started "mouse turn" mode turning will stop working.

Example, Im in "normal" mode, the mouse pointer is in the middle of the screen. I push the button to enter "mouse turn" mode. All is fine I turn with the mouse, with no key depressed. Then a tooltip fram appears on the middle of the screen (right where the mouse cursor was before entering "mouse turn" mode) Now the mouse wont turn anymore, and my key to exit "mouse turn" mode does'nt work eiter! All I can do is hit ESC to remove whatever frame popped up, and then hit my toggle button to exit "mouse turn" mode.

Any ideas?

The script looks something like this:

Code:
initialized = nil;
locked = nil;

-- Toggle mouse turn mode, a key is bound to this function
function MouseTurnToggle(arg1)
	if (locked ~= 1) then
		TurnOrActionStart_Original();
		locked = 1;
	else
		TurnOrActionStop_Original();
		locked = nil;
	end
end

-- Initialization
function MouseTurnFrame_OnLoad()
	if (initialized ~= 1) then

		TurnOrActionStart_Original = TurnOrActionStart;
		TurnOrActionStart = TurnOrActionStart_New();
		
		TurnOrActionStop_Original = TurnOrActionStop;
		TurnOrActionStop = TurnOrActionStop_New();

		initialized = 1;
	end
end

--------------------------------------------------
-- Hooked Functions
--------------------------------------------------

TurnOrActionStart_Original = nil;
TurnOrActionStop_Original = nil;

-- Right mouse button down
function TurnOrActionStart_New()
	if (locked == 1)
		-- Do nothing if in locked mode
	else
		TurnOrActionStart_Original();
	end
end

-- Right mouse button up
function TurnOrActionStop_New()
	if (locked == 1)
		-- Do nothing if in locked mode
	else
		TurnOrActionStop_Original();
	end
end
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » TurnOrActionStart() problem...


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