Aliases are all well and good, but in plenty of MUDs you will see lots of long numbers, often for differentiating items of the same type. So you might have potion82393 or ring5097. Now typing these out over and over is pretty exhausting and awkward.  Variables are incredibly powerful tools, and can be used for many things, however in this first basic tutorial I'll demonstrate how you can use variables in an alias to help make your life easier.

Now I'm going to try and use an example. Typically these will vary from game to game and individual to individual, so you will likely have to be adapted somewhat to your own ends. So, let us suppose you have several pipes in your inventory and you want to make an alias to fill, light and smoke your pipe.

You could create an alias to do all that with the pipe's number, but if you ever had to change your pipe you'd have to edit the alias over and over to keep it up to date. Now, a variable can help with this. There are many other uses for variables, but for now I hope this will demonstrate the power of the variable to you.

Now, lets create that variable, and then you can practice your alias making skills. In the name field, put pipe1, this will be the name of our variable. Now, leave everything else as it is, and put pipe12345 (or some other appropriate pipe and number.) It should look as below. Don't forget to click Save!

Now, thinking back to your alias tutorial, I want you to create an alias called smk that does the following commands, in order, put herb in @pipe1;light @pipe1;smoke @pipe1

Now, here we see the first of two special characters that ZMud uses. These are @ and ; each of which deserve special attention, as you'll likely encounter them later.

; - This is Zmud's standard "new line" character. This simply means that when you put ; between two words, ZMud will send them as seperate commands to the MUD you're playing. So if you type say hello;bow you will send say hello as the first command to the MUD, and bow as the second command to the MUD. This applies in aliases (and most other functions that send text to the MUD you're playing) too, and you can use the ; symbol instead of hitting enter between commands. ZMud will usually then separate this commands for you when using the graphical interface. 

@ - this symbol is what ZMud uses to denote a variable. When you are making an alias (or virtually anything else in ZMud) you can use the @ to tell ZMud to use the value of a variable. This is called variable expansion. Now that may sound a little complicated but if you perservere with this example you should come to understand it pretty quickly.

So now I've said that much, you should have an alias that looks a little something like this. If you're struggling, just take a quick look back over the alias tutorial to remind yourself of how to do it.

Notice how the text turns blue and is underlined? That's ZMud telling you that it recognises the variable. Now, if you type smk into your text bar, you should get the following sent to the MUD:

  • put herb in pipe12345
  • light pipe12345
  • smoke pipe12345
ZMud simply substitutes the @pipe1 for whatever you set as a value. Now, go edit the variable pipe1 and change it to anything you like. It will simply change all three instances of it in your alias. This is the simplest form of variable, but still they can make your life much easier. In the next tutorial we'll cover list variables and predefined variable.
Make a Free Website with Yola.