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

Release notes for MUSHclient version 4.65


Version 4.65

Released on 23 Oct 2010

1. Added GetInfo (122) - a boolean that returns true if SQLite3 is thread-safe.

2. Added GetInfo (298) - the SQLite3 version number (as a number, not a string).

[master 37a53c7]


3. Added new script function: DatabaseGetField

This lets you easily obtain a single piece of data from a database, such as the count of rows in a table, or whether or not a spell exists.

Effectively it does DatabasePrepare / DatabaseStep / DatabaseColumnValue / DatabaseFinalize for the supplied SQL statement, returning the value from the first column of the first row.

For example, to see if a table exists:

value = DatabaseGetField ("db",
"SELECT type FROM sqlite_master WHERE name = 'rooms_lookup' AND type = 'table' ")

print (value) --> "table" (if it exists) otherwise: nil


[master 261a3d7]


4. Updated SQLite3 to 3.7.3. Also enabled the R*Tree module. For more information about R*Tree see:

http://www.sqlite.org/rtree.html

From the introduction on that page:

"An R-Tree is a special index that is designed for doing range queries. R-Trees are most commonly used in geospatial systems where each entry is a rectangle with minimum and maximum X and Y coordinates. Given a query rectangle, an R-Tree is able to quickly find all entries that are contained within the query rectangle or which overlap the query rectangle."

Also see:

http://en.wikipedia.org/wiki/Rtree
http://en.wikipedia.org/wiki/R*_tree


Example code:

----------------------------------------
DatabaseOpen ("db", ":memory:", 6) -- open in-memory database

-- create RTREE table

DatabaseExec ("db", [[
CREATE VIRTUAL TABLE demo_index USING rtree(
id, -- Integer primary key
minX, maxX, -- Minimum and maximum X coordinate
minY, maxY -- Minimum and maximum Y coordinate
);

-- insert some data

INSERT INTO demo_index VALUES(
1, -- Primary key
-80.7749, -80.7747, -- Longitude range
30.3776, 30.3778 -- Latitude range
);

INSERT INTO demo_index VALUES(
2,
-81.0, -79.6,
35.0, 36.2
);

]]
) -- end of DatabaseExec


-- query location in range

print (DatabaseGetField ("db",
[[
SELECT id FROM demo_index
WHERE minX >= -81.08 AND maxX <= -80.58
AND minY >= 30.00 AND maxY <= 35.44;
]]
)) --> 1

print (DatabaseGetField ("db",
[[
SELECT id FROM demo_index
WHERE maxY >= 35.0 AND minY <= 35.0;
]]
)) --> 2

DatabaseClose ("db") -- close it

----------------------------------------

The potential usefulness of this is in the case of working out whether you are near to something (or something is near to something else). Whilst that is a simple problem to solve in one dimension (eg. is 4 between 2 and 6?) it is less easy to solve for "is a mob with coordinates 100,44 near to another one at 90,300?".

[master 2e0dd74]



5. Improved mapper.lua module slightly to allow for a callback during a find operation.

There is an example here:

http://www.gammon.com.au/forum/?id=10667&page=2

In this case, when rooms are found the callback is used to display the snippet of full-text-search that resulted in that room being selected.

[master 8d04fd2]



6. Modified WindowMenu so that, if the first character of the menu string is the "!" character, then it returns the selected item number rather than the selected string. It still returns an empty string if nothing is selected.

This lets you distinguish between multiple identical items in submenus. For example: Sword -> Drop, Helmet -> Drop. Previously both would have returned "Drop".

Only items that generate "active" menu elements are counted. That is, divider lines, grayed-out items, and sub-menus are not counted. The first item is item 1.

For example:

result = WindowMenu (win, 10, 10,
"!Take |-| ^Drop | >Eat | Fork | Hands | < | >Emote | Smile | Laugh ")

In this case we would get:

Take: 1
Divider line: (can't be selected)
Drop: (can't be selected)
Eat -> Fork: 2
Eat -> Hands: 3
Emote -> Smile: 4
Emote -> Laugh: 5

Cancelled: empty string

[master 1682ab9]


7. Modified configuration dialogs to allow for a tree view for triggers, aliases, timers. See:

http://www.gammon.com.au/forum/?id=10678

Also remembers last selected item (so when you re-enter world configuration it can be re-selected).

Note that whether or not you want a tree-view is remembered in the world document, however changing that choice does not set the "dirty" flag, so you have to manually save the document to retain your last choice (if you want to).

[master 1e8cacc 49540c2 d2970a9 78cec4e 2d959a3 14f3d42 86c9be5 f296766]
[master 3b4b5cb 58ce809 82070d5 3ffd965 24b0db7]



8. After adding a new trigger/timer/alias/variable the new item is selected.

[master 10ffb73]



9. The word under the mouse when you do an alias-click (Ctrl+LH-mouse click) is now returned as GetInfo (86).

This lets you build things like aliases that let you click on a mob or player name and take some action on the name you click on.

[master cf98abf]




10. Fixed bug in SendToAllPluginCallbacks where plugin callbacks which were supposed to stop as soon as they returned a false response, were assumed to return false even if they didn't.

In particular, this made the Chat system stop working properly.

[master d695a3e]

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.

[Home]


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]