[Home] [Downloads] [Search] [Help/forum]

Release notes for MUSHclient version 3.61

Version 3.61

Released on 23 Dec 2004

1. Fixed problem where the Toolbar and Info Bar menu items were not checked on the View menu, whether or not those bars were visible.

2. Improved the seeding algorithm for the Mersenne Twister random number generator. (The seeding algorithm was revised to correct a minor problem in which the highest bit of the seed was not well represented in the generator state.)

Also, you can now seed the Mersenne Twister with a table of seeds, rather than a single number. This is because, although the MT generator has a period of 2^19937-1 (that is, the number of iterations before it repeats itself), the initial seeding was only a single number of 2^32 bits. Thus there were effectively only 2^32 (4294967296) possible starting states for the generator. However by initialising with an array of seeds you can effectively seed the generator to many different states.

The restrictions on using the array of seeds are:

* It only applies to Lua
* The seeds must be numbers (or convertible to numbers)
* There must be at least one number
* They must be an ordinary Lua vector-style table. That is, the key of the first seed is 1, the key of the second is 2, and so on.


t = { 1234, 5678, 9876, 5432 }
MtSrand (t) -- seed with table of seeds
MtSrand (8888) -- seed with single seed

The previous remarks about the MT generator still apply. The same "state" of the generator is shared through all of MUSHclient, including all worlds, scripts and plugins. If you want to generate a known sequence then you must seed the generator, and generate the sequence, in a single script call.

3. Added copyright notice and other information from the Mersenne Twister documentation to the docs directory.

4. Improved the Mersenne Twister algorithm to return 53 bits of result rather than 32 bits. This is because the result returned is a "double" (floating-point number) with 52 bits of precision for the mantissa. Thus, all bits should be "used" compared to the previous 32-bit result returned (generated from a long). This gives an improved result in the "ent test" (entropy test), particularly in the value of pi:

Entropy = 7.999991 bits per byte.

Optimum compression would reduce the size of this 20078025 byte file by 0 percent.

Chi square distribution for 20078025 samples is 255.45, and randomly would exceed this value 50.00 percent of the times.

Arithmetic mean value of data bytes is 127.5045 (127.5 = random).
Monte Carlo value for Pi is 3.141509059 (error 0.00 percent).
Serial correlation coefficient is -0.000100 (totally uncorrelated = 0.0).

5. Corrected a documentation error in the Lua example for AddTimer. The flags should be added together, not concatenated together.

In other words:

timer_flag.Enabled + timer_flag.OneShot --> correct
timer_flag.Enabled .. timer_flag.OneShot --> incorrect

6. Added support for fractional-second timers.

You can now have timers fire with a 0.1 second granularity. To enable this you need to go to Global Configuration -> Timers and set the Timer Interval in seconds to zero.

The "seconds" argument for AddTimer, DoAfter, DoAfterNote, DoAfterSpeedWalk and DoAfterSpecial is now a double (floating-point) number. It will be allowed to be in the range 0 to 59.9999.

You can also specify fractional seconds for SetTimerOption and GetTimerOption (in the "second" argument).

However, regardless of what fraction you use, the timers will only be checked every 10th of a second, once the Timer Interval in global configuration is set to zero.

The timers may not fire exactly when you specify, as the timers are only checked in the "main loop" when MUSHclient has finished processing command input, and input from the MUD. It is quite likely that processing input, triggers, scripts and so on, may take more than 0.1 seconds, thus delaying the time for a timer to fire. It will, however, fire as soon as possible after the time you have specified.

7. Added additional utility functions accessible from Lua only:

utils.sha256 - this returns a 256-bit SHA hash (Secure Hash Algorithm) of the supplied string, which may contain binary zeroes. Unlike the utils.hash function this returns the result as a straight 32-byte (256-bit) field (that is, not converted to printable hex). If you want it in readable form you must then convert it yourself (eg. with utils.tohex).


print (utils.tohex (utils.sha256 ("nick gammon")))

--> result: B3223193E1C89CB1E42E2BE2DF34874320F43E149DC315A381B08B7BC52849AD

This is a more secure hash than the standard utils.hash algorithm, which returns a 160-bit hash.


utils.md5 - this returns a 128-bit MD5 hash of the supplied string, which may contain binary zeroes. Unlike the utils.hash function this returns the result as a straight 16-byte (128-bit) field (that is, not converted to printable hex). If you want it in readable form you must then convert it yourself (eg. with utils.tohex).


print (utils.tohex (utils.md5 ("nick gammon")))

--> result: 9A380FD967D936AC99ED73B4A038CE8C

You can write a small Lua program to do the same thing that the md5sum program does (in Linux, Cygwin etc.):

f = io.open ("docs/RegularExpressions.txt", "rb")
if f then
print (utils.tohex (utils.md5 (f:read ("*a"))))
f:close ()
end -- if

--> result: 3764E22E2AC5BA67997C42C288253101

Compare this to the output from md5sum using Cygwin:

$ md5sum RegularExpressions.txt
3764e22e2ac5ba67997c42c288253101 *RegularExpressions.txt

The hash is the same, apart from not being in lower case, which you can change with the string.lower function if you want. Use string.lower to make a lower-case version if that is what you prefer.


utils.tohex - this converts the supplied string to hexadecimal (printable) form. The string may contain binary zeroes.


print (utils.tohex ("Nick Gammon")) --> 4E69636B2047616D6D6F6E


utils.fromhex - this converts the supplied hexadecimal string back to a normal string. The converted string may contain binary zeroes.


print (utils.fromhex ("4E69636B2047616D6D6F6E")) --> Nick Gammon

The supplied string may contain 'space' characters (0x09 – 0x0D or 0x20) which are ignored, otherwise if it contains characters other than A-F, a-f or 0-9 this function raises an error. If the number of characters is odd then the last character is treated as the low-order nibble of the final byte. eg.

a = utils.fromhex ("ABC") --> same as utils.fromhex ("AB0C")

Note that "spaces are ignored" means that a sequence like "A B C D" is treated as the same as "ABCD" not "0A 0B 0C 0D".


8. Changed the "tabs" code slightly to update the wording of the tabs when the window title changes (eg. world closed).

9. Changed the "tabs" code to show the number of new lines that have arrived at a world that is not current (eg. "SMAUG (45)"), or in the case of a notepad window, to add an asterisk after the window title if it has been modified.

10. Fixed problem where you might get the message "Unable to invoke script subroutine "" when saving world" when saving a world.

View all MUSHclient release notes

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]