• 0

    posted a message on Replacing all Blizzard mods??
    I understand I'm going to need select portions of blizzard code for this to work. But most of it can be replaced altogether without any ill effects. Yes, the speed increase is going to be insignificant but any speed increase is helpful. Isn't that the point of Ace? to make code as efficient as possible? Why should we stop at our own code if blizzards can be improved as well? And as far as performance goes, my mods already load faster and with less memory usage than the default blizzard UI. So disabling my mods would actually slow down the game.
    Posted in: Addon Ideas
  • 0

    posted a message on Replacing all Blizzard mods??
    I am currently working on an idea I had and I would just like some feedback and comments from the modding community. Blizzard code is generally inefficiently written so I started replacing code. The major issue was it wasn't actually speeding anything up since the old code was still in memory. So I started nil'ing out replaced functions and made a fun little piece of code to delete frames. Now my goal is to replace the Blizzard UI altogether and eventually I hope to be able to actually delete UIParent. With 2.0 out I forsee a few issues but with the action bars done I doubt that it's anything I can't handle. Aside from a few files such as GlobalStrings.lua and the SecureFrameTemplate files I should be able to remove everything. Just looking for comments or possible problems anyone forsees.

    Althaya
    Posted in: Addon Ideas
  • 0

    posted a message on Pack function?
    Currently what I'm trying to do is create a redundant addon. Basically something that regardless of missing values will be able to load anyway. The only thing I have come up with is extensive check to make sure every variable exists. Obviously if this is run normally it would be extremely slow so I had an idea to create 2 versions of each function. One runs normally while the other does extensive checks. The first will be run with pcall( ) and if it errors it will run the second. I realize that dual functions is a huge waste of memory but I can't really think of any other way to do it. Besides I have memory to spare. But at the same time I'm trying to make it as efficient as possible.

    Althaya
    Posted in: Lua Code Discussion
  • 0

    posted a message on Pack function?
    I'm not too good with code efficiency yet. Is garbage collection actually that slow? or would it just fire alot with repetative tables?

    Also is garbage collection also fired from locals or are they permanently deleted after the function ends? e.g. this would be more efficient with local tables

    Althaya
    Posted in: Lua Code Discussion
  • 0

    posted a message on Pack function?
    I've recently discovered the unpack function and it has made my life much easier. However, I cannot seem to find another function to pack variables passed from returned function values.

    return1, return2, return3 = RandomFunction()


    I'm not sure if there is any way to do this ... but it would be most helpful in development of my mods if it was.

    Althaya
    Posted in: Lua Code Discussion
  • 0

    posted a message on randomly sort a list
    I never really thought about how taxing getglobal was. Would it be faster to put all the globals you are going to scan in a table that would be built within an OnLoad function?

    I was thinking more of another addon I have written and it calls getglobal 30 times OnUpdate. Would it be faster to define all 30 of those to a table and simply retrieve 30 table values?

    While we are talking about efficiency I was wondering if it was faster to run a check or a simple function. Mainly I was wondering about the Show() and Hide() functions. To keep a frame hidden would it be faster to check IsVisible() or to simply Hide() it regardless?

    Althaya
    Posted in: Lua Code Discussion
  • 0

    posted a message on The ongoing classes.
    Quote from Trimble Epic »

    "Rowne: If a variable isn't in the function parenthesis or doesn't have local behind it, it's global."

    the control variables in for statements are also automatically localized. I still see addon authors declaring their control variables as local before using them. why?
    a = "volkswagen"
    for a = 1,4 do
    print(a) -- will print numbers
    end
    print(a) -- will print "volkswagen"



    I know this post is quite old and may have already been answered elsewhere but I will attempt to answer it anyway.

    This is clearly from observation and there may be another reason of why it is done this way.

    local message = "testing"
    for i = 1, 4 do
    	if condition then
    		print(message)
    	end
    end
    
    for i = 1, 4 do
    	if condition then
    		local message = "testing"
    		print(message)
    	end
    end
    
    for i = 1, 4 do
    	local message = "testing"
    	if condition then
    		print(message)
    	end
    end


    In the first example message is defined first. This means it is only defined once. Within the second example it could be defined 8 times. Within each loop it could be defined each time the condition is true. This means it could also not be defined at all but on average it would be slower. It would also be defined again as nil when the if statement is ended. I may be wrong but I believe it is just as slow to change a value as to assign it again to the same value so in the third example it would still be defined 4 times.

    Locals are designed to be more efficient than globals since they are deleted when no longer needed. But deleting them too early will result in them being redefined which would slow the program down.

    Although I have a question about locals as well. Is it faster to define a local or to change its value?

    local message
    for i = 1, 4 do
    	message = "testing - line " .. i
    	print(message)
    end
    
    for i = 1, 4 do
    	local message = "testing - line " .. i
    	print(message)	
    end


    Would the first or second example be faster? I've seen both in code and there seems to be no real advantage of one or the other except that the first may be easier to read for debugging.

    Althaya
    Posted in: Lua Code Discussion
  • 0

    posted a message on randomly sort a list
    For personal use this would work fine. But to actually publish this mod you would need a table with a listing of every mount in the game which would be quite large. The alternative is to scan the tooltips of each inventory item instead of just the name.

    You would simply need to translate a single line for each language (2 if you also want the AQ mounts)

    function SlotIsMount(bag, slot)
    	GameTooltip:ClearLines()
    	GameTooltip:SetBagItem(bag, slot)
    	local text
    	for i = 1, 30 do
    	  text = getglobal("GameTooltipTextLeft" .. i):GetText()
    	  if text and string.find(text, "Use: Summons and dismisses a rideable ") then
    	    return true
    	  elseif text and string.find(text, "Use: Emits a high frequency sound, forcing a silithid tank") then
    		return true
          end
    	end
    end
    Posted in: Lua Code Discussion
  • 0

    posted a message on Frame Positioning - How It Works
    Scale will affect the size of the frame as its supposed to. But you also must realize that it will also affect the offsets. This is why frames move when the scale changes.

    Reparenting shouldn't move frames. Perhaps this is something specific to the way Visor handles frames and their parents. The only condition I can think of would be reparenting and then scaling the parent frame.

    Also keep in mind that all dimensions are assuming 1024x768. So for the purposes of offsets your screen has a width of 1024 and a height of 768. This is not affected by your actual screen size. A frame will move the exact same distance if your screen is at 800x600 or 1600x1200. I am not sure how this works for widescreen resolutions though. I have only tested this with 4:3 resolutions.

    Althaya
    Posted in: Lua Code Discussion
  • 0

    posted a message on Functions changed on entering instance?
    I am trying to write a simplified version of controlling alert message at the top of the screen. This seemed simple enough; simply replace the blizzard function with one that will check first for certain phrases and the send the rest back to the blizzard one. That seemed to create a problem within itself. It works perfectly ... until you enter an instance. I've used fireshow and replicated all events that fire when entering an instance and none of the individual events seem to break the mod. This is as basic as I can make the code while still replicating the error:

    fuction TempModOnLoad()
    	TempMod_OldErrorFrameEvent = UIErrorsFrame_OnEvent
    	UIErrorsFrame_OnEvent = TempMod_ErrorSupress
    end
    
    function TempMod_ErrorSupress(event, message)
    	TempMod_OldErrorFrameEvent(event, message)
    end


    This should do nothing ... which is exactly what it does normally. After passing through an instance portal it will give a stack overflow error every time "SYSMSG" or "UI_INFO_MESSAGE" or "UI_ERROR_MESSAGE" fires ... which are the 3 events this frame will accept normally. I have added a line to this simply to report the event and message every time it fires. This spams the entire chat log with the same event and message until it eventually gives the stack overflow error. I am just truly confused about why an instance is making this break since all events that fireshow is picking up don't break it if they are fired by themselves.

    Thanks for the help in advance.

    Althaya
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.