Home mm2k6 Help Files Procedures Input Processing
21 | 04 | 2018
Input Processing
Article Index
Input Processing
Abs
IsEmpty
PadLeft
StripAnsi
Val
All Pages

 

  @Abs @CharColor
@CharBackColor
@Comma @ConCat

@Decomma

@Exists @IsEmpty @Left
@Len @Lower @LTrim @Math
@Mid @PadLeft @PadRight @PreTrans
@Replace @Right @RTrim @StripAnsi
@StrStr @Substr @TextColor @Upper
@Val @Word

@WordColor

@WordCount


@Abs(number)

Returns the absolute value of an number.

@CharColor(character position) @CharBackColor(Character position}

CharColor is useful only in actions. It returns the color of the character in
a specific position on the line that caused the trigger to fire. CharBackColor returns the background color.

   character position - The 0 based index of the character to check.


@Comma(number)

Returns number with comma separatorrs.

@ConCat(text1,text2)

ConCat returns the concatenation of two text strings.

   text1 - The text to be appended to. 
   text2 - The text to append to text1.

/var test @ConCat(This is, a test!)
Would place the string "This is a test!" in a variable called test.

@Decomma(string)

Removes all the commas in the string. Variables may be used and thus intended to remove commas from numbers this can even be used to concatenate a comma separated list.

@Decomma(XoXoX,o,AA) returns XoAoXoAA

@Exists(var name)

Returns a 1 if the variable exists, otherwise a 0.

   var name - The name of the variable to look for.

 


@IsEmpty(var name)

Returns a 1 if the variable is empty, otherwise a 0.

   var name - The name of the variable to check.

@Left(text,number of characters)

Left returns a number of characters from the left side of a string.

   text - The text you want to take the left hand portion of. 
   number of characters - Number of characters you want.

@Left(Arithon,3)
Would return the string "Ari". The 3 leftmost characters.

@Len(text)

Len returns the number of characters in a string.

@Len(Arithon)
Would return 7.

@Lower(text)

Lower converts all the letters in the text to lower case.  This can be
useful when comparing items in a list or with an /if.

Examples:
   /if "@Lower($Name)" == "arithon"}

   @InList(Spells,@Lower($1))

@LTrim(text)

LTrim removes any spaces from the left side of a string.

@Math(expression)

Returns the result of a math expression. The works the same way as /math, only
the value is not placed into a variable. See the help on math for more
information.

@Mid(text,start character,number of characters)

Mid returns a portion of a string. You tell mid what character you want to
start at, and how many characters from that point on. Strings are zero based,
so if you want the very first character in a string the start character would
have to be zero.

   text - Text string from which you want to grab a portion. 
   start character - The character index of the first character to get. 
   number of characters - The number of characters to get.

@Mid(Arithon,0,3)
This will get you the same result as using a @Left(Arithon,3). The text "Ari"
would be returned.

@Mid(Arithon,2,4)
Would return the string "itho".


@PadLeft(text,character,number)

Returns a string padded on the left with a specific character.

   text - Text to pad. 
   character - Character to use for padding. 
   number - number of pad characters to add.

@PadRight(text,character,number)

Returns a string padded on the right with a specific character.

   text - Text to pad. 
   character - Character to use for padding. 
   number - number of pad characters to add.

@PreTrans(stuff to do)

Many commands in Mud Master translate variables and evaluate procedure when
the command is executed. An example of this is when you define a macro that
contains a variable -- when you press the macro key the variable gets
translated. Sometimes, however, you will want the macro to store the value of
that variable instead of the variable name itself. PreTrans allows you to
expand variables and evaluate procedures at the time the command is created.

/macro {f1} {say $Var}
When the F1 key is press the variable gets translated.

/macro {f2} {say @PreTrans($Var)}
In this case, using PreTrans, the variable gets expanded when the macro is
created. If $Var="Bob" the macro created is essentialy: /macro {f2} {say Bob}

@Replace(string,string,string)

Replaces all the instances of stringToReplace in string with ReplacementString and returns the result.
Variables may be used for any of the strings.

@Replace(XoXoX,o,AA) returns XAAXAAX

@RTrim(text)

RTrim removes any spaces from the right side of a string.

@Right(text,number of characters)

Right returns a number of characters from the right side of a string.

@Right(Arithon,3)
Would return the string "hon". The 3 rightmost characters.


@StripAnsi(text)

Pass in some text and it returns the same text with all the ansi codes removed.

@Strstr(search in,search for)

StrStr searches for the occurrence of one string in another. It returns the 0
based index of where the string to search for starts in the other. If the
search for string is not found -1 is returned.

@SubStr(string,startCharIndex,endCharIndex)

SubStr returns a string which is a substring of the original starting from
the startCharIndex until the endCharIndex. The index is 0 based.

@substr(OneTwoThree,3,5) would return Two

@TextColor(text)

This procedure is only useful in an action. It searches the line of text that
caused the action to fire for the text passed in. It returns the color of the
first character that matches.

@Upper(text)

Upper converts all the letters in the text to upper case.  This can be
useful when comparing items in a list or with an /if.

Examples:
   /if {"Upper($Name)" == "ARITHON"}

   @InList(Spells,@Upper($1))


@Val(text)

Pass in some text and it returns the numerical value. This has limited value
since MM treats string and numerical variables pretty much the same. What it
can do is help to trim off numbers at the front of a string. It will pull as
the value, from the start, all numerical characters.

@Word(string,word number)

Word returns a specific word from a string. A handy use for this procedure is
passing in multiple words to an alias -- the alias can then easily separate
the different words.

@Word(This is a test,2)
This would return the word "is".

/alias {test %0} {say @Word($0,2)}
Typing "test This is a test" would pull the second word out of the string
passed to the alias and produce: "say is"

@WordColor(word number)

This is only useful in an action. Pass in the number of the word whose color
you want to check in the line that set off the action. It returns the color
of the first character of that word.

@WordCount(text)

Returns the number of words in the text passed in.