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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Aardwolf inventory in miniwindow
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Aardwolf inventory in miniwindow

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1 2  3  4  

Posted by Blainer   (191 posts)  [Biography] bio
Date Tue 07 Jul 2009 03:18 PM (UTC)  quote  ]

Amended on Sat 22 Aug 2009 05:18 AM (UTC) by Blainer

Message
Saturday, August 22, 2009 at 05:18:05 UTC
http://code.google.com/p/aardinvwin/

Inventory Window Plugin
Show Aardwolf inventory in a mini window for MUSH Client 4.40.

Features:
-Shows a miniwindow with inventory contents.
-Caches item details in a searchable SQLite database.
-Drag and drop window (click and drag title text).
-Minimize miniwindow to a movable button.
-Apply filters to inventory from menu and command line.
-View contents of bags.
-Reference items by line number from command line.

Commands:
inw                 - show/refresh inventory window.
inw h               - minimize window to a movable button.
inw s               - maximize window, or just "inw".
inw n               - next page.
inw p               - previous page.
inw <page num>      - show page <page num>.
inw f               - show Filters list.
inw <filter name>   - filter inventory list, filter names can be shortened, "inw ar" will match Armour.
inw a               - use filter Show all.
inw s:<item desc>   - search database for an item by description.
inw slist           - add spell list to the database (needs to be done once to display details properly).
inw dbmsg           - toggle script database messages, at install reverts to value set in script.
inw <serial>        - get invdetails on item.
inw getalldetails   - get item details for entire inventory (not items in bags).
inw lines           - toggle show line numbers.
i <command> <num>   - send <command> for item <number>, "i id 1" = id item 1 on inv list.
inw ?               - show this help.



Upgrade Instructions

The script may not function properly if the state file is not deleted before new version is
installed.

1.
Download the plugin again from the here to get the latest version:
http://code.google.com/p/aardinvwin/

2.
Remove the old plugin from the File > Plugins dialog.

3.
Use Window XP search on the start menu with this search "*6dbbeddda02ed2390b58ccd9-state.xml" with out the quotes (").
The search should find a file like this:
777af83cdf336b8bb5207967-6dbbeddda02ed2390b58ccd9-state.xml

Or just use Explorer to browse to this directory:
"C:\Program Files\MUSHclient\worlds\plugins\state\777af83cdf336b8bb5207967-6dbbeddda02ed2390b58ccd9-state.xml"

This is my state file name it may different on your computer
how ever the "dbbeddda02ed2390b58ccd9" will be the same.

4.
Delete this file, it's important that this file be deleted after the plugin has
been removed and before you install the new version.

5.
If requested at begining of post.
Delete the Aardwolfdb.db file. By default this file is installed at:
"C:\Program Files\MUSHclient\worlds\plugins\Aardwolfdb.db"

6.
Then go to the File > Plugins dialog and install the new version.



Install Instructions

Requires MUSH 4.40 the custom Aardwolf MUSH client is here:
http://www.aardwolf.com/play/downloadmc.htm

1.
Three files are required to run this plugin Inventory_Window_2.xml, mw.lua and aardsql.lua.

Inventory_Window_2.xml
Download these from http://code.google.com/p/aardinvwin/:
Inventory_window_2.xml save to MUSH plugin directory (default: C:\Program Files\MUSHclient\worlds\plugins\)
aardsql.lua save to MUSH lua directory (default: C:\Program Files\MUSHclient\lua\)

If you have the latest version of MUSH the file below is included.
mw.lua
Download the file on the site below to the lua directory under the MUSH install directory.
http://www.gammon.com.au/forum/bbshowpost.php?id=8947

2.
If "invmon" is turned on at the MUD when plugin is installed the Plugin will disable this tag and AutoUpdate won't
work I plan to make a set of triggers to solve this.
So before install enter "invmon" until you get "You will no longer see inventory update tags." back from the MUD.

3.
Then install Inventory_Window_2.xml into MUSHclient using the File menu -> Plugins.
http://www.gammon.com.au/forum/?id=9617

4.
After the plugin is installed you need to run the command "inw slist" to load the spells list into the database.

I recommend creating an alias to reload the script from the command line. This is useful if you are editing the settings
in the script file or if the script screws up. Reloading the script won't change setting unless you have edited the script.
I plan to add this alias via the script but for now you'll need to do it manually.
1.
Select and copy between the lines below.
2.
Open "Game -> Configure -> Aliases" or "CTRL+SHIFT+9" menu.
3.
Click the paste button.

--cut--
<aliases>
    <alias
        match="rlinv"
        enabled="y"
        send_to="12"
        sequence="100"
    >
        <send>
            if ReloadPlugin ("6dbbeddda02ed2390b58ccd9") == error_code.eNoSuchPlugin then
                check (LoadPlugin ("/program files/mushclient/worlds/plugins/Inventory_Window_2.xml"))
            end
        </send>
    </alias>
</aliases>
--cut--

Full cut and paste aliases, triggers and timers instructions can be found here:
http://www.gammon.com.au/forum/?id=4777


The settings below will work as default.

A database is created in the plugin directory this can be changed by editing the script file.
change:
db_path = GetPluginInfo (GetPluginID(), 20) .. "\Aardwolfdb.db"

to:
db_path = [[c:\your directory]]



To change the look and behaviour of the plugin open the Inventory_Window_2.xml file
and edit the options below. An editor like Crimson Editor can be configured to display MUSH xml
files with colours making editing MUCH easier.
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=8692

You can find the options below starting at line 316 of Look_Scan.xml, make a backup of
these settings because tests are not done for unreasonable values.


BackgroundColour    = "black"                       -- Background colour for window. Supports Lua codes and MUSH colour names
                                                    -- i.e. "2432272" or "black" or GetInfo(271) can be used, this is your current window colour.
TitleColour         = "dimgray"                     -- Title text colour. Supports Lua codes and MUSH colour names.
LabelColour         = "dimgray"                     -- Colour for labels on popups, flags and values in list. Supports Lua codes and MUSH colour names.
SpellColour         = "65280"                       -- Colour for spell names on popups. Supports Lua codes Edit > Colour in MUSH
LevelColour         = "6908265"                     -- Colour for levels. Supports Lua codes. Supports Lua codes Edit > Colour in MUSH
ValueColour         = "6908265"                     -- Colour for values. Supports Lua codes. Supports Lua codes Edit > Colour in MUSH
WeightColour        = "6908265"                     -- Colour for weight. Supports Lua codes. Supports Lua codes Edit > Colour in MUSH
FontName            = GetInfo(20)                   -- Font for window, i.e. "Times New Roman", GetInfo(20) is current window font.
LFontSize           = 10                                -- List font size.
TFontSize           = 8                             -- Title font size.
CircleAction        = 2                             -- Set shape of boxes, 2="square", 3="rounded". popup shap in mw.lua.
BorderWidth         = 1                             -- Line thickness for display boxes, border width for popups is set in mw.lua.
ButtonGap           = 10                            -- Space between buttons.
OffSet              = BorderWidth + 4               -- Objects offset from window edge.
ItemSpace           = 5                             -- Space between list columns in points.
LineSpaces          = 2                             -- Space between inventory list lines.
PopOffSet           = 1                             -- Number of space characters to place at the begining and end of popup lines.
TitleText           = "Inventory"                   -- Title for window.
BagLabelChars       = 12                            -- Number of characters to display in bag name on bag button after bag open.
ShowBorders         = true                          -- true = draw title and foot boxes.
                                                    -- false = don't draw title and footer boxes.

ShowLineNums        = false                         -- Displays numbered lines that can be use to reference items from the commands line.
ShowValues          = true                          -- Show item values in inventory list (only appear after mouseover and then refresh).
LinesPerPage        = 40                            -- Number of lines per page in inv list.
MaxDescWidth        = 0                             -- Max number of chars in Item Description, 0 for unlitmited.
AutoSize            = false                         -- true = adjust window height to inv list size or LinesPerPage
                                                    -- false = always size to LinesPerPage.

AlignSide           = true                          -- true = Popup window on left
                                                    -- false = Popup window on right.
AlignBottom         = false                         -- false = Popup align bottom of AlignSide.
                                                    -- true = Popup align top of AlignSide.
PopupTop            = 10                            -- Top position of details popup in points

UseCache            = true                          -- "true" = use cached item details from db
                                                    -- "false" = get details from MUD each mouse over.
KeepInvDB           = false                         -- "true" = keep a table of current inventory
                                                    -- "false" is recommended because inventory table is not used atm
                                                    --  and all details are saved in other tables.
ShowWelcome         = true                          -- "true" = Displays msg when script has loaded
                                                    -- "false" = No message on install
AutoRefresh         = true                          -- "true" = uses invmon and invitem tags to trigger inventory refresh


It shouldn't interfere with any other plugins, all triggers are turned on and off as
needed if it does please let me know.


To trigger commands in plugin from other plugins use:

Execute (“inw <arg>”)


To view the contents of the database outside MUSH get SQLite Browser:
http://sourceforge.net/projects/sqlitebrowser/


The commands to reference items in a bag using serials is not completed on the MUD. So items in a bag can
be viewed but no details can be gotten from the MUD.

I would not run commands from this plugin on items in bags at all.

Look here for limitations on the MUD commands used for this plugin:
http://www.gammon.com.au/forum/?id=9461
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 07 Jul 2009 09:33 PM (UTC)  quote  ]
Message
First test result: mw.lua is not in fact included in the current distribution.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Tue 07 Jul 2009 09:57 PM (UTC)  quote  ]
Message
Bug:

I made a new character and started doing the Academy stuff. I started off with ...


an Aardwolf Adventurer's Guide (type read guide) (0)


in my inventory.

However after doing my first quest I wanted to see if I got anything else in my inventory so I typed "inw" again and saw:


2 x an Aardwolf Adventurer's Guide (type read guide) (0)


Strange, I thought. Why would they give me two of those? Typing "inw" again gives:


3 x an Aardwolf Adventurer's Guide (type read guide) (0)


So it looks like the inventory list is not cleared out when you refresh it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 07 Jul 2009 10:00 PM (UTC)  quote  ]
Message
To help the plugin look more readable on the web page, I suggest converting tabs to spaces (Crimson Editor will do this for you, as will most editors).

Also change tables like TypesT and WearT to wrap in the source (ie. one item per line) so the web page does not have horizontal scroll bars as much.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Tue 07 Jul 2009 10:03 PM (UTC)  quote  ]
Message
If you type "inw slist" it would be helpful to have a confirmation that something happened. I did it, but there was no confirmation anything had been updated. Something like "spells list now loaded" would help.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Tue 07 Jul 2009 11:48 PM (UTC)  quote  ]

Amended on Tue 07 Jul 2009 11:50 PM (UTC) by Nick Gammon

Message

This is how the inventory looked for me on a new chararacter:

It opened on the right-hand side of my window, about half-way down.


Then I opened an exisiting character with more inventory, and saw this:

For some reason, it opened in the top left corner, obscuring the MUD output somewhat. Notice the provision for multiple pages.


Then I realized I could drag the window around (which is nice) by clicking on the word "Inventory", and saw this:

Note the hover-over information when you hover over an item.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Tue 07 Jul 2009 11:52 PM (UTC)  quote  ]
Message
The last screen shot above shows that, after dragging, the window text quality seems degraded for some reason.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Tue 07 Jul 2009 11:56 PM (UTC)  quote  ]
Message
The line "Getting details form MUD..." should read "Getting details from MUD...".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Wed 08 Jul 2009 01:36 AM (UTC)  quote  ]
Message
Suggest checking window is visible after reload. Otherwise it might be off the screen somewhere. After these lines:


local x, y, mode, flags =
      tonumber (GetVariable ("windowx")) or 0,
      tonumber (GetVariable ("windowy")) or 0,
      tonumber (GetVariable ("windowmode")) or 8,
      tonumber (GetVariable ("windowflags")) or 4


Add:


-- check miniwindow visible
  if x < 0 or x > GetInfo (281) or
     y < 0 or y > GetInfo (280) then
     x, y = 0, 0  -- reset to top left
  end -- if not visible


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Wed 08 Jul 2009 01:39 AM (UTC)  quote  ]
Message

Just discovered the plugin implements click-to-use, like this:

So, to equip an item in the inventory (or quaff a potion, etc.) left-click on it and select the appropriate menu item.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Wed 08 Jul 2009 02:20 AM (UTC)  quote  ]

Amended on Wed 08 Jul 2009 02:21 AM (UTC) by Nick Gammon

Message
Got this error when mousing-over "a sharp tooth":


Run-time error
Plugin: Inventory_Display (called from world: Aardwolf)
Function/Sub: invdetailsParse called by trigger
Reason: processing trigger ""
[string "Plugin"]:1492: attempt to index field '?' (a nil value)
stack traceback:
        [string "Plugin"]:1492: in function 'ShowDet'
        [string "Plugin"]:551: in function <[string "Plugin"]:525>
Error context in script:
1488 :    sArm = "@p" .. sTyp .. " (@w" ..  WearT [ tostring (item["items"][1]["Wear"]) ] .. "@p)"
1489 :    inT (sOff .. sArm)
1490 :    inT (" ")
1491 :   elseif sTyp == "Weapon" then
1492*:    sNam = "@pWeapon Type @w" .. tostring (string.upper (item["weapon"][1]["wepName"]))
1493 :    sDmg = "@pAverage Dmg @w" .. tostring (item["weapon"][1]["wepAvgDmg"])
1494 :    sDmt = "@pDamage Type @w" .. tostring (string.upper (item["weapon"][1]["wepDmgType"]))
1495 :    sDmi = "@pInflict     @w" .. tostring (string.upper (item["weapon"][1]["wepInflict"]))
1496 :    inT (sOff .. sNam)



An id of the item shows:



id 163546456

+-----------------------------------------------------------------+
| Keywords   : sharp tooth                                        |
| Name       : a sharp tooth                                      |
| Type       : Weapon                    Level  :    10           |
| Worth      : 10                        Weight :     3           |
| Wearable   : wield                                              |
| Flags      : magic, V3                                          |
+-----------------------------------------------------------------+
| Weapon Type: dagger                Average Dam :      4         |
| Notes      : Item has weapon special flags.                     |
+-----------------------------------------------------------------+


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Wed 08 Jul 2009 04:18 AM (UTC)  quote  ]
Message
In your database management - I would not keep re-opening the database. In particular, in AardSelect, that is adding quite an overhead to open the database each time you want to query it. I would be opening that in plugin install, and leaving it open.

Also, I can't see the tables being indexed by name. This will make the lookups quite inefficient, as SQL has to do a linear scan to find a particular item.

I would make the "name" field the primary key where appropriate, or add an index like this:


CREATE INDEX xref_Name ON spells (Name);


Now, if you need to look up a particular spell by name, the database can directly index to the right one.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (19,383 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Wed 08 Jul 2009 04:50 AM (UTC)  quote  ]
Message
If you filter in such a way that the window is empty (eg. filter on keys when you don't have any) the page is shown as 1/0 pages.


BTW Blainer, don't take my comments as a criticism. I think the plugin is great - I was hoping someone would do something like this. :-)

Just needs a few tweaks, and I bet it will be very popular.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Blainer   (191 posts)  [Biography] bio
Date Reply #13 on Wed 08 Jul 2009 09:49 AM (UTC)  quote  ]
Message
Thanks for the help and pics, sorry about not posting proper instructions will do that when it works.
Didn't take your comments as criticism, the code is bad I know and to be honest I'm surprised I
didn't get a post saying "LOL!".

I'm fixing all you mentioned but in making the database stay open I created another problem,
I now get SQLite error "21 : Library used incorrectly" returned from DataBaseStep() when doing
AardSelect() from InvDet(). I don't think it's to do with the db being open, I had this error
before with something else. Do you know what this error actually means? I can't find it explained
in my books or online. The SQL the script uses when the error is caused works with SQLite Browser
on the same database.

I can't figure out the blurred text either. The title text is blurred all the time but the list
is always fine on my computer. I messed around with the size of the text box with no luck once
I get the db working again I'll do a bunch of tests in another window see if I can make the problem
again. I'm pretty sure it's the text box height.

Here's a list of features the next post will have as soon as I fix the above error:

-Shows a miniwindow with inventory contents
-Caches item details in a searchable SQLite database
-Drag and drop window
-Minimize miniwindow to a movable button
-Apply filters to inventory from menu and command line
-View contents of bags

Commands:
-Inventory Window plugin commands:
inw - show/refresh inventory window.
inw h - minimize window to a movable button.
inw s - maximize window.
inw n – show next page.
inw p – show previous page.
inw <page num> - show page <page num>.
inw f - show filters list.
inw <filter name> - filter inventory list, filter names can be shortened, "inw ar" will match Armour.
inw a - use filter Show all.
inw s:<item description> - search database for an item.
inw slist - add spell list to the database (needs to be done once to display details properly).
inw dbmsg - toggle script database messages, at install reverts to value set in script.
inw <serial> - get invdetails on item and add to database.
inw getalldetails - get item details for entire inventory (not items in bags).
inw ? - show this help.

I plan on adding these next:
-View bags from command line.
-Display item count, max items count, weight and max weight.
-Add button for refresh/return to page 1 of inventory.
[Go to top] top

Posted by Blainer   (191 posts)  [Biography] bio
Date Reply #14 on Wed 08 Jul 2009 04:49 PM (UTC)  quote  ]
Message
Got it worked fixed the post at the top of this thread should work. I put all the changes except the indexes which I will read about tomorrow.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


52,618 views.

This is page 1, subject is 4 pages long: 1 2  3  4  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]