Thread Tools Display Modes
01-14-10, 04:20 PM   #1
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Mount checking = almost dead keyboard....

Seriously, I'm about ready to throw my keyboard at a wall on this one. Once again, my noob ass can't figure this out, even though the code looks like it should.

Been struggling since DCam's release to get mount status checking to work properly and have about had it. Help would be appreciated at this point.

Code:
function DCam:COMPANION_UPDATE(_,change)
	if DCam_Vars.enableMount and change == "MOUNT" then
		if IsMounted() ~= nil then
			SetView(DCam_Vars.views.Mount)
		else
			SetView(DCam_Vars.views.Normal)
		end
	end
end
Obviously there's either a step I'm missing or something else. Needless to say, I'm on the verge of just scrapping this part, but figure it better to see if anyone has any ideas.

Last edited by Sythalin : 01-14-10 at 04:26 PM. Reason: L2English
  Reply With Quote
01-14-10, 04:39 PM   #2
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
What values are you seeing for change? Also, just for fun, assign the first value passed in a variable and print that out as well.
  Reply With Quote
01-14-10, 04:47 PM   #3
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by wurmfood View Post
What values are you seeing for change? Also, just for fun, assign the first value passed in a variable and print that out as well.
Already ran prints, the issue is that IsMounted() never returns anything other than nil (supposed to return "1" if mounted):

Code:
function DCam:COMPANION_UPDATE(_,change)
	print(change)
	print(DCam_Vars.enableMount)
	if DCam_Vars.enableMount and change == "MOUNT" then
		print(IsMounted())
		if IsMounted() ~= nil then
			SetView(DCam_Vars.views.Mount)
		else
			SetView(DCam_Vars.views.Normal)
		end
	end
end
Mount
change = "MOUNT"
DCam_Vars.enableMount = true
IsMounted() = nil

Dismounting
change = "MOUNT"
DCam_Vars.enableMount = true
IsMounted = nil
  Reply With Quote
01-14-10, 05:08 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
When the event fires, you're not mounted yet. You'll have to add in a slight delay.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-14-10, 05:12 PM   #5
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Ah, I'll give that whirl then. Edit the results in a bit.
  Reply With Quote
01-14-10, 05:16 PM   #6
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Doing some testing, it appears "IsMounted()" doesn't immediately return true after mounting. There's a series of events that happen after the mount process, including a UNIT_AURA for the player. It seems that only by that time will the IsMounted() return true.
  Reply With Quote
01-14-10, 06:07 PM   #7
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Adding the delay worked, but running into issues where the camera acts funny when changing zones. Have to look into it further.

RE: UNIT_AURA
Worked as well, but I'd have to create a filter for EVERY possible mount in the game or it'll trigger off every buff the player gets. Quite inefficient.

Thanks to all though. And my keyboard thanks you too.
  Reply With Quote
01-14-10, 07:38 PM   #8
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
For using UNIT_AURA, I wouldn't bother checking what the aura is, personally, though there are ways you could do it to test it and not have to document every mount.

You could watch for SPELL_CAST_START, and if it matches "mount", save the name, strip off the mount part, and watch for an aura with that name. Not fun, but it would work.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Mount checking = almost dead keyboard....

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