21 | 04 | 2018
Version 4.1

After years of accumulated incremental changes, updates, and fixes it is time to increment the version number. Two bugs reported in the sourceforge bug tracker have been fixed. A few new procedures and commands have been added along with improvements to chat group and chat serving behaviours.

Two big steps forward have been taken.

First, Perl-like regular expressions have been introduced into the code and are now used in the /scrollgrep command and available to scripters via the @regex and @regexmatch procedures. An arraycopy command has been added largely to support the regex matching because submatches are stored in a new system array which scripters will want to be able to use.

Second, the first steps towards supporting readable sripts have been taken. Script can now be formated in a limited but usable way. The basis of the new formatting is the introduction of line continuation and white space removal by the script reading commands.

Save Scrollback Bug Fixed

The full scrollback buffer is not written to file when save scrollback is called. This fixes the bug [ 2266665 ] Build 33:Save Scrollback doesn't saves the full scrollback  

Tokens in Substitutes

Substitutes which have tokens like /substitute {Some text %0 and more text %1}{Meaningful text $0 ignoring other text like $1}{myScript} will now work. This is a fix for bug [ 2015644 ] text variables in /substitute not working

View Menu Change 

Added Tool Bar option to View menu allowing you to toggle the toolbar visible or hidden.

Array Changes 

Arrays changed slightly. /array command now initializes all array elements in the new array to empty. When arrays are now written to script files elements which are empty are not written into the script file.

New /ArrayCopy {ArrayName}{CopyArrayName}{CopyArrayNGroup} added to copy arrays with all their contents.

New session level system array called RegexSubMatches. This will always exist as an array with up to 20 elements. Its contents are set and cleared by the @RegexMatch procedure.

Introduction of Regular Expressions 

Changed /scrollgrep command to use boost regular expressions. The pattern must be a complete match. If you want it to be a partial match use .* before and or after the pattern. See http://www.boost.org/doc/libs/1_37_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html for details of the supported regular expression. 

Two new procedures which also use these regular expression have been added.

@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.

Other New Procedures 

@microsecond() returns microsecond counter.

@charbackcolour (number) returns the background colour of the character indicated in the text matched by an action. Only works in actions.

New Chat Group Features 

/cg added as alias for /chatgroup

/eg added as alias for /emotegroup

Bug in /chatgroup which prevented multiple chat to groups in sequence corrected.

New Chat Serving Features 

All chat connections in the same chatgroup that are also being served will be served incoming chat from that group. Chat connections in the group that are not served will not sent incoming chat to group chats. Incoming chat to group continues to not be served to connections being served who are not labeled as being in the chatgroup.

New chat property ExcludeServe toggled by /chatExcludeServe {chatname or number}. Defaults to false which means not excluded. When you  want to set a chat connection so it will not be sent "chat to everyones" received from chat connections you are serving you set their ExcludeServe to true.

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}_
       Syntax: @ForeRed()values @ForeGreen()_
tradepost command @ForeYellow()- @ForeGreen()_
       tradepost @ForeYellow()_
       must be the first three or more letters and @ForeGreen()_
       command @ForeYellow()can be
      {/if {$1 == "list"}_
Trade Posts@AnsiReset()};_
            /loop {1,18}_
           {/var {Shop}
            /var {tpnum}{0}{TVVariables};_
            /var {NumWordLength}
            /var {NumStringLength}
            /math {NumChars} {$NumStringLength - $NumWordLength - 1};_
            /var {Command}_
{@Mid($1,@math($NumWordLength + 1),$NumChars)}_
            /if {$NumWordLength < 3}_
argument must be 3 letters or more long._
                {$Command @a(tpname,1,1) from ;_
                 /var {iBase}{1}{TVVariables};_
                 /loop {1,18,i}_
) != -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,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}