View Single Post
06-29-09, 03:45 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
You've almost got it.

The ToC file holds a list of which files are used for each addon. Here's an example from one of mine:

Code:
## Interface: 30100
## Title: nUI: InfoPanel [|cffeda55fMage Ports|r]
## Author: Xrystal
## Version: 1.02.01
## Notes: This mod adds a Portal/Teleport Box into the nUI information panel
## RequiredDeps: nUI
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: MagePorts_Defaults

localization.enUS.lua
localization.enGB.lua

MagePorts.lua
nUI_InfoPanel_MagePorts.lua
The interface line is the number that needs to change for each major game change if you do not want to tick the Load Out of Date Addons from the Addon Screen on your character selection screen. This is what you understood correctly. However, the ToC file itself cannot break the addon but the functionality the addon does can. At the bottom of the file will be a list of files and it is most likely one of these that will cause the problem and usually a lua or xml extension file.

An example from one of my smaller addons is this function here :

Code:
        if ( IsRaidLeader() or IsRaidOfficer() ) then
                SendChatMessage( sText, "RAID_WARNING");
        elseif ( GetNumPartyMembers() > 0 ) then
                CatchAndThrow_AddWarning(sText);
        else
                CatchAndThrow_AddWarning(sText);
        end
In this example IsRaidLeader, IsRaidOfficer and GetNumPartyMembers are all Blizzard commands. If Blizzard changed the name or return values of any of these then this addon would break. Something like bugsack should highlight this by listing which file and line was being executed when the error occurred. You can then track back as required to find which Blizzard command was used and then its the case of checking whether it had been changed and in what way so that your addon can then be adjusted so that it will work again.

I don't use xml files myself but here's an example of what could be happening with xml files if Blizzard changed anything there:

Code:
	<Button name="MyButtonTemplate" virtual="true" hidden="true">
		<Size><AbsDimension x="174" y="16" /></Size>		
		<Layers>
			<Layer level="BACKGROUND">
				<FontString name="$parent_EntryText" inherits="GameFontHighlightSmall" justifyH="LEFT">
					<Size><AbsDimension x="174" y="16" /></Size>
					<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="2"/></Offset></Anchor></Anchors>
				</FontString>
			</Layer>
		</Layers>

		<PushedTexture file="Interface\HelpFrame\HelpFrameButton-Highlight" alphaMode="ADD">
			<TexCoords left="0.15" right="0.25" top="0.0" bottom="0.6"/>
		</PushedTexture>
		<HighlightTexture file="Interface\HelpFrame\HelpFrameButton-Highlight" alphaMode="ADD">
			<TexCoords left="0.05" right="0.07" top="0.1" bottom="0.5"/>
		</HighlightTexture>
		<Scripts>
			<OnClick>
				MyButton_OnClick();
			</OnClick>
		</Scripts>
	</Button>
In this instance if Blizzard changed Button to say PushButton or OnClick to OnPush then this could be what would cause a break in the addon.

I hope that helps you a bit better. When I first started I had a hell of a time figuring things out and I have a programming background. I can only imagine how confusing it is for someone that hasn't programmed before.
__________________
  Reply With Quote