Home mm2k6 Releases New Script Features
11 | 12 | 2017
New Script Features
New commands, procedures, and system variables have been added that aren't found in the console version nor in MudMaster 2000 v3.9.

User Defined Clickable Text Buttons

Beginning with release 4.2.5 status bar items can be made clickable.

User Defined Clickable Buttons

Statusbar items can now be defined to execute script when you left-click on them. This is done by naming the statusbar item beginning with the word button and following this with the command to executed.

See Release 4.2.5 release notes for more.

 
ShowmeViaWeb

Beginning with Release 4.2.6 this command can be used to retrieve text from external web pages and display it as if were in a Showme command.

ShowmeViaWeb

ShowmeViaWeb displays the response of an HTTP request to the web address
supplied. Only web requests are handled. If the address provided doesn't
include the http:// this will be prepended before making the get request.
Data can be sent to the URL by appending it to the URL in the format
http://www.somewebsite.org/?key=value&key2=value2
The web request is sent as a GET if the URL provided is less than
256 characters and as a POST when longer.
The result should be either plain text or text with ANSI text commands.
MM2k6 variables and procedures will be evaluated and replaced before being
displayed.
þ {web address} The website to get the text from.
Example:
/ShowmeViaWeb {http://mm2k6.sourceforge.net/changes.txt}
Format: /ShowmeViaWeb {web address}

ShowmeViaWeb displays the response of an HTTP request to the web address
supplied. Only web requests are handled. If the address provided doesn't
include the http:// this will be prepended before making the get request.

Data can be sent to the URL by appending it to the URL in the format
http://www.somewebsite.org/?key=value&key2=value2
The web request is sent as a GET if the URL provided is less than
256 characters and as a POST when longer.

The result should be either plain text or text with ANSI text commands.
MM2k6 variables and procedures will be evaluated and replaced before being
displayed.

/showmeviaweb  {web address} The website to get the text from.

Example:

/ShowmeViaWeb {http://mm2k6.sourceforge.net/changes.txt}

Note: If this command is used repeatedly before a previous response is complete only the last one will display.

 
Database Commands for Text Files

According to the  poll the second most people preferred using text files for database access (first choice is MySql). This is possible in mm2k6 but is rather limited because text files are not indexed. This means you can add records to them and select records for reading from them but cannot delete or update records. Here's what you need to use database commands on text files.

 

To access text files as database files you need a file called Schema.ini in the folder you'll have your text db. In it
you need a section for each text file you'll want to use. The section looks like this:

[ClanDb.txt]
ColNameHeader = False
Format = CSVDelimited
CharacterSet = ANSI
Col1=ClanNumber short
Col2=ClanName char width 50
Col3=ClanLeader char width 20

Results of select statements run against databases go into arrays. For example:

If you have a text file ClanDB.txt with:

1,"Circle of Power","Romsek"
2,"The White Rose","Gnoden"
3,"Presence","Ausjos"
5,"Legion of Legends","Wonac"

then

/sqlquery {select * from ClanDB.txt where clannumber > 0}{clans}{txt:@sessionpath()}

creates an array called clans with 4 rows of 3 columns and another array called clansFields with 3 rows with the column names.

/loop {1,4,n}_
{/showme {@a(clans,$n,1) @a(clans,$n,2) @a(clans,$n,3)}}

You can create an empty file or delete the contents of an existing one with

/textout {@sesionpath()ClanDB.txt}{ }

An example of an action to fill a text file using db commands would be:


/action {[%0][ %1] %2}_
{_
/sqlexecute {insert into ClanDB.txt (ClanNumber, ClanName, ClanLeader)
values ($0,'@Ltrim($2)','@Ltrim($1)')}_
{txt:@sessionpath()}_
}_
{clandb}

Of course if you were to do things like this you'd need to manage the action with disablegroup and enable group and clear the array with /unarray clans if you planned on using it repeatedly.

So an alias to fill a clans database might look something like:


/alias {getclannames}_
 {_
  /unarray clans;_
  /textout {@sessionpath()ClanDB.txt}{ };_
  /enablegroup clandb;_
  page -none showclan n;_
  /disablegroup clandb;_
}_
{dbCommands}

 



 

 
Script Format

New Script Formating 

New script formatting rules that allow commands to be continued across lines. Ending a line with \ or _ tells the /read command that the line continues on the following line. Leading white space can now be used and will be stripped off by the /read command. Trailing white space on lines with the continuation character will also be removed.

For example:

/alias {values %1}_
 {/if
{@IsEmpty($1)==1}_
      {/showme
{@Chr(10)@AnsiBold()@ForeYellow()_
       Syntax: @ForeRed()values @ForeGreen()_
       
tradepost command @ForeYellow()- @ForeGreen()_
       tradepost @ForeYellow()_
       must be the first three or more letters and @ForeGreen()_
       command @ForeYellow()can be
anything.@AnsiReset()_
               }_
      }_
      {/if {$1 == "list"}_
           {/showme
{@Chr(10)@AnsiBold()_
             @ForeYellow()Medievia
Trade Posts@AnsiReset()};_
            /showme
{@AnsiBold()@ForeYellow()ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ};_
            /loop {1,18}_
                  {/showme
{@AnsiBold()@ForeGreen()_
                    @a(shopnames,$LoopCount,0)@AnsiReset
()}_
                  }_
           }_
           {/var {Shop}
{@Word($1,1)}{TVVariables};_
            /var
{tp}{@Lower($Shop)}{TVVariables};_
            /var {tpnum}{0}{TVVariables};_
            /var {NumWordLength}
{@Len($Shop)}{TVVariables};_
            /var {NumStringLength}
{@Len($1)}{TVVariables};_
            /math {NumChars} {$NumStringLength - $NumWordLength - 1};_
            /var {Command}_
                 
{@Mid($1,@math($NumWordLength + 1),$NumChars)}_
                 {TVVariables};_
            /if {$NumWordLength < 3}_
                {/showme
{@AnsiBold()@ForeCyan()_
                Shop
argument must be 3 letters or more long._
                @AnsiReset
()}_
                }_
                {$Command @a(tpname,1,1) from ;_
                 /var {iBase}{1}{TVVariables};_
                 /loop {1,18,i}_
                       {_
                        /if
{_
                            @StrStr(@Lower(@a(shopnames,$i,0)),$tp
) != -1_
                            } _
                            {/var {tpnum}{$i}{TVVariables}}_
                            {_
                             /if {$tpnum == 0}_
                                 {/if {$i == 2}_
                                      {/math {iBase}{$iBase +3}}_
                                      {/math {iBase}{$iBase +5}}_
                                 }_
                            }_
                       };_
                 /if {$tpnum != 2}_
                     {$Command @a(shopnames,$tpnum,0)_
                       - @a(itemstuff,$iBase,1)_
                       : @a(itemstuff,$iBase,7)_
                       . @a(itemstuff,@math($iBase + 1),1)_
                       : @a(itemstuff,@math($iBase + 1),7)_
                       . @a(itemstuff,@math($iBase + 2),1)_
                       : @a(itemstuff,@math($iBase + 2),7)_
                       . @a(itemstuff,@math($iBase +3),1)_
                       : @a(itemstuff,@math($iBase + 3),7)_
                       . @a(itemstuff,@math($iBase + 4),1)_
                       : @a(itemstuff,@math($iBase + 4),7).}_
                     {$Command @a(shopnames,$tpnum,0) - _
                       @a(itemstuff,$iBase,1)_
                       : @a(itemstuff,$iBase,7)_
                       . @a(itemstuff,@math($iBase + 1),1)_
                       : @a(itemstuff,@math($iBase + 1),7)_
                       . @a(itemstuff,@math($iBase + 2),1)_
                       : @a(itemstuff,@math($iBase + 2),7).}_
                 }_
            }_
       }_
 } {TValias}


would be the same as

/alias {values %1} {/if {@IsEmpty($1)==1}{/showme {@Chr(10)@AnsiBold()@ForeYellow()Syntax: @ForeRed()values @ForeGreen()tradepost command @ForeYellow()- @ForeGreen()tradepost @ForeYellow()must be the first three or more letters and @ForeGreen()command @ForeYellow()can be anything.@AnsiReset()}}{/if {$1 == "list"}{/showme {@Chr(10)@AnsiBold()@ForeYellow()Medievia Trade Posts@AnsiReset()};/showme {@AnsiBold()@ForeYellow()ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ};/loop {1,18}{/showme {@AnsiBold()@ForeGreen()@a(shopnames,$LoopCount,0)@AnsiReset()}}}{/var {Shop} {@Word($1,1)}{TVVariables};/var {tp}{@Lower($Shop)}{TVVariables};/var {tpnum}{0}{TVVariables};/var {NumWordLength} {@Len($Shop)}{TVVariables};/var {NumStringLength} {@Len($1)}{TVVariables};/math {NumChars} {$NumStringLength - $NumWordLength - 1};/var {Command} {@Mid($1,@math($NumWordLength + 1),$NumChars)}{TVVariables};/if {$NumWordLength < 3}{/showme {@AnsiBold()@ForeCyan()Shop argument must be 3 letters or more long.@AnsiReset()}}{$Command @a(tpname,1,1) from ;/var {iBase}{1}{TVVariables};/loop {1,18,i}{/if {@StrStr(@Lower(@a(shopnames,$i,0)),$tp) != -1}{/var {tpnum}{$i}{TVVariables}}{/if {$tpnum == 0}{/if {$i == 2}{/math {iBase}{$iBase +3}}{/math {iBase}{$iBase +5}}}}};/if {$tpnum != 2}{$Command @a(shopnames,$tpnum,0) - @a(itemstuff,$iBase,1): @a(itemstuff,$iBase,7). @a(itemstuff,@math($iBase + 1),1): @a(itemstuff,@math($iBase + 1),7). @a(itemstuff,@math($iBase + 2),1): @a(itemstuff,@math($iBase + 2),7). @a(itemstuff,@math($iBase +3),1): @a(itemstuff,@math($iBase + 3),7). @a(itemstuff,@math($iBase + 4),1): @a(itemstuff,@math($iBase + 4),7).}{$Command @a(shopnames,$tpnum,0) - @a(itemstuff,$iBase,1): @a(itemstuff,$iBase,7). @a(itemstuff,@math($iBase + 1),1): @a(itemstuff,@math($iBase + 1),7). @a(itemstuff,@math($iBase + 2),1): @a(itemstuff,@math($iBase + 2),7).}}}}}{TValias}

 

 
Regular Expressions

There are two new procedures in version 4.1 which introduce Perl regular expressions to MudMaster 2k6.

@regex(RegexPattern, stringToMatch)  returns true if a match is made false otherwise.

@regexMatch(RegexPattern, stringToMatch) returns the string that matches the pattern and fills the session level system array called RegexSubMatches with the submatches. The element indexes match the sub match number.

For details of the syntax and use of regular expressions check out the Boost.org documentation ar http://www.boost.org/doc/libs/1_37_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html 

These regular expressions are now what /scrollgrep uses to match lines in the scrollback buffer.

 

 

 
Clearscreen Window Close and Allcommands

There are three new commands in version 4.0 build 33  .

/clearscreen Clears the display portion of your session but leaves the scrollback intact.

/allcommands Lists every command available.

/window {SessionName}{close} Will close the session window identified.

 
Statusbar Item Colours

New in version 4.o build 33 you can now use procedures to return the foreground and background colour of existing statusbar items.


@BaritemBack(item number or name)  returns the background colour number of the item


@BaritemFore(item number or name)  returns the foreground colour number of the item.

 

 
Alias Procedure

@Alias(existingAlias [parameter])

This returns the results of executing the alias as text. In effect this allows you to make custom procedures by making an alias containing script to return some text and using @alias(yourAlias) to invoke it.

For example given you could create an alias

/alias {proper %0}{@Upper(@Left($0),1)@Lower(@Right($0),@Math(@Len($0)-1)))}{MyAliases}


and then use it like @alias(proper mIXedCasE) and it would return
Mixedcase.

 
Background Command
Introduced in build 31 the /background command allows you to set an image as the backgound of any session window.

/background {PathAndNameOfImage}{mode}

Loads the image as the background of your MUD session. The current text background colour is treated as transparent showing the background image. All other colours overwrite the image.

Mode is one of: tile, stretch, center, normal.

To remove the background use /Background off

 
ShowToast Command

/showtoast {text to pop up in taskbat notifier}

Similar to /showme or /showother except that a taskbar notification pops like toast above the tray when this command is used. The notification pop up is skinned using a simple bitmap toast.bmp which must be in the same directory as mudmaster.exe before a session started.

If /showtoast is executed while the toast is already up the new text is added to the old text.

If you hover the mouse over the toast it will keep the notification in place.

You can create your own custom skins for the popup. It must be a .bmp and be in the same directory as the mudmaster.exe when a session is opened for it to be used. Pure green RGB(0,ff,0) is treated as transparent. The text is displayed center justified with top margin of 40 pixels and side margins of 15 pixels. Text will not display over transparent portions of the skin.

 
« StartPrev12NextEnd »

Page 1 of 2