Trigger Help

Forgot to paste this over from the old forums!

Here's a basic how-to with using CMUD. Have fun! As a note, I gave Gretel permission to reproduce the first part of this guide over in this thread, so pardon the repeated information!

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

-Cmud Vocabulary and Basic Commands-

Here are some easy terms to help people new to Cmud understand it a bit better.

SYNTAX: the correct order you need to do something, or to write a bit of coding in. For example, the correct syntax for smiling at someone is SMILE (PERSON) eg SMILE SNUFFLES. Coding follows the same method - you must code commands in the right order for zmud to understand what you want it to do.

ALIAS: this means a shortcut for a command. You make an alias to stand for a series of actions you want to do. For example, you can have an alias titled HAPPY, with the commands SMILE, GIGGLE and DANCE inside (each command is separated by ; or a carriage return, to denote that they are new commands). Zmud would then send those three emotes to the MUD, and whenever you type HAPPY, you will do all 3 emotes.

VARIABLE: Just like in math class, where variables are used to express unknown or changing aspects of the equation, variables can be used in coding for parts of your aliases that you want to change. Using variables allows you to make general aliases with specific parts that can easily be changed. For example, you could have an alias called GW, which would stand for GET WEAPON. Then the command for the alias would be GET @WEAPON;WIELD @WEAPON. (@ is how you tell zmud that you are using a variable). Then, whenever you change a weapon, you don't need to change the whole alias, simply the variable for your weapon.

TRIGGER: Triggers are automatic reflexes that zmud will execute whenever a specified bit of text comes up. For example, you could make a trigger set to the PATTERN (the text you base the trigger on) of SNUFFLES TICKLES YOU MERCILESSLY for the COMMAND of GROWL SNUFFLES.

CLASS: Classes are folders in which you can place aliases, variables, and triggers. The benefit and power of using classes is that they can be disabled and enabled, allowing you to make temporary settings that are not always active, only when you specify them to be.

***

-Syntax for Settings-

Making settings via the command bar is the fastest, easiest way to make simple settings (the command bar is what you type in to interact in the MUD). You can make basic settings this way without having to access the main menu, although for complex editing, opening the menu (just click on the icon that says SETTINGS on the top left of your zmud window) tends to be best.

Some basic syntax for settings through the command bar:

aliases - #al {name} {command;command}

variables - #var {name} {value1|value2|value3}

also – (variable name)=(value), eg target=snuffles, lets you set a single value quickly for a variable

triggers - #tr {pattern} {reaction}

classes - #class {name}

ifs are a bit more tricky part of coding; they let you specify certain times actions should occur at. The syntax is #if (this is true) {then do this} {if it's not true, do this instead (this part is optional)}

#if girl {smile like a girl} {otherwise smile like a boy}

***

-Advanced Commands-

This is nowhere near exhaustive, as cmud is a complex client, enabling you to do many diverse things. However, here are some more advanced commands and ideas to help get you exploring the coding potential.

Variables – Variables can be more than just a simple item or name. They can also represent STATES of being. The most common state is “on” and “off,” for which the values are usually 1 (for on, or active) and 0 (for off, or disabled). You can then dictate certain actions to be executed for the different states of the variables. #ifs are usually used to help code these types of settings.

Eg - #al {emotion} {#if @happy=1 {em dances about in merriment} {em sulks in a corner}}

This setting will display an emotion appropriate to the state of the variable happy. If happy=1, ie if happy is “on,” then you will execute a happy command. Otherwise, if happy does not equal 1, “off,” you will execute an unhappy command. You’ll want to also create settings that determines what mood you are in

#al {happy} {happy=1} and #al {sad} {happy=0}

this changes the value of the variable named happy.

Macros – This setting lets you pin any actions to any key on your keyboard. Just select the macros button (the one with the keyboard key) from the top bar of the zmud window. Then create a new one, for the macro name typing the name of the key you want it to be set to (eg type F2 for it to be set to the F2 key or SHIFT+F2 for it to be set to pressing both shift and F2 at once).

^ - This symbol is placed at the start of triggers to indicate that the trigger should only fire if the pattern is the start of a line. This translates into stopping people from emoting or saying text and setting your triggers off

* - This symbol allows you to use a wildcard expression in triggers. * will replace any text that can vary.

Eg #tr {* giggles at you} {wink}

this trigger will set off you winking, no matter who it is giggling at you.

%1 – This allows you to capture a variable text and use it in your settings.

Eg #tr {%1 giggles at you} {wink %1}

this trigger will have you wink back at whoever if giggling at you

#cw/#co – this adds color to your MUD. #cw will color any words you specify, #co will color an entire line.

Eg #tr {Snuffles says, “I love you.”} {#cw pink}

just in case Snuffles ever admits it, you’ll see it bright and clear.

#say/#echo - this displays a text in the MUD window (visible only to you, no actually interaction with the MUD), useful for suggesting curing options, reminders, etc. #say displays the information in the window the trigger fired in, while #echo displays the message in whatever window you currently have active.

eg #tr {Snuffles says, “I love you.”} {#say RUN AWAY NOW!}.

Or, if you’re the popular type, #tr {%1 says, “I love you.”} {#say %1 wants to join the fan club.}

#path – this lets you set directional paths that you can then walk back later. #mark to start a path, then #path (name) to end it and title it. .name to walk it, ..name to walk it in reverse.

#temp – this sets a temporary trigger that will fire only once. Syntax is: #temp {pattern} {action}. You can place this inside aliases and other triggers; for example, you have a trigger to pick up bodies after you slay them:

#tr {^You have slain *} {#temp {(text for regaining balance)} {get @target}}

#wait – this tells zmud to wait a specified amount of milliseconds before sending the next command.

Eg #al {badjoke} {say Why did Snuffles cross the road?;#wa 1000;say To run away from the lag beast!}

%additem/#additem – Variables can also occur with multiple values for the variable, known as STRINGLISTS. These commands add a value to the list. #additem only adds the value if it is not already on the list. For example, you want to make a list of all your friends. You’d put them all into a variable named FRIENDS, by using the command #additem.

Eg - #al {addfriend} {#additem friends %1} – Just type addfriend Snuffles to add him to your list

#al {showfriends} {#show friends} – this displays all your friends

#loo – this lets you loop through a certain command a specified number of times, executing it multiple times with different values.

Eg #al {hideandseek} {#loo 1,10 (say %i)}

This setting will have you count from 1 to 10. Note that %i is used to denote the value that is being changed. This can be used in much more complex ways. For example, if you want to send a tell to all of your friends (or to your fighting allies):

#al {friendtell} {#loo 1,%numitems( @friends) {tell %item( @friends, %i) %1}}

Then, just type friendtell Snuffles just said he loved me! and everyone will know about the latest gossip.

The %numitems means take the number of items in the list “friends”, so the loop goes from 1 to however many entries you have in friends.

Syntax: %numitems(s) where s is any list, eg #show %numitems(a|b|c) would produce 3, because there are 3 items in the list.

The %item means use the value from the list friends in the %i place. Remember, %i is what we use to indicate this is the part that gets changed each loop. So, this translates into Friend1, friend2, friend3 etc.

Syntax: %item(list,n) where list is the list you are taking a value from and n is the nth place in the list you are specifying. Eg #show %item(a|b|c, 2) will give you b, because b is the 2nd item in the list.

***

-Examples-

Very first thing you will want to do is set up how to make a target. So...

Target alias

Name:tt

command: targ=%1

This sets the variable targ (for target) to whatever you type after tt. Eg you type tt Snuffles, then Snuffles will be the variable’s value.

Now, let's make an alias using that.

Stab Alias

Name: stb

command: stb %1 @targ

This has you attempt to jab whatever you type after j. If you type nothing, it jabs whoever/whatever you have targetted with the TT alias

Now, let’s make a variable so you can remember what the number of your sword is. This makes it easy to change things around if you switch your item.

Sword Variable

Name: dirk

value:%1=%2

now just figure out what the item is, then simply type dirk=item#### into your command line. easy as pie to change it, don't even have to open up the big settings menu.

Let’s make a setting now to get your dirk and wield it.

Wield Alias

Name: gd

Command: get @dirk;wield @dirk

Let's make a setting that helps you pick out what your target is, by colour.

Target Colour Trigger

Pattern: {%q{@targ}%q}

value:#cw (colour)

This just makes your target show up whatever color you choose. The %q ensures that the word won’t be colored unless the proper punctuation is in place (ie it is a full word, rat as your target won’t show up colored in the middle of the word “celebration”).

Now, let's tack on something fancy to help keep things easy to track.

Target Status Bar

Go to ACTIONS -> DEFINE STATUS BAR. This opens up the menu that lets you make a new status bar...a bit of text between the command line and the MUD window, that shows whatever you want.

Status Line: Target is: @targ

That should add a nifty line that keeps track of your current target and displays it for you. You can put lots of fun things in there, like tracking if you can resip elixirs yet or if you are webbed, etc.

Here is a setting to color all the names of your citymates:

#al {addcit} {#additem citymates %1}

#tr {%q{@citymates}%q} {#cw red}

This setting will add people to your variable named citymates. Just type ADDCIT <name>. It then will display every name in that list as red. The %q covers any punctuation that might be around the name, eg Snuffle's will still fire.

Let’s make a more fancy (yet still simple) alias, one for poisoning weapons and then attacking.

First, we have the multiple aliases:

Alias (prep-blade)

Name: pb

Command:

envenom @dirk with %1

envenom @dirk with %2

Then just type pb venom1 venom2 to coat your dirk

Alias

Name: stb

Command: stab @targ

Then we add them together.

Alias (poison-stab)

Name: ps

Command: pb %1 %2

stb

Then, we make it easy to use. I like using numbers for the basis on my main attacks, with suffixes added to them for the varieties of poisons and commands I can use. Eg, 1 for a bite, 2 for a stab, 3 for shooting arrows.

Alias

Name: 2

Command: ps %1 %2

Alias

Name: 2sk

Command: 2 slike kalmia

Simply make an alias for each combo you like. The benefit of nesting aliases like this is that you can quickly change all of your settings (for example, if you wanted to add in illusions) just by changing the main ones.