Page 1 of 4

[v1.0.1-1.0.5] Store Wish List

Posted: Fri Apr 12, 2013 1:13 am
by Zizzo
Inspired by this thread, I've taken a stab at making a Store Wish List addon. The idea is that you can save a list of things you'd like to buy when you can afford them, and the game will remind you when you can.

To add an item to your wish list, select it in the store's inventory list and press <ctrl-Return>. You can bring up your wish list later by pressing <alt-shift-w> (or whatever key you rebind it to), where you can reorder or remove items. Also, items should be automatically removed when you buy them.

I'm putting this out for testing and suggestions before possibly merging it into ZOmnibus.

[Oh, and as long as I'm here, is there any way to remove tags from an addon's description page? :oops: ]

[edit 2013-11-13 12:28am] Technical info:

Code: Select all

Hooks:
  ToME:load [to add our keybinding]
    ToME:runDone [to add our action to the keybinding and convert old-style
                  wish list data to new style]
  Entity:loadlist [to tweak the transmo chest use() function for our needs]

Superload:
  mod.class.Object:
    getDesc() [to tweak object description if it's on the wish list]
  mod.class.Store:
    onBuy() [to remove bought items from the wish list]
    interact() [to pass info to the ShowStore dialog]
  mod.class.Game:
    changeLevel() [to adjust leave-level auto-transmo for our needs]
  mod.class.Player:
    incMoney() [to show the wish list notification if appropriate]
  mod.dialogs.ShowStore:
    init() [to add the <Ctrl-Return> hook and highlight wish list items]

Re: [v1.0.1] Store Wish List

Posted: Tue Apr 16, 2013 4:58 am
by jenx
I'm loving this addon, but I keep getting lua errors. It doesn't break game, but I'm wary!

Re: [v1.0.1] Store Wish List

Posted: Wed Apr 17, 2013 12:58 am
by Zizzo
jenx wrote:I'm loving this addon, but I keep getting lua errors. It doesn't break game, but I'm wary!
Post `em and I'll try to fix `em.

Re: [v1.0.1] Store Wish List

Posted: Thu Apr 18, 2013 1:56 pm
by jenx
They occur in changing zones only. It is to do with triggering affordability of items, midway through a transmog during zone change. It prohibits zone change sometimes up to 3 times, but eventually letting you through.

Re: [v1.0.1] Store Wish List

Posted: Fri Apr 19, 2013 1:23 am
by Zizzo
jenx wrote:They occur in changing zones only. It is to do with triggering affordability of items, midway through a transmog during zone change. It prohibits zone change sometimes up to 3 times, but eventually letting you through.
Ooh, hadn't thought of that angle; I usually transmo stuff manually before level change, so I probably wouldn't have hit that. Hmm, I think the fix here is to delay the wish list notifications until after the level change is completed. I've pushed out v1a with this change; see if that fixes the problem.

Re: [v1.0.1] Store Wish List

Posted: Fri Apr 19, 2013 4:02 am
by jenx
will do.

can you also have it remove items that you purchase?

Re: [v1.0.1] Store Wish List

Posted: Fri Apr 19, 2013 10:03 pm
by Zizzo
jenx wrote:can you also have it remove items that you purchase?
? It should already be doing that. Mind you, it's matching by object UID, so if you don't buy the exact item you added to the wish list, it won't match. Hmm, perhaps modified store rendering for items on your wish list?

Re: [v1.0.1] Store Wish List

Posted: Sat Apr 20, 2013 1:09 pm
by jenx
still generating lua errors often

Re: [v1.0.1] Store Wish List

Posted: Sat Apr 20, 2013 6:33 pm
by Zizzo
Hmm, apparently object UIDs aren't invariant across a save/reload, which was screwing up the remove on buy. For lack of a better alternative, I guess we'll track by name. Of course, that means if some other store has an item with exactly the same name, buying it there will also remove it from your wish list... which I suppose is reasonable, actually.

Pushing out v2 with that change and some extra store highlighting of items in your wish list.
jenx wrote:still generating lua errors often
As before, post `em and I'll try to fix `em.

Re: [v1.0.1] Store Wish List

Posted: Sun Apr 21, 2013 2:01 am
by Noel
I'm getting this error when I try to manually use the transmog chest. Automatic transmog on zone change works fine.

Code: Select all

stack traceback:
	/hooks/store_wishlist/load.lua: in function 'use'
	/engine/interface/ObjectActivable.lua:74: in function 'useObject'
	/mod/class/Object.lua:97: in function 'use'
	/mod/class/Player.lua:1129: in function </mod/class/Player.lua:1120>
Lua Error: /mod/class/Player.lua:1161: /hooks/store_wishlist/load.lua:41: attempt to index upvalue 'WishListDialog' (a nil value)
	At [C]:-1 
	At [C]:-1 error
	At /mod/class/Player.lua:1161 playerUseItem
	At /mod/dialogs/UseItemDialog.lua:69 use
	At /mod/dialogs/UseItemDialog.lua:43 fct
	At /engine/ui/List.lua:154 onUse
	At /engine/ui/List.lua:87 fct
	At /engine/Mouse.lua:52 receiveMouse
	At /engine/Mouse.lua:90 delegate
	At /engine/ui/Dialog.lua:525 mouseEvent
	At /engine/ui/Dialog.lua:304 fct
	At /engine/Mouse.lua:52 

Re: [v1.0.1] Store Wish List

Posted: Sun Apr 21, 2013 8:06 pm
by Zizzo
Noel wrote:I'm getting this error when I try to manually use the transmog chest. Automatic transmog on zone change works fine.
[tests] Hmm, can't reproduce. On the theory that the 'require' at toplevel apparently isn't propagating into the overridden transmo chest method, we'll try pushing the former down into the latter. Pushing that out as v2a.

Re: [v1.0.1] Store Wish List

Posted: Sun Apr 21, 2013 8:28 pm
by Noel
Double hmmm...tossed v2a into game/addons, but still getting the same error from the same character.

However, I don't get the error with a newly-generated character, with either v2 or v2a.

IIRC, the failing character also had another issue -- I wishlisted a dagger from Yulek's Tools of the Night in Last Hope, but the store name showed up as "nil" in the wishlist. This was causing errors in the notification popups, so I removed the dagger from the wishlist. No idea if that could be related to this error...

Re: [v1.0.1] Store Wish List

Posted: Mon Apr 22, 2013 1:06 am
by Noel
Just got the same "nil" store thing on a new character with v2a -- added something from the ranged weapon shop in Lost Hope to the wishlist, and the store name says "nil".

(edit)
Yup, that's it -- with the "nil" store, I'm now getting the same WishListDialog error as above.

If it helps, the only other active addon is ZOmnibus.

(edit 2)
Here's the error when I get enough money that the nil-stored item can be bought:

Code: Select all

[LOG]	You pickup 0.50 gold pieces.
Lua Error: /mod/dialogs/WishListDialog.lua:153: attempt to concatenate field 'store' (a nil value)
	At [C]:-1 __concat
	At /mod/dialogs/WishListDialog.lua:153 notifyPopup
	At /mod/dialogs/WishListDialog.lua:173 checkNotify
	At /mod/addons/store_wishlist/superload/mod/class/Player.lua:30 incMoney
	At /data/general/objects/money.lua:29 check
	At /engine/interface/ActorInventory.lua:141 super_pickupFloor
	At /mod/addons/zomnibus/superload/mod/class/Player.lua:91 pickupFloor
	At /mod/class/Player.lua:196 describeFloor
	At /mod/class/Player.lua:254 move
	At /engine/interface/PlayerRun.lua:137 runStep
	At /mod/class/Player.lua:318 act
	At /engine/GameEnergyBased.lua:131 tickLevel
	At /engine/GameEnergyBased.lua:62 tick
	At /engine/GameTurnBased.lua:46 tick
	At /mod/class/Game.lua:1042 
 ----------------  Stack Dump ----------------
2: table // 416aca50
1: table // 416aca50
--------------- Stack Dump Finished ---------------
(edit3)
Just got another nil store from the ring shop in Angolwen.

Re: [v1.0.1] Store Wish List

Posted: Mon Apr 22, 2013 2:26 am
by Noel
Okay, color me obsessive...

Just did a full shopping tour, wishlisting something from each store in the West, except for the merchant's store (not unlocked yet). Some stores seem to consistently get a nil name, while others always work.

Stores getting "nil" names:

Angolwen
- ring/amulet store
- staff/wand store

Elvala: none

Derth: none

Zigur:
- mindstar/torque/totem store

Last Hope:
- archery store
- sword smith
- axe smith
- dagger store
- mace/maul store

All other stores get their name right in the wishlist.

HTH

Re: [v1.0.1] Store Wish List

Posted: Mon Apr 22, 2013 9:20 am
by jenx
There are also special towns for yeeks, tws, anorithils, and dwarves.