View Single Post
01-31-05, 03:40 PM   #1
Syra
A Kobold Labourer
Join Date: Jan 2005
Posts: 1
Mod Dissection: Preface [Crosspost from WoW Forums]

Alright, I decided to start a series of tutorials, my long term goal is to take some of the existing mods, disect them, and help explain how they work.

However, there are a few things and tools I'd like to present for those that might need them, and that personally help me when I'm making mods.

First, and foremost, an editor, you're going to be editing lots of files with just plain text. Notepad works just fine, however, I use and recommend SciTE

http://www.scintilla.org/SciTE.html

Next, something I made for myself, that just speeds up some of the initial gruntwork of creating a new mod. I made a template, that has some of the most basic information possible.

Code:
ModTemplate.toc
---------------
## Interface: 4150
## Title: Mod Template
## Notes: 
## Author: 
## SavedVariables:
## OptionalDeps:
## Dependencies: 
ModTemplate.xml


ModTemplate.xml
---------------
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
	..\FrameXML\UI.xsd">

	<Script file="ModTemplate.lua"/>
	<Frame name="ModTemplate" parent="UIParent" hidden="true">
		<Scripts>
			<OnLoad>
				ModTemplate_OnLoad();
			</OnLoad>
		</Scripts>
	</Frame>

</Ui>

ModTemplate.lua
---------------
function ModTemplate_OnLoad()
	if( DEFAULT_CHAT_FRAME ) then
		DEFAULT_CHAT_FRAME:AddMessage("ModTemplate Loaded");
	end
	UIErrorsFrame:AddMessage("ModTemplate Loaded", 1.0, 1.0, 1.0, 1.0, UIERRORS_HOLD_TIME);
end
I'll try and find a place to host these files as a download, but, wanted them posted for completeness sake inside this post. The .toc file provides the WoW client with information on what the mod is, and what dependencies it has. The .xml file defines the visual UI elements and what script file corresponds to certain interactions with the UI. The .lua file is the actual code that's run and processed on those interactions. The above is a full, working mod, that simple displays ModTemplate loaded in the overhead chat when loaded. A good starting point for almost any mod.

I confess, I'm ignorant of what other fields can be put in the .toc files and I also don't know exactly how the UI tag is made up, just that it's neccessary.

I know that's quite a bit to digest, and, I apologize, but a little more filler. LUA is a great scripting language, and it's how most of the functionality of your mods will come to be. Fortunately, it's not that complex, it's very human readable, and it's easy enough to pick up that until I'd looked at a few mods, I'd never coded anything in LUA. I know programming theory, but, before WoW modding, I'd never touched the language itself, I've figured almost everything I know about LUA from examining mods.

So, having bored you to death with some of the above. That may or may not be relevant to this actual lesson, but, neccessary for my own train of thought and considering this is a series of tutorial, I wanted to get some things out of the way, even if they end up being forgotten for a good long while.

I wanted to dissect existing mods, but, a good number I wanted to do, would be jumping just a bit far for a progressive tutorial. So, I've decided to do a hybrid of explaining a few functional mods, and then some mods of my own, and then onto some of the existing mods. I may deviate, but, that's the basic plan.

Lastly, some useful links.

Scintella Text Editor - http://www.scintilla.org/SciTE.html
WoW Wiki: World of Warcraft API - http://www.wowwiki.com/World_of_Warcraft_API
WoW Wiki: UI Customization Guide - http://www.wowwiki.com/WoW_UI_Customization_Guide

Of special note, the WinMPQ let's you extract files from the game, and those can be a great source of ideas and learning.

----------------------------------------------

I know this preface isn't what was promised, but it's information I wanted to put out there before going into the meat of something else. I'm not sure how helpful it'll be as a good deal of it is just stuff that's been stated elsewhere with my own rambling.
  Reply With Quote