LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   Read out the EffectList (https://www.lotrointerface.com/forums/showthread.php?t=1825)

Garan 06-10-2012 07:57 PM

Quote:

Originally Posted by moebius92 (Post 7986)
Actually, the loop variable of a for loop always has a scope that is local to the for loop itself. So I think Kunter's okay in this case.

True. Loop was a bad example.

Kunter 06-11-2012 05:40 AM

Code:

function Disease()
        for effectnumber=1, EffectList:GetCount(), 1 do
                if EffectList:Get(effectnumber):IsCurable() then
                Turbine.Shell.WriteLine(EffectList:Get(effectnumber):GetName());
                        if (EffectList:Get(effectnumber):GetName() == "Effectname here") then
                                return 0.5;
                                break;
                        end
                end
        end
        return 0;
end

I'd rewrite the function, I hope I get better results now, the WriteLine command is only to log the Buffnames.

Kunter 06-19-2012 01:17 PM

Ok, tested the plugin today, works fine, if Jackdaw is ok with it I will publish it in a few days.

Snoopy81 07-31-2012 03:35 AM

Catching effects
 
There is 2 ways to catch an effect on the player...

- 1st one as above is to scan "EffectList = LocalPlayer:GetEffects();" at regular intervals (ie: onTimer or on Refresh )

- 2nd, I'd say a cleaner way is to catch events AddCallback(EffectList, "EffectAdded", MyEffectChangedCallback); and "EffectRemoved"

Kunter 08-01-2012 06:49 PM

Quote:

Originally Posted by Snoopy81 (Post 8079)
There is 2 ways to catch an effect on the player...

- 1st one as above is to scan "EffectList = LocalPlayer:GetEffects();" at regular intervals (ie: onTimer or on Refresh )

- 2nd, I'd say a cleaner way is to catch events AddCallback(EffectList, "EffectAdded", MyEffectChangedCallback); and "EffectRemoved"

http://www.lotrointerface.com/downlo...ffectWarn.html

I used this:

EffectList = Turbine.Gameplay.LocalPlayer:GetInstance():GetEffe cts();

and this

AddCallback(EffectList,"EffectAdded", --function to handle event--);

So pretty much the same. EffectWarn works very fast and by the time 5 evenings at Saruman show that it is reliable (anyhow for me).


All times are GMT -5. The time now is 02:35 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI