Elitist Jerks
Register
Blogs
Forums


Go Back   Elitist Jerks » Public Discussion

Reply
 
LinkBack Thread Tools
Old 10/09/06, 10:44 PM   #1
Drakul
Von Kaiser
 
Human Paladin
 
Shattered Hand
I took a look at the forums, and searched a couple terms and came up with nothing regarding writing mods.

My guild could really benefit from someone writing mods for new encounters we learn.

The question I have is how much experience with other programming languages (ie C, Java, Html, etc.) do you need to be understand and use the lua programming language.

I looked through a couple of introductry websites and gathered a small amount of information, seemed like you needed a fair amount of experience with xml and basic experience with programming.

Any hints or tips would be great on how to get started or recommended prerequistes before actually writing mods for WoW.

Thanks ahead of time.

Last edited by Drakul : 06/25/07 at 11:15 AM.

Offline
Reply With Quote
Old 10/09/06, 10:46 PM   #2
 alcaras
Noli timere
 
alcaras's Avatar
 
Blood Elf Warrior
 
Mal'Ganis
I recommend using the Ace2 framework.

http://www.wowace.com/

There are tutorials there and the like.

If you have a working knowledge of a procedural event driven programming language and a bit of XML, it should be quick to pick up.

United States Offline
Reply With Quote
Old 10/09/06, 10:52 PM   #3
Drakul
Von Kaiser
 
Human Paladin
 
Shattered Hand
I appreciate the quick feedback.

I have taken a college course in introductory C programming and also MATLAB for engineering applications, I believe these will be enough to satisfy the procedural portion of your suggestion.

The XML on the other hand may prove to be difficult for me, is XML similiar to HTML?, because I do have some experience regarding HTML.

Offline
Reply With Quote
Old 10/09/06, 10:55 PM   #4
Cerralius
Glass Joe
 
Murloc Mage
 
Shattered Hand
Fatkul! Fill in your profile! Anyway Drakul and I are from the same guild, and learning how to write mods to have a modwriter in guild would be seriously helpful for new encounters, and not always having to rely on mods others create which may not be what we really need for a particular encounter.

I know a lot of guilds have mod writers in guild, hopefully Drakul can learn how!

-Cerralius
60 Mage, Shattered Hand
http://ctprofiles.net/7009

Offline
Reply With Quote
Old 10/09/06, 11:06 PM   #5
Thelyna
I park my feet under my desk.
 
Thelyna's Avatar
 
Night Elf Druid
 
Dragonblight
I've been poking around a bit, and it looks like wowace is the easiest way to get started. Your other option is to pick a relatively simple mod and deconstruct it and pick up on LUA that way. The worst part of LUA for me (Java/C/C++ programmer) is it's typelessness, I like knowing what a variable is supposed to hold.

On a side note, who else thought of the thread title as "Best Practices: Writing Mods?" =/

DeeNogger: "No dot timer? Get your belt off, its spanking time."

New Zealand Offline
Reply With Quote
Old 10/09/06, 11:16 PM   #6
Drakul
Von Kaiser
 
Human Paladin
 
Shattered Hand
So basically variables a re not defined as floats / decimals/ etc , Just a universal variable type?

It also seems the once you establish your own framework that the programming seems as simple as defining if statements in functions like, Anub'rekan casts locust swarm then do this.

Offline
Reply With Quote
Old 10/09/06, 11:34 PM   #7
Thelyna
I park my feet under my desk.
 
Thelyna's Avatar
 
Night Elf Druid
 
Dragonblight
As far as I'm aware (bear in mind I haven't written anything myself, and besides this machine doesn't have any LUA to check with) all you can define with a variable is it's scope (local/global), after that it can hold anything (akin to a pointer in C or an Object in Java).

DeeNogger: "No dot timer? Get your belt off, its spanking time."

New Zealand Offline
Reply With Quote
Old 10/09/06, 11:57 PM   #8
Dakous
Don Flamenco
 
Tauren Druid
 
Drenden
Originally Posted by Drakul
My guild could really benefit from someone writing mods for new encounters we learn.
I highly recommend taking a look at Bigwigs, and just dissecting what it does based on your needs. It should be pretty easy to infer what you need to.

The question I have is how much experience with other programming languages (ie C, Java, Html, etc.) do you need to be understand and use the lua programming language.
C/++ are like Latin. If you know Latin backwards and forwards, it's ridiculously easy to read dozens of languages. However, at some point, you need to actually start speaking it, and then the vocabulary has its own shift. Little nuances get moved around.

HTML is not a programming language, but a MARKUP Language - it doesn't DO, it DESCRIBES. Just a nitpick.

XML is a more strict relative of HTML - think about this. The < P > aragraph tag must be closed, but every browser everywhere will just automatically close it anyway. XML doesn't let you ever take shortcuts like that.

I looked through a couple of introductry websites and gathered a small amount of information, seemed like you needed a fair amount of experience with xml and basic experience with programming.

Any hints or tips would be great on how to get started or recommended prerequistes before actually writing mods for WoW.
If you want to make well crafted, well engineered, properly designed code in any language, it's going to be a long, tough road and you should start by exhausting the introductory texts on that language ( http://www.lua.org - reading the specification is a fine start ).

If you want to get a mod working by this Friday, start reading bigwigs, figure out what translates to what... make tweaks, see what happens...

Everybody is your brother until the rent comes due.

Offline
Reply With Quote
Old 10/10/06, 12:18 AM   #9
chuckg
Von Kaiser
 
chuckg's Avatar
 
Orc Warlock
 
Executus
The way BigWigs is written, it's modular. You can just as easily add a new script to be loaded with the existing scripts, which means you don't have to start from scratch. Most boss fights have similar timing mechanisms like "fear every 15 seconds" or "on cast announce xx spell" type stuff. Just rip apart a previous module for an existing boss and go for it. Timing systems, bars, raid announce, all of it, can just be dropped in based off of a previous script.

You should very quickly figure out how to do what I'm talking about, the folders are separated on a "by instance" basis. Also, there a number of "extra scripts" out there which attach onto the existing boss mods and add more functionality for a specific encounter to take examples from. The people who frequent the Ace community are also very helpful. It can all be found at the Ace forums: http://www.wowace.com/forums/index.php?board=25.0

Offline
Reply With Quote
Old 10/10/06, 12:26 AM   #10
Drakul
Von Kaiser
 
Human Paladin
 
Shattered Hand
Big Wigs seems to be the way to go.

I really wasn't looking to rewrite my own framework and BigWigs seems to be the easiest way to do what I need.

So thanks for all your help everyone, I think I should be able to create events based off the previously scripted examples.

Offline
Reply With Quote
Old 10/10/06, 1:20 AM   #11
borat
Von Kaiser
 
Murloc Warlock
 
<Sin>
Burning Legion
Why on earth do you need to start writing custom mods for your raid? You are not fighting bosses no one else in WoW is fighting (if you are, let us know how!). BigWigs or La Vendetta has pretty good boss timings at this point with all those weird caveats bosses have, theres no reason to reinvent the wheel.

But yeah ace2 is a great framework for writing mods, that plus stuff like TekWatch help with memory leak debugging. There are also some variable monitors you can get, you can get all the dev help at www.wowace.com.

Offline
Reply With Quote
Old 10/10/06, 1:48 AM   #12
Drakul
Von Kaiser
 
Human Paladin
 
Shattered Hand
I just wanted to plan ahead, make sure I was able to create and adjust at least functions for BC.

I was hoping I could do something like what the people have told me to do, just really didn't know how to go about doing it.

Really didn't want to "reinvent the wheel" just wanted to be able to make timers before bigwigs/CTRA created them.

Offline
Reply With Quote
Old 10/10/06, 3:41 AM   #13
Tanoh
Piston Honda
 
Tanoh's Avatar
 
Undead Mage
 
Earthen Ring (EU)
I don't see the point in using a framework or some other buzzword compliant word. Rarely needed and making it on your own is much better for really understanding how it works.

LUA isn't really hard, it just has its quirks. It's very stringent on nil. If you know C or similar it's not that hard. Only really annoyance I have is that constructs like:

local somevariable = 0;
if( somevariable ) {
   DoOneThing();
} else {
   DoAnotherThing();
};
doesn't quite do what you think, juts looking at the code. In normal languages it checks if somevariable is logically true, in lua it checks if it's nil or not. So in my example above DoOneThing(); would always be executed.

All in all, lua is quite nice. It's not divine like perl but it does the job (oh, how I'm gonna get flamed for that).

Originally Posted by Dakous
XML is a more strict relative of HTML - think about this. The < P > aragraph tag must be closed, but every browser everywhere will just automatically close it anyway. XML doesn't let you ever take shortcuts like that.
Totally nitpicking, but according to W3C for HTML 4.01 transitional about the Paragraph tag:

http://www.w3.org/TR/html4/struct/text.html#h-9.3.1

Originally Posted by w3c
Start tag: required, End tag: optional
:)

Offline
Reply With Quote
Old 10/10/06, 3:47 AM   #14
Kerkyon
Glass Joe
 
Murloc Priest
 
Alexstrasza (EU)
You may have a look at: http://www.wowwiki.com

Offline
Reply With Quote
Old 10/10/06, 5:59 AM   #15
Elethiomel
Glass Joe
 
Human Paladin
 
Dragonblight (EU)
Originally Posted by Tanoh
I don't see the point in using a framework or some other buzzword compliant word. Rarely needed and making it on your own is much better for really understanding how it works.

LUA isn't really hard, it just has its quirks. It's very stringent on nil. If you know C or similar it's not that hard. Only really annoyance I have is that constructs like:

local somevariable = 0;
if( somevariable ) {
   DoOneThing();
} else {
   DoAnotherThing();
};
doesn't quite do what you think, juts looking at the code. In normal languages it checks if somevariable is logically true, in lua it checks if it's nil or not. So in my example above DoOneThing(); would always be executed.
Not only wouldn't the code do what you'd think, it wouldn't work as it's not valid lua...
local somevariable = 0
if (somevariable) then
 DoOneThing()
else
 DoAnotherThing()
end
Also, to nitpick a bit, semicolons at the end of a line is optional in lua, and parenthesis in if statements are optional as well, so:
local somevariable = 0
if somevariable then
 DoOneThing()
else
 DoAnotherThing
end
To get back to the original question, lua-users.org/wiki/TutorialDirectory is a pretty good starting-place to learn lua.
Personally I found that skipping the whole XML-bit and simply creating everything dynamically is a lot easier to do. Not because the XML-bit is *hard* per se (I use XML *extensively* at work, so have quite a lot of experience with it), but simply because it's a whole lot easier to tinker with code directly in the game than keep doing changes in the XML and reloading the UI.

I would also *highly* recommend getting LuaSlinger for playing around with lua in-game.

Trust the Computer. The Computer is Your Friend.

Offline
Reply With Quote
Old 10/10/06, 6:44 AM   #16
Polleke
Foobar
 
Polleke's Avatar
 
Troll Priest
 
Azjol-Nerub (EU)
LUA isn't particular hard if you've used any other language before. The hard thing I would say is getting to know the WoW API and the way the WoW interface works. You're dealing with a real time game, and that requires some rethinking if you come from fairly static enviroments like shell and server scripts.

* Bla

Offline
Reply With Quote
Old 10/10/06, 9:29 AM   #17
berg
Don Flamenco
 
Undead Rogue
 
Tichondrius
If you are familiar with C there are all kinds of lua libs that allow you to write lua code in your IDE of choice. If you use visual studio just search for "studio lua" and you will find a handful to download. Just pick one you want. In the end these are very nice because they allow you to step through code in a debugger and you can write and test all of your code which does not interface with the UI API with the help of a debugger. As far as XML goes I think any programmer can make the XML stuff work just by hacking apart existing addons. If you are comfortable with C and not XML I would say just jump right in. If you are not familiar with either then there will be more work involved.

Also one of the main differences between lua and compiled code is that name collisions are never resolved.

For example, I was using /bb to access slash commands in a mod and some people in the guild had some other mod using that same thing and it looks like whoever registers it first wins.

Also make sure that your function names are similarly unique. Having a decent but generically named function like toggleButtonState() is very dangerous because if another addon has this function name you will overwrite their definition or they will overwrite yours. The functions are not at all module specific. Just think of every single function of every addon being thrown into a giant tub, there is no separation at all. You need to have very specific names to protect your code so preface everything with a unique identifier.

Offline
Reply With Quote
Old 10/10/06, 12:53 PM   #18
Antiarc
Still alive
 
Antiarc's Avatar
 
Human Rogue
 
Cenarion Circle
As far as naming collisions go, you're better off naming your non-local functions and variables with some portion of your mod's name, such as:

function MyMod_OnLoad()
That will keep everything clean and organized and prevent collisions.

Slash commands are a tossup, because there's a tradeoff between short commands and chance for collision. I usually provide short commands for my own use, but expend them to long ones if I publish something.

Need a Mumble server? I run MMO-Mumble for all your voice chat needs. | My rogue planning tool: Shadowcraft

Offline
Reply With Quote
Old 10/10/06, 1:17 PM   #19
Tuco
Piston Honda
 
Murloc Priest
 
Mal'Ganis
I write the boss mods for my guild(on 4H atm).

1. Intro to C is fine, the more comfortable you are with programming the better.
2. If you don't want to do graphical mods, you do not need much XML stuff, I've been using the same XML for my boss Mod since I finished my first boss mod basically.
3. www.wowwiki.com is your primary source of knowledge.
4. What I often do is take an existing mod (like BigWigs) and have mine work off of that. I either steal code, or I run BigWigs during an encounter and have it call functions of my mod, or have my mod pick up calls from BigWigs.

IE: on 4H I have it so BigWigs sends me a tell every time the 4H mark. I interpret that tell with my mod and have some logic built in that will shout out commands in /rw, as well as shoot tells to certain people.

Offline
Reply With Quote
Old 10/10/06, 1:37 PM   #20
Andorien
Von Kaiser
 
Human Warrior
 
Cenarion Circle
Originally Posted by Tanoh
local somevariable = 0;
if( somevariable ) {
   DoOneThing();
} else {
   DoAnotherThing();
};
doesn't quite do what you think, juts looking at the code. In normal languages it checks if somevariable is logically true, in lua it checks if it's nil or not. So in my example above DoOneThing(); would always be executed.
Use booleans please :)

Good coding practice, even in c/c++, is either

bool somevariable = true;
if( somevariable ) {
   DoOneThing();
} else {
   DoAnotherThing();
}
or

int somevariable = 0;
if( somevariable == 0) {
   DoOneThing();
} else {
   DoAnotherThing();
}

Offline
Reply With Quote
Old 10/10/06, 1:52 PM   #21
Lodi
Piston Honda
 
Night Elf Hunter
 
Draenor
(p) and (!p) are acceptable (preferred) substitutes for (p!=0) and (p==0) respectively in the majority of quality C/C++

but yes, in lua, apparently everything but "nil" and "false" ... is "true"

Offline
Reply With Quote
Old 10/10/06, 2:14 PM   #22
Antiarc
Still alive
 
Antiarc's Avatar
 
Human Rogue
 
Cenarion Circle
Personally, I find lua's evaluation of "0" as "true" quite handy. When you have a vaue that may be nil or numeric, and you want to check if the value exists, I much prefer:

if value
to:

if value or value == 0
Ruby's the same way, FWIW.

Need a Mumble server? I run MMO-Mumble for all your voice chat needs. | My rogue planning tool: Shadowcraft

Offline
Reply With Quote
Old 10/10/06, 2:22 PM   #23
aquasheep
Glass Joe
 
aquasheep's Avatar
 
Night Elf Rogue
 
Hyjal
Originally Posted by Drakul
The question I have is how much experience with other programming languages (ie C, Java, Html, etc.) do you need to be understand and use the lua programming language.
If you have any experience with scripting languages (perl, javascript), lua is extremely easy to pick up and work with.

I want to emphasize what someone else said earlier about global scope being the default, since that was an early mistake for me that took forever to debug. Naming functions/frames with your mod's name is good practice or else you'll run into weird issues with other mods. You can also take a look at lua's OO documentation (http://lua-users.org/wiki/ObjectOrientationTutorial) to handle that in a bit cleaner fashion (which happens to be what Ace2 mods use).

You also don't NEED to know XML, since you can create frames dynamically without ever needing a .xml file (again, look at Ace2). IMO, though, unless you're just making simple boss mods or combat parsers, which don't really have GUIs, creating the XML file can help understand how WoW handles frames (frameStrata and other such things).

If it helps, Blizzard provides an Addon kit at http://www.blizzard.com/support/wow/?id=aww01671p. It's not much, but it provides a little tutorial for creating a really simple mod, and it also has all of the lua/xml code for the default WoW UI, if you ever wanted to see how it works.

Offline
Reply With Quote
Old 10/10/06, 2:32 PM   #24
FunBall
Don Flamenco
 
FunBall's Avatar
 
Night Elf Druid
 
Magtheridon
Is there a mod out there that is designed to script new encounters while in game?

Usually, there are plenty of options for mods on encounters. When there wasn't a mod available, we have gotten by without it either through people paying more attention, running timers, and calling out events from a list. I'm not a programmer. I'm sure someone could figure it out if need be, but it simply hasn't been necessary.

At the most basic level, it'd be cool if there was a simple mod where I can "create new module". Make it so I can run a timer, make raidwarn or raid say messages, raid chat, whispers, or whatever on set times.

Slightly more advanced would be to make it so you could have it watch for specific messages in the combat log and again, make announcements or trigger an announcement chain.

There are other things involved with mods, but that would cover the basics, and would allow everyone to make more customized mods for their own guild without having to worry about in house coding.

Offline
Reply With Quote
Old 10/10/06, 3:04 PM   #25
Kalman
Super Macho Man
 
Kalman's Avatar
 
<>
Orc Shaman
 
No WoW Account
Both La Vendetta and Natur Enemy Cast Bars provide a function where you can broadcast a countdown or a repeated timerbar to your raid via script command, which is usually going to be enough until you can get a proper mod written.

Beyond that, coding a new mod for BigWigs is pretty simple if you look at a couple old ones; most of the research time in writing a new mod is figuring out what to trigger from and the intervals.

Melador> Incidentally, these last few pages are why people hate lawyers.
Viator> I really don't want to go all Kalman here.
Bury> Just imagine what the world would be like if you used your powers for good.

Clearly law school has done wonders for me.

United States Offline
Reply With Quote
Reply

Go Back   Elitist Jerks » Public Discussion

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Warrior] Threat gen tips seped Class Mechanics 85 08/11/08 8:50 PM
Anub tips for horde? GROGtheNailer The Dung Heap 1 12/22/06 12:17 AM