PQR_IsOutOfSight alternative for pqr 1.1.1 (LoS) menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PQR_IsOutOfSight alternative for pqr 1.1.1 (LoS)

    So since the "PQR_IsOutOfSight" always returns false when used on pqr 1.1.1, I'm trying to find a way to determine the LoS, when playing on 3.3.5 servers with old pqr. It's been days since I'm reading topics all over the internet and I didn't find anything working 100%.

    But I found something, a little... I am very very close to the solution but still this won't work as I want. This is an example of the code I made:

    Code:
    if UnitDebuff("target","Fear")
    then
    CastSpellByName("Cleanse","target")
    end
    
    local frame = CreateFrame'Frame'
    frame:RegisterEvent'UI_ERROR_MESSAGE'
    frame:SetScript('OnEvent', function(self, event, message)
    	if message == "Target not in line of sight" then
    	return true
    	end	
    end)
    The rotation kinda works, in fact, when UI_ERROR_MESSAGE "Target not in line of sight" is triggered, the rotation stops for a while, but then the loop start again, so the character will try again to dispel, gets the red error, stops, then re-try to dispel and so on...it loops forever. I tried with a "while error == "UI_ERROR_MESSAGE"" to trigger all kind of red errors including "Spell is not ready yet" but makes me freeze istant and I need to alt+f4

    Imagine your friend gets feared behind a pillar, the code should dispel him only if in LoS, otherwise, nothing....but keeps spamming cleanse over and over again locking your abilities instead of "understanding" that its not possible and its better to pause rotation. Maybe my target is in fear, and I need to heal myself because I'm dying but I can't because cast is blocked by the attempt of dispelling the partner out of sight.

    So is there a way to fix this?
    Last edited by dealerx; 11-30-2016 at 01:03 PM.

    PQR_IsOutOfSight alternative for pqr 1.1.1 (LoS)
  2. #2
    Numba1stunna1's Avatar Active Member
    Reputation
    70
    Join Date
    Dec 2013
    Posts
    182
    Thanks G/R
    1/34
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tl;dr - For UI_ERROR_MESSAGE, it is not GUID specific. Here is what I made.

    Code:
    -- make tables
     if not LosTable then LosTable = {} end;
     if not BehindTargetTable then BehindTargetTable = {} end;
     if not TargetFacingTable then TargetFacingTable = {} end;
     if not FacingTargetTable then FacingTargetTable = {} end;
    
    function SpellCastFailed(targetCheck,failCheck,timeCheck)
    
    	local timeCheck = timeCheck or 0.7
    	local destGUID = UnitGUID(targetCheck) or 0 -- this probably needs to be fail specific and globalized
    	local failCheck = failCheck or "all"
    
    	-- table cleaning needs to be failType and GUID specific
    	if failCheck == "LineOfSight" or failCheck == "IsLineOfSight" or failCheck == "all" then
    		if LosTable[destGUID] and timeCheck < (GetTime() - LosTable[destGUID].time) then
    			LosTable[destGUID] = nil
    		end
    	end
    	if failCheck == "BehindTarget" or failCheck == "IsBehindTarget" or failCheck == "all" then
    		if BehindTargetTable[destGUID]  and timeCheck < (GetTime() - BehindTargetTable[destGUID].time) then
    			BehindTargetTable[destGUID] = nil
    		end
    	end
    	if failCheck == "TargetFacing" or failCheck == "TargetIsFacing" or failCheck == "all" then
    		if TargetFacingTable[destGUID] and timeCheck < (GetTime() - TargetFacingTable[destGUID].time) then
    			TargetFacingTable[destGUID] = nil
    		end
    	end
    	if failCheck == "FacingTarget" or failCheck == "IsFacingTarget" or failCheck == "all" then
    		if FacingTargetTable[destGUID] and timeCheck < (GetTime() - FacingTargetTable[destGUID].time) then
    			FacingTargetTable[destGUID] = nil
    		end
    	end
    
    	-- once the GUID is in the table, set globabl GUID to nil and unregister all events
    	local function SpellFailed_OnEvent(self, event, ...)
    	 
    	 	local timestamp, type, _, sourceGUID, sourceName, sourceFlags, _, _, destName, destFlags, _ = ...;
    	 	local playerGUID = UnitGUID("player")
    	 	local destGUID = UnitGUID(targetCheck) or 0
    	 	local failCheck = failCheck or "all"
    	 	
    	 	if event == "COMBAT_LOG_EVENT_UNFILTERED" then
    		 	if type == "SPELL_CAST_FAILED" then
    		 		if sourceGUID == playerGUID then
    		 			local failType = select(15,...)
    		 			if failCheck == "LineOfSight" or failCheck == "IsLineOfSight" or failCheck == "all" then
    			 			if (failType == SPELL_FAILED_LINE_OF_SIGHT or failType == "Target not in line of sight") then
    			 				if not LosTable[destGUID] then
    			 					LosTable[destGUID] = {time = GetTime()}
    			 					SpellFailed:UnregisterAllEvents()
    			 					return
    			 				end
    			 			end
    			 		elseif failCheck == "BehindTarget" or failCheck == "IsBehindTarget" or failCheck == "all" then
    			 			if (failType == SPELL_FAILED_NOT_BEHIND or failType == "You must be behind your target.") then
    			 				if not BehindTargetTable[destGUID] then
    			 					BehindTargetTable[destGUID] = {time = GetTime()}
    			 					SpellFailed:UnregisterAllEvents()
    			 					return
    			 				end
    			 			end
    			 		elseif failCheck == "TargetFacing" or failCheck == "TargetIsFacing" or failCheck == "all" then
    			 			if (failType == SPELL_FAILED_NOT_INFRONT or failType == "You must be in front of your target.") then
    			 				if not TargetFacingTable[destGUID] then
    			 					TargetFacingTable[destGUID] = {time = GetTime()}
    			 					SpellFailed:UnregisterAllEvents()
    			 					return
    			 				end
    			 			end
    			 		elseif failCheck == "FacingTarget" or failCheck == "IsFacingTarget" or failCheck == "all" then
    		 				if (failType == SPELL_FAILED_UNIT_NOT_INFRONT or failType == "Target needs to be in front of you.") then
    		 					if not FacingTargetTable[destGUID] then
    			 					FacingTargetTable[destGUID] = {time = GetTime()}
    			 					SpellFailed:UnregisterAllEvents()
    			 					return
    			 				end
    			 			end
    			 		end
    		 		end
    		 	end
    		end
    	 	if event == "UI_ERROR_MESSAGE" then
    	 		local Message = ...
    	 		if (Message == SPELL_FAILED_LINE_OF_SIGHT or Message == "Target not in line of sight") then
    	 			if not LosTable[destGUID] then
    					LosTable[destGUID] = {time = GetTime()}
    					SpellFailed:UnregisterAllEvents()
    					return
    				end
    	 		end
    	 		if (Message == SPELL_FAILED_NOT_BEHIND or Message == "You must be behind your target.") then
    	 			if not BehindTargetTable[destGUID] then
     					BehindTargetTable[destGUID] = {time = GetTime()}
     					SpellFailed:UnregisterAllEvents()
     					return
     				end
    	 		end
    	 		if (Message == SPELL_FAILED_NOT_INFRONT or Message == "You must be in front of your target.") then
    	 			if not TargetFacingTable[destGUID] then
    					TargetFacingTable[destGUID] = {time = GetTime()}
    					SpellFailed:UnregisterAllEvents()
    					return
    				end
    	 		end
    	 		if (Message == SPELL_FAILED_UNIT_NOT_INFRONT or Message == "Target needs to be in front of you.") then
    	 			if not FacingTargetTable[destGUID] then
     					FacingTargetTable[destGUID] = {time = GetTime()}
     					SpellFailed:UnregisterAllEvents()
     					return
     				end
    	 		end
    	 	end
    	end
    
    	-- if in table, return false
    	if failCheck == "LineOfSight" or failCheck == "IsLineOfSight" or failCheck == "all" then
    		if LosTable[destGUID] then
    			return false
    		end
    	end
    	if failCheck == "BehindTarget" or failCheck == "IsBehindTarget" or failCheck == "all" then
    		if BehindTargetTable[destGUID] then
    			return false
    		end
    	end
    	if failCheck == "TargetFacing" or failCheck == "TargetIsFacing" or failCheck == "all" then
    		if TargetFacingTable[destGUID] then
    			return false
    		end
    	end
    	if failCheck == "FacingTarget" or failCheck == "IsFacingTarget" or failCheck == "all" then
    		if FacingTargetTable[destGUID] then
    			return false
    		end
    	end
    
    	-- make frame, set script
    	if not SpellFailed then
     		SpellFailed = CreateFrame("frame","spellFailedFrame")
     		SpellFailed:Hide()
     		SpellFailed:SetScript("OnEvent",SpellFailed_OnEvent)
     	end
    
     	-- this causes FPS issues after every true value, needs to be fixed.
    	SpellFailed:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    	SpellFailed:RegisterEvent("UI_ERROR_MESSAGE")
    	return true
    end
    This function includes if you are facing target, if the target is facing you, if you're behind target, and if you're out of line of sight.

    I forgot to mention, this fucntion only works for cata+. You need to modify
    Code:
    local timestamp, type, _, sourceGUID, sourceName, sourceFlags, _, _, destName, destFlags, _ = ...;
    to
    Code:
    local timestamp, type, sourceGUID, sourceName, sourceFlags,  _, destName, destFlags, = ...;
    and change
    Code:
    local failType = select(15,...)
    to
    Code:
    local failType = select(12,...)
    because 3 variables have been added in cata 4.1 and 4.2. We shift it 3 placements backwards.
    Last edited by Numba1stunna1; 12-06-2016 at 01:38 PM.

  3. #3
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks dude I will save this in case I will work on Cata profiles. But anyway, rather than write all this stuff and creating a table, isnt the PQR_OutOfSight command just more simpler to use? (assuming it works, I never tried it in Cata). Or it will just check "los" correct but ignores "facing you" and other stuff?

  4. #4
    Numba1stunna1's Avatar Active Member
    Reputation
    70
    Join Date
    Dec 2013
    Posts
    182
    Thanks G/R
    1/34
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It checks combat logs the same as this function.

    Code:
    PQR_IsOutOfSight(unit[, seconds])
      -- Returns true if the specified unit has been out of sight in the last X seconds (default 3.) Returns false otherwise.
      -- Note that the unit is converted to UnitName, and the check is based on unit name, so if 2 mobs both share the same name this will return the same value for either of them regardless of if one is out of sight and the other is not.
    I have done some testing, WoW doesn't allow the above combat logs to be triggered until after 3 seconds of not attempting to cast again on the same target. You can set the time to 3.1 to ensure this. OR, another spell must be cast or towards another target to reset the trigger timer. What I can do is make the function more specific to the spell casting; that way to profile will attempt to cast a different spell of the same parameters.
    Last edited by Numba1stunna1; 12-08-2016 at 11:26 AM.

  5. #5
    dealerx's Avatar Member
    Reputation
    9
    Join Date
    May 2016
    Posts
    124
    Thanks G/R
    14/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I understand..Thats a big shame it can't be done on 3.3.5 Very interesting function.

Similar Threads

  1. [PQR] Looking for PQR 5.4.8 release and profile pack.
    By f2p in forum World of Warcraft Bots and Programs
    Replies: 11
    Last Post: 05-08-2017, 09:36 PM
  2. [PQR] Need gladiator profile for PQR
    By Esdescon in forum World of Warcraft Bots and Programs
    Replies: 0
    Last Post: 12-14-2015, 12:52 PM
  3. REQUEST: Enhancement and Resto Shammy Roto for PQR Please... :D
    By Addramyr in forum WoW Bots Questions & Requests
    Replies: 3
    Last Post: 04-03-2012, 12:13 PM
  4. Alternative for SocksCap and FreeCap
    By barandeniz in forum World of Warcraft General
    Replies: 3
    Last Post: 03-11-2010, 01:00 AM
  5. [Question]Alternative for F8 in MEF?
    By Icelancelot in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 07-22-2008, 06:22 AM
All times are GMT -5. The time now is 02:56 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search