Thread Tools Display Modes
10-11-13, 07:12 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Lua script throttling?

I want to extract the WoW SetDisplayInfo database.

How can I do this without freezing my PC? Basically I want to track models from 1-100000.

Currently my idea is to use the model change event. But it is a drycode. I need to test it first. Not sure if the model update event fires on a unitless frame. I may be able to trick it by using self:SetUnit("player") though.

I don't think the event will fire properly for my frame. We will see.

Lua Code:
  1. local model = CreateFrame("PlayerModel")
  2. model.index = 1
  3. model.maxIndex = 100000
  4. model.defaultModel = "interface\\buttons\\talktomequestionmark.m2"
  5.  
  6. model:RegisterEvent("UNIT_PORTRAIT_UPDATE")
  7. model:RegisterEvent("UNIT_MODEL_CHANGED")
  8. model:RegisterEvent("PLAYER_LOGIN")
  9.  
  10. model:SetScript("OnEvent", function(self,event,...)
  11.   self[event](...)
  12. end)
  13.  
  14. function model:UNIT_PORTRAIT_UPDATE(...)
  15.   print("UNIT_PORTRAIT_UPDATE")
  16.   print(self:GetModel())
  17. end
  18.  
  19. function model:UNIT_MODEL_CHANGED(...)
  20.   print("UNIT_MODEL_CHANGED")
  21.   print(self:GetModel())
  22. end
  23.  
  24. function model:PLAYER_LOGIN(...)
  25.   print("PLAYER_LOGIN")
  26.   self:SetNewModel()
  27. end
  28.  
  29. function model:SetNewModel()
  30.   print("clear model")
  31.   self:ClearModel()
  32.   print("SetModel default")
  33.   self:SetModel(self.defaultModel) --will be uses if displayinfo fails
  34.   print("SetDisplayInfo "..self.index)
  35.   self:SetDisplayInfo(self.index)
  36. end
  37.  
  38. function model:NewIndex()
  39.    self.index = self.index + 1
  40. end

Is the model update event catch enough throtteling? Or do I need an OnUpdate handler that just parses chunks of models?

What I want to extract is the model name. It contains a lot of information about the used model that could be split into keywords. Thus you could rebuild the model database using keywords. Like "show me every human model".
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-11-13 at 07:19 AM.
  Reply With Quote
10-11-13, 08:00 AM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
The fact that you're operating on events should be enough. Only way to know for certain, though, is to test it; you can always F4 your client if it freezes.

Should that not be sufficient, a coroutine/OnUpdate would help.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-12-13, 02:41 AM   #3
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Those events probably wont fire as there's no unit involved, indeed.
__________________
Grab your sword and fight the Horde!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua script throttling?


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