Jump to content

Recommended Posts

Hi,

 

So I am using a macro to apply poison with condition lua code , it works on mainhand but it does not work on offhand. It used to work last year I made it. Not sure whats wrong.

The code I am using  for offhand:

Quote

hasOffHandEnchant = GetWeaponEnchantInfo()
 
if (hasOffHandEnchant) then
   retV = "1"
else
   retV = "0"
end

The one that works on mainhand is the same code except it says "Mainhand" instead of "offhand"

 

Also, if you have any better solution to manage my poisons, I would really appreciate it.

Link to comment
Share on other sites

Those are my mainhand and offhand checks, dunno how much API has changed since TBC, but you might wanna try it:

var needsMainHandRefresh = Lua.LuaDoString<bool>("local hasMainHandEnchant, mainHandExpiration, _, _, _, _ = GetWeaponEnchantInfo(); return not hasMainHandEnchant or (mainHandExpiration / 1000 / 60) <= 15;");
  
var needsOffHandRefresh = Lua.LuaDoString<bool>("local _, _, _, hasOffHandEnchant, offHandExpiration, _ = GetWeaponEnchantInfo(); return not hasOffHandEnchant or (offHandExpiration / 1000 / 60) <= 15;");

Checks if enchant is missing at all, or remaining time is smaller than 15 minutes (you might wanna remove that or change value for your own purposes)

Link to comment
Share on other sites

On 5/9/2018 at 3:31 AM, Requ said:

Those are my mainhand and offhand checks, dunno how much API has changed since TBC, but you might wanna try it:


var needsMainHandRefresh = Lua.LuaDoString<bool>("local hasMainHandEnchant, mainHandExpiration, _, _, _, _ = GetWeaponEnchantInfo(); return not hasMainHandEnchant or (mainHandExpiration / 1000 / 60) <= 15;");
  
var needsOffHandRefresh = Lua.LuaDoString<bool>("local _, _, _, hasOffHandEnchant, offHandExpiration, _ = GetWeaponEnchantInfo(); return not hasOffHandEnchant or (offHandExpiration / 1000 / 60) <= 15;");

Checks if enchant is missing at all, or remaining time is smaller than 15 minutes (you might wanna remove that or change value for your own purposes)

how does this work? Sorry for asking, I am not sure how to use it.

 

I am using XML file. I created a spell name as a macro "/cast [poison name] /use 17" which is weapon. And then added condition with the script I mentioned earlier.

Link to comment
Share on other sites

On 5/12/2018 at 4:43 AM, Lbniese said:

You can always use something like this

 

Thank you so much!!!! just what I needed. Works like charm !!

 

EDIT: it worked the first time only, after that It did not apply poisons, only on offhand.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...