Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Create/Modify Setting Items
  #BUTTON
  #CLASS
  #DIRECTION
  #EDITOR
  #GAUGE
  #KEY
  #MENU
  #MODULE
  #NOSAVE
  #RENAME
  #STATUS
  #STWIN
  #T+
  #T-
  #TAB
  Create/Modify Settings
Command Reference
  #nnn
  #ABORT
  #ACTION
  #ADD
  #ADDITEM
  #ADDKEY
  #AFK
  #ALARM
  #ALIAS
  #ALL
  #BACKUP
  #BEEP
  #BREAK
  #BUTTON
  #C-
  #C+
  #CALL
  #CAPTURE
  #CASE
  #CHARACTER
  #CLASS
  #CLOSE
  #CLR
  #CMD
  #COLOR
  #COM
  #CONDITION
  #CONFIGURE
  #CONNECT
  #CONTINUE
  #CR
  #CW
  #DBCLOSE
  #DBDELETE
  #DBFIRST
  #DBGET
  #DBLOAD
  #DBNEXT
  #DBOFFLINE
  #DBONLINE
  #DBPREV
  #DBPUT
  #DBRESET
  #DBSAVE
  #DDE
  #DEBUG
  #DEBUGFILE
  #DEFAULT
  #DELCLASS
  #DELITEM
  #DELKEY
  #DELNITEM
  #DESCRIBE
  #DIRECTION
  #DISCONNECT
  #DOOR
  #ECHO
  #ECHOPROMPT
  #EDITOR
  #ERASE
  #EVALUATE
  #EVENT
  #EXECUTE
  #EXECWIN
  #EXIT
  #FILE
  #FIND
  #FIRE
  #FORALL
  #FREEZE
  #FTP
  #FUNCTION
  #GAG
  #GAGBLOCK
  #GAGLOG
  #GAGOFF
  #GAGON
  #GAGSPACE
  #GAUGE
  #H-
  #H+
  #HELP
  #HIGHLIGHT
  #HISTLOAD
  #HISTORY
  #HISTSAVE
  #HOST
  #IF
  #IGNORE
  #IMAGE
  #INPUT
  #KEY
  #KILLALL
  #LAUNCH
  #LMAP
  #LOAD
  #LOCAL
  #LOCATION
  #LOG
  #LOOK
  #LOOP
  #LOOPDB
  #LOOPVIEW
  #LUA
  #MAKEROOM
  #MAKEWINDOW
  #MAP
  #MAPQUERY
  #MARK
  #MATH
  #MEDIA
  #MENU
  #MERGE
  #MESSAGE
  #MODULE
  #MOVE
  #MSS
  #MXP
  #MXPTRIG
  #NAME
  #NEW
  #NEWVAR
  #NODEF
  #NODIR
  #NOINPUT
  #NOMAP
  #NOOP
  #NOSAVE
  #OK
  #ONINPUT
  #PATH
  #PATHHIGH
  #PAUSE
  #PCOL
  #PICK
  #PLAY
  #PLUGIN
  #PORTAL
  #PRINT
  #PROMPT
  #PSUB
  #PUEBLO
  #PW
  #QUERY
  #QUEUE
  #RAISEEVENT
  #READ
  #RECALL
  #RECORD
  #REGEX
  #RENAME
  #REPEAT
  #RESET
  #RESUME
  #RESULT
  #RETRACE
  #RETURN
  #SAVE
  #SAY
  #SAYADD
  #SAYPROMPT
  #SCRIPT
  #SCROLL
  #SECTION
  #SEND
  #SENDGMCP
  #SENDPROMPT
  #SENDRAW
  #SENDSB
  #SESSION
  #SET
  #SETPROMPT
  #SHOW
  #SHOWARR
  #SHOWDB
  #SHOWPROMPT
  #SHOWTABLE
  #SIGNAL
  #SLOW
  #SORT
  #SQLCLOSE
  #SQLDB
  #SS
  #STATE
  #STATUS
  #STEP
  #STOP
  #STWIN
  #STYLE
  #SUBSTITUTE
  #SUSPEND
  #SWITCH
  #T-
  #T?
  #T+
  #TAB
  #TAG
  #TELEPORT
  #TEMP
  #TEMPVAR
  #THREAD
  #TIMER
  #TRACK
  #TRIGGER
  #TSET
  #TYPE
  #TZERO
  #UNALIAS
  #UNBUTTON
  #UNCLASS
  #UNDIR
  #UNGAG
  #UNKEY
  #UNEVENT
  #UNLOAD
  #UNLOC
  #UNMENU
  #UNPATH
  #UNPORTAL
  #UNSTYLE
  #UNTAB
  #UNTIL
  #UNTRIGGER
  #UNVAR
  #UPDATE
  #URL
  #VARFUNC
  #VARIABLE
  #VERBATIM
  #VERSION
  #VIEW
  #WAIT
  #WAITFOR
  #WAITSIGNAL
  #WAITTHREAD
  #WALK
  #WHILE
  #WINDOW
  #WITHLOC
  #WIZLIST
  #WRAP
  #WRITE
  #WRITELOG
  #YESNO
Related Links:
  New Features
  %alias
  %if
  %numparam
  %param
  #CLASS
  #EDITOR
  #MATH
  #RECORD
  #UNALIAS
  #VARIABLE
  Create/Modify Settings
  Introduction to Aliases
  Introduction to Variables
  Introduction to Classes
  Terminology
  Aliases
#ALIAS [[cmud_#AL]] 
ALIAS

Syntax: #AL aliasname {commands} classname
Related: #VARIABLE

Assign the commands to the shortcut aliasname. You should not start aliasname with a number is should always be a letter, after that first letter you can use numbers, for instance t5 is a valid aliasname whereas 5t is not.

If ALIAS is used with no parameters, all aliases are listed to the output window. If ALIAS is given a single parameter, the definition of aliasname will be displayed. The Classname parameter specifies the name of the class to create the alias in. If omitted, the alias is created in the current class.

Aliases can also be expanded via tab completion. If the aliasname is entered into the command line by itself and <TAB> is pressed, the aliasname will be replaced with the string assigned to that alias.

Text following the aliasname in the command line is stored in parameters. These parameters %1 through %99 can be used in the string definition of the alias. Special parameters %-1 through %-99 are also defined which represent the parameter plus all text following it. Thus, %-1 contains all text following the alias. %-2 contains everything past the first parameter, and so on. Thus, in the example alias foo bar, alias is the aliasname, foo is assign to %1, bar is assigned to %2, foo bar is assigned to %-1, and bar is assigned to %-2.

You can also use the %param(n) function instead of %n and the %params(n) function instead of %-n. You can also use "named parameters" as discussed below.

Change from zMUD: In zMUD, any text following the aliasname that is not used as a parameter was appended to the results of the alias expansion. In CMUD this is not done automatically. To append parameters you must use the %params function to add the unused parameters.

Simple alias

#AL fs {fill waterskin statue}

When fs is entered, the string fill waterskin statue is sent to the MUD.

Using variables

#AL fs {fill @container statue}

When fs is entered, the value of @container is expanded, and the result is send to the MUD. If @container has the value of jug, then the string fill jug statue is sent to the MUD.

Using parameters

#AL kk {kill %1;kick %1}

Used with a parameter. If kk rabbit is entered, the commands kill rabbit and kick rabbit are sent to the MUD.

Named Parameters

The %1 syntax was implemented to be compatible with TinTin and zMUD. However, this syntax can make scripts very difficult to support and debug over time. In addition, it becomes difficult to refer to parameters in nested statements.

In zMUD you could use %%1 to refer to nested parameters. But it was difficult to remember which parameter this syntax referred to.

To avoid all of this confusion you can use Named Parameters. Just specify the list of parameter names immediately after the name of the alias within parenthesis. Each parameter name MUST begin with a $ character (because it's actually creating a Local Variable for the given parameter). Seperate multiple parameter names with commas.

So, the above example could be re-written as:

#ALIAS kk($target) {kill $target;kick $target}

While this is a bit more typing, it's more obvious what it is doing. For multiple parameters, just list them with commas between them. Be sure that you do not put ANY space between the name of the alias and the ( parenthesis that starts the named parameter list.

Nested Parameters

#AL make($spell) {#ALIAS $spell($target) {cast $spell $target}}

This is a complicated alias which creates another alias. In this case, the 'make' alias takes a parameter which is the name of a spell to cast. When you use the 'make' alias, another alias is created with a name equal to the spell name. Thus, when you enter

make heal

the command

#ALIAS heal($target) {cast heal $target}

is entered, which creates the new spell alias called 'heal'

Classname

To define a variable inside a class, just include the name of the class after the command parameter:

#alias zt {tell zugg %-1} "tells"
creates an alias inside the class named tells. The class is created if it doesn't exist.

alias dt {tell darker %-1} "tells|darker"
creates an alias in the darker class, which is itself inside the tells class.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net