WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   CanExitVehicle() returns true on taxi but [canexitvehicle] does not (https://www.wowinterface.com/forums/showthread.php?t=54350)

zork 08-31-16 10:33 AM

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 = ...
  2.  
  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)

*edit*

Managed to get it done by doing this:
https://github.com/zorker/rothui/com...e827c4357059a8


All times are GMT -6. The time now is 06:53 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI