GMCP Inventory Organizer (Achaea)

Share your scripts and packages with other Mudlet users.

GMCP Inventory Organizer (Achaea)

Postby Rakon » Fri Sep 09, 2011 5:41 am

Based off the ideas presented here, I created an inventory organization script that is based off of GMCP. It will group the items and display wielded/held/worn when passed no argument and when passed an argument, it will display the known id' numbers of the items and only display the group of items.

A few people have asked me to share this script and so I present it here in hopes it will be useful. Understand, there is likely a lot of inefficiency in the script and YMMV, it works for me* but may not work for you. I cannot promise to support the script entirely, but I will answer questions to the best of my ability in this thread.

1) This is only tested on Achaea. Please do not ask me to make it work for another IRE mud. It technically should work, but I haven't tested it on another mud.

2) You must have GMCP enabled, with 'Char.Items 1' being sent in the Core.Supports negotiation.

3) Sometimes the display won't render if it runs into an error. This is usually, likely caused to the table inv_items not being populated. If you issue the command i/inv, and nothing displays try using i reset alias and press enter a few times. Then try the i/inv command again. If you still cannot get it to display, open the error dialog in the editor window and see what it says. Copy that error, and paste it to this thread with your issue, so I can try and fix it.


I would appreciate feedback on this script, and testing to work out the bugs so that it works for the majority of everyone. Please leave your comments and bug reports in this thread.

Code: Select all
USAGE: i[nv] [word|reset]
            i
            i reset
            inv
            i sword
            inv ring


Empty i or inv command with more than 25 lines:
Image

i/inv <word> that matched only something held:
Image

i/inv <word> that matched something held AND worn:
Image

i/inv <word> that matched only something worn:
Image

Changelog:
Code: Select all

22 DEC 2013
  - Misspelled inventory a few times, should be corrected now.
    If not, Find and replace all instances of 'iventory' with 'inventory'

22 NOV 2013
  - Added support for new GMCP attributes for wielding detection
  - Fixed display bug with 'more'
 
30 JUL 2012
  - Fixed a stupid bug on my part that rendered this script non-usable. Was referencing the wrong array in script.

20 JUL 2012
  - Fixed duplicate ids/items in worn table. (Hopefully)
  - Various updates to inventory handling/tables maintenance. Thanks to The Phoenix for assistance.
  - Packaged as Mpackage instead of XML file.

07 OCT 2011
  - Will send the inv/i command if there is no GMCP or inv_list information to use for the script.

20 Sep 2011
  - Fixed 'show gold' not displaying
  - Put a delay on the StatusVar update event for login
  - Added builtin method to reset inventory tracker - i/inv reset
  - Made inventory display a function
  - Added in paging functionality for held items. 

09 Sep 2011
  - Added StatusVar event to capture inv_items on login
  - Format quantity to 3 places instead of 2
  - Changed format to use spaces instead of \t
  - Implemented echoLink and appendCmdLine for ease of use
  - Fixed char.items.inv spamming/bug. Only requested if no inv_items table now.

08 Sept 2011
  - Initial code/package
Attachments
GMCP_Inventory.mpackage
(4.54 KiB) Downloaded 127 times
Last edited by Rakon on Mon Dec 23, 2013 1:45 am, edited 27 times in total.
User avatar
Rakon
 
Posts: 346
Joined: Tue Feb 16, 2010 7:41 pm

Re: GMCP Inventory Organizer (Achaea)

Postby Phoenix » Fri Sep 09, 2011 7:25 am

Great script, works a charm! 4 ideas for you, which I'd love to see:

1: TRACK THE ITEMS BETTER, instead of using sendGMCP("Char.Items.Inv") so often.
Cardan just zap-killed me, as the amount of items I had that it was needing to get (1000) was causing server lag as well as overflowing the GMCP buffer. Tracking the items using the gmcp update, add, and remove events, and a SINGLE sendGMCP("Char.Items.Inv") would works almost as effectively, if not just as effectively. 18% of 86 down the drain :/


DONE

2: remove the \t, as this causes mudlet highlighting issues.

DONE

3: When I do 'i item', I would like to be able to click on items ID to have it append the ID to the command line
appendCmdLine() would be perfect for this, in conjunction with echoLink() instead of plain echo(). Then you could type something like 'give ' <click ID 12345> ' to rakon'


DONE

4: Page lengths need to be implemented into it, cos it was definitely more than a single page for me.... haha. Wow. too many items :/
Last edited by Phoenix on Fri Sep 09, 2011 8:01 pm, edited 1 time in total.
Phoenix
 
Posts: 92
Joined: Tue Feb 15, 2011 3:23 am

Re: GMCP Inventory Organizer (Achaea)

Postby Rakon » Fri Sep 09, 2011 2:35 pm

Okay, I have updated the script to not abuse Char.Items.Inv. It will only request a full list if the inv_items table is not populated. Otherwise it will utilize the proper Char.Items.Add/Remove/Update to update the inv_items table for the script.

EDIT:
Implemented the echoLink and appendCmdLine ideas. The links will only show for ID numbers, when doing i <item> and for items in your inventory or worn.
User avatar
Rakon
 
Posts: 346
Joined: Tue Feb 16, 2010 7:41 pm

Re: GMCP Inventory Organizer (Achaea)

Postby Skylark » Fri Sep 09, 2011 6:35 pm

I'm getting an error.

[ERROR:] object:<inv> function:<Alias160>
<[string "function Alias160()..."]:41: attempt to call global 'len' (a nil value)>


Edit: Bit busy to look at it right now, figured I'd report it. I'll update if I manage to fix it later.
Skylark
 
Posts: 44
Joined: Mon Feb 22, 2010 12:38 am

Re: GMCP Inventory Organizer (Achaea)

Postby Phoenix » Fri Sep 09, 2011 7:57 pm

This has been fixed in the newest download... There were a number of bits that were dependant on Penguins 'standard' utilities, that he hadn't included. len() is essentially a table.size - almost identical code, slightly different.

edit - I take it back: These dependant utilities are once again missing, after the latest update:
len
orderedPairs

fixed: The char.items function was creating the inv_items table any time it got a Char.Items with a room location.
Last edited by Phoenix on Fri Sep 09, 2011 8:25 pm, edited 2 times in total.
Phoenix
 
Posts: 92
Joined: Tue Feb 15, 2011 3:23 am

Re: GMCP Inventory Organizer (Achaea)

Postby Rakon » Fri Sep 09, 2011 8:16 pm

Skylark wrote:I'm getting an error.

[ERROR:] object:<inv> function:<Alias160>
<[string "function Alias160()..."]:41: attempt to call global 'len' (a nil value)>


Edit: Bit busy to look at it right now, figured I'd report it. I'll update if I manage to fix it later.


I mistakenly 'updated' the post with the original file that had the errors. I've now uploaded the corrected plugin, which does not use len and includes the table orderedPairs function.

Please download the corrected file and let me know how it works.
User avatar
Rakon
 
Posts: 346
Joined: Tue Feb 16, 2010 7:41 pm

Re: GMCP Inventory Organizer (Achaea)

Postby Skylark » Fri Sep 09, 2011 10:02 pm

Hey, thanks for the quick response.

Had a bit of an odd situation. When I first imported (the new version) it, everything ran without error thanks to the fixes. However, nothing from my inventory was being displayed when I ran the alias --- it was as if I had an empty inv. I decided to do some debugging, but as soon as I touched the CharItems script everything began running smoothly. So now it works beautifully, just had a weird hitch trying to get it working.

Thanks for the package, it's a useful utility.
Skylark
 
Posts: 44
Joined: Mon Feb 22, 2010 12:38 am

Re: GMCP Inventory Organizer (Achaea)

Postby Rakon » Fri Sep 09, 2011 10:09 pm

Skylark wrote:Hey, thanks for the quick response.

Had a bit of an odd situation. When I first imported (the new version) it, everything ran without error thanks to the fixes. However, nothing from my inventory was being displayed when I ran the alias --- it was as if I had an empty inv. I decided to do some debugging, but as soon as I touched the CharItems script everything began running smoothly. So now it works beautifully, just had a weird hitch trying to get it working.

Thanks for the package, it's a useful utility.


When you run the alias, if inv_items table is empty it will request an inventory list from Achaea (not displaying anything because there is nothing to display). After it receives the gmcp list from Achaea (usually on next prompt) then the i alias should run just fine.

I have updated the package with a login event to populate inv_items table, so that you should not run into the issue again.

Thanks for the feedback.
User avatar
Rakon
 
Posts: 346
Joined: Tue Feb 16, 2010 7:41 pm

Re: GMCP Inventory Organizer (Achaea)

Postby Skylark » Fri Sep 09, 2011 10:56 pm

That update should fix things, but new prompts and running the alias again doesn't. Despite the inv_items table being nil, it isn't requesting Char.Items.Inv. No idea why.
Skylark
 
Posts: 44
Joined: Mon Feb 22, 2010 12:38 am

Re: GMCP Inventory Organizer (Achaea)

Postby Rakon » Fri Sep 09, 2011 11:05 pm

Skylark wrote:That update should fix things, but new prompts and running the alias again doesn't. Despite the inv_items table being nil, it isn't requesting Char.Items.Inv. No idea why.


Can you please remove the package you downloaded, and use the new one? Let me know if it still doesn't update after you do i, receive a few prompts, and try i again.

Thank you.
User avatar
Rakon
 
Posts: 346
Joined: Tue Feb 16, 2010 7:41 pm

Next

Return to Scripts & Packages

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron