Afaik, pqr loads any script in the data folder, on injection of the bot, so yes any global functions you then declare in there you have access to in any of your pqr rotation abilities.
so just to clarify all you would need to do is add the following code to your .lua script file in the data directory ( just remember to include your script file in the download when you release your rotation)
i just used PQR_BleedDebuff as an example, you could use whatever you wanted, keep in mind it is in the global name space and any addons or other profile authors who decide to declare a global with the same name will throw errors and taints,Code:local Bleeds = { 16511, -- Rogue, Hemorrhage 33876, -- Druid, Cat: Mangle 33878, -- Druid, Bear: Mangle 35290, -- Hunter Pet: Gore 46857, -- Warrior, Trauma 50271, -- Hunter Pet: Tendon Rip 57386, -- Hunter Pet: Stampede } function PQR_BleedDebuff(unit) for i=1,#Bleeds do if UnitDebuffID(unit,Bleeds[i]) then return true end end return false end
so i suggest making yourself a personal prefix to attach to your function names, just to be safe... for example you could use your name initials capitalized follow by an underscore: function SJL_BleedDebuff(unit) ...
Just to make sure I understood this correctly, I should copy/paste the code you provided into a LUA file, which should load when PQR loads, and then in the ability, I would simply do this if I wanted the ability to only fire off if the target was missing any of the debuffs, correct?
I tried the steps I listed above and get an error "attempt to call global "PQR_BleedDebuff" (a nil value)" - did I just make a mistake? Probably... extremely new to LUA, so I don't know.Code:if PQR_BleedDebuff("target") then return false else return true end
Oh god, that is my code, huh? Now I am the one that feels obligated to update it. I honestly had a great update for that profile with many bug fixes and dps increases, and much more profiles. I had made a Warrior Arena with very, very good DPS, and mostly working Spell Reflect. I had a Sub Rouge I was working on, and also had made a Ret Pally, and Enh Shaman. All of them for arenas, but once I got out of WoW, I kinda forgot about all of them, then I made the mistake of building a new computer and wiping my hard drive without even thinking about backing anything up. So yeah, all gone.
I am barely getting back into WoW, and have also barely started sifting through all the updates that has happened to this program and profiles. So I am kinda lost at the moment. I don't know if I will get back to making profiles to be honest, my schedule is pretty busy, plus I have doubts in my ability to code now that things have gotten so complicated. When I started, I couldn't LUA code at all, but just messing around in other profiles and just learning by example and trial and error, I got pretty good at it. But probably nowhere near the ability of any actual experienced coder here.
So yeah, I guess I'll leave it at that, probably not the answer you wanted, but if there is anyone here that can code who is also experienced in arenas, they are more than free to take a crack at it.
@Diesall: Thanks for correcting my error! all though I did have the impression that I put the table outside of the function itself. Oh well.
@Valma: I tried using TargetUnit() but it would simply just not target anything. The moment I changed from TargetUnit() to "/tar " it worked. Not sure why it wouldn't work.Haven't been using the function alot so, hm.
Having some problem fixing my combustion.
I have this code
The problem im having is that sometime combustion fires when the Living Bomb and ignite is on last 0.3 sec so PQR cast combustion when all the statements are true but when the combustion is "fired" ingame the dots have run out.Code:local LB, _, _, _, _, _, LBtimer = UnitDebuffID("target", 44457, "player") local IGNITE, _, _, _, _, _, IGNITEtimer = UnitDebuffID("target", 12654, "player") if UnitDebuffID("target", 44457,"PLAYER") and UnitDebuffID("target", 12654,"PLAYER") --and UnitDebuffID("target", 92315,"PLAYER") and UnitHealth("target") > UnitHealthMax("player")*Pressure("target") and IgniteLastDamage > 15000 and modkeystate then if LB then if LBtimer - GetTime() >= 2 and IGNITEtimer - GetTime() >= 2 then return true end end end
So i added the timers to check that ignite and Living Bomb has at least 2 secs until they expires.
Problem is still i get combustions that ticks for 7.7K damage and that should only be possible if im missing 1 of the dots on target. As you can se i also stated that ignitelastdamage always should be above 15K. And Combustion takes 50% of ignite into its damage so why does it keep coming up with so little damage on combustion?
@Gabbz: Where/How are you calculating IgniteLastDamage?
Using Event SPELL_PEROIDIC_DAMAGE and taking the amount value.
unit is only unitid? So it only possible to use on target, targetstarget, etc and not the name of the mob you wanted to target?
That is what i thought anyways so i did skip auto targeting but i can see from Mentally that we can create macros on the fly and there it is possible to target by name.
@Gabbz: I just re-arranged the logic a little bit: This is purely pseudo-code, as I don't have an active account with a 85 mage on to test with:
I think that should work though.Code:local LB,_,_,_,_,_,LBtimer = UnitDebuffID("target",44457,"PLAYER") local IGNITE,_,_,_,_,_,IGNITEtimer = UnitDebuffID("target", 12654,"PLAYER") if (LB and LB - GetTime() >= 2) and (IGNITE and IGNITEtimer - GetTime() >= 2) and IgniteLastDamage > 15000 UnitHealth("target") > (UnitHealthMax("player")*Pressure("target")) and modkeystate then return true end
But yeah, TargetUnit() seemd strange for me, even if I searched and allowed partial matches for a unit name, it just wouldn't hook, while running the macro worked nicely. I'm going to explore it further a bit later. It does take a unitID (Target, Focus, Targettarget, etc..) or a Unit Name, but, I couldn't get Unit Name to work, so I changed it to a /tar macro instead.
Edit:
@Crystal, it errors sometimes because you're comparing a unset value to nothing! This should remove any errors, and all.
Just cleaned it up a bit because especially UnitDebuffID returns "false" if we don't have the debuff, while I also changed all = 1 to = true just for clarity, it should work the same nontheless regardless (Because 1 is a positive integer, i.e. true)
Code:if not TTD_loaded and UnitAffectingCombat("player") ~= nil then PQ_TimeA = GetTime() PQ_LifeStart = UnitHealth("target") PQ_LifeMax = UnitHealthMax("target") TTD_loaded = true elseif TTD_loaded and not UnitAffectingCombat("player") then PQ_TimeA = nil PQ_LifeStart = nil PQ_LifeMax = nil TTD_loaded = nil -- set PQ_CalcTime to something other than zero to stop delays PQ_CalcTime = 0 end if TTD_loaded then PQ_TimeDiff = GetTime() - PQ_TimeA PQ_HPDiff = PQ_LifeStart - UnitHealth("target") if PQ_HPDiff > 0 then PQ_FullTime = (PQ_TimeDiff * PQ_LifeMax)/PQ_HPDiff PQ_PastFullTime = (PQ_LifeMax - PQ_LifeMax) * PQ_TimeDiff/ PQ_HPDiff PQ_CalcTime = PQ_TimeA - PQ_PastFullTime + PQ_FullTime - GetTime() end end --here i set Hunter's mark (ALLHM) to 1 if the TTD is greater than 21 secs if PQ_CalcTime >= 21 then ALLHM = true else ALLHM = nil end --under the hunters mark ability its if not UnitDebuffID("target",1130) and ALLHM then return true end
Last edited by Kinky; 03-16-2012 at 07:41 AM.
Hopefully someone can help me with this....
IM trying to refine Pulverize ( Spell ID 80313 ) (Player Buff ID 80951)
my original code:
And im wanting to add a command to not recast Pulverize until its Buff duration is under 3 seconds to maximize DoT dmg.Code:local _, _, _, LacerateCount = UnitDebuff("target", "Lacerate") if LacerateCount ~= nil then if LacerateCount == 3 then return true end else return false; end
Currently im wasting DoT dmg and recasting Pulverize with 11-12 seconds remaining on the player buff.
Please help......><
@googlebee: Basically you want to cast Pulverize only when Lacerate has 3+ stacks and 3 seconds left on the Pulverize buff?
Not sure if it's the way you wanted it, basically, this returns true if Lacerate has 3 stacks and Pulverize has 3 seconds or less left on the buff or is not currently active.Code:local Lacerate = select(4,UnitDebuffID("target",33745)) if Lacerate and Lacerate >= 3 then local Pulverize = select(7,UnitBuffID("player",80951)) if Pulverize then if Pulverize - GetTime() <= 3 then return true end else return true end end
Last edited by Kinky; 03-16-2012 at 07:59 AM.