BEFORE YOU MAKE A SCRIPT:


Now, before going straight to the meat, that is, answering this question: "How do I, a person new to scripting, make a script?" There are a few things you'll want to look into before you even start scripting. Most of these are pretty obvious and you've probably already got them covered, so just bear with me.


1) Your Text Editor and You ----- If you're on a computer right now (which I'm sure you are since you're reading this) you already have one, and hopefully you're pretty familiar with it. Any text editor will do, but there some key features you'll need to make sure it has.

First off, you want to be able to save a file as any extension, namely .cmd and .wiz. I've never heard of a text editor that can't, but who knows.

Second, you need a search and replace function. Replace isn't 100% vital but it comes in really handy if you suddenly notice you've been spelling it "jadise flower" for your last 6 match tables. Search on the other hand is extremely important and if your editor doesn't have it (probably does) you need to switch editors real fast.

Next, how your editor displays text is important. Not to anyone else, but to you as you make a script. The best displays are the ones similar to the wizard, not as in black background with white text, but rather how no matter what symbol there is, they all take up the same amount of space. this allows you to more easily spot mistakes, as well as helping you with knowing how your 'echoes' will display in game (with default settings).

And Finally, how your editor saves files. Using MS Word, or other high level text editors is great, but you need to make sure every time you save a script that it saves as a 'plain text' file, and usually that's an option you have to manually set when saving, and can get frustrating every time you make a knew script.


The above are all rather vital to a... pleasant script making experience, however there are also some extras you can get with an editor that can make things much easier for you. My editor has the ones below.

MULTI-TASKING ----- An editor that can open multiple files and let you quickly switch between them via tabs in the menu bar is a real time saver, I highly recommend it.

SPELL CHECK ----- A great tool if ever there was one, since most everything in DR is spelled correctly you want your scripts spelled correctly as well. If you're going to use one though, make sure you can add words to the dictionary. Leucros, while common creatures to hunt, don't turn up in most English dictionaries. Some script commands also need to be added in, like matchwait. Also if you like to type commands in all caps, make sure your editor is still checking them, most of them default to skipping over words in all caps assuming them to be acronyms.

BACK-UP ----- Having an editor that saves automatically every few minutes is great, its even better if it automatically saves a back-up of the original when you edit your scripts. Losing 3-4 hours of work is no fun. Been there, done that, and only ever let it happen to myself once.

HIGHLIGHTING ----- Just like in DR highlighting certain words during scripting helps you understand what's going on much better. As you get farther into this guide you'll notice all the commands in my example scripts are color coded. I painstakingly HTML color coded each word to match what my text editor does automatically for me, and I did it specifically to illustrate the point I'm making right now. Highlighting key scripting commands makes it very easy to notice a mistake. If one of my commands doesn't change color when I'm done typing it, I know I spelled it wrong and need to double check it. It's a real life saver.

CUSTOMIZABLE MACROS ----- Scripting, much like DR, consists of typing the same things over and over and over and over. Being able to set ALT+M to type out 'Match' saves about 30%-50% of the time I spend typing a script, and I have a macro for almost every scripting command.

TABBING ----- Having an editor that reads a tab as X number of spaces is useful to me, mainly because of What I say below about organizing scripts.

DEBUGGING ----- Hehe One of my text editors that I use I can hit a button, and it debugs my DragonRealms script. Finds miss-used commands, tells me if there is a match or goto that doesn't have a label, all sorts of neat stuff that makes fixing my scripts almost automatic. Don't worry I'll tell you what it is in in the next category.

RECOMMENDATIONS ----- Okay, I use 2 editors when scripting. My main editor is UltraEdit32:
http://www.ultraedit.com It has one of those 30 day trail things and then you have to buy it. This is the program that I spend 99% of my time in when scripting, (actually I use it for anything that involves text editing, I changed all my computer setting to use this program instead of notepad, word, or frontpage) it has everything I mentioned above except for the debugging. For that I use a program called Gemstone Script Editor. This Program was coded by Insomniac (whom I don't know and never met). And I would post his web site address so you can download it from him but unfortunately it seems he no longer owns his site and it is now a Teen Porn web page. *sighs* The sad things that happen when people lose interest in their hobbies. So Alas you cannot download the file from him.... good thing I have the install file on my web site here eh? GET GEMSTONE SCRIPT EDITOR If you don't feel like paying for Ultraedit you won't need anything more than this program. It highlights, debugs, multi-tasks, tabs, and My favorite feature that I never use (since I use ultra-edit) It's default save extension is .cmd, isn't that beautiful? The only I ever use it for, is to debug scripts I've made in Ultraedit Unfortunately I can't do it for EZhunter because the script is too big and GSE freezes when it tries to debug it.



2) Organize Your Script ----- This is a point I discovered later in my scripting but once I started, it really helped me with moving on to bigger and better scripts. So it's always good to have an idea of what you want, before you begin typing.

When you make a script, have a pattern to it, one that's diverse, obvious, not to hard to create, and easy to follow. Nothing is worse than trying to go back into a script to find a bug and have the entire thing just one line right below the other. Scripts like that are a huge problem to search through, and if you ever post one, and then tell someone to "edit it for your character", they are just going to find another script.

Put gaps betweens different sections, gaps don't bother the wizard or effect scripting speed at all. And I'm not talking between your swimming and climbing sections. I mean every time you make a label, separate it from whatever is above it. Match tables should have there own space with gaps above and below them.

Alignment is also a great way to separate things. The Tab I mentioned above is how I organize my match tables, all the 'match' lines, as well as the 'matchwait' are tabbed once to the right. Where as labels and game commands remain on the left border. This way I can very easily see everything I need to know about a match table with just one glance.

And never underestimate the power of CAPS. It's just a good idea to put commands, labels, and many other things in caps to make them easily identifiable.

These few things, combined with the highlights I use allow me to quickly skim though a script without having to study it in order to understand what's happening. As well as making it much easier to locate bugs. You will usually spend between 25%-50% of your scripting time in 'debug' mode, so make sure you plan ahead for it.



3) Echoes ----- A very simple thought, but something you should decide before you actually start on a script. For debugging purposes, in almost all of my larger scripts I echo the label name for almost every label. I get a lot of complaints from people telling me the echoes create too much scroll In Game, (mainly with my EZhunter script). I do apologize for the inconvenience this may cause you guys, but the simple fact is if I hadn't put in those echoes I would NEVER have finished the script. They saved me hours and hours of digging through text trying to find bugs. I still spent many hours rewriting and fixing bugs, but because off all those scroll inducing echoes I always knew exactly where I could find a bug. Nine times out of ten I even knew what the bug was and how to fix it before I could even get to it in my editor. So echoes are definitely a good choice.



4) Oh yeah one more thing ----- You'll need a computer to any of this :-p. He he seriously though, and speaking from experience you're computer area and mind state are important too. I'm sure you already have a nice comfortable setup and won't mind sitting there for a few hours. I mean you want to start scripting, that means you've already been sitting there for hours on end playing DR in the first place. Just be comfortable, relax, and have fun. If you get frustrated, sleep on it. I can truthfully save I've solved several of my most difficult scripting problems by dreaming about them.

Also, If you're trying to figure out how to squeeze 50+ matches into a 32 limit match table, and still have room the required death and roundtime matches... email me. One computer chair having it's arms ripped off and thrown into a wall in a fit of scripting rage is enough for the world.