HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[script] ItemMenu

11-12-2009, 01:18 AM#1
weaaddar
Hi all,
Here is my latest rendition of itemMenu its included in a demo map. But it can work as a standalone script.

ItemMenu is out to make it easy to use items as a menu system. It does so by giving you a bunch of event handlers and having really drop dead simple implementation.

Included is a customizable Storage Menu, an Annoying Menu, and a Build menu.

Check it out let me know what you think. There is more documentation in the readme, but the premise is you implement an OnOpen, an OnInterupt, and any event handler you'd like and it sets up the rest. ItemMenus can be registed to state that they provide storage, and you get granular control on how things will be placed. If none of the default settings meet your need you can always write your own.

The system was coded in Zinc. To be fair and partisan to non-zinc users, I wrote the most "complicated" of the menus included (the build Menu) in Vjass to demo how easy it is to use.

Credit::
Vexorian -- For Zinc/VJass and SimError.

The map is using Table and Cohandlar's version of GetItemCostById. Neither are required for core operation.
It also includes a library I created call Collections that implements list_$$ Obviously its less awesome in Zinc compared to its CJass equivalent, but CJass is toxic on this site.

Code by request::
ItemMenu Library
Expand Zinc:
Collections
Expand Zinc:
Simerror can be found in this thread :: http://www.wc3c.net/showthread.php?t...light=SimError

Implementation guide text::
Expand Zinc:
Attached Files
File type: w3xitemmenu3.w3x (48.4 KB)
11-12-2009, 02:41 AM#2
Veev
I tested just the test map (as in, I didn't change a single thing) and I think I bugged out the system.

Initially, I had 12 free slots, and I picked up all the Reports on the ground. When I paged through the inventory, there was 4 on page one. But, 3 on page 2 with the pseduo-item "Next Page" in the 4th inventory slot and an empty item slot in the 5th slot (where normally the "Next Page" item is). Page 3 was fine, it had all the reports...

This next bug is based on the previous. Keeping Page 2 open and picking up another item will place it in Page 2, Slot 5. Cycling through the pages and returning to it causes the item to vanish completely. In my experiment, I used a crown of kings and it was gone when I cycled back.
EDIT: More elaboration. Picking up an item causes the 6th item slot to become open again BUT the item does not get added to the inventory. Attempting to pick up the item will add it to your inventory. Upon picking up said item, the 6th item slot becomes filled with a black pseudo-item.

EDIT 2: Another bug. In the small inventory, I filled it with 4 items and swapped to another inventory. When I went back to the 4-slot inventory, I dropped one item. For some reason, the black square pseudo-item in the 6th slot gets removed. Upon picking up an item, it replaces the black square into slot 6.
11-12-2009, 03:15 AM#3
weaaddar
Thanks a lot for testing. I thought I ironed out most of the kinks.

I did find a bit of a bug and fixed, I'm not sure about the next getting stuck on a wrong slot. I don't know how that happens. I'm trying to see if I can reproduce it. Obviously if the nextItem is part of the inventory that is a bad thing. I'm not sure how to catch that easily.

As for the small inventory bug this is unfortunately correct behavior. When all inventory space is full it seals up the 6th slot with the blank item so that you cna't pick up more items. Once you drop something, a space is freed so you can pick something up.

I'm uploading a fixed version of the map.
Change:
Fix issue where dropping an item on itself caused an incorrect count change in storage.
Fix issue where orderItem gave the wrong item back.
11-12-2009, 04:04 AM#4
Rising_Dusk
Please include the code in the first post. Also, it wouldn't hurt if you made your first post a bit easier on the eyes.
11-12-2009, 06:57 AM#5
Veev
Quote:
Originally Posted by weaaddar
As for the small inventory bug this is unfortunately correct behavior. When all inventory space is full it seals up the 6th slot with the blank item so that you cna't pick up more items. Once you drop something, a space is freed so you can pick something up.

Ah, gotcha. I'll post back (later today) with (hopefully) no bugs! I'm going to try really hard this time, though, to bug it out. =P
11-12-2009, 09:02 AM#6
Anachron
I made the same system, but I never decided to upload.
11-12-2009, 02:55 PM#7
Rising_Dusk
Err, your library has to actually require the SimError in the database, you can't submit your own ZINC version. Also, your "Collections" library is not an approved script, so you cannot use it in your submission per the submission rules.
11-13-2009, 12:18 AM#8
weaaddar
I couldn't find simerror when I looked so I just stole one from an old map written in Vjass and switched it over to zinc as it made it so when I was developing I could save everything as Zn file. As for collections its a simple arraylist class. I have no idea if there is an equivalent arraylist in the database. I suppose I could submit Collection and its list_$type$.
11-13-2009, 01:04 AM#9
Rising_Dusk
Found it on a ten second search.
Quote:
Originally Posted by weaaddar
I have no idea if there is an equivalent arraylist in the database
There probably is.
11-13-2009, 11:41 PM#10
weaaddar
There wasn't so I submitted it. I realize that it isn't approved but I don't think anyone has done one yet.
11-14-2009, 01:57 AM#11
Veev
Okay so, this is strange and I don't remembering it happen in my first test.

I picked up enough items to fill all 6 slots in the AnnoyingMenu, which I believe acts as storage. (The debug messages did say I was storing the correct item into the AnnoyingMenu.) However, when I opened up the AnnoyingMenu, there were NO items there, just the black box things in all 6 slots.
11-14-2009, 09:53 PM#12
weaaddar
Yeah I was able to repeat it I'll try to figure out whats cause it.