VIP Mud Script Creation Guide

Order Of Chaos Alliance Wiki | RecentChanges | Visiting as a guest. Login for full access.

VIP Mud Script Creation Guide

 : There will come a time when you want your client to do something more. This guide will give you the understanding required to achieve many basic and advanced functions. And before you start thinking its too difficult, accept that even the most advanced processes can be broken down into a collection of basic functions. 

Making A Script File

 : The simplest way to ensure your work is saved where and how you intend it is to use a plain text editor. Use Notepad or some such application to open your '.set. type files. Save the file yourself,. Use the VIP Mud client command #LOAD command as needed, to load your definitions into active memory. 

vipmud_example1.set : Try this example to see how easy it is to put your work where it wont get lost.

Loading Scripts

VIP Mud Script Loading Guide
See this guide for storing and loading script files.

Defining Aliases

 : An alias is a shortcut. It allows you to execute sets of commands with a single customized command. Whenever possible, we use an alias in place of writing the same list of commands repeatedly. The VIP Mud help file explains fundamentals of defining an alias. How to organize and utilize aliases is another story. 

 : Especially in the playing of sounds, it is useful to define an alias to allow for testing of the sound before you use it in a function. 

vipmud_example2.set : Try this example of a sound alias to explore the benefits of writing easily testable and reusable code. An alias like the one given in this example could be refered to by dozens of sound triggers, each ensured to make the same easily changed sound and each playing at different volume settings.

Explaining Example 2

Note that the name of the alias in the example starts with "MM_". This convention allows us to better understand why this alias exists. In a list of dozens of alias names, it quickly becomes obvious why we use meaningful names.

The entire set of commands, 1 #PLAY command, is enclosed within {} braces. This denotes the start and end of the alias code.

The #PLAY command consists of 3 parts: the command word starting with a '#' sign, the pathh, and the volume.

The file path could just as easily include a full path starting from a machine drive like "C:/" or could extend into subdirectories of the main sound directory like "/mm/effects/ding.wav". So long as the file exists and the '/' forward slash is used and not the '\' backslash. The file path is also enclosed in {} braces to ensure the start and end of it is defined correctly.

The volume, as a percentage of full volume, is at the end. Without the volume, the file will play at full 100% volume by default. If any number is given after the alias, as an argument, it will replace the %0 portion of the code. (see the 'parsing arguments' section of this page)

The alias is called by its name, with an optional volume setting to follow. With the alias code in place, use "MM_TEST_SOUND 50" to play the sound file.

Using Variables

 : The VIP Mud help file is no place to be explaining the finer points of how best to use variables. Accurate and reliable storage of data is essential to proper performance of your scripts. There may be no one truely correct method, but there are certainly many ways to go wrong. 

vipmud_example3.set : Check out this basic example of how the use of variables can make life easier.

Explaining Example 3

First a variable "coords" is given the value of "(none)". Then an alias is defined to say the value stored in the variable. The alias code has the '@' sign before the variable name, marking that word as a variable name to be replaced with its current value. Lastly, a macro key is defined to call the alias and say the coords. With the code loaded, hit your macro key to hear the value text.

You can use "#Var coords {344, 1200}" in your client entry window to change the value. Then hit the macro key to test your work. Consider how you might use this as a quick note for making your way to a specific location on a map. You might use a trigger to set the variable value, and automatically have map coordinates where you can read them as often as you need.

Use only upper and lower case letters in variable names. Anything else is likely to cause an error. For our purposes, its best to prefix all variable names with "mm" as in "mmCoords". When you pull up your list of dozens of variables, you will be glad the variable names have some meaning. Also, Capitolize the first letter of each word in a variable name, because it helps your brain make sense of it.

Defining Triggers

 : Triggers are probably the single most important part of keeping VIP users up to speed. Your desire to define triggers will certainly grow as you become more familiar with how they relate to game play. Everyone uses triggers of some form, but not everyone relies on sound triggers to keep us informed about what is happening. 

vipmud_example4.set : Try this sound trigger to play a sound on your client.

Explaining Example 4

A #Trigger definition has three parts: the #Tr command word, a bracketed syntax definition, and a bracketed set of commands. The trigger tells your client to try to match every line sent from the server with the syntax you have defined in the first section. When a match is found, the second section of commands are executed.

In this example, * wildcards are used before and after the word "test". Any text before or after will be ignored, but when the word "test" is found, a sound will play. The VIP Mud help file gives details about the markup used for the syntax portion of the definition.

Load the file and see how you can make the sound play. Notice that the word must have blank spaces before and after. Consider and explore the different combinations of syntax markup.

This example shows how easy it is to define a sound trigger, but it also points to how useful this trick is. Consider being on a crystal quest, running through hundreds of rooms, each possibly having a crystal left on the ground. Would you stop to read each room or set a trigger to ding and grab the crystal as you entered the room.

Using External Files

 : Variables have their limits. Memory within the client is limited. Use of external files provides greatly expanded data storage with reliable stability. 

Related Pages

Sight Impaired Client Guide
Other prefered clients
An overview and links for downloading the client
VIP Mud Scripts
List of downloadable scripts
VIP Mud Script Loading Guide
A user's guide for understanding and using scripts

Order Of Chaos Alliance Wiki | RecentChanges | Visiting as a guest. Login for full access.
This page is read-only.
Last edited April 8, 2012 1:26 am by Daintree (diff)