WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Classic - AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=179)
-   -   Help me sort this error please. (https://www.wowinterface.com/forums/showthread.php?t=57472)

Šynasty 09-09-19 08:08 AM

Help me sort this error please.
 
Code:

2x Binding header MouseLook is defined more than once in Mouse_Look_Lock\Bindings.xml
The "2x" actually changes I think the more times the error is sacked (bugsac).

The addon is no longer maintained and I can't play without it.

It still works but I would like to get rid of the error. And I would also like to update it for Classic WoW.


Code:

<?xml version="1.0"?>

-<Bindings>

<Binding header="MouseLook" description="Enable/Disable MouseLook Lock mode" name="MouseLook_mode_toggle">MouseLook_Toggle() </Binding>

<Binding header="MouseLook" description="Brings up the pointer while held down" name="MouseLook_momentary" hidden="false" runOnUp="true">MouseLook_Momentary(keystate) </Binding>

</Bindings>



Lua Code:
  1. --[[------------------------------------------------------------
  2.     Mouse Look v7.0
  3.    
  4.     By Trimble Epic
  5.    
  6.     This mod allows a button to be mapped to allow
  7.     WoW to simulate the Mouselook mode found in DAoC.
  8.    
  9.     The code below is a work-around for the
  10.     way WoW handles it's mouse controlled camera functions
  11.    
  12.     Revision History
  13.     7.0 Jul 29 '16  Updated TOC for use with 7.0 Legion
  14.     6.0 Nov 13 '14  Updated TOC for use with 6.0 Wod
  15.     5.1 Aug 11 '14  Updated TOC for use with 5.4 Cata
  16.             Also added many new user interface windows to automatically pop up cursor.
  17.  
  18.     5.0 Aug 29 '12  Updated TOC for use with 5.0.4 Mists of Pandaria
  19.  
  20.     4.0 Oct 12 '10  Updated the addon to fix some code issues.  Blizzard removed "this", as well as
  21.             a few other "features" like values passed as "arg1" in XML code.  I also updated
  22.             the TOC for use with 4.0.1
  23.     3.2 Aug 16 '09
  24.             Updated TOC for use with 3.2
  25.     3.1 Apr 15 '09
  26.             Updated TOC for use with 3.1
  27.     2.2 Oct 14 '08
  28.             Updated TOC for use with 3.0.2
  29.     2.1 Aug 4 '08
  30.             Updated TOC for use with 2.4
  31.             Fixed bug associated with sRaidFrames (wouldn't return to mouselook mode)
  32.             Fixed bug so that mouselook setting is started when entering the world
  33.     1.6 Nov 3
  34.             Updated TOC for use with patch 1.12
  35.     1.5 Mar 29
  36.             Updated TOC for use with patch 1.10
  37.             Changed essential functions used to engage and disengage mouselook to comply with new 1.10 rules
  38.     1.4 Jun 20
  39.             Updated TOC for use with version 1500 of game client
  40.     1.3 Feb 22
  41.             Updated TOC for use with version 4216 of game client
  42.     1.2 Feb 15
  43.             Updated TOC for use with version 4211 of game client
  44.             Reworked Lua file to contain all code internally to reduce stray code in bindings.xml
  45.             Reworked bindings.xml to be cleaner and leaner
  46.             Added some code in an attempt to fix 'walklock' issue.
  47.     1.1 I wasn't keeping track of changes prior to 1.2, but it should be sufficient to say that
  48.             1.1 was pretty much a stable release.
  49.  
  50.     Todo notes:
  51.     Implement MouseOverFrame function and increase update speed
  52.    
  53. --------------------------------------------------------------]]
  54.  
  55. local Version = '7.0'
  56. local Debugging = false
  57. local MouseLook_TempLockout = false
  58. local MouseLook_LastUpdate = 0
  59. local MouseLook_UpdateFrequency = 0.2  ---> Adjust this number UP to improve frame rate.
  60.  
  61. BINDING_HEADER_MouseLook            = 'MouseLook'
  62. BINDING_NAME_MouseLook_mode_toggle  = "MouseLook toggle" -- are these needed?
  63. BINDING_NAME_MouseLook_momentary    = "MouseLook momentary"
  64.  
  65.  
  66. --List of frames that should automatically undo mouselook while they are up
  67. local MouseLook_FramesToCheck = {
  68.     "AuctionFrame",       "BankFrame",          "BattlefieldFrame",   "CharacterFrame",
  69.     "ChatMenu",           "EmoteMenu",          "LanguageMenu",       "VoiceMacroMenu",
  70.     "ClassTrainerFrame",  "CoinPickupFrame",    "CraftFrame",         "FriendsFrame",
  71.     "GameMenuFrame",      "GossipFrame",        "GuildRegistrarFrame","HelpFrame",
  72.     "InspectFrame",       "KeyBindingFrame",    "LoXXXotFrame",       "MacroFrame",
  73.     "MailFrame",          "MerchantFrame",      "OptionsFrame",       "PaperDollFrame",
  74.     "PetPaperDollFrame",  "PetRenamePopup",     "PetStable",          "QuestFrame",
  75.     "QuestLogFrame",      "RaidFrame",          "ReputationFrame",    "ScriptErrors",
  76.     "SkillFrame",         "SoundOptionsFrame",  "SpellBookFrame",     "StackSplitFrame",
  77.     "StatsFrame",         "SuggestFrame",       "TabardFrame",        "TalentFrame",
  78.     "TalentTrainerFrame", "TaxiFrame",          "TradeFrame",         "TradeSkillFrame",
  79.     "TutorialFrame",      "UIOptionsFrame",     "UnitPopup",          "WorldMapFrame",
  80.     "CosmosMasterFrame",  "CosmosDropDown",     "ChooseItemsFrame",   "ImprovedErrorFrame",
  81.     "TicTacToeFrame",     "OthelloFrame",       "MinesweeperFrame",   "GamesListFrame",
  82.     "ConnectFrame",       "ChessFrame",         "QuestShareFrame",    "TotemStomperFrame",
  83.     "StaticPopXXXup1",       "StaticPopup2",       "StaticPopup3",       "StaticPopup4",
  84.     "DropDownList1",      "DropDownList2",      "DropDownList3",      "WantAds",
  85.     "CosmosDropDownBis",  "InventoryManagerFrame", "InspectPaperDollFrame",
  86.     "ContainerFrame1",    "ContainerFrame2", "ContainerFrame3", "ContainerFrame4",
  87.     "ContainerFrame5",    "ContainerFrame6",    "ContainerFrame7",    "ContainerFrame8",
  88.     "ContainerFrame9",    "ContainerFrame10",   "ContainerFrame11",   "ContainerFrame12",
  89.     "ContainerFrame13",   "ContainerFrame14",   "ContainerFrame15",   "ContainerFrame16",
  90.     "ContainerFrame17",   "AutoPotion_Template_Dialog","NxSocial",    "ARKINV_Frame1",
  91.     "AchievementFrame",   "LookingForGuildFrame", "PVPUIFrame",       "GuildFrame",
  92.     "WorldMapFrame",      "VideoOptionsFrame",  "InterfaceOptionsFrame",
  93.         "ACP_AddonList",      "PlayerTalentFrame",  "PVEFrame",           "EncounterJournal",
  94.     "PetJournalParent",   "AccountantFrame", "ElvUI_ContainerFrame",
  95.     --   "NxMap1",  (carbonite's world map breaks mouselook)
  96.     -- "StoreFrame", (causes taint??!??  wtf, blizzard?)
  97.     }
  98.  
  99. --List of frames that mouse might be over (Yes, these could badly use some cleanup)
  100. local MouseLook_FramesToCheckForMouse = {
  101.     "BonusActionBarFrame",
  102.     "BuffFrame",
  103.     "CastingBarFrame",
  104.     "ChatFrameMenuButton", "ChatFrameEditBox",
  105.     "ChatFrame1Tab", "ChatFrame2Tab", "ChatFrame3Tab", "ChatFrame4Tab", "ChatFrame5Tab", "ChatFrame6Tab", "ChatFrame7Tab",
  106.     "ChatFrame1BottomButton", "ChatFrame2BottomButton", "ChatFrame3BottomButton", "ChatFrame4BottomButton", "ChatFrame5BottomButton", "ChatFrame6BottomButton", "ChatFrame7BottomButton",
  107.     "ChatFrame1DownButton", "ChatFrame2DownButton", "ChatFrame3DownButton", "ChatFrame4DownButton", "ChatFrame5DownButton", "ChatFrame6DownButton", "ChatFrame7DownButton",
  108.     "ChatFrame1UpButton", "ChatFrame2UpButton", "ChatFrame3UpButton", "ChatFrame4UpButton", "ChatFrame5UpButton", "ChatFrame6UpButton", "ChatFrame7UpButton",
  109.     "CoinPickupFrame",
  110.     "ColorPickerFrame",
  111.     "DialogBoxFrame",
  112.     "DurabilityFrame",
  113.     "GameTimeFrame",
  114.     "ItemTextFrame",
  115.     "MainMenuBar",
  116.     "MinimapCluster",
  117.     "PartyFrame",
  118.     "PetActionBarFrame", "PetFrame", "PetitionFrame",
  119.     "PlayerFrame",
  120.     "QuestTimerFrame",
  121.     "TargetFrame",
  122.     "UnitFrame",
  123.     "AutoFollowStatus",
  124.     "SecondBar",
  125.     "ClockFrame",
  126.     "CosmosTooltip",
  127.     "CombatStatsDataFrame",
  128.     "CombatStatsFrame",
  129.     "DPSPLUS_PlayerFrame",
  130.     "ItemBuffBar",
  131.     "ItemBuffButton1", "ItemBuffButton2", "ItemBuffButton3", "ItemBuffButton4", "ItemBuffButton5", "ItemBuffButton6",
  132.     "KillCountFrame", "KillCountFrame2",
  133.     "InventoryManagerTooltip",
  134.     "MonitorStatus",
  135.     "SideBar", "SideBar2",
  136.     "TargetDistanceFrame",
  137.     "TargetStatsTooltip",
  138.     "HealomaticMainFrame",
  139.     }
  140.  
  141. local function ML_debug(...)
  142.    
  143.     if not DEFAULT_CHAT_FRAME or not Debugging then return end
  144.    
  145.     local msg = ''
  146.    
  147.     for k,v in ipairs(arg) do
  148.        
  149.         msg = msg .. tostring(v) .. ' : '
  150.        
  151.     end
  152.    
  153.     DEFAULT_CHAT_FRAME:AddMessage(msg)
  154.    
  155. end
  156.  
  157. local function Print(text)
  158.    
  159.     if not DEFAULT_CHAT_FRAME then return end
  160.    
  161.     DEFAULT_CHAT_FRAME:AddMessage(text)
  162.    
  163. end
  164.  
  165. local function UnmouseableFrameOnScreen()
  166.    
  167.     for index in pairs(MouseLook_FramesToCheck) do
  168.        
  169.         local curFrame = getglobal(MouseLook_FramesToCheck[index])
  170.         if (curFrame and curFrame:IsVisible()) then
  171.             --ML_debug("Frame on screen : " .. MouseLook_FramesToCheck[index])
  172.             return true
  173.         end
  174.        
  175.     end
  176.    
  177. end
  178.  
  179. local function MouseIsOverFrame()
  180.    
  181.     for index in pairs(MouseLook_FramesToCheckForMouse) do
  182.        
  183.         local curFrameName = MouseLook_FramesToCheckForMouse[index]
  184.         local curFrame = getglobal(curFrameName)
  185.        
  186.         if  curFrame
  187.         and curFrame:IsVisible() then
  188.            
  189.             local xPos, yPos = GetCursorPosition()
  190.            
  191.             local top    = curFrame:GetTop()    * UIParent:GetScale() + 10
  192.             local right  = curFrame:GetRight()  * UIParent:GetScale() + 10
  193.             local left   = curFrame:GetLeft()   * UIParent:GetScale() - 10
  194.             local bottom = curFrame:GetBottom() * UIParent:GetScale() - 10
  195.            
  196.             if string.find(curFrameName, "ChatFrame") then
  197.                 top = top + 10
  198.                 left = left - 10
  199.             end
  200.            
  201.             if  xPos and yPos
  202.             and left and right
  203.             and top  and bottom then
  204.                
  205.                 if  (xPos >= left)
  206.                 and (xPos <= right)
  207.                 and (yPos >= bottom)
  208.                 and (yPos <= top) then
  209.                    
  210.                     --ML_debug("Mouse is over frame : " .. curFrameName)
  211.                     return true
  212.                    
  213.                 end
  214.                
  215.             end
  216.            
  217.         end
  218.        
  219.     end
  220.    
  221. end
  222.  
  223.  
  224. function MouseLook_OnUpdate(self,elapsed,...)
  225.    
  226.    
  227.     MouseLook_LastUpdate = MouseLook_LastUpdate + elapsed
  228.    
  229.     if (MouseLook_LastUpdate >= MouseLook_UpdateFrequency) then
  230.        
  231.         MouseLook_LastUpdate = 0
  232.        
  233.         if MouseLookOn
  234.         and not MouseLook_MomentaryPointer then
  235.            
  236.             if CursorHasItem()
  237.             or UnmouseableFrameOnScreen()
  238.             or MouseIsOverFrame() then
  239.                
  240.                 if not MouseLook_TempLockout then
  241.                    
  242.                     --IsMouselooking() -- also for mouselook tools ;)
  243.                     MouselookStop()
  244.                     --Print("MouselookStop()")
  245.                     --SetBinding("BUTTON1","CAMERAORSELECTORMOVE")
  246.                     --SetBinding("BUTTON2","TURNORACTION")
  247.                     MouseLook_TempLockout = true
  248.                    
  249.                    
  250.                 end
  251.                
  252.             else
  253.                
  254.                 if MouseLook_TempLockout then
  255.  
  256.                     if SpellIsTargeting() then return end  
  257.                     MouselookStart()
  258.                     --Print("MouselookStart()")
  259.                     --SetBinding("BUTTON1","MOVEBACKWARD")
  260.                     --SetBinding("BUTTON2","MOVEFORWARD")
  261.                     MouseLook_TempLockout = false
  262.                    
  263.                 end
  264.                
  265.             end
  266.            
  267.         end
  268.        
  269.     end
  270.    
  271. end
  272.  
  273. function MouseLook_Toggle()
  274.    
  275.     if not MouseLookOn then
  276.  
  277.         MouselookStart()
  278.         --SetBinding("BUTTON1","MOVEBACKWARD")
  279.         --SetBinding("BUTTON2","MOVEFORWARD")
  280.         MouseLookOn = true
  281.        
  282.     else
  283.        
  284.         MouselookStop()
  285.         --SetBinding("BUTTON1","CAMERAORSELECTORMOVE")
  286.         --SetBinding("BUTTON2","TURNORACTION")
  287.         MouseLookOn = false
  288.        
  289.        
  290.     end
  291.    
  292. end
  293.  
  294. local oldMouseDown
  295. local oldMouseUp
  296. local mouse_button_down
  297.  
  298. local function status(bool)
  299.    
  300.     if bool then return "true" else return "false" end
  301.    
  302. end
  303.  
  304. function MouseLook_Momentary(keystate)
  305.    
  306.     if MouseLookOn then
  307.        
  308.         if ( keystate == "down" ) then
  309.            
  310.             MouselookStop()
  311.             --Print("MouselookStop()")
  312.             --SetBinding("BUTTON1","CAMERAORSELECTORMOVE")
  313.             --SetBinding("BUTTON2","TURNORACTION")
  314.             MouseLook_MomentaryPointer = true
  315.             --Print("Down")
  316.            
  317.         else
  318.            
  319.             --if mouse_button_down then
  320.                
  321.             --  waiting_to_reset = true
  322.             --  Print("1")
  323.             --else
  324.                
  325.                 if not MouseLook_TempLockout then
  326.                     MouselookStart()
  327.                     --Print("MouselookStart()")
  328.                     --SetBinding("BUTTON1","MOVEBACKWARD")
  329.                     --SetBinding("BUTTON2","MOVEFORWARD")
  330.                     --Print("2")
  331.                 else
  332.                     --Print("3")
  333.                    
  334.                 end
  335.                
  336.                 MouseLook_MomentaryPointer = false
  337.                
  338.             --end
  339.             --Print("up")
  340.            
  341.         end
  342.        
  343.     end
  344.    
  345. end
  346.  
  347.  
  348. function MouseLook_OnLoad(self,...)
  349.    
  350.     MouseLookFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
  351.     MouseLookFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
  352.     MouseLookFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
  353.     MouseLookFrame:RegisterEvent("CURRENT_SPELL_CAST_CHANGED")
  354.  
  355.     oldMouseDown=WorldFrame:GetScript("OnMouseDown")
  356.     oldMouseUp = WorldFrame:GetScript("OnMouseUp")
  357.     WorldFrame:SetScript("OnMouseDown",MouseDown)
  358.     WorldFrame:SetScript("OnMouseUp",MouseUp)
  359.    
  360.     SetMouselookOverrideBinding("BUTTON1", "MOVEBACKWARD")
  361.     SetMouselookOverrideBinding("BUTTON2", "MOVEFORWARD")
  362.     --Print("on load")
  363. end;
  364.  
  365.  
  366. function MouseDown(...)
  367. -- need to determine WHICH mousebutton is down.  it's in arg2.   how do I read it?  i forgot.  actually, it doesn't really matter anymore.
  368.    
  369.     if mouse_button_down then
  370.        
  371.         --both_buttons_down = true
  372.         --Print("MouseDown() mouse_button_down true")
  373.        
  374.     else
  375.        
  376.         mouse_button_down = true
  377.         --Print("MouseDown() mouse_button_down false")
  378.        
  379.     end
  380.    
  381.     if oldMouseDown then oldMouseDown(args) end
  382.    
  383. end
  384.  
  385. function MouseUp(...)
  386.    
  387.     if both_buttons_down then
  388.        
  389.         both_buttons_down = false
  390.         --Print("MouseUp() both_buttons_down true")
  391.        
  392.     else
  393.        
  394.         mouse_button_down = false
  395.         --Print("MouseUp() both_buttons_down false")
  396.         if waiting_to_reset then
  397.            
  398.             MouseLook_TempLockout = true
  399.            
  400.             MouseLook_MomentaryPointer = false
  401.            
  402.             waiting_to_reset = false
  403.            
  404.         end
  405.        
  406.     end
  407.    
  408.     if oldMouseUp then oldMouseUp(args) end
  409.    
  410. end
  411.  
  412. function MouseLook_OnEvent(self,event,...)
  413.    
  414.     --Print("on event:" ..event)
  415.    
  416.     if event == "PLAYER_ENTERING_WORLD" then
  417.        
  418.         --Print("PLAYER_ENTERING_WORLD event")
  419.        
  420.         if MouseLookOn then
  421.            
  422.             --Print("Trying to automatically start Mouselook")
  423.             MouselookStart()
  424.             --Print("MouselookStart()")
  425.             --SetBinding("BUTTON1","MOVEBACKWARD")
  426.             --SetBinding("BUTTON2","MOVEFORWARD")
  427.            
  428.         end
  429.        
  430.     end
  431.    
  432.     if event == "PLAYER_REGEN_DISABLED" then
  433.        
  434.         if MouseLookOn then
  435.            
  436.             --SetBinding("BUTTON1","CAMERAORSELECTORMOVE")
  437.             --SetBinding("BUTTON2","TURNORACTION")
  438.            
  439.         end
  440.        
  441.     end
  442.    
  443.     if event == "PLAYER_REGEN_ENABLED" then
  444.        
  445.         if MouseLookOn then
  446.            
  447.             --SetBinding("BUTTON1","MOVEBACKWARD")
  448.             --SetBinding("BUTTON2","MOVEFORWARD")
  449.            
  450.         end
  451.        
  452.     end
  453.     if event == "CURRENT_SPELL_CAST_CHANGED" then
  454.         if MouseLookOn then
  455.             if SpellIsTargeting() then
  456.                 MouselookStop()
  457.             else
  458.                 MouselookStart()
  459.             end
  460.         end
  461.     end
  462. end

Seerah 09-09-19 12:27 PM

There are two bindings sharing the same name. Change one.
https://wow.gamepedia.com/Creating_key_bindings

Šynasty 09-09-19 04:59 PM

Quote:

Originally Posted by Seerah (Post 333673)
There are two bindings sharing the same name. Change one.
https://wow.gamepedia.com/Creating_key_bindings

I think I got it, thanks.


All times are GMT -6. The time now is 09:32 AM.

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