lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #1  
Unread 04-19-2019, 07:39 PM
Grimmerthan Grimmerthan is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: Aug 2014
Posts: 11
using EffectList:Contains(effect)?

Hi folks,

I want to improve DebuffVitals by reducing brute force searching down to a direct Contains() call. I strongly suspect this will improve performance issues, as well as being a more elegant solution.

However, I haven't yet figured out how to use the EffectList:Contains() method correctly, and I hope someone with more insight could share what they know?

I expect to pass a Turbine.Gameplay.Effect object, but I can't seem to create a Turbine.Gameplay.Effect object directly. Is there an enumeration of Effects that I can reference? Some list of asset tags that I could extract and then use (like various resource browsers have done)? Some constructor definition that uses specific unique IDs?

Can the method even be used this way, or am I barking up the wrong tree?

Thanks a lot,
Grimmerthan
Reply With Quote
  #2  
Unread 04-19-2019, 08:19 PM
Thurallor's Avatar
Thurallor Thurallor is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: May 2013
Posts: 202
Interesting idea. I didn't notice that function, back when I was trying to get target effects to work.

I don't think you can create the objects directly; nor is there any enumeration of all possible effects. I think the best you can do is save all of the effects into a hash as you receive them from EffectAdded events or EffectList:Get(). Of course, if you are maintaining that hash, there's no reason to call the Contains() function. Just do a direct hash table lookup.

In case it's not clear, I mean maintaining a list of the form

Code:
{
   [effectObject1] -> true,
   [effectObject2] -> true,
   [effectObject3] -> true
   ...
}
so you can use Lua's built-in hash function to see if an effectObject is present in the list.

I still have my fingers crossed that the situation will be improved in U24.

Last edited by Thurallor : 04-19-2019 at 08:23 PM.
Reply With Quote
  #3  
Unread 04-19-2019, 11:26 PM
Grimmerthan Grimmerthan is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: Aug 2014
Posts: 11
Hmm, I'm not sure about what you've described. It doesn't fit into the usage patterns and code flow, or I don't understand what you meant, or both, or something else.

I have a different idea, which is to persist the first one of a specific effect, and then use it for all subsequent checks. I don't know if an Effect from one EffectList can be used to check against a different EffectList though. Need to do some more testing.

Fall-back plan though. I have hopes that a dev may respond on Lotro forums.
Reply With Quote
  #4  
Unread 04-20-2019, 10:49 AM
Thurallor's Avatar
Thurallor Thurallor is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: May 2013
Posts: 202
Well, I'm not quite sure how you want to use EffectList:Contains(), but my point is that
if (effectList:Contains(effect)) then
is probably not significantly more efficient than
if (effectIsPresent[effect]) then
where effectIsPresent is a hash table that you have built with
effectList.EffectAdded = function(obj, args)
local effect = obj:Get(args.Index);
effectIsPresent[effect] = true;
end
effectList.EffectRemoved = function(obj, args)
local effect = obj:Get(args.Index);
effectIsPresent[effect] = false;
end

of course assuming that the "EffectRemoved" event is fixed in U24.

Note: I believe each instance of an effect has its own distinct object. So you can't create an Effect object for a given effect and use that for comparison to future instances of that effect.
Reply With Quote
  #5  
Unread 04-22-2019, 11:26 PM
Grimmerthan Grimmerthan is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: Aug 2014
Posts: 11
Taking it up a level, I want to reduce impact of the plugin on game performance. I've had feedback about lag from users. I'm pretty sure it's coming from the repeated Effect* callbacks feeding into nested for loops.

I hoped that I could use EffectList:Contains() to cut down on the loop. Instead, I'm going to do some adjustable throttling instead, to cut down on callback triggers. Maybe some additional handling cases where there are multiple DV windows targeted on one thing.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Add/Remove callback functions with the localplayer EffectList Stever1388 Lua Programming Help (L) 6 04-21-2013 11:38 PM
Read out the EffectList Kunter Lua Programming Help (L) 14 08-01-2012 06:49 PM
Save Effect (Icon) in a file? Heta Lua Programming Help (L) 4 11-01-2010 11:03 AM


All times are GMT -5. The time now is 01:29 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui