Jump to content

Recommended Posts

I am using this script as a condition:

anyDisease false;
for i=1,40 do
    local name, rank, icon, count, debuffAuraType = UnitAura("player", i);
    if name and debuffAuraType and debuffAuraType == "Disease" then
        anyDisease = true;
        return;
    end
end

true

anyDisease

 

It never attempts to use the spell. I have attached my fight class.

Enhancement Shaman.xml

Game Version 2.4.3

Debug:

Quote

[D] 23:53:06.969 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:06.969 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:07.223 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:07.223 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:07.485 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:07.485 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:07.798 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:07.798 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:08.059 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:08.059 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:08.317 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:08.317 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:08.564 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:08.564 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:08.854 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:08.854 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 31
[F] 23:53:09.020 - [Spell] Cast Earth Shock (Earth Shock)
[F] 23:53:09.310 - [Spell] Cast Earth Shock (Earth Shock)
[D] 23:53:09.703 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:09.703 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:09.956 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:09.956 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:10.200 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:10.200 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:10.478 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:10.478 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:10.767 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:10.767 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[F] 23:53:10.959 - [Spell] Cast Stormstrike (Stormstrike)
[D] 23:53:11.351 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 2.250727, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:11.351 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 31
[D] 23:53:11.613 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 1.035729, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:11.613 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:11.877 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 1.870931, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:11.877 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:12.152 - [FightClass] Disease Cleansing Totem - NeedToRun = false - KnownSpell = True, IsDistanceGood = True (target distance = 3.959648, max spell distance = 4.8), IsSpellUsable = False
[D] 23:53:12.152 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:12.423 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:12.423 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:12.687 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:12.687 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:12.955 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:12.955 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:13.230 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:13.230 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 31
[D] 23:53:13.543 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:13.543 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 32
[D] 23:53:13.808 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:13.808 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:14.048 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:14.048 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:14.307 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:14.307 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:14.565 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:14.565 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:14.818 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:14.818 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:15.057 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.057 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:15.193 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.193 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:15.320 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.320 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
23:53:15.443 - [Looting] Loot Bonechewer Scavenger
[D] 23:53:15.452 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.452 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:15.580 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.580 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:15.714 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.714 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:15.849 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.849 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:15.985 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:15.985 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:16.114 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:16.114 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:16.248 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:16.248 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:16.382 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:16.382 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:16.519 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:16.519 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:16.651 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:16.651 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:16.783 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:16.783 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:16.918 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:16.918 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
23:53:16.938 - [Regen] Started
[D] 23:53:17.047 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:17.047 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:17.186 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:17.186 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:17.315 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:17.315 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:17.444 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:17.444 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:17.584 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:17.584 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:17.722 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:17.722 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
23:53:17.876 - [Regen] Use drink Morning Glory Dew
[D] 23:53:17.880 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:17.880 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 31
[D] 23:53:18.006 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.006 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 31
[D] 23:53:18.143 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.143 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:18.277 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.277 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:18.405 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.405 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:18.536 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.536 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:18.671 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.671 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:18.801 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.801 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:18.927 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:18.927 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:19.045 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:19.045 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:19.174 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:19.174 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 0
[D] 23:53:19.306 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:19.306 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:19.439 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:19.439 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 15
[D] 23:53:19.573 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:19.573 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16
[D] 23:53:19.699 - [FightClass] Disease Cleansing Totem - NeedToRun = false - condition
[D] 23:53:19.699 - [FightClass] Disease Cleansing Totem - NeedToRun time to execute: 16

Link to comment
https://wrobot.eu/forums/topic/10459-remove-diseasepoison-not-working/
Share on other sites

9 hours ago, Matenia said:

You're using the vanilla version of UnitDebuff, you need to go to wowwiki and get the arguments for 2008 (TBC) from the history

Per your suggestion I changed it to the 2.1 arguments as it seems to have gone unchanged between 2.1 and 3.0. Here is what I came up with, but it still doesn't work:

anyPoison = false;
for i=1,40 do
    local name, rank, icon, count, debuffType, duration, timeLeft = UnitDebuff("player", i);
    if debuffType == "Poison" then
        anyPoison = true
        return;
    end
end

research = true

var = anyPoison

If I misunderstood what you were saying I apologize. I AM trying to learn this I promise ?

hasDebuff = false;
        for i=1,40 do
	        local name, rank, iconTexture, count, debuffType, duration, timeLeft = UnitDebuff('player', i);
            if debuffType == 'Poison' then
                hasDebuff = true
                break;
            end
        end

And then use hasDebuff as a the "search value".

Or this, if you wanted to use C#:

 

public static bool HasDebuffType(this WoWUnit unit, string type)
    {
        string luaString = @"hasDebuff = false;
        for i=1,40 do
	        local name, rank, iconTexture, count, debuffType, duration, timeLeft = UnitDebuff(""{1}"", i);
            if debuffType == ""{0}"" then
                hasDebuff = true
                break;
            end
        end";
        return Lua.LuaDoString<bool>(string.Format(luaString, type, "target"), "hasDebuff");
    }

 

Edited by Matenia

Thank you so much for the response! If you don't mind me asking, I am assuming that 

UnitDebuff(""{1}"", i)

Indicates the current player in the ""{1}""?

And does 

if debuffType == ""{0}"" then

Mean any debuff or is there some other identifier I need to put there, e.g. poison or disease?

Again, thanks so much. Your quick responses are much appreciated!

It's an extension function in C#. It's meant for a specific unit.
But essentially, when using string.Format, you're passing a bunch of arguments and they're enumerated where they're supposed to be replaced.

So {0} is the type parameter and {1} is "target" (the Lua unit).
Type here is a string in C# so you can pass something to it like "Poison", "Curse", etc.

I edited the original Lua function to better indicate this (if you want to use pure Lua in the fightclass editor).

Lua unit ids:http://wowwiki.wikia.com/wiki/UnitId
Careful! Many don't exist in Vanilla or TBC (history function is your friend again)

Edited by Matenia

I am wondering if this doesn't work in TBC (2.4.3)? Based on your posts and research over the last day trying to get this to work I feel it should work with how I currently have the condition set:

       <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>hasDebuff = false;
        for i=1,40 do
            local name, rank, iconTexture, count, debuffType, duration, timeLeft = UnitDebuff('player', i);
            if debuffType == 'Disease' then
                hasDebuff = true
                break;
            end
        end</LuaScript>
            <VarRet>hasDebuff</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>

That's from my XML. I have also tried " instead of ' with no change.

Your XML implementation is correct. I'm not sure why it won't work. It's possible addons are breaking this or you don't have a debuffType called 'Disease' because your client is French/German/etc and it's a different localized string.

On 12/6/2018 at 1:18 AM, Mykoplazma said:

Check if debuffType is returing value that you need to check ( it can return other kind of thing like number , small letters, big letters etc depends on server ).

 

 

 

 

 

 

Is that using the /run command?  I tried this using /run before this in game and it gives nothing in return.

        for i=1,40 do
	        local name, rank, iconTexture, count, debuffType, duration, timeLeft = UnitDebuff('player', i);
            if debuffType == 'Disease' then
                hasDebuff = true
                break;
            end
        end

 

You should try it in the wRobot dev tools and to test it you can use:
 

for i=1,40 do
	        local name, rank, iconTexture, count, debuffType, duration, timeLeft = UnitDebuff('player', i);
            if debuffType == 'Disease' then
                hasDebuff = true
                break;
            end
        end
DEFAULT_CHAT_FRAME:AddMessage(hasDebuff and 'true' or 'false')

 

Done, and it returns a true in game, so it is working. It has to be an issue with how I have the spell configured in wrobot then. I will look into it some more tomorrow. I really appreciate the help so far.

  • 2 weeks later...

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...