Quantcast CanExitVehicle() returns true on taxi but [canexitvehicle] does not - WoWInterface
Thread Tools Display Modes
08-31-16, 10:33 AM   #1
A Pyroguard Emberseer
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
CanExitVehicle() returns true on taxi but [canexitvehicle] does not

The macro condition behaves differently from the Lua function.

Because of that any vehicle exit button with the visibility state of "[canexitvehicle] show; hide" will not show up on a taxi ride. It will only show in a vehicle. Currently it is not possible to exit a taxi early because the visibility state handler does not reflect CanExitVehicle() properly.

Currently the only way I may be able to it is this ?!
Lua Code:
  1. local A,L = ...
  3. local frame = CreateFrame("Frame", A.."VehicleExitFrame", UIParent, "SecureHandlerStateTemplate")
  4. RegisterStateDriver(frame, "exit", "[canexitvehicle]c;[mounted]m;n")
  5. frame:SetAttribute("_onstate-exit", [[
  6.   print("_onstate-exit",newstate)
  7.   if CanExitVehicle() then
  8.     self:Show()
  9.   else
  10.     self:Hide()
  11.   end
  12. ]])
  13. local button = CreateFrame("CHECKBUTTON", A.."VehicleExitButton", frame, "ActionButtonTemplate, SecureHandlerClickTemplate")
  14. button:RegisterForClicks("AnyUp")
  15. button:SetScript("OnClick", function(self) if UnitOnTaxi("player") then TaxiRequestEarlyLanding() else VehicleExit() end self:SetChecked(false) end)


Managed to get it done by doing this:
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 08-31-16 at 02:42 PM.

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » CanExitVehicle() returns true on taxi but [canexitvehicle] does not

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